On 05/25/2018 04:24 AM, Michal Privoznik wrote: > 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@xxxxxxxxxx> >> --- >> 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. > Which path would do that? I believe I'm making "interesting" use of the DO_TEST_CAPS_LATEST actually. There are two ways to call qemuBuildCommandLine - one via the PretendCmd logic and one via the Launch logic. In the Launch logic prior to calling qemuBuildCommandLine, the capability is checked *and* the "need" for generating a new GUID is determined. It was a "design decision" to not check/change it earlier. Is there somewhere else you believe that code should go? IDC, I can move it, but understand the risk of doing so. Now that we have DO_TEST_CAPS_LATEST there's no need to pass an explicit flag for the PretendCmd line logic, so we get it for free for the test/fake command line. John >> +} > > Michal > -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list