Re: [PATCH v2 10/11] qemu: Add VM Generation ID to qemu command line

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Apr 23, 2018 at 20:00:04 -0400, 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                | 31 +++++++++++++++++++++++++++++++
>  tests/qemuxml2argvdata/genid-auto.args | 24 ++++++++++++++++++++++++
>  tests/qemuxml2argvdata/genid.args      | 24 ++++++++++++++++++++++++
>  tests/qemuxml2argvtest.c               |  4 ++++
>  4 files changed, 83 insertions(+)
>  create mode 100644 tests/qemuxml2argvdata/genid-auto.args
>  create mode 100644 tests/qemuxml2argvdata/genid.args
> 
> diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
> index b666f3715f..1f5e79d86a 100644
> --- a/src/qemu/qemu_command.c
> +++ b/src/qemu/qemu_command.c
> @@ -5942,6 +5942,34 @@ qemuBuildSmbiosCommandLine(virCommandPtr cmd,
>  
>  
>  static int
> +qemuBuildVMGenIDCommandLine(virCommandPtr cmd,
> +                            const virDomainDef *def,
> +                            virQEMUCapsPtr qemuCaps)
> +{
> +    virBuffer opts = VIR_BUFFER_INITIALIZER;
> +    char guid[VIR_UUID_STRING_BUFLEN];
> +
> +    if (!def->genidRequested)
> +        return 0;
> +
> +    if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VMGENID)) {
> +        virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
> +                       _("genid is not supported with this QEMU binary"));
> +        return -1;

This is already checked in qemuProcessGenID.

> +    }
> +
> +    virUUIDFormat(def->genid, guid);
> +    virBufferAsprintf(&opts, "vmgenid,guid=%s,id=vmgenid0", guid);

[...]

> diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
> index 74d930ebe2..0dd0850036 100644
> --- a/tests/qemuxml2argvtest.c
> +++ b/tests/qemuxml2argvtest.c
> @@ -805,6 +805,10 @@ mymain(void)
>              QEMU_CAPS_SECCOMP_BLACKLIST);
>      DO_TEST_PARSE_ERROR("minimal-no-memory", NONE);
>      DO_TEST("minimal-msg-timestamp", QEMU_CAPS_MSG_TIMESTAMP);
> +
> +    DO_TEST("genid", QEMU_CAPS_DEVICE_VMGENID);
> +    DO_TEST("genid-auto", QEMU_CAPS_DEVICE_VMGENID);

Please use DO_TEST_CAPS_LATEST/DO_TEST_CAPS_VER

Attachment: signature.asc
Description: PGP signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux