Skip to content

Commit 512f0d8

Browse files
winterhazelDaanHoogland
authored andcommitted
[VMware] Consider CD/DVD drive when calculating next free unit number for volume attachment over IDE controller (apache#9644)
Co-authored-by: dahn <daan.hoogland@gmail.com>
1 parent b6ff171 commit 512f0d8

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

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
@@ -3168,9 +3168,12 @@ public int getFreeUnitNumberOnIDEController(int controllerKey) throws Exception
31683168

31693169
int deviceCount = 0;
31703170
int ideDeviceUnitNumber = -1;
3171-
if (devices != null && devices.size() > 0) {
3171+
if (devices != null) {
31723172
for (VirtualDevice device : devices) {
3173-
if (device instanceof VirtualDisk && (controllerKey == device.getControllerKey())) {
3173+
if (device.getControllerKey() == null || device.getControllerKey() != controllerKey) {
3174+
continue;
3175+
}
3176+
if (device instanceof VirtualDisk || device instanceof VirtualCdrom) {
31743177
deviceCount++;
31753178
ideDeviceUnitNumber = device.getUnitNumber();
31763179
}

0 commit comments

Comments
 (0)