@@ -68,7 +68,7 @@ type DeviceUtils interface {
68
68
69
69
// VerifyDevicePath returns the first of the list of device paths that
70
70
// 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 )
72
72
}
73
73
74
74
type deviceUtils struct {
@@ -138,7 +138,7 @@ func parseScsiSerial(output string) (string, error) {
138
138
// candidate devicePaths or an empty string if none is found. If
139
139
// /lib/udev_containerized/scsi_id exists it will attempt to fix any issues
140
140
// 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 ) {
142
142
var devicePath string
143
143
var err error
144
144
const (
@@ -167,9 +167,9 @@ func (m *deviceUtils) VerifyDevicePath(devicePaths []string, diskName string) (s
167
167
168
168
if len (devicePath ) == 0 {
169
169
// 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
171
171
// device to get the device to show up in /dev/by-id/
172
- innerErr := udevadmTriggerForDiskIfExists (diskName )
172
+ innerErr := udevadmTriggerForDiskIfExists (deviceName )
173
173
if innerErr != nil {
174
174
return false , fmt .Errorf ("failed to trigger udevadm fix: %v" , innerErr )
175
175
}
@@ -188,16 +188,16 @@ func (m *deviceUtils) VerifyDevicePath(devicePaths []string, diskName string) (s
188
188
if strings .Contains (devSDX , diskSDPath ) {
189
189
scsiSerial , innerErr := getScsiSerial (devSDX )
190
190
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 )
192
192
}
193
193
// SUCCESS! devicePath points to a /dev/sdx that has a SCSI serial
194
194
// equivilant to our disk name
195
- if scsiSerial == diskName {
195
+ if scsiSerial == deviceName {
196
196
return true , nil
197
197
}
198
198
}
199
199
// The devicePath is not mapped to the correct disk
200
- innerErr = udevadmTriggerForDiskIfExists (diskName )
200
+ innerErr = udevadmTriggerForDiskIfExists (deviceName )
201
201
if innerErr != nil {
202
202
return false , fmt .Errorf ("failed to trigger udevadm fix: %v" , innerErr )
203
203
}
@@ -207,13 +207,13 @@ func (m *deviceUtils) VerifyDevicePath(devicePaths []string, diskName string) (s
207
207
})
208
208
209
209
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 )
211
211
}
212
212
213
213
return devicePath , nil
214
214
}
215
215
216
- func udevadmTriggerForDiskIfExists (diskName string ) error {
216
+ func udevadmTriggerForDiskIfExists (deviceName string ) error {
217
217
devToSCSI := map [string ]string {}
218
218
sds , err := filepath .Glob (diskSDPattern )
219
219
if err != nil {
@@ -225,7 +225,7 @@ func udevadmTriggerForDiskIfExists(diskName string) error {
225
225
return fmt .Errorf ("failed to get SCSI Serial num: %v" , err )
226
226
}
227
227
devToSCSI [devSDX ] = scsiSerial
228
- if scsiSerial == diskName {
228
+ if scsiSerial == deviceName {
229
229
// Found the disk that we're looking for so run a trigger on it
230
230
// to resolve its /dev/by-id/ path
231
231
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 {
236
236
return nil
237
237
}
238
238
}
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 )
241
241
}
242
242
243
243
// Calls "udevadm trigger --action=change" on the specified drive. drivePath
0 commit comments