Move to qemu_domain during the validation of controller options and rename qemuDomainCheckSCSIControllerModel. Signed-off-by: John Ferlan <jferlan@xxxxxxxxxx> --- src/qemu/qemu_command.c | 67 ------------------------------------------------- src/qemu/qemu_domain.c | 66 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 66 insertions(+), 67 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 7b2f4cd13..1efaec2d3 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -1888,68 +1888,6 @@ qemuCheckIOThreads(const virDomainDef *def, } -/** - * @qemuCaps: QEMU capabilities - * @model: SCSI model to check - * - * Using the @qemuCaps, let's ensure the provided @model can be supported - * - * Returns true if acceptible, false otherwise with error message set. - */ -static bool -qemuBuildCheckSCSIControllerModel(virQEMUCapsPtr qemuCaps, - int model) -{ - switch ((virDomainControllerModelSCSI) model) { - case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_LSILOGIC: - if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_SCSI_LSI)) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("This QEMU doesn't support " - "the LSI 53C895A SCSI controller")); - return false; - } - break; - case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VIRTIO_SCSI: - if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_SCSI)) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("This QEMU doesn't support " - "virtio scsi controller")); - return false; - } - break; - case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_IBMVSCSI: - /*TODO: need checking work here if necessary */ - break; - case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_LSISAS1068: - if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_SCSI_MPTSAS1068)) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("This QEMU doesn't support " - "the LSI SAS1068 (MPT Fusion) controller")); - return false; - } - 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 (MegaRAID) controller")); - return false; - } - break; - case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_AUTO: - case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_BUSLOGIC: - case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VMPVSCSI: - case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_LAST: - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("Unsupported controller model: %s"), - virDomainControllerModelSCSITypeToString(model)); - return false; - } - - return true; -} - - char * qemuBuildDriveDevStr(const virDomainDef *def, virDomainDiskDefPtr disk, @@ -2720,11 +2658,6 @@ qemuBuildControllerDevStr(const virDomainDef *domainDef, *devstr = NULL; - if (def->type == VIR_DOMAIN_CONTROLLER_TYPE_SCSI) { - if (!qemuBuildCheckSCSIControllerModel(qemuCaps, def->model)) - return -1; - } - switch ((virDomainControllerType) def->type) { case VIR_DOMAIN_CONTROLLER_TYPE_SCSI: switch (def->model) { diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 324805282..152718c0d 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -3953,6 +3953,68 @@ qemuDomainDeviceDefValidateControllerAttributes(const virDomainControllerDef *co } +/** + * @qemuCaps: QEMU capabilities + * @model: SCSI model to check + * + * Using the @qemuCaps, let's ensure the provided @model can be supported + * + * Returns true if acceptible, false otherwise with error message set. + */ +static bool +qemuDomainCheckSCSIControllerModel(virQEMUCapsPtr qemuCaps, + int model) +{ + switch ((virDomainControllerModelSCSI) model) { + case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_LSILOGIC: + if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_SCSI_LSI)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("This QEMU doesn't support " + "the LSI 53C895A SCSI controller")); + return false; + } + break; + case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VIRTIO_SCSI: + if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_SCSI)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("This QEMU doesn't support " + "virtio scsi controller")); + return false; + } + break; + case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_IBMVSCSI: + /*TODO: need checking work here if necessary */ + break; + case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_LSISAS1068: + if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_SCSI_MPTSAS1068)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("This QEMU doesn't support " + "the LSI SAS1068 (MPT Fusion) controller")); + return false; + } + 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 (MegaRAID) controller")); + return false; + } + break; + case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_AUTO: + case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_BUSLOGIC: + case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VMPVSCSI: + case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_LAST: + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Unsupported controller model: %s"), + virDomainControllerModelSCSITypeToString(model)); + return false; + } + + return true; +} + + static int qemuDomainDeviceDefValidateControllerIDE(const virDomainControllerDef *controller, const virDomainDef *def) @@ -3990,6 +4052,10 @@ qemuDomainDeviceDefValidateController(const virDomainControllerDef *controller, "controller")) return -1; + if (controller->type == VIR_DOMAIN_CONTROLLER_TYPE_SCSI && + !qemuDomainCheckSCSIControllerModel(qemuCaps, controller->model)) + return -1; + if (qemuDomainDeviceDefValidateControllerAttributes(controller) < 0) return -1; -- 2.13.6 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list