qemu: add ibmvscsi controller model

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>
This commit is contained in:
Paolo Bonzini 2012-02-27 17:08:23 +08:00 committed by Osier Yang
parent 4cc4b62e30
commit 3482191d12
6 changed files with 33 additions and 8 deletions

View File

@ -1657,8 +1657,8 @@
attributes <code>ports</code> and <code>vectors</code>, which attributes <code>ports</code> and <code>vectors</code>, which
control how many devices can be connected through the control how many devices can be connected through the
controller. A "scsi" controller has an optional controller. A "scsi" controller has an optional
attribute <code>model</code>, which is one of "auto", attribute <code>model</code>, which is one of "auto", "buslogic",
"buslogic", "lsilogic", "lsias1068", or "vmpvscsi". "ibmvscsi", "lsilogic", "lsias1068", or "vmpvscsi".
A "usb" controller has an optional attribute <code>model</code>, A "usb" controller has an optional attribute <code>model</code>,
which is one of "piix3-uhci", "piix4-uhci", "ehci", which is one of "piix3-uhci", "piix4-uhci", "ehci",
"ich9-ehci1", "ich9-uhci1", "ich9-uhci2", "ich9-uhci3", "ich9-ehci1", "ich9-uhci1", "ich9-uhci2", "ich9-uhci3",

View File

@ -1120,6 +1120,7 @@
<value>lsilogic</value> <value>lsilogic</value>
<value>lsisas1068</value> <value>lsisas1068</value>
<value>vmpvscsi</value> <value>vmpvscsi</value>
<value>ibmvscsi</value>
<value>piix3-uhci</value> <value>piix3-uhci</value>
<value>piix4-uhci</value> <value>piix4-uhci</value>
<value>ehci</value> <value>ehci</value>

View File

@ -238,7 +238,8 @@ VIR_ENUM_IMPL(virDomainControllerModelSCSI, VIR_DOMAIN_CONTROLLER_MODEL_SCSI_LAS
"buslogic", "buslogic",
"lsilogic", "lsilogic",
"lsisas1068", "lsisas1068",
"vmpvscsi") "vmpvscsi",
"ibmvscsi");
VIR_ENUM_IMPL(virDomainControllerModelUSB, VIR_DOMAIN_CONTROLLER_MODEL_USB_LAST, VIR_ENUM_IMPL(virDomainControllerModelUSB, VIR_DOMAIN_CONTROLLER_MODEL_USB_LAST,
"piix3-uhci", "piix3-uhci",

View File

@ -452,6 +452,7 @@ enum virDomainControllerModelSCSI {
VIR_DOMAIN_CONTROLLER_MODEL_SCSI_LSILOGIC, VIR_DOMAIN_CONTROLLER_MODEL_SCSI_LSILOGIC,
VIR_DOMAIN_CONTROLLER_MODEL_SCSI_LSISAS1068, VIR_DOMAIN_CONTROLLER_MODEL_SCSI_LSISAS1068,
VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VMPVSCSI, VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VMPVSCSI,
VIR_DOMAIN_CONTROLLER_MODEL_SCSI_IBMVSCSI,
VIR_DOMAIN_CONTROLLER_MODEL_SCSI_LAST VIR_DOMAIN_CONTROLLER_MODEL_SCSI_LAST
}; };

View File

@ -461,6 +461,15 @@ static int qemuAssignDeviceDiskAliasFixed(virDomainDiskDefPtr disk)
return 0; 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= */ /* Our custom -drive naming scheme used with id= */
static int qemuAssignDeviceDiskAliasCustom(virDomainDiskDefPtr disk) static int qemuAssignDeviceDiskAliasCustom(virDomainDiskDefPtr disk)
@ -2356,14 +2365,26 @@ qemuBuildControllerDevStr(virDomainDefPtr domainDef,
int *nusbcontroller) int *nusbcontroller)
{ {
virBuffer buf = VIR_BUFFER_INITIALIZER; virBuffer buf = VIR_BUFFER_INITIALIZER;
int model;
switch (def->type) { switch (def->type) {
case VIR_DOMAIN_CONTROLLER_TYPE_SCSI: case VIR_DOMAIN_CONTROLLER_TYPE_SCSI:
if (STREQ(domainDef->os.arch, "ppc64") && model = def->model;
STREQ(domainDef->os.machine, "pseries")) { if (model == -1 ||
virBufferAddLit(&buf, "spapr-vscsi"); model == VIR_DOMAIN_CONTROLLER_MODEL_SCSI_AUTO) {
} else { model = qemuDefaultScsiControllerModel(domainDef);
}
switch (model) {
case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_LSILOGIC:
virBufferAddLit(&buf, "lsi"); 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); virBufferAsprintf(&buf, ",id=scsi%d", def->idx);
break; break;

View File

@ -490,7 +490,8 @@ VIR_ENUM_IMPL(virVMXControllerModelSCSI, VIR_DOMAIN_CONTROLLER_MODEL_SCSI_LAST,
"buslogic", "buslogic",
"lsilogic", "lsilogic",
"lsisas1068", "lsisas1068",
"pvscsi"); "pvscsi",
"UNUSED ibmvscsi");