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

[libvirt] [PATCH 1/7] qemu: add ibmvscsi controller model



From: Paolo Bonzini <pbonzini redhat com>

KVM will be able to use a PCI SCSI controller even on POWER.  Let
the user specify the vSCSI controller by other means than a default.

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       |   29 +++++++++++++++++++++++++----
 src/vmx/vmx.c                 |    3 ++-
 6 files changed, 33 insertions(+), 8 deletions(-)

diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index 5305f82..25f8da5 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 b0c3fa6..18e8b97 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 e783f22..90d9948 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -461,6 +461,15 @@ static int qemuAssignDeviceDiskAliasFixed(virDomainDiskDefPtr disk)
     return 0;
 }
 
+static int
+qemuDefaultScsiControllerModel(virDomainDefPtr def) {
+    if (STREQ(def->os.arch, "ppc64") &&
+        STREQ(def->os.machine, "pseries")) {
+        return VIR_DOMAIN_CONTROLLER_MODEL_SCSI_IBMVSCSI;
+    } else {
+        return VIR_DOMAIN_CONTROLLER_MODEL_SCSI_LSILOGIC;
+    }
+}
 
 /* Our custom -drive naming scheme used with id= */
 static int qemuAssignDeviceDiskAliasCustom(virDomainDiskDefPtr disk)
@@ -2356,14 +2365,26 @@ qemuBuildControllerDevStr(virDomainDefPtr domainDef,
                           int *nusbcontroller)
 {
     virBuffer buf = VIR_BUFFER_INITIALIZER;
+    int model;
 
     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 {
+        model = def->model;
+        if (model == -1 ||
+            model == VIR_DOMAIN_CONTROLLER_MODEL_SCSI_AUTO) {
+            model = qemuDefaultScsiControllerModel(domainDef);
+        }
+        switch (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 5a1aebd..5eb7acb 100644
--- a/src/vmx/vmx.c
+++ b/src/vmx/vmx.c
@@ -490,7 +490,8 @@ VIR_ENUM_IMPL(virVMXControllerModelSCSI, VIR_DOMAIN_CONTROLLER_MODEL_SCSI_LAST,
               "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]