From 3482191d125b44316bbcdb1467bfc7cf4a2099f0 Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Mon, 27 Feb 2012 17:08:23 +0800 Subject: [PATCH] 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 Signed-off-by: Osier Yang --- 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 5305f82daa..25f8da5da0 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -1657,8 +1657,8 @@ attributes ports and vectors, which control how many devices can be connected through the controller. A "scsi" controller has an optional - attribute model, which is one of "auto", - "buslogic", "lsilogic", "lsias1068", or "vmpvscsi". + attribute model, which is one of "auto", "buslogic", + "ibmvscsi", "lsilogic", "lsias1068", or "vmpvscsi". A "usb" controller has an optional attribute model, 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 e276a92ce1..d3deaea457 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -1120,6 +1120,7 @@ lsilogic lsisas1068 vmpvscsi + ibmvscsi piix3-uhci piix4-uhci ehci diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index b0c3fa67b7..18e8b97d2d 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 9c8792a2e3..aa8c824589 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 e783f22e42..90d9948c5d 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 5a1aebd8e5..5eb7acba5e 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"); -- GitLab