QEMU_CAPS_DEVICE_VMGENID is now being validated by
qemuDomainDefValidate().
Signed-off-by: Daniel Henrique Barboza <danielhb413(a)gmail.com>
---
src/qemu/qemu_command.c | 11 ++---------
src/qemu/qemu_domain.c | 7 +++++++
2 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 9431efa384..1bbd69b891 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -6005,8 +6005,7 @@ qemuBuildSmbiosCommandLine(virCommandPtr cmd,
static int
qemuBuildVMGenIDCommandLine(virCommandPtr cmd,
- const virDomainDef *def,
- virQEMUCapsPtr qemuCaps)
+ const virDomainDef *def)
{
g_auto(virBuffer) opts = VIR_BUFFER_INITIALIZER;
char guid[VIR_UUID_STRING_BUFLEN];
@@ -6014,12 +6013,6 @@ qemuBuildVMGenIDCommandLine(virCommandPtr cmd,
if (!def->genidRequested)
return 0;
- if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VMGENID)) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
- _("this QEMU does not support the 'genid'
capability"));
- return -1;
- }
-
virUUIDFormat(def->genid, guid);
virBufferAsprintf(&opts, "vmgenid,guid=%s,id=vmgenid0", guid);
@@ -10022,7 +10015,7 @@ qemuBuildCommandLine(virQEMUDriverPtr driver,
if (qemuBuildSmbiosCommandLine(cmd, driver, def) < 0)
return NULL;
- if (qemuBuildVMGenIDCommandLine(cmd, def, qemuCaps) < 0)
+ if (qemuBuildVMGenIDCommandLine(cmd, def) < 0)
return NULL;
/*
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index b39942c49f..e3ffa4978b 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -5391,6 +5391,13 @@ qemuDomainDefValidate(const virDomainDef *def,
}
}
+ if (def->genidRequested &&
+ !virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VMGENID)) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("this QEMU does not support the 'genid'
capability"));
+ goto cleanup;
+ }
+
/* QEMU 2.7 (detected via the availability of query-hotpluggable-cpus)
* enforces stricter rules than previous versions when it comes to guest
* CPU topology. Verify known constraints are respected */
--
2.23.0