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

[libvirt] [PATCH 01/10] qemu: Add ibmvscsi controller model



From: Paolo Bonzini <pbonzini redhat com>

The codes to set default controller model is removed, it should
be done when parsing in src/conf/domain_conf.c instead, setting
default value for the command line and ignoring the domain def
is not a good idea, an inactive domain can't known what the default
setting should be, and thus you don't known how to give a right
XML for it when formating. [PATCH 3/9] will introduce a new
function to set the default value for controller model when
parsing and adding controller implicitly.

After this patch, the QEMU driver will actually look at the model
and reject anything but auto, lsilogic and ibmvscsi.

Signed-off-by: Paolo Bonzini <pbonzini redhat com>
Signed-off-by: Osier Yang <jyang redhat com>
---
 docs/formatdomain.html.in     |    4 ++--
 docs/schemas/domaincommon.rng |    1 +
 src/conf/domain_conf.c        |    3 ++-
 src/conf/domain_conf.h        |    1 +
 src/qemu/qemu_command.c       |   16 +++++++++++-----
 src/vmx/vmx.c                 |    9 +++++----
 6 files changed, 22 insertions(+), 12 deletions(-)

diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index 5305f82..2dd3fd2 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -1657,8 +1657,8 @@
       attributes <code>ports</code> and <code>vectors</code>, which
       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", "lsilogic", "lsias1068", or "vmpvscsi".
+      attribute <code>model</code>, which is one of "auto", "buslogic",
+      "ibmvscsi", "lsilogic", "lsias1068" 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",
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index e276a92..d3deaea 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -1120,6 +1120,7 @@
             <value>lsilogic</value>
             <value>lsisas1068</value>
             <value>vmpvscsi</value>
+            <value>ibmvscsi</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 85a2058..a23be05 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -238,7 +238,8 @@ VIR_ENUM_IMPL(virDomainControllerModelSCSI, VIR_DOMAIN_CONTROLLER_MODEL_SCSI_LAS
               "buslogic",
               "lsilogic",
               "lsisas1068",
-              "vmpvscsi")
+              "vmpvscsi",
+              "ibmvscsi")
 
 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 9c8792a..aa8c824 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -452,6 +452,7 @@ enum virDomainControllerModelSCSI {
     VIR_DOMAIN_CONTROLLER_MODEL_SCSI_LSILOGIC,
     VIR_DOMAIN_CONTROLLER_MODEL_SCSI_LSISAS1068,
     VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VMPVSCSI,
+    VIR_DOMAIN_CONTROLLER_MODEL_SCSI_IBMVSCSI,
 
     VIR_DOMAIN_CONTROLLER_MODEL_SCSI_LAST
 };
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 5a34504..0cc552f 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -2350,7 +2350,7 @@ qemuBuildUSBControllerDevStr(virDomainControllerDefPtr def,
 }
 
 char *
-qemuBuildControllerDevStr(virDomainDefPtr domainDef,
+qemuBuildControllerDevStr(virDomainDefPtr domainDef ATTRIBUTE_UNUSED,
                           virDomainControllerDefPtr def,
                           virBitmapPtr qemuCaps,
                           int *nusbcontroller)
@@ -2359,11 +2359,17 @@ qemuBuildControllerDevStr(virDomainDefPtr domainDef,
 
     switch (def->type) {
     case VIR_DOMAIN_CONTROLLER_TYPE_SCSI:
-        if (STREQ(domainDef->os.arch, "ppc64") &&
-            STREQ(domainDef->os.machine, "pseries")) {
-            virBufferAddLit(&buf, "spapr-vscsi");
-        } else {
+        switch (def->model) {
+        case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_LSILOGIC:
             virBufferAddLit(&buf, "lsi");
+            break;
+        case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_IBMVSCSI:
+            virBufferAddLit(&buf, "spapr-vscsi");
+            break;
+        default:
+            qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+                            _("Unsupported controller model: %s"),
+                            virDomainControllerModelSCSITypeToString(def->model));
         }
         virBufferAsprintf(&buf, ",id=scsi%d", def->idx);
         break;
diff --git a/src/vmx/vmx.c b/src/vmx/vmx.c
index 823d5df..5ebd81d 100644
--- a/src/vmx/vmx.c
+++ b/src/vmx/vmx.c
@@ -481,16 +481,17 @@ def->parallels[0]...
 #define VMX_BUILD_NAME(_suffix)                                               \
     VMX_BUILD_NAME_EXTRA(_suffix, #_suffix)
 
-/* directly map the virDomainControllerModel to virVMXSCSIControllerModel,
- * this is good enough for now because all virDomainControllerModel values
- * are actually SCSI controller models in the ESX case */
+/* directly map the virDomainControllerModel to virVMXSCSIControllerModel.
+ * Using an uppercase name for unused values ensures that they will never
+ * be used.  */
 VIR_ENUM_DECL(virVMXControllerModelSCSI)
 VIR_ENUM_IMPL(virVMXControllerModelSCSI, VIR_DOMAIN_CONTROLLER_MODEL_SCSI_LAST,
               "auto", /* just to match virDomainControllerModel, will never be used */
               "buslogic",
               "lsilogic",
               "lsisas1068",
-              "pvscsi");
+              "pvscsi",
+              "UNUSED ibmvscsi");
 
 
 
-- 
1.7.7.3


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