Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Back-ported vcpu based virtio-scsi queues #39

Merged
merged 1 commit into from
Feb 28, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2026,8 +2026,7 @@ So if getMinSpeed() returns null we fall back to getSpeed().

// If we're using virtio scsi, then we need to add a virtual scsi controller
if (busT == DiskDef.DiskBus.SCSI) {
int queues = getVirtioSCSIDriverQueuesFromVMDetail(vmTO);
final SCSIDef sd = new SCSIDef((short)0, 0, 0, 9, 0, queues);
final SCSIDef sd = new SCSIDef((short)0, 0, 0, 9, 0, vcpus);
devices.addDevice(sd);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1379,16 +1379,12 @@ public static class SCSIDef {
private int function = 0;
private int queues = 0;

public SCSIDef(short index, int domain, int bus, int slot, int function) {
public SCSIDef(short index, int domain, int bus, int slot, int function, int queues) {
this.index = index;
this.domain = domain;
this.bus = bus;
this.slot = slot;
this.function = function;
}

public SCSIDef(short index, int domain, int bus, int slot, int function, int queues) {
this(index, domain, bus, slot, function);
this.queues = queues;
}

Expand All @@ -1400,10 +1396,10 @@ public SCSIDef() {
public String toString() {
StringBuilder scsiBuilder = new StringBuilder();

scsiBuilder.append(String.format("<controller type='scsi' index='%d' model='virtio-scsi'>\n", this.index ));
scsiBuilder.append(String.format("<controller type='scsi' index='%d' model='virtio-scsi'>\n", this.index));
scsiBuilder.append(String.format("<address type='pci' domain='0x%04X' bus='0x%02X' slot='0x%02X' function='0x%01X'/>\n",
this.domain, this.bus, this.slot, this.function ) );
if(this.queues > 0) {
if (this.queues > 0) {
scsiBuilder.append(String.format("<driver queues='%d'/>\n", this.queues));
}
scsiBuilder.append("</controller>\n");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,10 +120,11 @@ public void testHypervEnlightDef() {
}

public void testSCSIDef() {
SCSIDef def = new SCSIDef();
SCSIDef def = new SCSIDef((short)0, 0, 0, 9, 0, 4);
String str = def.toString();
String expected = "<controller type='scsi' index='0' model='virtio-scsi'>\n" +
"<address type='pci' domain='0x0000' bus='0x00' slot='0x09' function='0x0'/>\n" +
"<driver queues='4'/>\n" +
"</controller>\n";
assertEquals(str, expected);
}
Expand Down