cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] GabrielBrascher closed pull request #3101: kvm: Set amount of queues for Virtio SCSI driver to vCPU of Instance
Date Tue, 08 Jan 2019 09:39:23 GMT
GabrielBrascher closed pull request #3101: kvm: Set amount of queues for Virtio SCSI driver
to vCPU of Instance
URL: https://github.com/apache/cloudstack/pull/3101
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java
b/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java
index ac92f37edab..ced37c90543 100644
--- a/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java
+++ b/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java
@@ -2214,7 +2214,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) {
-            final SCSIDef sd = new SCSIDef((short)0, 0, 0, 9, 0);
+            final SCSIDef sd = new SCSIDef((short)0, 0, 0, 9, 0, vcpus);
             devices.addDevice(sd);
         }
 
diff --git a/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/LibvirtVMDef.java
b/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/LibvirtVMDef.java
index e0089dc61fd..1f1c3a051a1 100644
--- a/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/LibvirtVMDef.java
+++ b/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/LibvirtVMDef.java
@@ -1501,13 +1501,15 @@ public String toString() {
         private int bus = 0;
         private int slot = 9;
         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;
+            this.queues = queues;
         }
 
         public SCSIDef() {
@@ -1518,9 +1520,12 @@ 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) {
+                scsiBuilder.append(String.format("<driver queues='%d'/>\n", this.queues));
+            }
             scsiBuilder.append("</controller>\n");
             return scsiBuilder.toString();
         }
diff --git a/plugins/hypervisors/kvm/src/test/java/com/cloud/hypervisor/kvm/resource/LibvirtVMDefTest.java
b/plugins/hypervisors/kvm/src/test/java/com/cloud/hypervisor/kvm/resource/LibvirtVMDefTest.java
index 32effb474d8..e127ed350e2 100644
--- a/plugins/hypervisors/kvm/src/test/java/com/cloud/hypervisor/kvm/resource/LibvirtVMDefTest.java
+++ b/plugins/hypervisors/kvm/src/test/java/com/cloud/hypervisor/kvm/resource/LibvirtVMDefTest.java
@@ -196,10 +196,11 @@ public void testWatchDogDef() {
     }
 
     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);
     }


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message