Skip to content

Commit e278bcd

Browse files
[VMware] Consider CD/DVD drive when calculating next free unit number for volume attachment over IDE controller (#9644)
Co-authored-by: dahn <[email protected]>
1 parent cf5bd80 commit e278bcd

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

vmware-base/src/main/java/com/cloud/hypervisor/vmware/mo/VirtualMachineMO.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3169,9 +3169,12 @@ public int getFreeUnitNumberOnIDEController(int controllerKey) throws Exception
31693169

31703170
int deviceCount = 0;
31713171
int ideDeviceUnitNumber = -1;
3172-
if (devices != null && devices.size() > 0) {
3172+
if (devices != null) {
31733173
for (VirtualDevice device : devices) {
3174-
if (device instanceof VirtualDisk && (controllerKey == device.getControllerKey())) {
3174+
if (device.getControllerKey() == null || device.getControllerKey() != controllerKey) {
3175+
continue;
3176+
}
3177+
if (device instanceof VirtualDisk || device instanceof VirtualCdrom) {
31753178
deviceCount++;
31763179
ideDeviceUnitNumber = device.getUnitNumber();
31773180
}

0 commit comments

Comments
 (0)