This is an automated email from the ASF dual-hosted git repository.

bhaisaab pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cloudstack.git


The following commit(s) were added to refs/heads/master by this push:
     new fdf2509  CLOUDSTACK-10160: Fix typo in Libvirt XML definition for 
Virtio-SCSI (#2341)
fdf2509 is described below

commit fdf250906066e63fb89ee1ab62efc1b6f70b94c1
Author: Wido den Hollander <[email protected]>
AuthorDate: Tue Nov 28 05:12:15 2017 +0100

    CLOUDSTACK-10160: Fix typo in Libvirt XML definition for Virtio-SCSI (#2341)
    
    * CLOUDSTACK-10160: Fix typo in Libvirt XML definition for Virtio-SCSI
    
    The attribute for the XML element 'controller' should be 'model' and
    not 'mode'.
    
    Source: https://libvirt.org/formatdomain.html#elementsControllers
    
      A scsi controller has an optional attribute model, which is one of
      'auto', 'buslogic', 'ibmvscsi', 'lsilogic', 'lsisas1068', 'lsisas1078',
      'virtio-scsi' or 'vmpvscsi'.
    
    In the current state a regular SCSI device is attached and not a Virtio-SCSI
    device.
    
    Signed-off-by: Wido den Hollander <[email protected]>
    
    * CLOUDSTACK-10160: Add UnitTest for LibvirtVMDef.SCSIDef
    
    To make sure the XML output string is correct
    
    Signed-off-by: Wido den Hollander <[email protected]>
---
 .../src/com/cloud/hypervisor/kvm/resource/LibvirtVMDef.java    |  4 ++--
 .../com/cloud/hypervisor/kvm/resource/LibvirtVMDefTest.java    | 10 ++++++++++
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git 
a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtVMDef.java
 
b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtVMDef.java
index ff3eb03..0f34a92 100644
--- 
a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtVMDef.java
+++ 
b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtVMDef.java
@@ -1411,10 +1411,10 @@ public class LibvirtVMDef {
         public String toString() {
             StringBuilder scsiBuilder = new StringBuilder();
 
-            scsiBuilder.append(String.format("<controller type='scsi' 
index='%d' mode='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 ) );
-            scsiBuilder.append("</controller>");
+            scsiBuilder.append("</controller>\n");
             return scsiBuilder.toString();
         }
     }
diff --git 
a/plugins/hypervisors/kvm/test/com/cloud/hypervisor/kvm/resource/LibvirtVMDefTest.java
 
b/plugins/hypervisors/kvm/test/com/cloud/hypervisor/kvm/resource/LibvirtVMDefTest.java
index 8f0f93d..e758dec 100644
--- 
a/plugins/hypervisors/kvm/test/com/cloud/hypervisor/kvm/resource/LibvirtVMDefTest.java
+++ 
b/plugins/hypervisors/kvm/test/com/cloud/hypervisor/kvm/resource/LibvirtVMDefTest.java
@@ -22,6 +22,7 @@ package com.cloud.hypervisor.kvm.resource;
 import junit.framework.TestCase;
 import com.cloud.hypervisor.kvm.resource.LibvirtVMDef.DiskDef;
 import com.cloud.hypervisor.kvm.resource.LibvirtVMDef.ChannelDef;
+import com.cloud.hypervisor.kvm.resource.LibvirtVMDef.SCSIDef;
 import com.cloud.utils.Pair;
 
 import java.io.File;
@@ -158,4 +159,13 @@ public class LibvirtVMDefTest extends TestCase {
         assertEquals(def.getAction(), action);
     }
 
+    public void testSCSIDef() {
+        SCSIDef def = new SCSIDef();
+        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" +
+                "</controller>\n";
+        assertEquals(str, expected);
+    }
+
 }

-- 
To stop receiving notification emails like this one, please contact
['"[email protected]" <[email protected]>'].

Reply via email to