diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 22c9144514014fb980f05f9fe03c2ba9adef83de..dc12bebcb3afcd9676c3027f332a1e1a69bd1634 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -6048,8 +6048,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]; @@ -6057,12 +6056,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); @@ -10070,7 +10063,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 40a2e33658a27d9a83c7a8d2fe4ee081497d3ca5..442a0020592e464feda0e5c1864b0db0cf231f7b 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -5458,6 +5458,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 */