@@ -68,7 +68,7 @@ type DeviceUtils interface {
6868
6969 // VerifyDevicePath returns the first of the list of device paths that
7070 // exists on the machine, or an empty string if none exists
71- VerifyDevicePath (devicePaths []string , diskName string ) (string , error )
71+ VerifyDevicePath (devicePaths []string , deviceName string ) (string , error )
7272}
7373
7474type deviceUtils struct {
@@ -138,7 +138,7 @@ func parseScsiSerial(output string) (string, error) {
138138// candidate devicePaths or an empty string if none is found. If
139139// /lib/udev_containerized/scsi_id exists it will attempt to fix any issues
140140// caused by missing paths or mismatched devices by running a udevadm --trigger.
141- func (m * deviceUtils ) VerifyDevicePath (devicePaths []string , diskName string ) (string , error ) {
141+ func (m * deviceUtils ) VerifyDevicePath (devicePaths []string , deviceName string ) (string , error ) {
142142 var devicePath string
143143 var err error
144144 const (
@@ -167,9 +167,9 @@ func (m *deviceUtils) VerifyDevicePath(devicePaths []string, diskName string) (s
167167
168168 if len (devicePath ) == 0 {
169169 // Couldn't find the path so we need to find a /dev/sdx with the SCSI
170- // serial that matches diskName . Then we run udevadm trigger on that
170+ // serial that matches deviceName . Then we run udevadm trigger on that
171171 // device to get the device to show up in /dev/by-id/
172- innerErr := udevadmTriggerForDiskIfExists (diskName )
172+ innerErr := udevadmTriggerForDiskIfExists (deviceName )
173173 if innerErr != nil {
174174 return false , fmt .Errorf ("failed to trigger udevadm fix: %v" , innerErr )
175175 }
@@ -188,16 +188,16 @@ func (m *deviceUtils) VerifyDevicePath(devicePaths []string, diskName string) (s
188188 if strings .Contains (devSDX , diskSDPath ) {
189189 scsiSerial , innerErr := getScsiSerial (devSDX )
190190 if innerErr != nil {
191- return false , fmt .Errorf ("couldn't get SCSI serial number for disk %s: %v" , diskName , innerErr )
191+ return false , fmt .Errorf ("couldn't get SCSI serial number for disk %s: %v" , deviceName , innerErr )
192192 }
193193 // SUCCESS! devicePath points to a /dev/sdx that has a SCSI serial
194194 // equivilant to our disk name
195- if scsiSerial == diskName {
195+ if scsiSerial == deviceName {
196196 return true , nil
197197 }
198198 }
199199 // The devicePath is not mapped to the correct disk
200- innerErr = udevadmTriggerForDiskIfExists (diskName )
200+ innerErr = udevadmTriggerForDiskIfExists (deviceName )
201201 if innerErr != nil {
202202 return false , fmt .Errorf ("failed to trigger udevadm fix: %v" , innerErr )
203203 }
@@ -207,13 +207,13 @@ func (m *deviceUtils) VerifyDevicePath(devicePaths []string, diskName string) (s
207207 })
208208
209209 if err != nil {
210- return "" , fmt .Errorf ("failed to find and re-link disk %s with udevadm after retrying for %v: %v" , diskName , pollTimeout , err )
210+ return "" , fmt .Errorf ("failed to find and re-link disk %s with udevadm after retrying for %v: %v" , deviceName , pollTimeout , err )
211211 }
212212
213213 return devicePath , nil
214214}
215215
216- func udevadmTriggerForDiskIfExists (diskName string ) error {
216+ func udevadmTriggerForDiskIfExists (deviceName string ) error {
217217 devToSCSI := map [string ]string {}
218218 sds , err := filepath .Glob (diskSDPattern )
219219 if err != nil {
@@ -225,7 +225,7 @@ func udevadmTriggerForDiskIfExists(diskName string) error {
225225 return fmt .Errorf ("failed to get SCSI Serial num: %v" , err )
226226 }
227227 devToSCSI [devSDX ] = scsiSerial
228- if scsiSerial == diskName {
228+ if scsiSerial == deviceName {
229229 // Found the disk that we're looking for so run a trigger on it
230230 // to resolve its /dev/by-id/ path
231231 klog .Warningf ("udevadm --trigger running to fix disk at path %s which has SCSI ID %s" , devSDX , scsiSerial )
@@ -236,8 +236,8 @@ func udevadmTriggerForDiskIfExists(diskName string) error {
236236 return nil
237237 }
238238 }
239- klog .Warningf ("udevadm --trigger requested to fix disk %s but no such disk was found in %v" , diskName , devToSCSI )
240- return fmt .Errorf ("udevadm --trigger requested to fix disk %s but no such disk was found" , diskName )
239+ klog .Warningf ("udevadm --trigger requested to fix disk %s but no such disk was found in %v" , deviceName , devToSCSI )
240+ return fmt .Errorf ("udevadm --trigger requested to fix disk %s but no such disk was found" , deviceName )
241241}
242242
243243// Calls "udevadm trigger --action=change" on the specified drive. drivePath
0 commit comments