[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] [PATCH] qemu: add support for LSI MegaRAID SAS1078 (aka megasas) SCSI controller



This does nothing more than adding the new device and capability.
The device is present since QEMU 1.2.0.

Signed-off-by: Paolo Bonzini <pbonzini redhat com>
---
 docs/formatdomain.html.in                          |  6 ++--
 docs/schemas/domaincommon.rng                      |  1 +
 src/conf/domain_conf.c                             |  3 +-
 src/conf/domain_conf.h                             |  1 +
 src/qemu/qemu_capabilities.c                       |  2 ++
 src/qemu/qemu_capabilities.h                       |  1 +
 src/qemu/qemu_command.c                            | 13 ++++++++-
 src/vmx/vmx.c                                      |  3 +-
 tests/qemuhelptest.c                               |  6 ++--
 .../qemuxml2argv-disk-scsi-megasas.args            |  9 ++++++
 .../qemuxml2argv-disk-scsi-megasas.xml             | 32 ++++++++++++++++++++++
 tests/qemuxml2argvtest.c                           |  3 ++
 tests/qemuxml2xmltest.c                            |  1 +
 13 files changed, 73 insertions(+), 8 deletions(-)
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-disk-scsi-megasas.args
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-disk-scsi-megasas.xml

diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index c2cf75f..8bf0736 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -2091,9 +2091,9 @@
       control how many devices can be connected through the
       controller.  A "scsi" controller has an optional
       attribute <code>model</code>, which is one of "auto", "buslogic",
-      "ibmvscsi", "lsilogic", "lsias1068", "virtio-scsi" or "vmpvscsi".
-      A "usb" controller has an optional attribute <code>model</code>,
-      which is one of "piix3-uhci", "piix4-uhci", "ehci",
+      "ibmvscsi", "lsilogic", "lsisas1068", "lsisas1078", "virtio-scsi" or
+      "vmpvscsi".  A "usb" controller has an optional attribute
+      <code>model</code>, which is one of "piix3-uhci", "piix4-uhci", "ehci",
       "ich9-ehci1", "ich9-uhci1", "ich9-uhci2", "ich9-uhci3",
       "vt82c686b-uhci", "pci-ohci" or "nec-xhci". Additionally,
       <span class="since">since 0.10.0</span>, if the USB bus needs to be
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index fae5c0d..a136ae8 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -1391,6 +1391,7 @@
             <value>vmpvscsi</value>
             <value>ibmvscsi</value>
             <value>virtio-scsi</value>
+            <value>lsisas1078</value>
             <value>piix3-uhci</value>
             <value>piix4-uhci</value>
             <value>ehci</value>
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 159a23d..0ef67be 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -304,7 +304,8 @@ VIR_ENUM_IMPL(virDomainControllerModelSCSI, VIR_DOMAIN_CONTROLLER_MODEL_SCSI_LAS
               "lsisas1068",
               "vmpvscsi",
               "ibmvscsi",
-              "virtio-scsi");
+              "virtio-scsi",
+              "lsisas1078");
 
 VIR_ENUM_IMPL(virDomainControllerModelUSB, VIR_DOMAIN_CONTROLLER_MODEL_USB_LAST,
               "piix3-uhci",
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index a750a1f..c3b2608 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -695,6 +695,7 @@ enum virDomainControllerModelSCSI {
     VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VMPVSCSI,
     VIR_DOMAIN_CONTROLLER_MODEL_SCSI_IBMVSCSI,
     VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VIRTIO_SCSI,
+    VIR_DOMAIN_CONTROLLER_MODEL_SCSI_LSISAS1078,
 
     VIR_DOMAIN_CONTROLLER_MODEL_SCSI_LAST
 };
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index 50f8084..3840b41 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -212,6 +212,7 @@ VIR_ENUM_IMPL(virQEMUCaps, QEMU_CAPS_LAST,
               "rng-egd",
               "virtio-ccw",
               "dtb",
+              "megasas",
     );
 
 struct _virQEMUCaps {
@@ -1329,6 +1330,7 @@ struct virQEMUCapsStringFlags virQEMUCapsObjectTypes[] = {
     { "virtio-scsi-pci", QEMU_CAPS_VIRTIO_SCSI },
     { "virtio-scsi-s390", QEMU_CAPS_VIRTIO_SCSI },
     { "virtio-scsi-ccw", QEMU_CAPS_VIRTIO_SCSI },
+    { "megasas", QEMU_CAPS_SCSI_MEGASAS },
     { "spicevmc", QEMU_CAPS_DEVICE_SPICEVMC },
     { "qxl-vga", QEMU_CAPS_DEVICE_QXL_VGA },
     { "qxl", QEMU_CAPS_DEVICE_QXL },
diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h
index b0f8c5b..7101f67 100644
--- a/src/qemu/qemu_capabilities.h
+++ b/src/qemu/qemu_capabilities.h
@@ -173,6 +173,7 @@ enum virQEMUCapsFlags {
     QEMU_CAPS_OBJECT_RNG_EGD     = 131, /* EGD protocol daemon for rng */
     QEMU_CAPS_VIRTIO_CCW         = 132, /* -device virtio-*-ccw */
     QEMU_CAPS_DTB                = 133, /* -dtb file */
+    QEMU_CAPS_SCSI_MEGASAS       = 134, /* -device megasas */
 
     QEMU_CAPS_LAST,                   /* this must always be the last item */
 };
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 006f83d..a0c278f 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -500,7 +500,7 @@ qemuSetScsiControllerModel(virDomainDefPtr def,
             if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_SCSI_LSI)) {
                 virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
                                _("This QEMU doesn't support "
-                                 "lsi scsi controller"));
+                                 "the LSI 53C895A SCSI controller"));
                 return -1;
             }
             break;
@@ -515,6 +515,14 @@ qemuSetScsiControllerModel(virDomainDefPtr def,
         case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_IBMVSCSI:
             /*TODO: need checking work here if necessary */
             break;
+        case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_LSISAS1078:
+            if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_SCSI_MEGASAS)) {
+                virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+                               _("This QEMU doesn't support "
+                                 "the LSI SAS1078 controller"));
+                return -1;
+            }
+            break;
         default:
             virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                            _("Unsupported controller model: %s"),
@@ -3544,6 +3552,9 @@ qemuBuildControllerDevStr(virDomainDefPtr domainDef,
         case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_IBMVSCSI:
             virBufferAddLit(&buf, "spapr-vscsi");
             break;
+        case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_LSISAS1078:
+            virBufferAddLit(&buf, "megasas");
+            break;
         default:
             virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                            _("Unsupported controller model: %s"),
diff --git a/src/vmx/vmx.c b/src/vmx/vmx.c
index c604bd2..d7eee09 100644
--- a/src/vmx/vmx.c
+++ b/src/vmx/vmx.c
@@ -511,7 +511,8 @@ VIR_ENUM_IMPL(virVMXControllerModelSCSI, VIR_DOMAIN_CONTROLLER_MODEL_SCSI_LAST,
               "lsisas1068",
               "pvscsi",
               "UNUSED ibmvscsi",
-              "UNUSED virtio-scsi");
+              "UNUSED virtio-scsi",
+              "UNUSED lsisas1078");
 
 
 
diff --git a/tests/qemuhelptest.c b/tests/qemuhelptest.c
index 059fa86..a28109a 100644
--- a/tests/qemuhelptest.c
+++ b/tests/qemuhelptest.c
@@ -912,7 +912,8 @@ mymain(void)
             QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
             QEMU_CAPS_DEVICE_USB_SERIAL,
             QEMU_CAPS_DEVICE_USB_NET,
-            QEMU_CAPS_DTB);
+            QEMU_CAPS_DTB,
+            QEMU_CAPS_SCSI_MEGASAS);
     DO_TEST("qemu-kvm-1.2.0", 1002000, 1, 0,
             QEMU_CAPS_VNC_COLON,
             QEMU_CAPS_NO_REBOOT,
@@ -1017,7 +1018,8 @@ mymain(void)
             QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
             QEMU_CAPS_DEVICE_USB_SERIAL,
             QEMU_CAPS_DEVICE_USB_NET,
-            QEMU_CAPS_DTB);
+            QEMU_CAPS_DTB,
+            QEMU_CAPS_SCSI_MEGASAS);
 
     return ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
 }
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-scsi-megasas.args b/tests/qemuxml2argvdata/qemuxml2argv-disk-scsi-megasas.args
new file mode 100644
index 0000000..c4d5f87
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-scsi-megasas.args
@@ -0,0 +1,9 @@
+LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu -S -M \
+pc -m 214 -smp 1 -nographic -nodefconfig -nodefaults -monitor \
+unix:/tmp/test-monitor,server,nowait -no-acpi -boot c -device \
+megasas,id=scsi0,bus=pci.0,addr=0x3 -usb -drive file=/dev/HostVG/QEMUGuest1,\
+if=none,id=drive-ide0-0-0 -device ide-drive,bus=ide.0,unit=0,\
+drive=drive-ide0-0-0,id=ide0-0-0 -drive file=/tmp/scsidisk.img,if=none,\
+id=drive-scsi0-0-4-0 -device scsi-disk,bus=scsi0.0,channel=0,scsi-id=4,lun=0,\
+drive=drive-scsi0-0-4-0,id=scsi0-0-4-0 -device virtio-balloon-pci,\
+id=balloon0,bus=pci.0,addr=0x4
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-scsi-megasas.xml b/tests/qemuxml2argvdata/qemuxml2argv-disk-scsi-megasas.xml
new file mode 100644
index 0000000..9a496ae
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-scsi-megasas.xml
@@ -0,0 +1,32 @@
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219136</memory>
+  <currentMemory unit='KiB'>219136</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>hvm</type>
+    <boot dev='hd'/>
+  </os>
+  <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>destroy</on_crash>
+  <devices>
+    <emulator>/usr/bin/qemu</emulator>
+    <disk type='block' device='disk'>
+      <source dev='/dev/HostVG/QEMUGuest1'/>
+      <target dev='hda' bus='ide'/>
+      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
+    </disk>
+    <disk type='file' device='disk'>
+      <source file='/tmp/scsidisk.img'/>
+      <target dev='sda' bus='scsi'/>
+      <address type='drive' controller='0' bus='0' target='4' unit='0'/>
+    </disk>
+    <controller type='ide' index='0'/>
+    <controller type='scsi' index='0' model='lsisas1078'/>
+    <controller type='usb' index='0'/>
+    <memballoon model='virtio'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index 5e7adf5..38787ac 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -550,6 +550,9 @@ mymain(void)
     DO_TEST("disk-scsi-virtio-scsi",
             QEMU_CAPS_DRIVE, QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG,
             QEMU_CAPS_VIRTIO_SCSI);
+    DO_TEST("disk-scsi-megasas",
+            QEMU_CAPS_DRIVE, QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG,
+            QEMU_CAPS_SCSI_MEGASAS);
     DO_TEST("disk-sata-device",
             QEMU_CAPS_DRIVE, QEMU_CAPS_DEVICE,
             QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_ICH9_AHCI);
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
index 899414d..ba9aa96 100644
--- a/tests/qemuxml2xmltest.c
+++ b/tests/qemuxml2xmltest.c
@@ -179,6 +179,7 @@ mymain(void)
     DO_TEST("disk-scsi-device");
     DO_TEST("disk-scsi-vscsi");
     DO_TEST("disk-scsi-virtio-scsi");
+    DO_TEST("disk-scsi-megasas");
     DO_TEST_FULL("disk-mirror", false, WHEN_ACTIVE);
     DO_TEST_FULL("disk-mirror", true, WHEN_INACTIVE);
     DO_TEST("graphics-listen-network");
-- 
1.8.1.4


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]