Move the SATA controller check from command line building to
controller def validation.
Signed-off-by: John Ferlan <jferlan(a)redhat.com>
---
src/qemu/qemu_command.c | 6 ------
src/qemu/qemu_domain.c | 17 ++++++++++++++++-
2 files changed, 16 insertions(+), 7 deletions(-)
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 414c6a13f..cc4b138a6 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -2699,12 +2699,6 @@ qemuBuildControllerDevStr(const virDomainDef *domainDef,
break;
case VIR_DOMAIN_CONTROLLER_TYPE_SATA:
- if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_ICH9_AHCI)) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
- _("SATA is not supported with this "
- "QEMU binary"));
- goto error;
- }
virBufferAsprintf(&buf, "ahci,id=%s", def->info.alias);
break;
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 4c2daa176..80327be11 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -4305,6 +4305,18 @@ qemuDomainDeviceDefValidateControllerPCI(const
virDomainControllerDef *controlle
static int
+qemuDomainDeviceDefValidateControllerSATA(virQEMUCapsPtr qemuCaps)
+{
+ if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_ICH9_AHCI)) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("SATA is not supported with this QEMU binary"));
+ return -1;
+ }
+ return 0;
+}
+
+
+static int
qemuDomainDeviceDefValidateController(const virDomainControllerDef *controller,
const virDomainDef *def,
virQEMUCapsPtr qemuCaps)
@@ -4332,8 +4344,11 @@ qemuDomainDeviceDefValidateController(const virDomainControllerDef
*controller,
ret = qemuDomainDeviceDefValidateControllerPCI(controller, qemuCaps);
break;
- case VIR_DOMAIN_CONTROLLER_TYPE_FDC:
case VIR_DOMAIN_CONTROLLER_TYPE_SATA:
+ ret = qemuDomainDeviceDefValidateControllerSATA(qemuCaps);
+ break;
+
+ case VIR_DOMAIN_CONTROLLER_TYPE_FDC:
case VIR_DOMAIN_CONTROLLER_TYPE_VIRTIO_SERIAL:
case VIR_DOMAIN_CONTROLLER_TYPE_CCID:
case VIR_DOMAIN_CONTROLLER_TYPE_USB:
--
2.13.6