virQEMUCapsSupportsVmport() is now being called inside
qemuDomainDefValidateFeatures() for VIR_DOMAIN_FEATURE_VMPORT
feature.
qemuxml2xmltest.c was changed to account for this caps being
now validated at domain define time.
Signed-off-by: Daniel Henrique Barboza <danielhb413(a)gmail.com>
---
src/qemu/qemu_command.c | 10 +---------
src/qemu/qemu_domain.c | 12 +++++++++++-
tests/qemuxml2xmltest.c | 3 ++-
3 files changed, 14 insertions(+), 11 deletions(-)
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index a56f324af2..e7365ba86a 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -7097,17 +7097,9 @@ qemuBuildMachineCommandLine(virCommandPtr cmd,
*/
virBufferAddLit(&buf, ",usb=off");
- if (vmport) {
- if (!virQEMUCapsSupportsVmport(qemuCaps, def)) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
- _("vmport is not available "
- "with this QEMU binary"));
- return -1;
- }
-
+ if (vmport != VIR_TRISTATE_SWITCH_ABSENT)
virBufferAsprintf(&buf, ",vmport=%s",
virTristateSwitchTypeToString(vmport));
- }
if (smm)
virBufferAsprintf(&buf, ",smm=%s",
virTristateSwitchTypeToString(smm));
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index d78c5904ff..d62e13f26c 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -4983,6 +4983,17 @@ qemuDomainDefValidateFeatures(const virDomainDef *def,
}
break;
+ case VIR_DOMAIN_FEATURE_VMPORT:
+ if (def->features[i] != VIR_TRISTATE_SWITCH_ABSENT &&
+ !virQEMUCapsSupportsVmport(qemuCaps, def)) {
+
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("vmport is not available "
+ "with this QEMU binary"));
+ return -1;
+ }
+ break;
+
case VIR_DOMAIN_FEATURE_ACPI:
case VIR_DOMAIN_FEATURE_APIC:
case VIR_DOMAIN_FEATURE_PAE:
@@ -4993,7 +5004,6 @@ qemuDomainDefValidateFeatures(const virDomainDef *def,
case VIR_DOMAIN_FEATURE_PVSPINLOCK:
case VIR_DOMAIN_FEATURE_CAPABILITIES:
case VIR_DOMAIN_FEATURE_PMU:
- case VIR_DOMAIN_FEATURE_VMPORT:
case VIR_DOMAIN_FEATURE_VMCOREINFO:
case VIR_DOMAIN_FEATURE_MSRS:
case VIR_DOMAIN_FEATURE_LAST:
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
index e5bbd8dec4..4353c7a6b8 100644
--- a/tests/qemuxml2xmltest.c
+++ b/tests/qemuxml2xmltest.c
@@ -840,7 +840,8 @@ mymain(void)
QEMU_CAPS_SPICE,
QEMU_CAPS_DEVICE_QXL,
QEMU_CAPS_HDA_DUPLEX,
- QEMU_CAPS_USB_REDIR);
+ QEMU_CAPS_USB_REDIR,
+ QEMU_CAPS_MACHINE_VMPORT_OPT);
DO_TEST("pcie-root",
QEMU_CAPS_DEVICE_IOH3420,
QEMU_CAPS_ICH9_AHCI,
--
2.23.0