Skip to content

Commit

Permalink
Update pr9823: add new method
Browse files Browse the repository at this point in the history
  • Loading branch information
weizhouapache committed Oct 28, 2024
1 parent e381ded commit 89eb4eb
Showing 1 changed file with 12 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2585,13 +2585,7 @@ protected DevicesDef createDevicesDef(VirtualMachineTO vmTO, GuestDef guest, int
Map<String, String> details = vmTO.getDetails();

boolean isIothreadsEnabled = details != null && details.containsKey(VmDetailConstants.IOTHREADS);
int controllers = vmTO.getDisks().length / 7;
if (vmTO.getDisks().length % 7 != 0) {
controllers++;
}
for (int i = 0; i < controllers; i++) {
devices.addDevice(createSCSIDef((short)i, vcpus, isIothreadsEnabled));
}
addSCSIControllers(devices, vcpus, vmTO.getDisks().length, isIothreadsEnabled);
}
return devices;
}
Expand Down Expand Up @@ -2633,6 +2627,17 @@ protected SCSIDef createSCSIDef(short index, int vcpus, boolean isIothreadsEnabl
return new SCSIDef(index, 0, 0, 9 + index, 0, vcpus, isIothreadsEnabled);
}


private void addSCSIControllers(DevicesDef devices, int vcpus, int diskCount, boolean isIothreadsEnabled) {
int controllers = diskCount / 7;
if (diskCount % 7 != 0) {
controllers++;
}
for (int i = 0; i < controllers; i++) {
devices.addDevice(createSCSIDef((short)i, vcpus, isIothreadsEnabled));
}
}

protected ConsoleDef createConsoleDef() {
return new ConsoleDef(PTY, null, null, (short)0);
}
Expand Down

0 comments on commit 89eb4eb

Please sign in to comment.