We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent cf5bd80 commit e278bcdCopy full SHA for e278bcd
1 file changed
vmware-base/src/main/java/com/cloud/hypervisor/vmware/mo/VirtualMachineMO.java
@@ -3169,9 +3169,12 @@ public int getFreeUnitNumberOnIDEController(int controllerKey) throws Exception
3169
3170
int deviceCount = 0;
3171
int ideDeviceUnitNumber = -1;
3172
- if (devices != null && devices.size() > 0) {
+ if (devices != null) {
3173
for (VirtualDevice device : devices) {
3174
- if (device instanceof VirtualDisk && (controllerKey == device.getControllerKey())) {
+ if (device.getControllerKey() == null || device.getControllerKey() != controllerKey) {
3175
+ continue;
3176
+ }
3177
+ if (device instanceof VirtualDisk || device instanceof VirtualCdrom) {
3178
deviceCount++;
3179
ideDeviceUnitNumber = device.getUnitNumber();
3180
}
0 commit comments