Skip to content

Commit 89eb4eb

Browse files
committed
Update pr9823: add new method
1 parent e381ded commit 89eb4eb

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2585,13 +2585,7 @@ protected DevicesDef createDevicesDef(VirtualMachineTO vmTO, GuestDef guest, int
25852585
Map<String, String> details = vmTO.getDetails();
25862586

25872587
boolean isIothreadsEnabled = details != null && details.containsKey(VmDetailConstants.IOTHREADS);
2588-
int controllers = vmTO.getDisks().length / 7;
2589-
if (vmTO.getDisks().length % 7 != 0) {
2590-
controllers++;
2591-
}
2592-
for (int i = 0; i < controllers; i++) {
2593-
devices.addDevice(createSCSIDef((short)i, vcpus, isIothreadsEnabled));
2594-
}
2588+
addSCSIControllers(devices, vcpus, vmTO.getDisks().length, isIothreadsEnabled);
25952589
}
25962590
return devices;
25972591
}
@@ -2633,6 +2627,17 @@ protected SCSIDef createSCSIDef(short index, int vcpus, boolean isIothreadsEnabl
26332627
return new SCSIDef(index, 0, 0, 9 + index, 0, vcpus, isIothreadsEnabled);
26342628
}
26352629

2630+
2631+
private void addSCSIControllers(DevicesDef devices, int vcpus, int diskCount, boolean isIothreadsEnabled) {
2632+
int controllers = diskCount / 7;
2633+
if (diskCount % 7 != 0) {
2634+
controllers++;
2635+
}
2636+
for (int i = 0; i < controllers; i++) {
2637+
devices.addDevice(createSCSIDef((short)i, vcpus, isIothreadsEnabled));
2638+
}
2639+
}
2640+
26362641
protected ConsoleDef createConsoleDef() {
26372642
return new ConsoleDef(PTY, null, null, (short)0);
26382643
}

0 commit comments

Comments
 (0)