
On 05/17/2018 02:42 PM, John Ferlan wrote:
https://bugzilla.redhat.com/show_bug.cgi?id=1149445
If the domain requests usage of the genid functionality, then add the QEMU '-device vmgenid' to the command line providing either the supplied or generated GUID value.
Add tests for both a generated and supplied GUID value.
Signed-off-by: John Ferlan <jferlan@redhat.com> --- src/qemu/qemu_command.c | 24 +++++++++++++++++ .../qemuxml2argvdata/genid-auto.x86_64-latest.args | 30 ++++++++++++++++++++++ tests/qemuxml2argvdata/genid.x86_64-latest.args | 30 ++++++++++++++++++++++ tests/qemuxml2argvtest.c | 4 +++ 4 files changed, 88 insertions(+) create mode 100644 tests/qemuxml2argvdata/genid-auto.x86_64-latest.args create mode 100644 tests/qemuxml2argvdata/genid.x86_64-latest.args
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index c4237339bf..78bd685008 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -6002,6 +6002,27 @@ qemuBuildSmbiosCommandLine(virCommandPtr cmd, }
+static int +qemuBuildVMGenIDCommandLine(virCommandPtr cmd, + const virDomainDef *def) +{ + virBuffer opts = VIR_BUFFER_INITIALIZER; + char guid[VIR_UUID_STRING_BUFLEN]; + + if (!def->genidRequested) + return 0; + + virUUIDFormat(def->genid, guid); + virBufferAsprintf(&opts, "vmgenid,guid=%s,id=vmgenid0", guid); + + virCommandAddArg(cmd, "-device"); + virCommandAddArgBuffer(cmd, &opts); + + virBufferFreeAndReset(&opts); + return 0;
As mentioned in previous patch this function must check for DEVICE_VMGENID capability. Otherwise we might put -device vmgenid on command line for qemu that doesn't support it.
+}
Michal