update bdf serial device
@@ -371,11 +371,14 @@ func getDeviceSerial(serial string) (device string) {
// If cannot find the device using the serial number, get device by volumeID, link file should be like:
// /dev/disk/by-id/virtio-wz9cu3ctp6aj1iagco4h -> ../../vdc
func GetDeviceByVolumeID(volumeID string) (device string, err error) {
+ // this is danger in Bdf mode
+ if !GlobalConfigVar.DiskBdfEnable {
device = getDeviceSerial(strings.TrimPrefix(volumeID, "d-"))
- log.Infof("Use the serial to find the device is %q, volumeID: %s", device, volumeID)
if device != "" {
+ log.Infof("Use the serial to find device, got %q, volumeID: %s", device, volumeID)
return device, nil
}
+ }
byIDPath := "/dev/disk/by-id/"
volumeLinkName := strings.Replace(volumeID, "d-", "virtio-", -1)
