mirror of https://github.com/apache/cloudstack.git
Moving the call to getDeviceId(long, long) avoids a race condition when two volumes are being attached to a VM at the same time
This commit is contained in:
parent
7ef122dcc9
commit
e5ffcab09d
|
|
@ -1303,7 +1303,6 @@ public class VolumeApiServiceImpl extends ManagerBase implements VolumeApiServic
|
|||
throw new InvalidParameterValueException("The specified VM already has the maximum number of data disks (" + maxDataVolumesSupported + "). Please specify another VM.");
|
||||
}
|
||||
}
|
||||
deviceId = getDeviceId(vmId, deviceId);
|
||||
|
||||
// If local storage is disabled then attaching a volume with local disk
|
||||
// offering not allowed
|
||||
|
|
@ -2300,6 +2299,9 @@ public class VolumeApiServiceImpl extends ManagerBase implements VolumeApiServic
|
|||
}
|
||||
|
||||
DataTO volTO = volFactory.getVolume(volumeToAttach.getId()).getTO();
|
||||
|
||||
deviceId = getDeviceId(vm.getId(), deviceId);
|
||||
|
||||
DiskTO disk = new DiskTO(volTO, deviceId, volumeToAttach.getPath(), volumeToAttach.getVolumeType());
|
||||
|
||||
AttachCommand cmd = new AttachCommand(disk, vm.getInstanceName());
|
||||
|
|
|
|||
Loading…
Reference in New Issue