[libvirt] [REPOSTv2 PATCH v3 0/6] Add support for VM Generation ID (vmgenid)

Second reposting of: https://www.redhat.com/archives/libvir-list/2018-May/msg00813.html To update patches with more conflicts for patch 2 (capabilities) and patch 6 (news) Cover from the v3 posting: v2: https://www.redhat.com/archives/libvir-list/2018-April/msg02234.html Changes since v2: * Essentially handle comments from code review of original series from comments received for patch 6: https://www.redhat.com/archives/libvir-list/2018-April/msg02240.html It's a somewhat simplified approach removing the ABI checks and the adjustment to the genid value as part of domain def copy. * (NEW) Patch 5 - add a 'genid' domain capability (similar to how Cole added support for vmcoreinfo). Since the apps need a way to determine whether this is enabled, this seems to be the best way. John Ferlan (6): conf: Add VM Generation ID parse/format support qemu: Add VM Generation ID device capability qemu: Alter VM Generation ID for specific startup/launch transitions qemu: Add VM Generation ID to qemu command line domcaps: Add 'genid' to domain capabilities docs: Add news article for VM Generation ID docs/formatdomain.html.in | 27 +++++++++++ docs/formatdomaincaps.html.in | 7 ++- docs/news.xml | 13 ++++++ docs/schemas/domaincaps.rng | 7 +++ docs/schemas/domaincommon.rng | 8 ++++ src/conf/domain_capabilities.c | 3 ++ src/conf/domain_capabilities.h | 1 + src/conf/domain_conf.c | 54 ++++++++++++++++++++++ src/conf/domain_conf.h | 5 ++ src/qemu/qemu_capabilities.c | 4 ++ src/qemu/qemu_capabilities.h | 1 + src/qemu/qemu_command.c | 24 ++++++++++ src/qemu/qemu_driver.c | 17 +++++-- src/qemu/qemu_process.c | 46 +++++++++++++++++- src/qemu/qemu_process.h | 1 + tests/domaincapsschemadata/basic.xml | 1 + tests/domaincapsschemadata/bhyve_basic.x86_64.xml | 1 + tests/domaincapsschemadata/bhyve_fbuf.x86_64.xml | 1 + tests/domaincapsschemadata/bhyve_uefi.x86_64.xml | 1 + tests/domaincapsschemadata/full.xml | 1 + tests/domaincapsschemadata/libxl-xenfv-usb.xml | 1 + tests/domaincapsschemadata/libxl-xenfv.xml | 1 + tests/domaincapsschemadata/libxl-xenpv-usb.xml | 1 + tests/domaincapsschemadata/libxl-xenpv.xml | 1 + tests/domaincapsschemadata/qemu_1.7.0.x86_64.xml | 1 + .../qemu_2.12.0-virt.aarch64.xml | 1 + tests/domaincapsschemadata/qemu_2.12.0.ppc64.xml | 1 + tests/domaincapsschemadata/qemu_2.12.0.s390x.xml | 1 + tests/domaincapsschemadata/qemu_2.12.0.x86_64.xml | 1 + .../qemu_2.6.0-virt.aarch64.xml | 1 + tests/domaincapsschemadata/qemu_2.6.0.aarch64.xml | 1 + tests/domaincapsschemadata/qemu_2.6.0.ppc64.xml | 1 + tests/domaincapsschemadata/qemu_2.6.0.x86_64.xml | 1 + tests/domaincapsschemadata/qemu_2.7.0.s390x.xml | 1 + .../domaincapsschemadata/qemu_2.8.0-tcg.x86_64.xml | 1 + tests/domaincapsschemadata/qemu_2.8.0.s390x.xml | 1 + tests/domaincapsschemadata/qemu_2.8.0.x86_64.xml | 1 + .../domaincapsschemadata/qemu_2.9.0-q35.x86_64.xml | 1 + .../domaincapsschemadata/qemu_2.9.0-tcg.x86_64.xml | 1 + tests/domaincapsschemadata/qemu_2.9.0.x86_64.xml | 1 + tests/qemucapabilitiesdata/caps_2.10.0.x86_64.xml | 1 + tests/qemucapabilitiesdata/caps_2.12.0.x86_64.xml | 1 + tests/qemucapabilitiesdata/caps_2.9.0.x86_64.xml | 1 + .../qemuxml2argvdata/genid-auto.x86_64-latest.args | 30 ++++++++++++ tests/qemuxml2argvdata/genid-auto.xml | 32 +++++++++++++ tests/qemuxml2argvdata/genid.x86_64-latest.args | 30 ++++++++++++ tests/qemuxml2argvdata/genid.xml | 32 +++++++++++++ tests/qemuxml2argvtest.c | 4 ++ tests/qemuxml2xmloutdata/genid-active.xml | 32 +++++++++++++ tests/qemuxml2xmloutdata/genid-auto-active.xml | 32 +++++++++++++ tests/qemuxml2xmloutdata/genid-auto-inactive.xml | 32 +++++++++++++ tests/qemuxml2xmloutdata/genid-inactive.xml | 32 +++++++++++++ tests/qemuxml2xmltest.c | 5 +- 53 files changed, 500 insertions(+), 7 deletions(-) create mode 100644 tests/qemuxml2argvdata/genid-auto.x86_64-latest.args create mode 100644 tests/qemuxml2argvdata/genid-auto.xml create mode 100644 tests/qemuxml2argvdata/genid.x86_64-latest.args create mode 100644 tests/qemuxml2argvdata/genid.xml create mode 100644 tests/qemuxml2xmloutdata/genid-active.xml create mode 100644 tests/qemuxml2xmloutdata/genid-auto-active.xml create mode 100644 tests/qemuxml2xmloutdata/genid-auto-inactive.xml create mode 100644 tests/qemuxml2xmloutdata/genid-inactive.xml -- 2.14.3

The VM Generation ID is a mechanism to provide a unique 128-bit, cryptographically random, and integer value identifier known as the GUID (Globally Unique Identifier) to the guest OS. The value is used to help notify the guest operating system when the virtual machine is executed with a different configuration. This patch adds support for a new "genid" XML element similar to the "uuid" element. The "genid" element can have two forms "<genid/>" or "<genid>$GUID</genid>". If the $GUID is not provided, libvirt will generate one and save it in the XML. Since adding support for a generated GUID (or UUID like) value to be displayed modifying the xml2xml test to include virrandommock.so is necessary since it will generate a "known" value. Signed-off-by: John Ferlan <jferlan@redhat.com> --- docs/formatdomain.html.in | 27 ++++++++++++ docs/schemas/domaincommon.rng | 8 ++++ src/conf/domain_conf.c | 54 ++++++++++++++++++++++++ src/conf/domain_conf.h | 5 +++ tests/qemuxml2argvdata/genid-auto.xml | 32 ++++++++++++++ tests/qemuxml2argvdata/genid.xml | 32 ++++++++++++++ tests/qemuxml2xmloutdata/genid-active.xml | 32 ++++++++++++++ tests/qemuxml2xmloutdata/genid-auto-active.xml | 32 ++++++++++++++ tests/qemuxml2xmloutdata/genid-auto-inactive.xml | 32 ++++++++++++++ tests/qemuxml2xmloutdata/genid-inactive.xml | 32 ++++++++++++++ tests/qemuxml2xmltest.c | 5 ++- 11 files changed, 290 insertions(+), 1 deletion(-) create mode 100644 tests/qemuxml2argvdata/genid-auto.xml create mode 100644 tests/qemuxml2argvdata/genid.xml create mode 100644 tests/qemuxml2xmloutdata/genid-active.xml create mode 100644 tests/qemuxml2xmloutdata/genid-auto-active.xml create mode 100644 tests/qemuxml2xmloutdata/genid-auto-inactive.xml create mode 100644 tests/qemuxml2xmloutdata/genid-inactive.xml diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index 0d0fd3b9f3..72a55ff075 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -34,6 +34,7 @@ <domain type='kvm' id='1'> <name>MyGuest</name> <uuid>4dea22b3-1d52-d8f3-2516-782e98ab3fa0</uuid> + <genid>43dc0cf8-809b-4adb-9bea-a9abb5f3d90e</genid> <title>A short description - title - of the domain</title> <description>Some human readable description</description> <metadata> @@ -61,6 +62,32 @@ specification. <span class="since">Since 0.0.1, sysinfo since 0.8.7</span></dd> + <dt><code>genid</code></dt> + <dd><span class="since">Since 4.4.0</span>, the <code>genid</code> + element can be used to add a Virtual Machine Generation ID which + exposes a 128-bit, cryptographically random, integer value identifier, + referred to as a Globally Unique Identifier (GUID) using the same + format as the <code>uuid</code>. The value is used to help notify + the guest operating system when the virtual machine is re-executing + something that has already executed before, such as: + + <ul> + <li>VM starts executing a snapshot</li> + <li>VM is recovered from backup</li> + <li>VM is failover in a disaster recovery environment</li> + <li>VM is imported, copied, or cloned</li> + </ul> + + The guest operating system notices the change and is then able to + react as appropriate by marking its copies of distributed databases + as dirty, re-initializing its random number generator, etc. + + <p> + The libvirt XML parser will accept both a provided GUID value + or just <genid/> in which case a GUID will be generated + and saved in the XML. For the transitions such as above, libvirt + will change the GUID before re-executing.</p></dd> + <dt><code>title</code></dt> <dd>The optional element <code>title</code> provides space for a short description of the domain. The title should not contain diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index 71ac3d079c..1fba108927 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -502,6 +502,14 @@ <ref name="UUID"/> </element> </optional> + <optional> + <element name="genid"> + <choice> + <ref name="UUID"/> + <empty/> + </choice> + </element> + </optional> </interleave> </define> <define name="idmap"> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 3689ac0a82..4d5f3c6740 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -18919,6 +18919,34 @@ virDomainDefParseXML(xmlDocPtr xml, VIR_FREE(tmp); } + /* Extract domain genid - a genid can either be provided or generated */ + if ((n = virXPathNodeSet("./genid", ctxt, &nodes)) < 0) + goto error; + + if (n > 0) { + if (n != 1) { + virReportError(VIR_ERR_XML_ERROR, "%s", + _("element 'genid' can only appear once")); + goto error; + } + def->genidRequested = true; + if (!(tmp = virXPathString("string(./genid[1])", ctxt))) { + if (virUUIDGenerate(def->genid) < 0) { + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("Failed to generate genid")); + goto error; + } + def->genidGenerated = true; + } else { + if (virUUIDParse(tmp, def->genid) < 0) { + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("malformed genid element")); + goto error; + } + } + } + VIR_FREE(nodes); + /* Extract short description of domain (title) */ def->title = virXPathString("string(./title[1])", ctxt); if (def->title && strchr(def->title, '\n')) { @@ -22033,6 +22061,25 @@ virDomainDefCheckABIStabilityFlags(virDomainDefPtr src, goto error; } + if (src->genidRequested != dst->genidRequested) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("Target domain requested genid does not match source")); + goto error; + } + + if (src->genidRequested && + memcmp(src->genid, dst->genid, VIR_UUID_BUFLEN) != 0) { + char guidsrc[VIR_UUID_STRING_BUFLEN]; + char guiddst[VIR_UUID_STRING_BUFLEN]; + + virUUIDFormat(src->genid, guidsrc); + virUUIDFormat(dst->genid, guiddst); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Target domain genid %s does not match source %s"), + guiddst, guidsrc); + goto error; + } + /* Not strictly ABI related, but we want to make sure domains * don't get silently re-named through the backdoor when passing * custom XML into various APIs, since this would create havoc @@ -26751,6 +26798,13 @@ virDomainDefFormatInternal(virDomainDefPtr def, virUUIDFormat(uuid, uuidstr); virBufferAsprintf(buf, "<uuid>%s</uuid>\n", uuidstr); + if (def->genidRequested) { + char genidstr[VIR_UUID_STRING_BUFLEN]; + + virUUIDFormat(def->genid, genidstr); + virBufferAsprintf(buf, "<genid>%s</genid>\n", genidstr); + } + virBufferEscapeString(buf, "<title>%s</title>\n", def->title); virBufferEscapeString(buf, "<description>%s</description>\n", diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index a78fdee40c..f5264ea850 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -2327,6 +2327,11 @@ struct _virDomainDef { virDomainVirtType virtType; int id; unsigned char uuid[VIR_UUID_BUFLEN]; + + unsigned char genid[VIR_UUID_BUFLEN]; + bool genidRequested; + bool genidGenerated; + char *name; char *title; char *description; diff --git a/tests/qemuxml2argvdata/genid-auto.xml b/tests/qemuxml2argvdata/genid-auto.xml new file mode 100644 index 0000000000..96ad9ddda8 --- /dev/null +++ b/tests/qemuxml2argvdata/genid-auto.xml @@ -0,0 +1,32 @@ +<domain type='qemu' id='1'> + <name>QEMUGuest1</name> + <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid> + <genid/> + <memory unit='KiB'>219136</memory> + <currentMemory unit='KiB'>219136</currentMemory> + <vcpu placement='static'>1</vcpu> + <os> + <type arch='x86_64' machine='pc'>hvm</type> + <boot dev='hd'/> + </os> + <features> + <acpi/> + </features> + <clock offset='utc'/> + <on_poweroff>destroy</on_poweroff> + <on_reboot>restart</on_reboot> + <on_crash>destroy</on_crash> + <devices> + <emulator>/usr/bin/qemu-system-x86_64</emulator> + <controller type='usb' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> + </controller> + <controller type='ide' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/> + </controller> + <controller type='pci' index='0' model='pci-root'/> + <input type='mouse' bus='ps2'/> + <input type='keyboard' bus='ps2'/> + <memballoon model='none'/> + </devices> +</domain> diff --git a/tests/qemuxml2argvdata/genid.xml b/tests/qemuxml2argvdata/genid.xml new file mode 100644 index 0000000000..fc41f2dd28 --- /dev/null +++ b/tests/qemuxml2argvdata/genid.xml @@ -0,0 +1,32 @@ +<domain type='qemu' id='1'> + <name>QEMUGuest1</name> + <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid> + <genid>e9392370-2917-565e-692b-d057f46512d6</genid> + <memory unit='KiB'>219136</memory> + <currentMemory unit='KiB'>219136</currentMemory> + <vcpu placement='static'>1</vcpu> + <os> + <type arch='x86_64' machine='pc'>hvm</type> + <boot dev='hd'/> + </os> + <features> + <acpi/> + </features> + <clock offset='utc'/> + <on_poweroff>destroy</on_poweroff> + <on_reboot>restart</on_reboot> + <on_crash>destroy</on_crash> + <devices> + <emulator>/usr/bin/qemu-system-x86_64</emulator> + <controller type='usb' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> + </controller> + <controller type='ide' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/> + </controller> + <controller type='pci' index='0' model='pci-root'/> + <input type='mouse' bus='ps2'/> + <input type='keyboard' bus='ps2'/> + <memballoon model='none'/> + </devices> +</domain> diff --git a/tests/qemuxml2xmloutdata/genid-active.xml b/tests/qemuxml2xmloutdata/genid-active.xml new file mode 100644 index 0000000000..fc41f2dd28 --- /dev/null +++ b/tests/qemuxml2xmloutdata/genid-active.xml @@ -0,0 +1,32 @@ +<domain type='qemu' id='1'> + <name>QEMUGuest1</name> + <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid> + <genid>e9392370-2917-565e-692b-d057f46512d6</genid> + <memory unit='KiB'>219136</memory> + <currentMemory unit='KiB'>219136</currentMemory> + <vcpu placement='static'>1</vcpu> + <os> + <type arch='x86_64' machine='pc'>hvm</type> + <boot dev='hd'/> + </os> + <features> + <acpi/> + </features> + <clock offset='utc'/> + <on_poweroff>destroy</on_poweroff> + <on_reboot>restart</on_reboot> + <on_crash>destroy</on_crash> + <devices> + <emulator>/usr/bin/qemu-system-x86_64</emulator> + <controller type='usb' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> + </controller> + <controller type='ide' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/> + </controller> + <controller type='pci' index='0' model='pci-root'/> + <input type='mouse' bus='ps2'/> + <input type='keyboard' bus='ps2'/> + <memballoon model='none'/> + </devices> +</domain> diff --git a/tests/qemuxml2xmloutdata/genid-auto-active.xml b/tests/qemuxml2xmloutdata/genid-auto-active.xml new file mode 100644 index 0000000000..aeca0d7fc0 --- /dev/null +++ b/tests/qemuxml2xmloutdata/genid-auto-active.xml @@ -0,0 +1,32 @@ +<domain type='qemu' id='1'> + <name>QEMUGuest1</name> + <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid> + <genid>00010203-0405-4607-8809-0a0b0c0d0e0f</genid> + <memory unit='KiB'>219136</memory> + <currentMemory unit='KiB'>219136</currentMemory> + <vcpu placement='static'>1</vcpu> + <os> + <type arch='x86_64' machine='pc'>hvm</type> + <boot dev='hd'/> + </os> + <features> + <acpi/> + </features> + <clock offset='utc'/> + <on_poweroff>destroy</on_poweroff> + <on_reboot>restart</on_reboot> + <on_crash>destroy</on_crash> + <devices> + <emulator>/usr/bin/qemu-system-x86_64</emulator> + <controller type='usb' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> + </controller> + <controller type='ide' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/> + </controller> + <controller type='pci' index='0' model='pci-root'/> + <input type='mouse' bus='ps2'/> + <input type='keyboard' bus='ps2'/> + <memballoon model='none'/> + </devices> +</domain> diff --git a/tests/qemuxml2xmloutdata/genid-auto-inactive.xml b/tests/qemuxml2xmloutdata/genid-auto-inactive.xml new file mode 100644 index 0000000000..a7b711d469 --- /dev/null +++ b/tests/qemuxml2xmloutdata/genid-auto-inactive.xml @@ -0,0 +1,32 @@ +<domain type='qemu'> + <name>QEMUGuest1</name> + <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid> + <genid>00010203-0405-4607-8809-0a0b0c0d0e0f</genid> + <memory unit='KiB'>219136</memory> + <currentMemory unit='KiB'>219136</currentMemory> + <vcpu placement='static'>1</vcpu> + <os> + <type arch='x86_64' machine='pc'>hvm</type> + <boot dev='hd'/> + </os> + <features> + <acpi/> + </features> + <clock offset='utc'/> + <on_poweroff>destroy</on_poweroff> + <on_reboot>restart</on_reboot> + <on_crash>destroy</on_crash> + <devices> + <emulator>/usr/bin/qemu-system-x86_64</emulator> + <controller type='usb' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> + </controller> + <controller type='ide' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/> + </controller> + <controller type='pci' index='0' model='pci-root'/> + <input type='mouse' bus='ps2'/> + <input type='keyboard' bus='ps2'/> + <memballoon model='none'/> + </devices> +</domain> diff --git a/tests/qemuxml2xmloutdata/genid-inactive.xml b/tests/qemuxml2xmloutdata/genid-inactive.xml new file mode 100644 index 0000000000..8bd526a7a9 --- /dev/null +++ b/tests/qemuxml2xmloutdata/genid-inactive.xml @@ -0,0 +1,32 @@ +<domain type='qemu'> + <name>QEMUGuest1</name> + <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid> + <genid>e9392370-2917-565e-692b-d057f46512d6</genid> + <memory unit='KiB'>219136</memory> + <currentMemory unit='KiB'>219136</currentMemory> + <vcpu placement='static'>1</vcpu> + <os> + <type arch='x86_64' machine='pc'>hvm</type> + <boot dev='hd'/> + </os> + <features> + <acpi/> + </features> + <clock offset='utc'/> + <on_poweroff>destroy</on_poweroff> + <on_reboot>restart</on_reboot> + <on_crash>destroy</on_crash> + <devices> + <emulator>/usr/bin/qemu-system-x86_64</emulator> + <controller type='usb' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> + </controller> + <controller type='ide' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/> + </controller> + <controller type='pci' index='0' model='pci-root'/> + <input type='mouse' bus='ps2'/> + <input type='keyboard' bus='ps2'/> + <memballoon model='none'/> + </devices> +</domain> diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c index 7cedc2b999..35a41007fc 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -276,6 +276,8 @@ mymain(void) setenv("PATH", "/bin", 1); DO_TEST("minimal", NONE); + DO_TEST("genid", NONE); + DO_TEST("genid-auto", NONE); DO_TEST("machine-core-on", NONE); DO_TEST("machine-core-off", NONE); DO_TEST("machine-loadparm-multiple-disks-nets-s390", NONE); @@ -1219,7 +1221,8 @@ mymain(void) } VIR_TEST_MAIN_PRELOAD(mymain, - abs_builddir "/.libs/virpcimock.so") + abs_builddir "/.libs/virpcimock.so", + abs_builddir "/.libs/virrandommock.so") #else -- 2.14.3

On 05/17/2018 02:42 PM, John Ferlan wrote:
The VM Generation ID is a mechanism to provide a unique 128-bit, cryptographically random, and integer value identifier known as the GUID (Globally Unique Identifier) to the guest OS. The value is used to help notify the guest operating system when the virtual machine is executed with a different configuration.
This patch adds support for a new "genid" XML element similar to the "uuid" element. The "genid" element can have two forms "<genid/>" or "<genid>$GUID</genid>". If the $GUID is not provided, libvirt will generate one and save it in the XML.
Since adding support for a generated GUID (or UUID like) value to be displayed modifying the xml2xml test to include virrandommock.so is necessary since it will generate a "known" value.
Signed-off-by: John Ferlan <jferlan@redhat.com> --- docs/formatdomain.html.in | 27 ++++++++++++ docs/schemas/domaincommon.rng | 8 ++++ src/conf/domain_conf.c | 54 ++++++++++++++++++++++++ src/conf/domain_conf.h | 5 +++ tests/qemuxml2argvdata/genid-auto.xml | 32 ++++++++++++++ tests/qemuxml2argvdata/genid.xml | 32 ++++++++++++++ tests/qemuxml2xmloutdata/genid-active.xml | 32 ++++++++++++++ tests/qemuxml2xmloutdata/genid-auto-active.xml | 32 ++++++++++++++ tests/qemuxml2xmloutdata/genid-auto-inactive.xml | 32 ++++++++++++++ tests/qemuxml2xmloutdata/genid-inactive.xml | 32 ++++++++++++++ tests/qemuxml2xmltest.c | 5 ++- 11 files changed, 290 insertions(+), 1 deletion(-) create mode 100644 tests/qemuxml2argvdata/genid-auto.xml create mode 100644 tests/qemuxml2argvdata/genid.xml create mode 100644 tests/qemuxml2xmloutdata/genid-active.xml create mode 100644 tests/qemuxml2xmloutdata/genid-auto-active.xml create mode 100644 tests/qemuxml2xmloutdata/genid-auto-inactive.xml create mode 100644 tests/qemuxml2xmloutdata/genid-inactive.xml
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index 0d0fd3b9f3..72a55ff075 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -34,6 +34,7 @@ <domain type='kvm' id='1'> <name>MyGuest</name> <uuid>4dea22b3-1d52-d8f3-2516-782e98ab3fa0</uuid> + <genid>43dc0cf8-809b-4adb-9bea-a9abb5f3d90e</genid> <title>A short description - title - of the domain</title> <description>Some human readable description</description> <metadata> @@ -61,6 +62,32 @@ specification. <span class="since">Since 0.0.1, sysinfo since 0.8.7</span></dd>
+ <dt><code>genid</code></dt> + <dd><span class="since">Since 4.4.0</span>, the <code>genid</code> + element can be used to add a Virtual Machine Generation ID which + exposes a 128-bit, cryptographically random, integer value identifier, + referred to as a Globally Unique Identifier (GUID) using the same + format as the <code>uuid</code>. The value is used to help notify + the guest operating system when the virtual machine is re-executing + something that has already executed before, such as: + + <ul> + <li>VM starts executing a snapshot</li> + <li>VM is recovered from backup</li> + <li>VM is failover in a disaster recovery environment</li> + <li>VM is imported, copied, or cloned</li> + </ul> + + The guest operating system notices the change and is then able to + react as appropriate by marking its copies of distributed databases + as dirty, re-initializing its random number generator, etc. + + <p> + The libvirt XML parser will accept both a provided GUID value + or just <genid/> in which case a GUID will be generated + and saved in the XML. For the transitions such as above, libvirt + will change the GUID before re-executing.</p></dd> + <dt><code>title</code></dt> <dd>The optional element <code>title</code> provides space for a short description of the domain. The title should not contain diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index 71ac3d079c..1fba108927 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -502,6 +502,14 @@ <ref name="UUID"/> </element> </optional> + <optional> + <element name="genid"> + <choice> + <ref name="UUID"/> + <empty/> + </choice> + </element> + </optional> </interleave> </define> <define name="idmap"> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 3689ac0a82..4d5f3c6740 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -18919,6 +18919,34 @@ virDomainDefParseXML(xmlDocPtr xml, VIR_FREE(tmp); }
+ /* Extract domain genid - a genid can either be provided or generated */ + if ((n = virXPathNodeSet("./genid", ctxt, &nodes)) < 0) + goto error; + + if (n > 0) { + if (n != 1) { + virReportError(VIR_ERR_XML_ERROR, "%s", + _("element 'genid' can only appear once"));
This _() seems misaligned.
+ goto error; + } + def->genidRequested = true; + if (!(tmp = virXPathString("string(./genid[1])", ctxt))) {
Since you check that there's only onde <genid/> above, this [1] seems redundant.
+ if (virUUIDGenerate(def->genid) < 0) { + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("Failed to generate genid")); + goto error; + } + def->genidGenerated = true; + } else { + if (virUUIDParse(tmp, def->genid) < 0) { + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("malformed genid element")); + goto error; + } + } + } + VIR_FREE(nodes); +
Michal

On 05/25/2018 04:24 AM, Michal Privoznik wrote:
On 05/17/2018 02:42 PM, John Ferlan wrote:
The VM Generation ID is a mechanism to provide a unique 128-bit, cryptographically random, and integer value identifier known as the GUID (Globally Unique Identifier) to the guest OS. The value is used to help notify the guest operating system when the virtual machine is executed with a different configuration.
This patch adds support for a new "genid" XML element similar to the "uuid" element. The "genid" element can have two forms "<genid/>" or "<genid>$GUID</genid>". If the $GUID is not provided, libvirt will generate one and save it in the XML.
Since adding support for a generated GUID (or UUID like) value to be displayed modifying the xml2xml test to include virrandommock.so is necessary since it will generate a "known" value.
Signed-off-by: John Ferlan <jferlan@redhat.com> --- docs/formatdomain.html.in | 27 ++++++++++++ docs/schemas/domaincommon.rng | 8 ++++ src/conf/domain_conf.c | 54 ++++++++++++++++++++++++ src/conf/domain_conf.h | 5 +++ tests/qemuxml2argvdata/genid-auto.xml | 32 ++++++++++++++ tests/qemuxml2argvdata/genid.xml | 32 ++++++++++++++ tests/qemuxml2xmloutdata/genid-active.xml | 32 ++++++++++++++ tests/qemuxml2xmloutdata/genid-auto-active.xml | 32 ++++++++++++++ tests/qemuxml2xmloutdata/genid-auto-inactive.xml | 32 ++++++++++++++ tests/qemuxml2xmloutdata/genid-inactive.xml | 32 ++++++++++++++ tests/qemuxml2xmltest.c | 5 ++- 11 files changed, 290 insertions(+), 1 deletion(-) create mode 100644 tests/qemuxml2argvdata/genid-auto.xml create mode 100644 tests/qemuxml2argvdata/genid.xml create mode 100644 tests/qemuxml2xmloutdata/genid-active.xml create mode 100644 tests/qemuxml2xmloutdata/genid-auto-active.xml create mode 100644 tests/qemuxml2xmloutdata/genid-auto-inactive.xml create mode 100644 tests/qemuxml2xmloutdata/genid-inactive.xml
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index 0d0fd3b9f3..72a55ff075 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -34,6 +34,7 @@ <domain type='kvm' id='1'> <name>MyGuest</name> <uuid>4dea22b3-1d52-d8f3-2516-782e98ab3fa0</uuid> + <genid>43dc0cf8-809b-4adb-9bea-a9abb5f3d90e</genid> <title>A short description - title - of the domain</title> <description>Some human readable description</description> <metadata> @@ -61,6 +62,32 @@ specification. <span class="since">Since 0.0.1, sysinfo since 0.8.7</span></dd>
+ <dt><code>genid</code></dt> + <dd><span class="since">Since 4.4.0</span>, the <code>genid</code> + element can be used to add a Virtual Machine Generation ID which + exposes a 128-bit, cryptographically random, integer value identifier, + referred to as a Globally Unique Identifier (GUID) using the same + format as the <code>uuid</code>. The value is used to help notify + the guest operating system when the virtual machine is re-executing + something that has already executed before, such as: + + <ul> + <li>VM starts executing a snapshot</li> + <li>VM is recovered from backup</li> + <li>VM is failover in a disaster recovery environment</li> + <li>VM is imported, copied, or cloned</li> + </ul> + + The guest operating system notices the change and is then able to + react as appropriate by marking its copies of distributed databases + as dirty, re-initializing its random number generator, etc. + + <p> + The libvirt XML parser will accept both a provided GUID value + or just <genid/> in which case a GUID will be generated + and saved in the XML. For the transitions such as above, libvirt + will change the GUID before re-executing.</p></dd> + <dt><code>title</code></dt> <dd>The optional element <code>title</code> provides space for a short description of the domain. The title should not contain diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index 71ac3d079c..1fba108927 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -502,6 +502,14 @@ <ref name="UUID"/> </element> </optional> + <optional> + <element name="genid"> + <choice> + <ref name="UUID"/> + <empty/> + </choice> + </element> + </optional> </interleave> </define> <define name="idmap"> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 3689ac0a82..4d5f3c6740 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -18919,6 +18919,34 @@ virDomainDefParseXML(xmlDocPtr xml, VIR_FREE(tmp); }
+ /* Extract domain genid - a genid can either be provided or generated */ + if ((n = virXPathNodeSet("./genid", ctxt, &nodes)) < 0) + goto error; + + if (n > 0) { + if (n != 1) { + virReportError(VIR_ERR_XML_ERROR, "%s", + _("element 'genid' can only appear once"));
This _() seems misaligned.
Right - good eyes. Fixed.
+ goto error; + } + def->genidRequested = true; + if (!(tmp = virXPathString("string(./genid[1])", ctxt))) {
Since you check that there's only onde <genid/> above, this [1] seems redundant.
As with many other XML parses, the code is essentially copied from elsewhere. Where exactly, I don't recall - I've removed the [1] though. John
+ if (virUUIDGenerate(def->genid) < 0) { + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("Failed to generate genid")); + goto error; + } + def->genidGenerated = true; + } else { + if (virUUIDParse(tmp, def->genid) < 0) { + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("malformed genid element")); + goto error; + } + } + } + VIR_FREE(nodes); +
Michal

Add the query of the device objects for the vmgenid device Signed-off-by: John Ferlan <jferlan@redhat.com> --- src/qemu/qemu_capabilities.c | 2 ++ src/qemu/qemu_capabilities.h | 1 + tests/qemucapabilitiesdata/caps_2.10.0.x86_64.xml | 1 + tests/qemucapabilitiesdata/caps_2.12.0.x86_64.xml | 1 + tests/qemucapabilitiesdata/caps_2.9.0.x86_64.xml | 1 + 5 files changed, 6 insertions(+) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index a5cb24fec6..cf763b4113 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -486,6 +486,7 @@ VIR_ENUM_IMPL(virQEMUCaps, QEMU_CAPS_LAST, /* 300 */ "sdl-gl", + "vmgenid", ); @@ -1116,6 +1117,7 @@ struct virQEMUCapsStringFlags virQEMUCapsObjectTypes[] = { { "pr-manager-helper", QEMU_CAPS_PR_MANAGER_HELPER }, { "virtual-css-bridge", QEMU_CAPS_CCW }, { "vfio-ccw", QEMU_CAPS_DEVICE_VFIO_CCW }, + { "vmgenid", QEMU_CAPS_DEVICE_VMGENID }, }; static struct virQEMUCapsStringFlags virQEMUCapsDevicePropsVirtioBalloon[] = { diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h index d23c34c24d..9a2328a598 100644 --- a/src/qemu/qemu_capabilities.h +++ b/src/qemu/qemu_capabilities.h @@ -470,6 +470,7 @@ typedef enum { /* virQEMUCapsFlags grouping marker for syntax-check */ /* 300 */ QEMU_CAPS_SDL_GL, /* -sdl gl */ + QEMU_CAPS_DEVICE_VMGENID, /* -device vmgenid */ QEMU_CAPS_LAST /* this must always be the last item */ } virQEMUCapsFlags; diff --git a/tests/qemucapabilitiesdata/caps_2.10.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_2.10.0.x86_64.xml index 77ca3013b5..d04f3bb596 100644 --- a/tests/qemucapabilitiesdata/caps_2.10.0.x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_2.10.0.x86_64.xml @@ -197,6 +197,7 @@ <flag name='disk-write-cache'/> <flag name='nbd-tls'/> <flag name='sdl-gl'/> + <flag name='vmgenid'/> <version>2010000</version> <kvmVersion>0</kvmVersion> <microcodeVersion>344938</microcodeVersion> diff --git a/tests/qemucapabilitiesdata/caps_2.12.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_2.12.0.x86_64.xml index 4247afeb31..68eb7906e0 100644 --- a/tests/qemucapabilitiesdata/caps_2.12.0.x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_2.12.0.x86_64.xml @@ -200,6 +200,7 @@ <flag name='qom-list-properties'/> <flag name='memory-backend-file.discard-data'/> <flag name='sdl-gl'/> + <flag name='vmgenid'/> <version>2011090</version> <kvmVersion>0</kvmVersion> <microcodeVersion>390813</microcodeVersion> diff --git a/tests/qemucapabilitiesdata/caps_2.9.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_2.9.0.x86_64.xml index 0701c244f6..f5638b6a41 100644 --- a/tests/qemucapabilitiesdata/caps_2.9.0.x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_2.9.0.x86_64.xml @@ -192,6 +192,7 @@ <flag name='disk-write-cache'/> <flag name='nbd-tls'/> <flag name='sdl-gl'/> + <flag name='vmgenid'/> <version>2009000</version> <kvmVersion>0</kvmVersion> <microcodeVersion>320947</microcodeVersion> -- 2.14.3

Before we generate the command line for qemu, if the domain about to be launched desires to utilize the VM Generation ID functionality, then handle both the regenerating the GUID value for backup recovery (restore operation) and the startup after snapshot as both require a new GUID to be generated to allow the guest operating system to recognize the VM is re-executing something that has already executed before. Signed-off-by: John Ferlan <jferlan@redhat.com> --- src/qemu/qemu_driver.c | 17 ++++++++++++++--- src/qemu/qemu_process.c | 46 ++++++++++++++++++++++++++++++++++++++++++++-- src/qemu/qemu_process.h | 1 + 3 files changed, 59 insertions(+), 5 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index b697838070..7e968f475d 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -6554,7 +6554,8 @@ qemuDomainSaveImageStartVM(virConnectPtr conn, if (qemuProcessStart(conn, driver, vm, cookie ? cookie->cpu : NULL, asyncJob, "stdio", *fd, path, NULL, VIR_NETDEV_VPORT_PROFILE_OP_RESTORE, - VIR_QEMU_PROCESS_START_PAUSED) == 0) + VIR_QEMU_PROCESS_START_PAUSED | + VIR_QEMU_PROCESS_START_GEN_VMID) == 0) restored = true; if (intermediatefd != -1) { @@ -15827,6 +15828,15 @@ qemuDomainRevertToSnapshot(virDomainSnapshotPtr snapshot, compatible = qemuDomainCheckABIStability(driver, vm, config); } + /* If using VM GenID, there is no way currently to change + * the genid for the running guest, so set an error and + * mark as incompatible. */ + if (compatible && config->genidRequested) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("domain genid update requires restart")); + compatible = false; + } + if (!compatible) { virErrorPtr err = virGetLastError(); @@ -15907,7 +15917,8 @@ qemuDomainRevertToSnapshot(virDomainSnapshotPtr snapshot, cookie ? cookie->cpu : NULL, QEMU_ASYNC_JOB_START, NULL, -1, NULL, snap, VIR_NETDEV_VPORT_PROFILE_OP_CREATE, - VIR_QEMU_PROCESS_START_PAUSED); + VIR_QEMU_PROCESS_START_PAUSED | + VIR_QEMU_PROCESS_START_GEN_VMID); virDomainAuditStart(vm, "from-snapshot", rc >= 0); detail = VIR_DOMAIN_EVENT_STARTED_FROM_SNAPSHOT; event = virDomainEventLifecycleNewFromObj(vm, @@ -15993,7 +16004,7 @@ qemuDomainRevertToSnapshot(virDomainSnapshotPtr snapshot, VIR_DOMAIN_SNAPSHOT_REVERT_PAUSED)) { /* Flush first event, now do transition 2 or 3 */ bool paused = (flags & VIR_DOMAIN_SNAPSHOT_REVERT_PAUSED) != 0; - unsigned int start_flags = 0; + unsigned int start_flags = VIR_QEMU_PROCESS_START_GEN_VMID; start_flags |= paused ? VIR_QEMU_PROCESS_START_PAUSED : 0; diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 5b73a61962..f9bba69f80 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -6072,6 +6072,43 @@ qemuProcessPrepareHost(virQEMUDriverPtr driver, } +/** + * qemuProcessGenID: + * @vm: Pointer to domain object + * @flags: qemuProcessStartFlags + * + * If this domain is requesting to use genid + */ +static int +qemuProcessGenID(virDomainObjPtr vm, + unsigned int flags) +{ + qemuDomainObjPrivatePtr priv = vm->privateData; + + if (!vm->def->genidRequested) + return 0; + + if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE_VMGENID)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("this QEMU does not support the 'genid' capability")); + return -1; + } + + /* If we are coming from a path where we must provide a new gen id + * value regardless of whether it was previously generated or provided, + * then generate a new GUID value before we build the command line. */ + if (flags & VIR_QEMU_PROCESS_START_GEN_VMID) { + if (virUUIDGenerate(vm->def->genid)) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("failed to regenerate genid")); + return -1; + } + } + + return 0; +} + + /** * qemuProcessLaunch: * @@ -6124,7 +6161,8 @@ qemuProcessLaunch(virConnectPtr conn, virCheckFlags(VIR_QEMU_PROCESS_START_COLD | VIR_QEMU_PROCESS_START_PAUSED | VIR_QEMU_PROCESS_START_AUTODESTROY | - VIR_QEMU_PROCESS_START_NEW, -1); + VIR_QEMU_PROCESS_START_NEW | + VIR_QEMU_PROCESS_START_GEN_VMID, -1); cfg = virQEMUDriverGetConfig(driver); @@ -6148,6 +6186,9 @@ qemuProcessLaunch(virConnectPtr conn, goto cleanup; logfile = qemuDomainLogContextGetWriteFD(logCtxt); + if (qemuProcessGenID(vm, flags) < 0) + goto cleanup; + VIR_DEBUG("Building emulator command line"); if (!(cmd = qemuBuildCommandLine(driver, qemuDomainLogContextGetManager(logCtxt), @@ -6513,7 +6554,8 @@ qemuProcessStart(virConnectPtr conn, virCheckFlagsGoto(VIR_QEMU_PROCESS_START_COLD | VIR_QEMU_PROCESS_START_PAUSED | - VIR_QEMU_PROCESS_START_AUTODESTROY, cleanup); + VIR_QEMU_PROCESS_START_AUTODESTROY | + VIR_QEMU_PROCESS_START_GEN_VMID, cleanup); if (!migrateFrom && !snapshot) flags |= VIR_QEMU_PROCESS_START_NEW; diff --git a/src/qemu/qemu_process.h b/src/qemu/qemu_process.h index a0e34b1c85..5098eacfe8 100644 --- a/src/qemu/qemu_process.h +++ b/src/qemu/qemu_process.h @@ -80,6 +80,7 @@ typedef enum { VIR_QEMU_PROCESS_START_AUTODESTROY = 1 << 2, VIR_QEMU_PROCESS_START_PRETEND = 1 << 3, VIR_QEMU_PROCESS_START_NEW = 1 << 4, /* internal, new VM is starting */ + VIR_QEMU_PROCESS_START_GEN_VMID = 1 << 5, /* Generate a new VMID */ } qemuProcessStartFlags; int qemuProcessStart(virConnectPtr conn, -- 2.14.3

On 05/17/2018 02:42 PM, John Ferlan wrote:
Before we generate the command line for qemu, if the domain about to be launched desires to utilize the VM Generation ID functionality, then handle both the regenerating the GUID value for backup recovery (restore operation) and the startup after snapshot as both require a new GUID to be generated to allow the guest operating system to recognize the VM is re-executing something that has already executed before.
Signed-off-by: John Ferlan <jferlan@redhat.com> --- src/qemu/qemu_driver.c | 17 ++++++++++++++--- src/qemu/qemu_process.c | 46 ++++++++++++++++++++++++++++++++++++++++++++-- src/qemu/qemu_process.h | 1 + 3 files changed, 59 insertions(+), 5 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index b697838070..7e968f475d 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -6554,7 +6554,8 @@ qemuDomainSaveImageStartVM(virConnectPtr conn, if (qemuProcessStart(conn, driver, vm, cookie ? cookie->cpu : NULL, asyncJob, "stdio", *fd, path, NULL, VIR_NETDEV_VPORT_PROFILE_OP_RESTORE, - VIR_QEMU_PROCESS_START_PAUSED) == 0) + VIR_QEMU_PROCESS_START_PAUSED | + VIR_QEMU_PROCESS_START_GEN_VMID) == 0) restored = true;
if (intermediatefd != -1) { @@ -15827,6 +15828,15 @@ qemuDomainRevertToSnapshot(virDomainSnapshotPtr snapshot, compatible = qemuDomainCheckABIStability(driver, vm, config); }
+ /* If using VM GenID, there is no way currently to change + * the genid for the running guest, so set an error and + * mark as incompatible. */ + if (compatible && config->genidRequested) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("domain genid update requires restart")); + compatible = false; + } + if (!compatible) { virErrorPtr err = virGetLastError();
@@ -15907,7 +15917,8 @@ qemuDomainRevertToSnapshot(virDomainSnapshotPtr snapshot, cookie ? cookie->cpu : NULL, QEMU_ASYNC_JOB_START, NULL, -1, NULL, snap, VIR_NETDEV_VPORT_PROFILE_OP_CREATE, - VIR_QEMU_PROCESS_START_PAUSED); + VIR_QEMU_PROCESS_START_PAUSED | + VIR_QEMU_PROCESS_START_GEN_VMID); virDomainAuditStart(vm, "from-snapshot", rc >= 0); detail = VIR_DOMAIN_EVENT_STARTED_FROM_SNAPSHOT; event = virDomainEventLifecycleNewFromObj(vm, @@ -15993,7 +16004,7 @@ qemuDomainRevertToSnapshot(virDomainSnapshotPtr snapshot, VIR_DOMAIN_SNAPSHOT_REVERT_PAUSED)) { /* Flush first event, now do transition 2 or 3 */ bool paused = (flags & VIR_DOMAIN_SNAPSHOT_REVERT_PAUSED) != 0; - unsigned int start_flags = 0; + unsigned int start_flags = VIR_QEMU_PROCESS_START_GEN_VMID;
start_flags |= paused ? VIR_QEMU_PROCESS_START_PAUSED : 0;
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 5b73a61962..f9bba69f80 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -6072,6 +6072,43 @@ qemuProcessPrepareHost(virQEMUDriverPtr driver, }
+/** + * qemuProcessGenID: + * @vm: Pointer to domain object + * @flags: qemuProcessStartFlags + * + * If this domain is requesting to use genid + */ +static int +qemuProcessGenID(virDomainObjPtr vm, + unsigned int flags) +{ + qemuDomainObjPrivatePtr priv = vm->privateData; + + if (!vm->def->genidRequested) + return 0; + + if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE_VMGENID)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("this QEMU does not support the 'genid' capability")); + return -1; + }
This looks misplaced to me. Firstly, if domain is required to generate new vmid this function should do that. Secondly, this check is missing when generating command line.
+ + /* If we are coming from a path where we must provide a new gen id + * value regardless of whether it was previously generated or provided, + * then generate a new GUID value before we build the command line. */ + if (flags & VIR_QEMU_PROCESS_START_GEN_VMID) { + if (virUUIDGenerate(vm->def->genid)) {
Please do explicit comparison here. It might bite us in the future when we want virUUIDGenerate to return a positive value (which would still be success).
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("failed to regenerate genid")); + return -1; + } + } + + return 0; +} + + /** * qemuProcessLaunch: * @@ -6124,7 +6161,8 @@ qemuProcessLaunch(virConnectPtr conn, virCheckFlags(VIR_QEMU_PROCESS_START_COLD | VIR_QEMU_PROCESS_START_PAUSED | VIR_QEMU_PROCESS_START_AUTODESTROY | - VIR_QEMU_PROCESS_START_NEW, -1); + VIR_QEMU_PROCESS_START_NEW | + VIR_QEMU_PROCESS_START_GEN_VMID, -1);
cfg = virQEMUDriverGetConfig(driver);
@@ -6148,6 +6186,9 @@ qemuProcessLaunch(virConnectPtr conn, goto cleanup; logfile = qemuDomainLogContextGetWriteFD(logCtxt);
+ if (qemuProcessGenID(vm, flags) < 0) + goto cleanup; + VIR_DEBUG("Building emulator command line"); if (!(cmd = qemuBuildCommandLine(driver, qemuDomainLogContextGetManager(logCtxt), @@ -6513,7 +6554,8 @@ qemuProcessStart(virConnectPtr conn,
virCheckFlagsGoto(VIR_QEMU_PROCESS_START_COLD | VIR_QEMU_PROCESS_START_PAUSED | - VIR_QEMU_PROCESS_START_AUTODESTROY, cleanup); + VIR_QEMU_PROCESS_START_AUTODESTROY | + VIR_QEMU_PROCESS_START_GEN_VMID, cleanup);
if (!migrateFrom && !snapshot) flags |= VIR_QEMU_PROCESS_START_NEW; diff --git a/src/qemu/qemu_process.h b/src/qemu/qemu_process.h index a0e34b1c85..5098eacfe8 100644 --- a/src/qemu/qemu_process.h +++ b/src/qemu/qemu_process.h @@ -80,6 +80,7 @@ typedef enum { VIR_QEMU_PROCESS_START_AUTODESTROY = 1 << 2, VIR_QEMU_PROCESS_START_PRETEND = 1 << 3, VIR_QEMU_PROCESS_START_NEW = 1 << 4, /* internal, new VM is starting */ + VIR_QEMU_PROCESS_START_GEN_VMID = 1 << 5, /* Generate a new VMID */
I wonder if we can do without this flag. Basically, only a handful of paths require VMID regeneration. But I haven't read older versions so maybe you had what I'm suggesting and were told to switch to flag. Michal

On 05/25/2018 04:24 AM, Michal Privoznik wrote:
On 05/17/2018 02:42 PM, John Ferlan wrote:
Before we generate the command line for qemu, if the domain about to be launched desires to utilize the VM Generation ID functionality, then handle both the regenerating the GUID value for backup recovery (restore operation) and the startup after snapshot as both require a new GUID to be generated to allow the guest operating system to recognize the VM is re-executing something that has already executed before.
Signed-off-by: John Ferlan <jferlan@redhat.com> --- src/qemu/qemu_driver.c | 17 ++++++++++++++--- src/qemu/qemu_process.c | 46 ++++++++++++++++++++++++++++++++++++++++++++-- src/qemu/qemu_process.h | 1 + 3 files changed, 59 insertions(+), 5 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index b697838070..7e968f475d 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -6554,7 +6554,8 @@ qemuDomainSaveImageStartVM(virConnectPtr conn, if (qemuProcessStart(conn, driver, vm, cookie ? cookie->cpu : NULL, asyncJob, "stdio", *fd, path, NULL, VIR_NETDEV_VPORT_PROFILE_OP_RESTORE, - VIR_QEMU_PROCESS_START_PAUSED) == 0) + VIR_QEMU_PROCESS_START_PAUSED | + VIR_QEMU_PROCESS_START_GEN_VMID) == 0) restored = true;
if (intermediatefd != -1) { @@ -15827,6 +15828,15 @@ qemuDomainRevertToSnapshot(virDomainSnapshotPtr snapshot, compatible = qemuDomainCheckABIStability(driver, vm, config); }
+ /* If using VM GenID, there is no way currently to change + * the genid for the running guest, so set an error and + * mark as incompatible. */ + if (compatible && config->genidRequested) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("domain genid update requires restart")); + compatible = false; + } + if (!compatible) { virErrorPtr err = virGetLastError();
@@ -15907,7 +15917,8 @@ qemuDomainRevertToSnapshot(virDomainSnapshotPtr snapshot, cookie ? cookie->cpu : NULL, QEMU_ASYNC_JOB_START, NULL, -1, NULL, snap, VIR_NETDEV_VPORT_PROFILE_OP_CREATE, - VIR_QEMU_PROCESS_START_PAUSED); + VIR_QEMU_PROCESS_START_PAUSED | + VIR_QEMU_PROCESS_START_GEN_VMID); virDomainAuditStart(vm, "from-snapshot", rc >= 0); detail = VIR_DOMAIN_EVENT_STARTED_FROM_SNAPSHOT; event = virDomainEventLifecycleNewFromObj(vm, @@ -15993,7 +16004,7 @@ qemuDomainRevertToSnapshot(virDomainSnapshotPtr snapshot, VIR_DOMAIN_SNAPSHOT_REVERT_PAUSED)) { /* Flush first event, now do transition 2 or 3 */ bool paused = (flags & VIR_DOMAIN_SNAPSHOT_REVERT_PAUSED) != 0; - unsigned int start_flags = 0; + unsigned int start_flags = VIR_QEMU_PROCESS_START_GEN_VMID;
start_flags |= paused ? VIR_QEMU_PROCESS_START_PAUSED : 0;
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 5b73a61962..f9bba69f80 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -6072,6 +6072,43 @@ qemuProcessPrepareHost(virQEMUDriverPtr driver, }
+/** + * qemuProcessGenID: + * @vm: Pointer to domain object + * @flags: qemuProcessStartFlags + * + * If this domain is requesting to use genid + */ +static int +qemuProcessGenID(virDomainObjPtr vm, + unsigned int flags) +{ + qemuDomainObjPrivatePtr priv = vm->privateData; + + if (!vm->def->genidRequested) + return 0; + + if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE_VMGENID)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("this QEMU does not support the 'genid' capability")); + return -1; + }
This looks misplaced to me. Firstly, if domain is required to generate new vmid this function should do that. Secondly, this check is missing when generating command line.
I dunno, it's just before building the command line in qemuProcessLaunch - IDC if it moves, but there may have been a request from some earlier review to make it be called earlier. Still moving it has implications on the entire logic. Essentially it's a "common" place before we generate the command line to make sure if GenID is desired/wanted that we have the capability and then can if we need to for this path change the genid value. That need is based on starting the domain after specific events - there is a list in the spec: http://go.microsoft.com/fwlink/?LinkId=260709 and you'd have to read the replies from the v2 review series: https://www.redhat.com/archives/libvir-list/2018-April/msg02234.html in particular lots of discussion in patch 6
+ + /* If we are coming from a path where we must provide a new gen id + * value regardless of whether it was previously generated or provided, + * then generate a new GUID value before we build the command line. */ + if (flags & VIR_QEMU_PROCESS_START_GEN_VMID) { + if (virUUIDGenerate(vm->def->genid)) {
Please do explicit comparison here. It might bite us in the future when we want virUUIDGenerate to return a positive value (which would still be success).
Right, strange - that got chopped off somewhere either during a rebase or cut-paste-copy from a previous review... I even posted/pushed the patch that changed all of them to use the < 0 syntax. Fixed this.
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("failed to regenerate genid")); + return -1; + } + } + + return 0; +} + + /** * qemuProcessLaunch: * @@ -6124,7 +6161,8 @@ qemuProcessLaunch(virConnectPtr conn, virCheckFlags(VIR_QEMU_PROCESS_START_COLD | VIR_QEMU_PROCESS_START_PAUSED | VIR_QEMU_PROCESS_START_AUTODESTROY | - VIR_QEMU_PROCESS_START_NEW, -1); + VIR_QEMU_PROCESS_START_NEW | + VIR_QEMU_PROCESS_START_GEN_VMID, -1);
cfg = virQEMUDriverGetConfig(driver);
@@ -6148,6 +6186,9 @@ qemuProcessLaunch(virConnectPtr conn, goto cleanup; logfile = qemuDomainLogContextGetWriteFD(logCtxt);
+ if (qemuProcessGenID(vm, flags) < 0) + goto cleanup; + VIR_DEBUG("Building emulator command line"); if (!(cmd = qemuBuildCommandLine(driver, qemuDomainLogContextGetManager(logCtxt), @@ -6513,7 +6554,8 @@ qemuProcessStart(virConnectPtr conn,
virCheckFlagsGoto(VIR_QEMU_PROCESS_START_COLD | VIR_QEMU_PROCESS_START_PAUSED | - VIR_QEMU_PROCESS_START_AUTODESTROY, cleanup); + VIR_QEMU_PROCESS_START_AUTODESTROY | + VIR_QEMU_PROCESS_START_GEN_VMID, cleanup);
if (!migrateFrom && !snapshot) flags |= VIR_QEMU_PROCESS_START_NEW; diff --git a/src/qemu/qemu_process.h b/src/qemu/qemu_process.h index a0e34b1c85..5098eacfe8 100644 --- a/src/qemu/qemu_process.h +++ b/src/qemu/qemu_process.h @@ -80,6 +80,7 @@ typedef enum { VIR_QEMU_PROCESS_START_AUTODESTROY = 1 << 2, VIR_QEMU_PROCESS_START_PRETEND = 1 << 3, VIR_QEMU_PROCESS_START_NEW = 1 << 4, /* internal, new VM is starting */ + VIR_QEMU_PROCESS_START_GEN_VMID = 1 << 5, /* Generate a new VMID */
I wonder if we can do without this flag. Basically, only a handful of paths require VMID regeneration. But I haven't read older versions so maybe you had what I'm suggesting and were told to switch to flag.
That was the whole point of adding the flag - only a handful of explicit paths require changing the vmgen id. Those are controlled by calls to qemuProcessStart which eventually calls ProcessLaunch where we not only check the capability but the flag in order to force a change to the GenID based on whether we're in a path that requires a change. John

On 05/25/2018 12:58 PM, John Ferlan wrote:
On 05/25/2018 04:24 AM, Michal Privoznik wrote:
On 05/17/2018 02:42 PM, John Ferlan wrote:
Before we generate the command line for qemu, if the domain about to be launched desires to utilize the VM Generation ID functionality, then handle both the regenerating the GUID value for backup recovery (restore operation) and the startup after snapshot as both require a new GUID to be generated to allow the guest operating system to recognize the VM is re-executing something that has already executed before.
Signed-off-by: John Ferlan <jferlan@redhat.com> --- src/qemu/qemu_driver.c | 17 ++++++++++++++--- src/qemu/qemu_process.c | 46 ++++++++++++++++++++++++++++++++++++++++++++-- src/qemu/qemu_process.h | 1 + 3 files changed, 59 insertions(+), 5 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index b697838070..7e968f475d 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -6554,7 +6554,8 @@ qemuDomainSaveImageStartVM(virConnectPtr conn, if (qemuProcessStart(conn, driver, vm, cookie ? cookie->cpu : NULL, asyncJob, "stdio", *fd, path, NULL, VIR_NETDEV_VPORT_PROFILE_OP_RESTORE, - VIR_QEMU_PROCESS_START_PAUSED) == 0) + VIR_QEMU_PROCESS_START_PAUSED | + VIR_QEMU_PROCESS_START_GEN_VMID) == 0) restored = true;
if (intermediatefd != -1) { @@ -15827,6 +15828,15 @@ qemuDomainRevertToSnapshot(virDomainSnapshotPtr snapshot, compatible = qemuDomainCheckABIStability(driver, vm, config); }
+ /* If using VM GenID, there is no way currently to change + * the genid for the running guest, so set an error and + * mark as incompatible. */ + if (compatible && config->genidRequested) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("domain genid update requires restart")); + compatible = false; + } + if (!compatible) { virErrorPtr err = virGetLastError();
@@ -15907,7 +15917,8 @@ qemuDomainRevertToSnapshot(virDomainSnapshotPtr snapshot, cookie ? cookie->cpu : NULL, QEMU_ASYNC_JOB_START, NULL, -1, NULL, snap, VIR_NETDEV_VPORT_PROFILE_OP_CREATE, - VIR_QEMU_PROCESS_START_PAUSED); + VIR_QEMU_PROCESS_START_PAUSED | + VIR_QEMU_PROCESS_START_GEN_VMID); virDomainAuditStart(vm, "from-snapshot", rc >= 0); detail = VIR_DOMAIN_EVENT_STARTED_FROM_SNAPSHOT; event = virDomainEventLifecycleNewFromObj(vm, @@ -15993,7 +16004,7 @@ qemuDomainRevertToSnapshot(virDomainSnapshotPtr snapshot, VIR_DOMAIN_SNAPSHOT_REVERT_PAUSED)) { /* Flush first event, now do transition 2 or 3 */ bool paused = (flags & VIR_DOMAIN_SNAPSHOT_REVERT_PAUSED) != 0; - unsigned int start_flags = 0; + unsigned int start_flags = VIR_QEMU_PROCESS_START_GEN_VMID;
start_flags |= paused ? VIR_QEMU_PROCESS_START_PAUSED : 0;
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 5b73a61962..f9bba69f80 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -6072,6 +6072,43 @@ qemuProcessPrepareHost(virQEMUDriverPtr driver, }
+/** + * qemuProcessGenID: + * @vm: Pointer to domain object + * @flags: qemuProcessStartFlags + * + * If this domain is requesting to use genid + */ +static int +qemuProcessGenID(virDomainObjPtr vm, + unsigned int flags) +{ + qemuDomainObjPrivatePtr priv = vm->privateData; + + if (!vm->def->genidRequested) + return 0; + + if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE_VMGENID)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("this QEMU does not support the 'genid' capability")); + return -1; + }
This looks misplaced to me. Firstly, if domain is required to generate new vmid this function should do that. Secondly, this check is missing when generating command line.
I dunno, it's just before building the command line in qemuProcessLaunch - IDC if it moves, but there may have been a request from some earlier review to make it be called earlier.
Still moving it has implications on the entire logic. Essentially it's a "common" place before we generate the command line to make sure if GenID is desired/wanted that we have the capability and then can if we need to for this path change the genid value. That need is based on starting the domain after specific events - there is a list in the spec:
http://go.microsoft.com/fwlink/?LinkId=260709
and you'd have to read the replies from the v2 review series:
https://www.redhat.com/archives/libvir-list/2018-April/msg02234.html
in particular lots of discussion in patch 6
Okay, so leave it here.
+ + /* If we are coming from a path where we must provide a new gen id + * value regardless of whether it was previously generated or provided, + * then generate a new GUID value before we build the command line. */ + if (flags & VIR_QEMU_PROCESS_START_GEN_VMID) { + if (virUUIDGenerate(vm->def->genid)) {
Please do explicit comparison here. It might bite us in the future when we want virUUIDGenerate to return a positive value (which would still be success).
Right, strange - that got chopped off somewhere either during a rebase or cut-paste-copy from a previous review... I even posted/pushed the patch that changed all of them to use the < 0 syntax. Fixed this.
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("failed to regenerate genid")); + return -1; + } + } + + return 0; +} + + /** * qemuProcessLaunch: * @@ -6124,7 +6161,8 @@ qemuProcessLaunch(virConnectPtr conn, virCheckFlags(VIR_QEMU_PROCESS_START_COLD | VIR_QEMU_PROCESS_START_PAUSED | VIR_QEMU_PROCESS_START_AUTODESTROY | - VIR_QEMU_PROCESS_START_NEW, -1); + VIR_QEMU_PROCESS_START_NEW | + VIR_QEMU_PROCESS_START_GEN_VMID, -1);
cfg = virQEMUDriverGetConfig(driver);
@@ -6148,6 +6186,9 @@ qemuProcessLaunch(virConnectPtr conn, goto cleanup; logfile = qemuDomainLogContextGetWriteFD(logCtxt);
+ if (qemuProcessGenID(vm, flags) < 0) + goto cleanup; + VIR_DEBUG("Building emulator command line"); if (!(cmd = qemuBuildCommandLine(driver, qemuDomainLogContextGetManager(logCtxt), @@ -6513,7 +6554,8 @@ qemuProcessStart(virConnectPtr conn,
virCheckFlagsGoto(VIR_QEMU_PROCESS_START_COLD | VIR_QEMU_PROCESS_START_PAUSED | - VIR_QEMU_PROCESS_START_AUTODESTROY, cleanup); + VIR_QEMU_PROCESS_START_AUTODESTROY | + VIR_QEMU_PROCESS_START_GEN_VMID, cleanup);
if (!migrateFrom && !snapshot) flags |= VIR_QEMU_PROCESS_START_NEW; diff --git a/src/qemu/qemu_process.h b/src/qemu/qemu_process.h index a0e34b1c85..5098eacfe8 100644 --- a/src/qemu/qemu_process.h +++ b/src/qemu/qemu_process.h @@ -80,6 +80,7 @@ typedef enum { VIR_QEMU_PROCESS_START_AUTODESTROY = 1 << 2, VIR_QEMU_PROCESS_START_PRETEND = 1 << 3, VIR_QEMU_PROCESS_START_NEW = 1 << 4, /* internal, new VM is starting */ + VIR_QEMU_PROCESS_START_GEN_VMID = 1 << 5, /* Generate a new VMID */
I wonder if we can do without this flag. Basically, only a handful of paths require VMID regeneration. But I haven't read older versions so maybe you had what I'm suggesting and were told to switch to flag.
That was the whole point of adding the flag - only a handful of explicit paths require changing the vmgen id. Those are controlled by calls to qemuProcessStart which eventually calls ProcessLaunch where we not only check the capability but the flag in order to force a change to the GenID based on whether we're in a path that requires a change.
Okay. For some reason having a special flag looked as an overkill to me, but I can live with that. Michal

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; +} + + static int qemuBuildSgaCommandLine(virCommandPtr cmd, const virDomainDef *def, @@ -9995,6 +10016,9 @@ qemuBuildCommandLine(virQEMUDriverPtr driver, if (qemuBuildSmbiosCommandLine(cmd, driver, def) < 0) goto error; + if (qemuBuildVMGenIDCommandLine(cmd, def) < 0) + goto error; + /* * NB, -nographic *MUST* come before any serial, or monitor * or parallel port flags due to QEMU craziness, where it diff --git a/tests/qemuxml2argvdata/genid-auto.x86_64-latest.args b/tests/qemuxml2argvdata/genid-auto.x86_64-latest.args new file mode 100644 index 0000000000..ce163020b9 --- /dev/null +++ b/tests/qemuxml2argvdata/genid-auto.x86_64-latest.args @@ -0,0 +1,30 @@ +LC_ALL=C \ +PATH=/bin \ +HOME=/home/test \ +USER=test \ +LOGNAME=test \ +QEMU_AUDIO_DRV=none \ +/usr/bin/qemu-system-x86_64 \ +-name guest=QEMUGuest1,debug-threads=on \ +-S \ +-object secret,id=masterKey0,format=raw,\ +file=/tmp/lib/domain--1-QEMUGuest1/master-key.aes \ +-machine pc-i440fx-2.12,accel=tcg,usb=off,dump-guest-core=off \ +-m 214 \ +-realtime mlock=off \ +-smp 1,sockets=1,cores=1,threads=1 \ +-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ +-device vmgenid,guid=00010203-0405-4607-8809-0a0b0c0d0e0f,id=vmgenid0 \ +-display none \ +-no-user-config \ +-nodefaults \ +-chardev socket,id=charmonitor,path=/tmp/lib/domain--1-QEMUGuest1/monitor.sock,\ +server,nowait \ +-mon chardev=charmonitor,id=monitor,mode=control \ +-rtc base=utc \ +-no-shutdown \ +-boot strict=on \ +-device piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2 \ +-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\ +resourcecontrol=deny \ +-msg timestamp=on diff --git a/tests/qemuxml2argvdata/genid.x86_64-latest.args b/tests/qemuxml2argvdata/genid.x86_64-latest.args new file mode 100644 index 0000000000..54e00f4bdb --- /dev/null +++ b/tests/qemuxml2argvdata/genid.x86_64-latest.args @@ -0,0 +1,30 @@ +LC_ALL=C \ +PATH=/bin \ +HOME=/home/test \ +USER=test \ +LOGNAME=test \ +QEMU_AUDIO_DRV=none \ +/usr/bin/qemu-system-x86_64 \ +-name guest=QEMUGuest1,debug-threads=on \ +-S \ +-object secret,id=masterKey0,format=raw,\ +file=/tmp/lib/domain--1-QEMUGuest1/master-key.aes \ +-machine pc-i440fx-2.12,accel=tcg,usb=off,dump-guest-core=off \ +-m 214 \ +-realtime mlock=off \ +-smp 1,sockets=1,cores=1,threads=1 \ +-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ +-device vmgenid,guid=e9392370-2917-565e-692b-d057f46512d6,id=vmgenid0 \ +-display none \ +-no-user-config \ +-nodefaults \ +-chardev socket,id=charmonitor,path=/tmp/lib/domain--1-QEMUGuest1/monitor.sock,\ +server,nowait \ +-mon chardev=charmonitor,id=monitor,mode=control \ +-rtc base=utc \ +-no-shutdown \ +-boot strict=on \ +-device piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2 \ +-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\ +resourcecontrol=deny \ +-msg timestamp=on diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 07e5ba1d13..025fe407e0 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -787,6 +787,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_CAPS_LATEST("genid"); + DO_TEST_CAPS_LATEST("genid-auto"); + DO_TEST("machine-aliases1", NONE); DO_TEST("machine-aliases2", QEMU_CAPS_KVM); DO_TEST("machine-core-on", NONE); -- 2.14.3

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

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@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.
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

On 05/25/2018 12:58 PM, John Ferlan wrote:
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@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.
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.
Well, qemuConnectDomainXMLToNative() for instance. So I suggest leaving the capability check in qemuProcessGenID() and having it repeated here. Michal

Report domaincaps <features><genid supported='yes'/> if the guest config accepts <genid/> or <genid>$GUID</genid>. Signed-off-by: John Ferlan <jferlan@redhat.com> --- docs/formatdomaincaps.html.in | 7 ++++++- docs/schemas/domaincaps.rng | 7 +++++++ src/conf/domain_capabilities.c | 3 +++ src/conf/domain_capabilities.h | 1 + src/qemu/qemu_capabilities.c | 2 ++ tests/domaincapsschemadata/basic.xml | 1 + tests/domaincapsschemadata/bhyve_basic.x86_64.xml | 1 + tests/domaincapsschemadata/bhyve_fbuf.x86_64.xml | 1 + tests/domaincapsschemadata/bhyve_uefi.x86_64.xml | 1 + tests/domaincapsschemadata/full.xml | 1 + tests/domaincapsschemadata/libxl-xenfv-usb.xml | 1 + tests/domaincapsschemadata/libxl-xenfv.xml | 1 + tests/domaincapsschemadata/libxl-xenpv-usb.xml | 1 + tests/domaincapsschemadata/libxl-xenpv.xml | 1 + tests/domaincapsschemadata/qemu_1.7.0.x86_64.xml | 1 + tests/domaincapsschemadata/qemu_2.12.0-virt.aarch64.xml | 1 + tests/domaincapsschemadata/qemu_2.12.0.ppc64.xml | 1 + tests/domaincapsschemadata/qemu_2.12.0.s390x.xml | 1 + tests/domaincapsschemadata/qemu_2.12.0.x86_64.xml | 1 + tests/domaincapsschemadata/qemu_2.6.0-virt.aarch64.xml | 1 + tests/domaincapsschemadata/qemu_2.6.0.aarch64.xml | 1 + tests/domaincapsschemadata/qemu_2.6.0.ppc64.xml | 1 + tests/domaincapsschemadata/qemu_2.6.0.x86_64.xml | 1 + tests/domaincapsschemadata/qemu_2.7.0.s390x.xml | 1 + tests/domaincapsschemadata/qemu_2.8.0-tcg.x86_64.xml | 1 + tests/domaincapsschemadata/qemu_2.8.0.s390x.xml | 1 + tests/domaincapsschemadata/qemu_2.8.0.x86_64.xml | 1 + tests/domaincapsschemadata/qemu_2.9.0-q35.x86_64.xml | 1 + tests/domaincapsschemadata/qemu_2.9.0-tcg.x86_64.xml | 1 + tests/domaincapsschemadata/qemu_2.9.0.x86_64.xml | 1 + 30 files changed, 44 insertions(+), 1 deletion(-) diff --git a/docs/formatdomaincaps.html.in b/docs/formatdomaincaps.html.in index 86c9ce8c5c..f54581c702 100644 --- a/docs/formatdomaincaps.html.in +++ b/docs/formatdomaincaps.html.in @@ -434,6 +434,7 @@ </enum> </gic> <vmcoreinfo supported='yes'/> + <genid supported='yes'/> </features> </domainCapabilities> </pre> @@ -460,7 +461,11 @@ <h4><a id="elementsvmcoreinfo">vmcoreinfo</a></h4> - <p>Reports whether the vmcoreinfo feature can be enabled</p> + <p>Reports whether the vmcoreinfo feature can be enabled.</p> + + <h4><a id="elementsgenid">genid</a></h4> + + <p>Reports whether the genid feature can be used by the domain.</p> </body> </html> diff --git a/docs/schemas/domaincaps.rng b/docs/schemas/domaincaps.rng index 5913d711a3..5ceabb0a80 100644 --- a/docs/schemas/domaincaps.rng +++ b/docs/schemas/domaincaps.rng @@ -184,6 +184,7 @@ <interleave> <ref name='gic'/> <ref name='vmcoreinfo'/> + <ref name='vmgenid'/> </interleave> </element> </define> @@ -201,6 +202,12 @@ </element> </define> + <define name='vmgenid'> + <element name='genid'> + <ref name='supported'/> + </element> + </define> + <define name='value'> <zeroOrMore> <element name='value'> diff --git a/src/conf/domain_capabilities.c b/src/conf/domain_capabilities.c index 6e2ab0a287..c20358e916 100644 --- a/src/conf/domain_capabilities.c +++ b/src/conf/domain_capabilities.c @@ -586,6 +586,9 @@ virDomainCapsFormat(virDomainCapsPtr const caps) virBufferAsprintf(&buf, "<vmcoreinfo supported='%s'/>\n", caps->vmcoreinfo ? "yes" : "no"); + virBufferAsprintf(&buf, "<genid supported='%s'/>\n", + caps->genid ? "yes" : "no"); + virBufferAdjustIndent(&buf, -2); virBufferAddLit(&buf, "</features>\n"); diff --git a/src/conf/domain_capabilities.h b/src/conf/domain_capabilities.h index 9b852e8649..b0eb4aa7e3 100644 --- a/src/conf/domain_capabilities.h +++ b/src/conf/domain_capabilities.h @@ -159,6 +159,7 @@ struct _virDomainCaps { virDomainCapsFeatureGIC gic; bool vmcoreinfo; + bool genid; /* add new domain features here */ }; diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index cf763b4113..fe48196bd1 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -4936,6 +4936,8 @@ virQEMUCapsFillDomainCaps(virCapsPtr caps, domCaps->vmcoreinfo = virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VMCOREINFO); + domCaps->genid = virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VMGENID); + if (virQEMUCapsFillDomainOSCaps(os, firmwares, nfirmwares) < 0 || virQEMUCapsFillDomainCPUCaps(caps, qemuCaps, domCaps) < 0 || virQEMUCapsFillDomainIOThreadCaps(qemuCaps, domCaps) < 0 || diff --git a/tests/domaincapsschemadata/basic.xml b/tests/domaincapsschemadata/basic.xml index 09e9376585..acc4a4d7d7 100644 --- a/tests/domaincapsschemadata/basic.xml +++ b/tests/domaincapsschemadata/basic.xml @@ -19,5 +19,6 @@ <features> <gic supported='no'/> <vmcoreinfo supported='no'/> + <genid supported='no'/> </features> </domainCapabilities> diff --git a/tests/domaincapsschemadata/bhyve_basic.x86_64.xml b/tests/domaincapsschemadata/bhyve_basic.x86_64.xml index 055d05b568..c4e8477055 100644 --- a/tests/domaincapsschemadata/bhyve_basic.x86_64.xml +++ b/tests/domaincapsschemadata/bhyve_basic.x86_64.xml @@ -29,5 +29,6 @@ <features> <gic supported='no'/> <vmcoreinfo supported='no'/> + <genid supported='no'/> </features> </domainCapabilities> diff --git a/tests/domaincapsschemadata/bhyve_fbuf.x86_64.xml b/tests/domaincapsschemadata/bhyve_fbuf.x86_64.xml index b22ca43ba0..0ba46b2c5e 100644 --- a/tests/domaincapsschemadata/bhyve_fbuf.x86_64.xml +++ b/tests/domaincapsschemadata/bhyve_fbuf.x86_64.xml @@ -46,5 +46,6 @@ <features> <gic supported='no'/> <vmcoreinfo supported='no'/> + <genid supported='no'/> </features> </domainCapabilities> diff --git a/tests/domaincapsschemadata/bhyve_uefi.x86_64.xml b/tests/domaincapsschemadata/bhyve_uefi.x86_64.xml index 625a55e70c..80318c78d8 100644 --- a/tests/domaincapsschemadata/bhyve_uefi.x86_64.xml +++ b/tests/domaincapsschemadata/bhyve_uefi.x86_64.xml @@ -38,5 +38,6 @@ <features> <gic supported='no'/> <vmcoreinfo supported='no'/> + <genid supported='no'/> </features> </domainCapabilities> diff --git a/tests/domaincapsschemadata/full.xml b/tests/domaincapsschemadata/full.xml index 47017c6fd1..9866886303 100644 --- a/tests/domaincapsschemadata/full.xml +++ b/tests/domaincapsschemadata/full.xml @@ -109,5 +109,6 @@ <features> <gic supported='no'/> <vmcoreinfo supported='no'/> + <genid supported='no'/> </features> </domainCapabilities> diff --git a/tests/domaincapsschemadata/libxl-xenfv-usb.xml b/tests/domaincapsschemadata/libxl-xenfv-usb.xml index 3f245e8961..6b56419ee1 100644 --- a/tests/domaincapsschemadata/libxl-xenfv-usb.xml +++ b/tests/domaincapsschemadata/libxl-xenfv-usb.xml @@ -72,5 +72,6 @@ <features> <gic supported='no'/> <vmcoreinfo supported='no'/> + <genid supported='no'/> </features> </domainCapabilities> diff --git a/tests/domaincapsschemadata/libxl-xenfv.xml b/tests/domaincapsschemadata/libxl-xenfv.xml index a81ce3310c..65dbc5aaf4 100644 --- a/tests/domaincapsschemadata/libxl-xenfv.xml +++ b/tests/domaincapsschemadata/libxl-xenfv.xml @@ -71,5 +71,6 @@ <features> <gic supported='no'/> <vmcoreinfo supported='no'/> + <genid supported='no'/> </features> </domainCapabilities> diff --git a/tests/domaincapsschemadata/libxl-xenpv-usb.xml b/tests/domaincapsschemadata/libxl-xenpv-usb.xml index 2bcd588c0f..92e54bae07 100644 --- a/tests/domaincapsschemadata/libxl-xenpv-usb.xml +++ b/tests/domaincapsschemadata/libxl-xenpv-usb.xml @@ -62,5 +62,6 @@ <features> <gic supported='no'/> <vmcoreinfo supported='no'/> + <genid supported='no'/> </features> </domainCapabilities> diff --git a/tests/domaincapsschemadata/libxl-xenpv.xml b/tests/domaincapsschemadata/libxl-xenpv.xml index e856ed00c6..741fd2d9d6 100644 --- a/tests/domaincapsschemadata/libxl-xenpv.xml +++ b/tests/domaincapsschemadata/libxl-xenpv.xml @@ -61,5 +61,6 @@ <features> <gic supported='no'/> <vmcoreinfo supported='no'/> + <genid supported='no'/> </features> </domainCapabilities> diff --git a/tests/domaincapsschemadata/qemu_1.7.0.x86_64.xml b/tests/domaincapsschemadata/qemu_1.7.0.x86_64.xml index 88c087549d..236d0de8f1 100644 --- a/tests/domaincapsschemadata/qemu_1.7.0.x86_64.xml +++ b/tests/domaincapsschemadata/qemu_1.7.0.x86_64.xml @@ -110,5 +110,6 @@ <features> <gic supported='no'/> <vmcoreinfo supported='no'/> + <genid supported='no'/> </features> </domainCapabilities> diff --git a/tests/domaincapsschemadata/qemu_2.12.0-virt.aarch64.xml b/tests/domaincapsschemadata/qemu_2.12.0-virt.aarch64.xml index 69d9968064..4d7056162e 100644 --- a/tests/domaincapsschemadata/qemu_2.12.0-virt.aarch64.xml +++ b/tests/domaincapsschemadata/qemu_2.12.0-virt.aarch64.xml @@ -117,5 +117,6 @@ </enum> </gic> <vmcoreinfo supported='yes'/> + <genid supported='no'/> </features> </domainCapabilities> diff --git a/tests/domaincapsschemadata/qemu_2.12.0.ppc64.xml b/tests/domaincapsschemadata/qemu_2.12.0.ppc64.xml index 5fac2ed772..8d7fd64f65 100644 --- a/tests/domaincapsschemadata/qemu_2.12.0.ppc64.xml +++ b/tests/domaincapsschemadata/qemu_2.12.0.ppc64.xml @@ -79,5 +79,6 @@ <features> <gic supported='no'/> <vmcoreinfo supported='no'/> + <genid supported='no'/> </features> </domainCapabilities> diff --git a/tests/domaincapsschemadata/qemu_2.12.0.s390x.xml b/tests/domaincapsschemadata/qemu_2.12.0.s390x.xml index 1475451e68..dac3df28da 100644 --- a/tests/domaincapsschemadata/qemu_2.12.0.s390x.xml +++ b/tests/domaincapsschemadata/qemu_2.12.0.s390x.xml @@ -171,5 +171,6 @@ <features> <gic supported='no'/> <vmcoreinfo supported='no'/> + <genid supported='no'/> </features> </domainCapabilities> diff --git a/tests/domaincapsschemadata/qemu_2.12.0.x86_64.xml b/tests/domaincapsschemadata/qemu_2.12.0.x86_64.xml index d0e2866c49..a8e3174dd6 100644 --- a/tests/domaincapsschemadata/qemu_2.12.0.x86_64.xml +++ b/tests/domaincapsschemadata/qemu_2.12.0.x86_64.xml @@ -141,5 +141,6 @@ <features> <gic supported='no'/> <vmcoreinfo supported='yes'/> + <genid supported='yes'/> </features> </domainCapabilities> diff --git a/tests/domaincapsschemadata/qemu_2.6.0-virt.aarch64.xml b/tests/domaincapsschemadata/qemu_2.6.0-virt.aarch64.xml index a4290ddc22..709a14d7fe 100644 --- a/tests/domaincapsschemadata/qemu_2.6.0-virt.aarch64.xml +++ b/tests/domaincapsschemadata/qemu_2.6.0-virt.aarch64.xml @@ -114,5 +114,6 @@ </enum> </gic> <vmcoreinfo supported='no'/> + <genid supported='no'/> </features> </domainCapabilities> diff --git a/tests/domaincapsschemadata/qemu_2.6.0.aarch64.xml b/tests/domaincapsschemadata/qemu_2.6.0.aarch64.xml index 943d978682..a4789a532c 100644 --- a/tests/domaincapsschemadata/qemu_2.6.0.aarch64.xml +++ b/tests/domaincapsschemadata/qemu_2.6.0.aarch64.xml @@ -110,5 +110,6 @@ <features> <gic supported='no'/> <vmcoreinfo supported='no'/> + <genid supported='no'/> </features> </domainCapabilities> diff --git a/tests/domaincapsschemadata/qemu_2.6.0.ppc64.xml b/tests/domaincapsschemadata/qemu_2.6.0.ppc64.xml index 86985a5856..79f4a06769 100644 --- a/tests/domaincapsschemadata/qemu_2.6.0.ppc64.xml +++ b/tests/domaincapsschemadata/qemu_2.6.0.ppc64.xml @@ -83,5 +83,6 @@ <features> <gic supported='no'/> <vmcoreinfo supported='no'/> + <genid supported='no'/> </features> </domainCapabilities> diff --git a/tests/domaincapsschemadata/qemu_2.6.0.x86_64.xml b/tests/domaincapsschemadata/qemu_2.6.0.x86_64.xml index 04be214659..55edf1b221 100644 --- a/tests/domaincapsschemadata/qemu_2.6.0.x86_64.xml +++ b/tests/domaincapsschemadata/qemu_2.6.0.x86_64.xml @@ -115,5 +115,6 @@ <features> <gic supported='no'/> <vmcoreinfo supported='no'/> + <genid supported='no'/> </features> </domainCapabilities> diff --git a/tests/domaincapsschemadata/qemu_2.7.0.s390x.xml b/tests/domaincapsschemadata/qemu_2.7.0.s390x.xml index 6b2d81520e..d18e05e53c 100644 --- a/tests/domaincapsschemadata/qemu_2.7.0.s390x.xml +++ b/tests/domaincapsschemadata/qemu_2.7.0.s390x.xml @@ -76,5 +76,6 @@ <features> <gic supported='no'/> <vmcoreinfo supported='no'/> + <genid supported='no'/> </features> </domainCapabilities> diff --git a/tests/domaincapsschemadata/qemu_2.8.0-tcg.x86_64.xml b/tests/domaincapsschemadata/qemu_2.8.0-tcg.x86_64.xml index eadcc3c8e4..825f1f97f8 100644 --- a/tests/domaincapsschemadata/qemu_2.8.0-tcg.x86_64.xml +++ b/tests/domaincapsschemadata/qemu_2.8.0-tcg.x86_64.xml @@ -116,5 +116,6 @@ <features> <gic supported='no'/> <vmcoreinfo supported='no'/> + <genid supported='no'/> </features> </domainCapabilities> diff --git a/tests/domaincapsschemadata/qemu_2.8.0.s390x.xml b/tests/domaincapsschemadata/qemu_2.8.0.s390x.xml index 0a71be4244..d524bb8970 100644 --- a/tests/domaincapsschemadata/qemu_2.8.0.s390x.xml +++ b/tests/domaincapsschemadata/qemu_2.8.0.s390x.xml @@ -157,5 +157,6 @@ <features> <gic supported='no'/> <vmcoreinfo supported='no'/> + <genid supported='no'/> </features> </domainCapabilities> diff --git a/tests/domaincapsschemadata/qemu_2.8.0.x86_64.xml b/tests/domaincapsschemadata/qemu_2.8.0.x86_64.xml index 243d84fd0d..a0d9e11522 100644 --- a/tests/domaincapsschemadata/qemu_2.8.0.x86_64.xml +++ b/tests/domaincapsschemadata/qemu_2.8.0.x86_64.xml @@ -116,5 +116,6 @@ <features> <gic supported='no'/> <vmcoreinfo supported='no'/> + <genid supported='no'/> </features> </domainCapabilities> diff --git a/tests/domaincapsschemadata/qemu_2.9.0-q35.x86_64.xml b/tests/domaincapsschemadata/qemu_2.9.0-q35.x86_64.xml index d7cb1dc5ee..254ee01049 100644 --- a/tests/domaincapsschemadata/qemu_2.9.0-q35.x86_64.xml +++ b/tests/domaincapsschemadata/qemu_2.9.0-q35.x86_64.xml @@ -124,5 +124,6 @@ <features> <gic supported='no'/> <vmcoreinfo supported='no'/> + <genid supported='yes'/> </features> </domainCapabilities> diff --git a/tests/domaincapsschemadata/qemu_2.9.0-tcg.x86_64.xml b/tests/domaincapsschemadata/qemu_2.9.0-tcg.x86_64.xml index 09457e4be6..478133693f 100644 --- a/tests/domaincapsschemadata/qemu_2.9.0-tcg.x86_64.xml +++ b/tests/domaincapsschemadata/qemu_2.9.0-tcg.x86_64.xml @@ -148,5 +148,6 @@ <features> <gic supported='no'/> <vmcoreinfo supported='no'/> + <genid supported='yes'/> </features> </domainCapabilities> diff --git a/tests/domaincapsschemadata/qemu_2.9.0.x86_64.xml b/tests/domaincapsschemadata/qemu_2.9.0.x86_64.xml index f8337d8dd4..058e624ed3 100644 --- a/tests/domaincapsschemadata/qemu_2.9.0.x86_64.xml +++ b/tests/domaincapsschemadata/qemu_2.9.0.x86_64.xml @@ -125,5 +125,6 @@ <features> <gic supported='no'/> <vmcoreinfo supported='no'/> + <genid supported='yes'/> </features> </domainCapabilities> -- 2.14.3

Signed-off-by: John Ferlan <jferlan@redhat.com> --- docs/news.xml | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/docs/news.xml b/docs/news.xml index 7d40e85b9a..67128e1120 100644 --- a/docs/news.xml +++ b/docs/news.xml @@ -54,6 +54,19 @@ a QEMU virtual machine. </description> </change> + <change> + <summary> + Add support for VM Generation ID + </summary> + <description> + The VM Generatation ID exposes a 128-bit, cryptographically + random, integer value identifier, referred to as a Globally + Unique Identifier (GUID) to the guest in order to notify the + guest operating system when the virtual machine is executed + with a different configuration. Add a new domain XML processing + and a domain capabilities feature. + </description> + </change> </section> <section title="Improvements"> <change> -- 2.14.3

Ping? Or do I need to repost yet again? Tks, John On 05/17/2018 08:42 AM, John Ferlan wrote:
Second reposting of:
https://www.redhat.com/archives/libvir-list/2018-May/msg00813.html
To update patches with more conflicts for patch 2 (capabilities) and patch 6 (news)
Cover from the v3 posting:
v2: https://www.redhat.com/archives/libvir-list/2018-April/msg02234.html
Changes since v2:
* Essentially handle comments from code review of original series from comments received for patch 6:
https://www.redhat.com/archives/libvir-list/2018-April/msg02240.html
It's a somewhat simplified approach removing the ABI checks and the adjustment to the genid value as part of domain def copy.
* (NEW) Patch 5 - add a 'genid' domain capability (similar to how Cole added support for vmcoreinfo). Since the apps need a way to determine whether this is enabled, this seems to be the best way.
John Ferlan (6): conf: Add VM Generation ID parse/format support qemu: Add VM Generation ID device capability qemu: Alter VM Generation ID for specific startup/launch transitions qemu: Add VM Generation ID to qemu command line domcaps: Add 'genid' to domain capabilities docs: Add news article for VM Generation ID
docs/formatdomain.html.in | 27 +++++++++++ docs/formatdomaincaps.html.in | 7 ++- docs/news.xml | 13 ++++++ docs/schemas/domaincaps.rng | 7 +++ docs/schemas/domaincommon.rng | 8 ++++ src/conf/domain_capabilities.c | 3 ++ src/conf/domain_capabilities.h | 1 + src/conf/domain_conf.c | 54 ++++++++++++++++++++++ src/conf/domain_conf.h | 5 ++ src/qemu/qemu_capabilities.c | 4 ++ src/qemu/qemu_capabilities.h | 1 + src/qemu/qemu_command.c | 24 ++++++++++ src/qemu/qemu_driver.c | 17 +++++-- src/qemu/qemu_process.c | 46 +++++++++++++++++- src/qemu/qemu_process.h | 1 + tests/domaincapsschemadata/basic.xml | 1 + tests/domaincapsschemadata/bhyve_basic.x86_64.xml | 1 + tests/domaincapsschemadata/bhyve_fbuf.x86_64.xml | 1 + tests/domaincapsschemadata/bhyve_uefi.x86_64.xml | 1 + tests/domaincapsschemadata/full.xml | 1 + tests/domaincapsschemadata/libxl-xenfv-usb.xml | 1 + tests/domaincapsschemadata/libxl-xenfv.xml | 1 + tests/domaincapsschemadata/libxl-xenpv-usb.xml | 1 + tests/domaincapsschemadata/libxl-xenpv.xml | 1 + tests/domaincapsschemadata/qemu_1.7.0.x86_64.xml | 1 + .../qemu_2.12.0-virt.aarch64.xml | 1 + tests/domaincapsschemadata/qemu_2.12.0.ppc64.xml | 1 + tests/domaincapsschemadata/qemu_2.12.0.s390x.xml | 1 + tests/domaincapsschemadata/qemu_2.12.0.x86_64.xml | 1 + .../qemu_2.6.0-virt.aarch64.xml | 1 + tests/domaincapsschemadata/qemu_2.6.0.aarch64.xml | 1 + tests/domaincapsschemadata/qemu_2.6.0.ppc64.xml | 1 + tests/domaincapsschemadata/qemu_2.6.0.x86_64.xml | 1 + tests/domaincapsschemadata/qemu_2.7.0.s390x.xml | 1 + .../domaincapsschemadata/qemu_2.8.0-tcg.x86_64.xml | 1 + tests/domaincapsschemadata/qemu_2.8.0.s390x.xml | 1 + tests/domaincapsschemadata/qemu_2.8.0.x86_64.xml | 1 + .../domaincapsschemadata/qemu_2.9.0-q35.x86_64.xml | 1 + .../domaincapsschemadata/qemu_2.9.0-tcg.x86_64.xml | 1 + tests/domaincapsschemadata/qemu_2.9.0.x86_64.xml | 1 + tests/qemucapabilitiesdata/caps_2.10.0.x86_64.xml | 1 + tests/qemucapabilitiesdata/caps_2.12.0.x86_64.xml | 1 + tests/qemucapabilitiesdata/caps_2.9.0.x86_64.xml | 1 + .../qemuxml2argvdata/genid-auto.x86_64-latest.args | 30 ++++++++++++ tests/qemuxml2argvdata/genid-auto.xml | 32 +++++++++++++ tests/qemuxml2argvdata/genid.x86_64-latest.args | 30 ++++++++++++ tests/qemuxml2argvdata/genid.xml | 32 +++++++++++++ tests/qemuxml2argvtest.c | 4 ++ tests/qemuxml2xmloutdata/genid-active.xml | 32 +++++++++++++ tests/qemuxml2xmloutdata/genid-auto-active.xml | 32 +++++++++++++ tests/qemuxml2xmloutdata/genid-auto-inactive.xml | 32 +++++++++++++ tests/qemuxml2xmloutdata/genid-inactive.xml | 32 +++++++++++++ tests/qemuxml2xmltest.c | 5 +- 53 files changed, 500 insertions(+), 7 deletions(-) create mode 100644 tests/qemuxml2argvdata/genid-auto.x86_64-latest.args create mode 100644 tests/qemuxml2argvdata/genid-auto.xml create mode 100644 tests/qemuxml2argvdata/genid.x86_64-latest.args create mode 100644 tests/qemuxml2argvdata/genid.xml create mode 100644 tests/qemuxml2xmloutdata/genid-active.xml create mode 100644 tests/qemuxml2xmloutdata/genid-auto-active.xml create mode 100644 tests/qemuxml2xmloutdata/genid-auto-inactive.xml create mode 100644 tests/qemuxml2xmloutdata/genid-inactive.xml

On 05/17/2018 02:42 PM, John Ferlan wrote:
Second reposting of:
https://www.redhat.com/archives/libvir-list/2018-May/msg00813.html
To update patches with more conflicts for patch 2 (capabilities) and patch 6 (news)
Cover from the v3 posting:
v2: https://www.redhat.com/archives/libvir-list/2018-April/msg02234.html
Changes since v2:
* Essentially handle comments from code review of original series from comments received for patch 6:
https://www.redhat.com/archives/libvir-list/2018-April/msg02240.html
It's a somewhat simplified approach removing the ABI checks and the adjustment to the genid value as part of domain def copy.
* (NEW) Patch 5 - add a 'genid' domain capability (similar to how Cole added support for vmcoreinfo). Since the apps need a way to determine whether this is enabled, this seems to be the best way.
John Ferlan (6): conf: Add VM Generation ID parse/format support qemu: Add VM Generation ID device capability qemu: Alter VM Generation ID for specific startup/launch transitions qemu: Add VM Generation ID to qemu command line domcaps: Add 'genid' to domain capabilities docs: Add news article for VM Generation ID
docs/formatdomain.html.in | 27 +++++++++++ docs/formatdomaincaps.html.in | 7 ++- docs/news.xml | 13 ++++++ docs/schemas/domaincaps.rng | 7 +++ docs/schemas/domaincommon.rng | 8 ++++ src/conf/domain_capabilities.c | 3 ++ src/conf/domain_capabilities.h | 1 + src/conf/domain_conf.c | 54 ++++++++++++++++++++++ src/conf/domain_conf.h | 5 ++ src/qemu/qemu_capabilities.c | 4 ++ src/qemu/qemu_capabilities.h | 1 + src/qemu/qemu_command.c | 24 ++++++++++ src/qemu/qemu_driver.c | 17 +++++-- src/qemu/qemu_process.c | 46 +++++++++++++++++- src/qemu/qemu_process.h | 1 + tests/domaincapsschemadata/basic.xml | 1 + tests/domaincapsschemadata/bhyve_basic.x86_64.xml | 1 + tests/domaincapsschemadata/bhyve_fbuf.x86_64.xml | 1 + tests/domaincapsschemadata/bhyve_uefi.x86_64.xml | 1 + tests/domaincapsschemadata/full.xml | 1 + tests/domaincapsschemadata/libxl-xenfv-usb.xml | 1 + tests/domaincapsschemadata/libxl-xenfv.xml | 1 + tests/domaincapsschemadata/libxl-xenpv-usb.xml | 1 + tests/domaincapsschemadata/libxl-xenpv.xml | 1 + tests/domaincapsschemadata/qemu_1.7.0.x86_64.xml | 1 + .../qemu_2.12.0-virt.aarch64.xml | 1 + tests/domaincapsschemadata/qemu_2.12.0.ppc64.xml | 1 + tests/domaincapsschemadata/qemu_2.12.0.s390x.xml | 1 + tests/domaincapsschemadata/qemu_2.12.0.x86_64.xml | 1 + .../qemu_2.6.0-virt.aarch64.xml | 1 + tests/domaincapsschemadata/qemu_2.6.0.aarch64.xml | 1 + tests/domaincapsschemadata/qemu_2.6.0.ppc64.xml | 1 + tests/domaincapsschemadata/qemu_2.6.0.x86_64.xml | 1 + tests/domaincapsschemadata/qemu_2.7.0.s390x.xml | 1 + .../domaincapsschemadata/qemu_2.8.0-tcg.x86_64.xml | 1 + tests/domaincapsschemadata/qemu_2.8.0.s390x.xml | 1 + tests/domaincapsschemadata/qemu_2.8.0.x86_64.xml | 1 + .../domaincapsschemadata/qemu_2.9.0-q35.x86_64.xml | 1 + .../domaincapsschemadata/qemu_2.9.0-tcg.x86_64.xml | 1 + tests/domaincapsschemadata/qemu_2.9.0.x86_64.xml | 1 + tests/qemucapabilitiesdata/caps_2.10.0.x86_64.xml | 1 + tests/qemucapabilitiesdata/caps_2.12.0.x86_64.xml | 1 + tests/qemucapabilitiesdata/caps_2.9.0.x86_64.xml | 1 + .../qemuxml2argvdata/genid-auto.x86_64-latest.args | 30 ++++++++++++ tests/qemuxml2argvdata/genid-auto.xml | 32 +++++++++++++ tests/qemuxml2argvdata/genid.x86_64-latest.args | 30 ++++++++++++ tests/qemuxml2argvdata/genid.xml | 32 +++++++++++++ tests/qemuxml2argvtest.c | 4 ++ tests/qemuxml2xmloutdata/genid-active.xml | 32 +++++++++++++ tests/qemuxml2xmloutdata/genid-auto-active.xml | 32 +++++++++++++ tests/qemuxml2xmloutdata/genid-auto-inactive.xml | 32 +++++++++++++ tests/qemuxml2xmloutdata/genid-inactive.xml | 32 +++++++++++++ tests/qemuxml2xmltest.c | 5 +- 53 files changed, 500 insertions(+), 7 deletions(-) create mode 100644 tests/qemuxml2argvdata/genid-auto.x86_64-latest.args create mode 100644 tests/qemuxml2argvdata/genid-auto.xml create mode 100644 tests/qemuxml2argvdata/genid.x86_64-latest.args create mode 100644 tests/qemuxml2argvdata/genid.xml create mode 100644 tests/qemuxml2xmloutdata/genid-active.xml create mode 100644 tests/qemuxml2xmloutdata/genid-auto-active.xml create mode 100644 tests/qemuxml2xmloutdata/genid-auto-inactive.xml create mode 100644 tests/qemuxml2xmloutdata/genid-inactive.xml
I like the patches, I do. I'd ACK them but some discussion is needed first in my opinion. Michal

On 05/25/2018 04:24 AM, Michal Privoznik wrote:
On 05/17/2018 02:42 PM, John Ferlan wrote:
Second reposting of:
https://www.redhat.com/archives/libvir-list/2018-May/msg00813.html
To update patches with more conflicts for patch 2 (capabilities) and patch 6 (news)
Cover from the v3 posting:
v2: https://www.redhat.com/archives/libvir-list/2018-April/msg02234.html
Changes since v2:
* Essentially handle comments from code review of original series from comments received for patch 6:
https://www.redhat.com/archives/libvir-list/2018-April/msg02240.html
It's a somewhat simplified approach removing the ABI checks and the adjustment to the genid value as part of domain def copy.
* (NEW) Patch 5 - add a 'genid' domain capability (similar to how Cole added support for vmcoreinfo). Since the apps need a way to determine whether this is enabled, this seems to be the best way.
John Ferlan (6): conf: Add VM Generation ID parse/format support qemu: Add VM Generation ID device capability qemu: Alter VM Generation ID for specific startup/launch transitions qemu: Add VM Generation ID to qemu command line domcaps: Add 'genid' to domain capabilities docs: Add news article for VM Generation ID
docs/formatdomain.html.in | 27 +++++++++++ docs/formatdomaincaps.html.in | 7 ++- docs/news.xml | 13 ++++++ docs/schemas/domaincaps.rng | 7 +++ docs/schemas/domaincommon.rng | 8 ++++ src/conf/domain_capabilities.c | 3 ++ src/conf/domain_capabilities.h | 1 + src/conf/domain_conf.c | 54 ++++++++++++++++++++++ src/conf/domain_conf.h | 5 ++ src/qemu/qemu_capabilities.c | 4 ++ src/qemu/qemu_capabilities.h | 1 + src/qemu/qemu_command.c | 24 ++++++++++ src/qemu/qemu_driver.c | 17 +++++-- src/qemu/qemu_process.c | 46 +++++++++++++++++- src/qemu/qemu_process.h | 1 + tests/domaincapsschemadata/basic.xml | 1 + tests/domaincapsschemadata/bhyve_basic.x86_64.xml | 1 + tests/domaincapsschemadata/bhyve_fbuf.x86_64.xml | 1 + tests/domaincapsschemadata/bhyve_uefi.x86_64.xml | 1 + tests/domaincapsschemadata/full.xml | 1 + tests/domaincapsschemadata/libxl-xenfv-usb.xml | 1 + tests/domaincapsschemadata/libxl-xenfv.xml | 1 + tests/domaincapsschemadata/libxl-xenpv-usb.xml | 1 + tests/domaincapsschemadata/libxl-xenpv.xml | 1 + tests/domaincapsschemadata/qemu_1.7.0.x86_64.xml | 1 + .../qemu_2.12.0-virt.aarch64.xml | 1 + tests/domaincapsschemadata/qemu_2.12.0.ppc64.xml | 1 + tests/domaincapsschemadata/qemu_2.12.0.s390x.xml | 1 + tests/domaincapsschemadata/qemu_2.12.0.x86_64.xml | 1 + .../qemu_2.6.0-virt.aarch64.xml | 1 + tests/domaincapsschemadata/qemu_2.6.0.aarch64.xml | 1 + tests/domaincapsschemadata/qemu_2.6.0.ppc64.xml | 1 + tests/domaincapsschemadata/qemu_2.6.0.x86_64.xml | 1 + tests/domaincapsschemadata/qemu_2.7.0.s390x.xml | 1 + .../domaincapsschemadata/qemu_2.8.0-tcg.x86_64.xml | 1 + tests/domaincapsschemadata/qemu_2.8.0.s390x.xml | 1 + tests/domaincapsschemadata/qemu_2.8.0.x86_64.xml | 1 + .../domaincapsschemadata/qemu_2.9.0-q35.x86_64.xml | 1 + .../domaincapsschemadata/qemu_2.9.0-tcg.x86_64.xml | 1 + tests/domaincapsschemadata/qemu_2.9.0.x86_64.xml | 1 + tests/qemucapabilitiesdata/caps_2.10.0.x86_64.xml | 1 + tests/qemucapabilitiesdata/caps_2.12.0.x86_64.xml | 1 + tests/qemucapabilitiesdata/caps_2.9.0.x86_64.xml | 1 + .../qemuxml2argvdata/genid-auto.x86_64-latest.args | 30 ++++++++++++ tests/qemuxml2argvdata/genid-auto.xml | 32 +++++++++++++ tests/qemuxml2argvdata/genid.x86_64-latest.args | 30 ++++++++++++ tests/qemuxml2argvdata/genid.xml | 32 +++++++++++++ tests/qemuxml2argvtest.c | 4 ++ tests/qemuxml2xmloutdata/genid-active.xml | 32 +++++++++++++ tests/qemuxml2xmloutdata/genid-auto-active.xml | 32 +++++++++++++ tests/qemuxml2xmloutdata/genid-auto-inactive.xml | 32 +++++++++++++ tests/qemuxml2xmloutdata/genid-inactive.xml | 32 +++++++++++++ tests/qemuxml2xmltest.c | 5 +- 53 files changed, 500 insertions(+), 7 deletions(-) create mode 100644 tests/qemuxml2argvdata/genid-auto.x86_64-latest.args create mode 100644 tests/qemuxml2argvdata/genid-auto.xml create mode 100644 tests/qemuxml2argvdata/genid.x86_64-latest.args create mode 100644 tests/qemuxml2argvdata/genid.xml create mode 100644 tests/qemuxml2xmloutdata/genid-active.xml create mode 100644 tests/qemuxml2xmloutdata/genid-auto-active.xml create mode 100644 tests/qemuxml2xmloutdata/genid-auto-inactive.xml create mode 100644 tests/qemuxml2xmloutdata/genid-inactive.xml
I like the patches, I do. I'd ACK them but some discussion is needed first in my opinion.
Discussion about what? Honestly this "version" of the patches has been languishing for the entire month without any review. I know "everyone" is "busy" with their own stuff and facing their own deadlines so I don't expect immediate review, but a whole month without any feedback is a bitter pill to swallow. Now that we reach the end of the month and release time - the design is being called into question. That's fine - although IMO I got review on the original design from the RFC posted in March and the v1 posted in early April. The v2 series posted a couple weeks later gave a lot more important feedback and resulted in the adjustments posted here. So as noted in another response, the v2 review gave the best feedback and is the basis for this simplified approach. John

On 05/25/2018 01:10 PM, John Ferlan wrote:
On 05/25/2018 04:24 AM, Michal Privoznik wrote:
On 05/17/2018 02:42 PM, John Ferlan wrote:
Second reposting of:
https://www.redhat.com/archives/libvir-list/2018-May/msg00813.html
To update patches with more conflicts for patch 2 (capabilities) and patch 6 (news)
Cover from the v3 posting:
v2: https://www.redhat.com/archives/libvir-list/2018-April/msg02234.html
Changes since v2:
* Essentially handle comments from code review of original series from comments received for patch 6:
https://www.redhat.com/archives/libvir-list/2018-April/msg02240.html
It's a somewhat simplified approach removing the ABI checks and the adjustment to the genid value as part of domain def copy.
* (NEW) Patch 5 - add a 'genid' domain capability (similar to how Cole added support for vmcoreinfo). Since the apps need a way to determine whether this is enabled, this seems to be the best way.
John Ferlan (6): conf: Add VM Generation ID parse/format support qemu: Add VM Generation ID device capability qemu: Alter VM Generation ID for specific startup/launch transitions qemu: Add VM Generation ID to qemu command line domcaps: Add 'genid' to domain capabilities docs: Add news article for VM Generation ID
docs/formatdomain.html.in | 27 +++++++++++ docs/formatdomaincaps.html.in | 7 ++- docs/news.xml | 13 ++++++ docs/schemas/domaincaps.rng | 7 +++ docs/schemas/domaincommon.rng | 8 ++++ src/conf/domain_capabilities.c | 3 ++ src/conf/domain_capabilities.h | 1 + src/conf/domain_conf.c | 54 ++++++++++++++++++++++ src/conf/domain_conf.h | 5 ++ src/qemu/qemu_capabilities.c | 4 ++ src/qemu/qemu_capabilities.h | 1 + src/qemu/qemu_command.c | 24 ++++++++++ src/qemu/qemu_driver.c | 17 +++++-- src/qemu/qemu_process.c | 46 +++++++++++++++++- src/qemu/qemu_process.h | 1 + tests/domaincapsschemadata/basic.xml | 1 + tests/domaincapsschemadata/bhyve_basic.x86_64.xml | 1 + tests/domaincapsschemadata/bhyve_fbuf.x86_64.xml | 1 + tests/domaincapsschemadata/bhyve_uefi.x86_64.xml | 1 + tests/domaincapsschemadata/full.xml | 1 + tests/domaincapsschemadata/libxl-xenfv-usb.xml | 1 + tests/domaincapsschemadata/libxl-xenfv.xml | 1 + tests/domaincapsschemadata/libxl-xenpv-usb.xml | 1 + tests/domaincapsschemadata/libxl-xenpv.xml | 1 + tests/domaincapsschemadata/qemu_1.7.0.x86_64.xml | 1 + .../qemu_2.12.0-virt.aarch64.xml | 1 + tests/domaincapsschemadata/qemu_2.12.0.ppc64.xml | 1 + tests/domaincapsschemadata/qemu_2.12.0.s390x.xml | 1 + tests/domaincapsschemadata/qemu_2.12.0.x86_64.xml | 1 + .../qemu_2.6.0-virt.aarch64.xml | 1 + tests/domaincapsschemadata/qemu_2.6.0.aarch64.xml | 1 + tests/domaincapsschemadata/qemu_2.6.0.ppc64.xml | 1 + tests/domaincapsschemadata/qemu_2.6.0.x86_64.xml | 1 + tests/domaincapsschemadata/qemu_2.7.0.s390x.xml | 1 + .../domaincapsschemadata/qemu_2.8.0-tcg.x86_64.xml | 1 + tests/domaincapsschemadata/qemu_2.8.0.s390x.xml | 1 + tests/domaincapsschemadata/qemu_2.8.0.x86_64.xml | 1 + .../domaincapsschemadata/qemu_2.9.0-q35.x86_64.xml | 1 + .../domaincapsschemadata/qemu_2.9.0-tcg.x86_64.xml | 1 + tests/domaincapsschemadata/qemu_2.9.0.x86_64.xml | 1 + tests/qemucapabilitiesdata/caps_2.10.0.x86_64.xml | 1 + tests/qemucapabilitiesdata/caps_2.12.0.x86_64.xml | 1 + tests/qemucapabilitiesdata/caps_2.9.0.x86_64.xml | 1 + .../qemuxml2argvdata/genid-auto.x86_64-latest.args | 30 ++++++++++++ tests/qemuxml2argvdata/genid-auto.xml | 32 +++++++++++++ tests/qemuxml2argvdata/genid.x86_64-latest.args | 30 ++++++++++++ tests/qemuxml2argvdata/genid.xml | 32 +++++++++++++ tests/qemuxml2argvtest.c | 4 ++ tests/qemuxml2xmloutdata/genid-active.xml | 32 +++++++++++++ tests/qemuxml2xmloutdata/genid-auto-active.xml | 32 +++++++++++++ tests/qemuxml2xmloutdata/genid-auto-inactive.xml | 32 +++++++++++++ tests/qemuxml2xmloutdata/genid-inactive.xml | 32 +++++++++++++ tests/qemuxml2xmltest.c | 5 +- 53 files changed, 500 insertions(+), 7 deletions(-) create mode 100644 tests/qemuxml2argvdata/genid-auto.x86_64-latest.args create mode 100644 tests/qemuxml2argvdata/genid-auto.xml create mode 100644 tests/qemuxml2argvdata/genid.x86_64-latest.args create mode 100644 tests/qemuxml2argvdata/genid.xml create mode 100644 tests/qemuxml2xmloutdata/genid-active.xml create mode 100644 tests/qemuxml2xmloutdata/genid-auto-active.xml create mode 100644 tests/qemuxml2xmloutdata/genid-auto-inactive.xml create mode 100644 tests/qemuxml2xmloutdata/genid-inactive.xml
I like the patches, I do. I'd ACK them but some discussion is needed first in my opinion.
Discussion about what? Honestly this "version" of the patches has been languishing for the entire month without any review. I know "everyone" is "busy" with their own stuff and facing their own deadlines so I don't expect immediate review, but a whole month without any feedback is a bitter pill to swallow. Now that we reach the end of the month and release time - the design is being called into question. That's fine - although IMO I got review on the original design from the RFC posted in March and the v1 posted in early April. The v2 series posted a couple weeks later gave a lot more important feedback and resulted in the adjustments posted here. So as noted in another response, the v2 review gave the best feedback and is the basis for this simplified approach.
I meant answers to my questions. Esp. on the capability check and usage of flags. If you fix the capability check like I'm suggesting in 4/6 you have my ACK for the whole patch set. Also, sorry for leaving these patches so long without any review. Michal

On 05/25/2018 07:39 AM, Michal Privoznik wrote:
On 05/25/2018 01:10 PM, John Ferlan wrote:
On 05/25/2018 04:24 AM, Michal Privoznik wrote:
On 05/17/2018 02:42 PM, John Ferlan wrote:
Second reposting of:
https://www.redhat.com/archives/libvir-list/2018-May/msg00813.html
To update patches with more conflicts for patch 2 (capabilities) and patch 6 (news)
Cover from the v3 posting:
v2: https://www.redhat.com/archives/libvir-list/2018-April/msg02234.html
Changes since v2:
* Essentially handle comments from code review of original series from comments received for patch 6:
https://www.redhat.com/archives/libvir-list/2018-April/msg02240.html
It's a somewhat simplified approach removing the ABI checks and the adjustment to the genid value as part of domain def copy.
* (NEW) Patch 5 - add a 'genid' domain capability (similar to how Cole added support for vmcoreinfo). Since the apps need a way to determine whether this is enabled, this seems to be the best way.
John Ferlan (6): conf: Add VM Generation ID parse/format support qemu: Add VM Generation ID device capability qemu: Alter VM Generation ID for specific startup/launch transitions qemu: Add VM Generation ID to qemu command line domcaps: Add 'genid' to domain capabilities docs: Add news article for VM Generation ID
docs/formatdomain.html.in | 27 +++++++++++ docs/formatdomaincaps.html.in | 7 ++- docs/news.xml | 13 ++++++ docs/schemas/domaincaps.rng | 7 +++ docs/schemas/domaincommon.rng | 8 ++++ src/conf/domain_capabilities.c | 3 ++ src/conf/domain_capabilities.h | 1 + src/conf/domain_conf.c | 54 ++++++++++++++++++++++ src/conf/domain_conf.h | 5 ++ src/qemu/qemu_capabilities.c | 4 ++ src/qemu/qemu_capabilities.h | 1 + src/qemu/qemu_command.c | 24 ++++++++++ src/qemu/qemu_driver.c | 17 +++++-- src/qemu/qemu_process.c | 46 +++++++++++++++++- src/qemu/qemu_process.h | 1 + tests/domaincapsschemadata/basic.xml | 1 + tests/domaincapsschemadata/bhyve_basic.x86_64.xml | 1 + tests/domaincapsschemadata/bhyve_fbuf.x86_64.xml | 1 + tests/domaincapsschemadata/bhyve_uefi.x86_64.xml | 1 + tests/domaincapsschemadata/full.xml | 1 + tests/domaincapsschemadata/libxl-xenfv-usb.xml | 1 + tests/domaincapsschemadata/libxl-xenfv.xml | 1 + tests/domaincapsschemadata/libxl-xenpv-usb.xml | 1 + tests/domaincapsschemadata/libxl-xenpv.xml | 1 + tests/domaincapsschemadata/qemu_1.7.0.x86_64.xml | 1 + .../qemu_2.12.0-virt.aarch64.xml | 1 + tests/domaincapsschemadata/qemu_2.12.0.ppc64.xml | 1 + tests/domaincapsschemadata/qemu_2.12.0.s390x.xml | 1 + tests/domaincapsschemadata/qemu_2.12.0.x86_64.xml | 1 + .../qemu_2.6.0-virt.aarch64.xml | 1 + tests/domaincapsschemadata/qemu_2.6.0.aarch64.xml | 1 + tests/domaincapsschemadata/qemu_2.6.0.ppc64.xml | 1 + tests/domaincapsschemadata/qemu_2.6.0.x86_64.xml | 1 + tests/domaincapsschemadata/qemu_2.7.0.s390x.xml | 1 + .../domaincapsschemadata/qemu_2.8.0-tcg.x86_64.xml | 1 + tests/domaincapsschemadata/qemu_2.8.0.s390x.xml | 1 + tests/domaincapsschemadata/qemu_2.8.0.x86_64.xml | 1 + .../domaincapsschemadata/qemu_2.9.0-q35.x86_64.xml | 1 + .../domaincapsschemadata/qemu_2.9.0-tcg.x86_64.xml | 1 + tests/domaincapsschemadata/qemu_2.9.0.x86_64.xml | 1 + tests/qemucapabilitiesdata/caps_2.10.0.x86_64.xml | 1 + tests/qemucapabilitiesdata/caps_2.12.0.x86_64.xml | 1 + tests/qemucapabilitiesdata/caps_2.9.0.x86_64.xml | 1 + .../qemuxml2argvdata/genid-auto.x86_64-latest.args | 30 ++++++++++++ tests/qemuxml2argvdata/genid-auto.xml | 32 +++++++++++++ tests/qemuxml2argvdata/genid.x86_64-latest.args | 30 ++++++++++++ tests/qemuxml2argvdata/genid.xml | 32 +++++++++++++ tests/qemuxml2argvtest.c | 4 ++ tests/qemuxml2xmloutdata/genid-active.xml | 32 +++++++++++++ tests/qemuxml2xmloutdata/genid-auto-active.xml | 32 +++++++++++++ tests/qemuxml2xmloutdata/genid-auto-inactive.xml | 32 +++++++++++++ tests/qemuxml2xmloutdata/genid-inactive.xml | 32 +++++++++++++ tests/qemuxml2xmltest.c | 5 +- 53 files changed, 500 insertions(+), 7 deletions(-) create mode 100644 tests/qemuxml2argvdata/genid-auto.x86_64-latest.args create mode 100644 tests/qemuxml2argvdata/genid-auto.xml create mode 100644 tests/qemuxml2argvdata/genid.x86_64-latest.args create mode 100644 tests/qemuxml2argvdata/genid.xml create mode 100644 tests/qemuxml2xmloutdata/genid-active.xml create mode 100644 tests/qemuxml2xmloutdata/genid-auto-active.xml create mode 100644 tests/qemuxml2xmloutdata/genid-auto-inactive.xml create mode 100644 tests/qemuxml2xmloutdata/genid-inactive.xml
I like the patches, I do. I'd ACK them but some discussion is needed first in my opinion.
Discussion about what? Honestly this "version" of the patches has been languishing for the entire month without any review. I know "everyone" is "busy" with their own stuff and facing their own deadlines so I don't expect immediate review, but a whole month without any feedback is a bitter pill to swallow. Now that we reach the end of the month and release time - the design is being called into question. That's fine - although IMO I got review on the original design from the RFC posted in March and the v1 posted in early April. The v2 series posted a couple weeks later gave a lot more important feedback and resulted in the adjustments posted here. So as noted in another response, the v2 review gave the best feedback and is the basis for this simplified approach.
I meant answers to my questions. Esp. on the capability check and usage of flags. If you fix the capability check like I'm suggesting in 4/6 you have my ACK for the whole patch set.
Ironically, as part of review of v2 patch 10, I was asked to remove the check from qemuBuildVMGenIDCommandLine: https://www.redhat.com/archives/libvir-list/2018-April/msg02253.html Perhaps it's best to just move it from qemu_process to qemu_command - that just means passing @qemuCaps into qemuBuildVMGenIDCommandLine and using it as well as removing @priv from qemuProcessGenID. It really doesn't matter in qemu_process whether the capability exists, it was an optimization to put it there rather than an error path in qemu_command... and with that change GenIDCommandLine now could return -1 or 0; whereas, without the caps check it was only ever returning 0. I can repost the entire series if so desired. Tks - John
Also, sorry for leaving these patches so long without any review.
Michal

On 05/25/2018 02:04 PM, John Ferlan wrote:
On 05/25/2018 07:39 AM, Michal Privoznik wrote:
On 05/25/2018 01:10 PM, John Ferlan wrote:
On 05/25/2018 04:24 AM, Michal Privoznik wrote:
On 05/17/2018 02:42 PM, John Ferlan wrote:
Second reposting of:
https://www.redhat.com/archives/libvir-list/2018-May/msg00813.html
To update patches with more conflicts for patch 2 (capabilities) and patch 6 (news)
Cover from the v3 posting:
v2: https://www.redhat.com/archives/libvir-list/2018-April/msg02234.html
Changes since v2:
* Essentially handle comments from code review of original series from comments received for patch 6:
https://www.redhat.com/archives/libvir-list/2018-April/msg02240.html
It's a somewhat simplified approach removing the ABI checks and the adjustment to the genid value as part of domain def copy.
* (NEW) Patch 5 - add a 'genid' domain capability (similar to how Cole added support for vmcoreinfo). Since the apps need a way to determine whether this is enabled, this seems to be the best way.
John Ferlan (6): conf: Add VM Generation ID parse/format support qemu: Add VM Generation ID device capability qemu: Alter VM Generation ID for specific startup/launch transitions qemu: Add VM Generation ID to qemu command line domcaps: Add 'genid' to domain capabilities docs: Add news article for VM Generation ID
docs/formatdomain.html.in | 27 +++++++++++ docs/formatdomaincaps.html.in | 7 ++- docs/news.xml | 13 ++++++ docs/schemas/domaincaps.rng | 7 +++ docs/schemas/domaincommon.rng | 8 ++++ src/conf/domain_capabilities.c | 3 ++ src/conf/domain_capabilities.h | 1 + src/conf/domain_conf.c | 54 ++++++++++++++++++++++ src/conf/domain_conf.h | 5 ++ src/qemu/qemu_capabilities.c | 4 ++ src/qemu/qemu_capabilities.h | 1 + src/qemu/qemu_command.c | 24 ++++++++++ src/qemu/qemu_driver.c | 17 +++++-- src/qemu/qemu_process.c | 46 +++++++++++++++++- src/qemu/qemu_process.h | 1 + tests/domaincapsschemadata/basic.xml | 1 + tests/domaincapsschemadata/bhyve_basic.x86_64.xml | 1 + tests/domaincapsschemadata/bhyve_fbuf.x86_64.xml | 1 + tests/domaincapsschemadata/bhyve_uefi.x86_64.xml | 1 + tests/domaincapsschemadata/full.xml | 1 + tests/domaincapsschemadata/libxl-xenfv-usb.xml | 1 + tests/domaincapsschemadata/libxl-xenfv.xml | 1 + tests/domaincapsschemadata/libxl-xenpv-usb.xml | 1 + tests/domaincapsschemadata/libxl-xenpv.xml | 1 + tests/domaincapsschemadata/qemu_1.7.0.x86_64.xml | 1 + .../qemu_2.12.0-virt.aarch64.xml | 1 + tests/domaincapsschemadata/qemu_2.12.0.ppc64.xml | 1 + tests/domaincapsschemadata/qemu_2.12.0.s390x.xml | 1 + tests/domaincapsschemadata/qemu_2.12.0.x86_64.xml | 1 + .../qemu_2.6.0-virt.aarch64.xml | 1 + tests/domaincapsschemadata/qemu_2.6.0.aarch64.xml | 1 + tests/domaincapsschemadata/qemu_2.6.0.ppc64.xml | 1 + tests/domaincapsschemadata/qemu_2.6.0.x86_64.xml | 1 + tests/domaincapsschemadata/qemu_2.7.0.s390x.xml | 1 + .../domaincapsschemadata/qemu_2.8.0-tcg.x86_64.xml | 1 + tests/domaincapsschemadata/qemu_2.8.0.s390x.xml | 1 + tests/domaincapsschemadata/qemu_2.8.0.x86_64.xml | 1 + .../domaincapsschemadata/qemu_2.9.0-q35.x86_64.xml | 1 + .../domaincapsschemadata/qemu_2.9.0-tcg.x86_64.xml | 1 + tests/domaincapsschemadata/qemu_2.9.0.x86_64.xml | 1 + tests/qemucapabilitiesdata/caps_2.10.0.x86_64.xml | 1 + tests/qemucapabilitiesdata/caps_2.12.0.x86_64.xml | 1 + tests/qemucapabilitiesdata/caps_2.9.0.x86_64.xml | 1 + .../qemuxml2argvdata/genid-auto.x86_64-latest.args | 30 ++++++++++++ tests/qemuxml2argvdata/genid-auto.xml | 32 +++++++++++++ tests/qemuxml2argvdata/genid.x86_64-latest.args | 30 ++++++++++++ tests/qemuxml2argvdata/genid.xml | 32 +++++++++++++ tests/qemuxml2argvtest.c | 4 ++ tests/qemuxml2xmloutdata/genid-active.xml | 32 +++++++++++++ tests/qemuxml2xmloutdata/genid-auto-active.xml | 32 +++++++++++++ tests/qemuxml2xmloutdata/genid-auto-inactive.xml | 32 +++++++++++++ tests/qemuxml2xmloutdata/genid-inactive.xml | 32 +++++++++++++ tests/qemuxml2xmltest.c | 5 +- 53 files changed, 500 insertions(+), 7 deletions(-) create mode 100644 tests/qemuxml2argvdata/genid-auto.x86_64-latest.args create mode 100644 tests/qemuxml2argvdata/genid-auto.xml create mode 100644 tests/qemuxml2argvdata/genid.x86_64-latest.args create mode 100644 tests/qemuxml2argvdata/genid.xml create mode 100644 tests/qemuxml2xmloutdata/genid-active.xml create mode 100644 tests/qemuxml2xmloutdata/genid-auto-active.xml create mode 100644 tests/qemuxml2xmloutdata/genid-auto-inactive.xml create mode 100644 tests/qemuxml2xmloutdata/genid-inactive.xml
I like the patches, I do. I'd ACK them but some discussion is needed first in my opinion.
Discussion about what? Honestly this "version" of the patches has been languishing for the entire month without any review. I know "everyone" is "busy" with their own stuff and facing their own deadlines so I don't expect immediate review, but a whole month without any feedback is a bitter pill to swallow. Now that we reach the end of the month and release time - the design is being called into question. That's fine - although IMO I got review on the original design from the RFC posted in March and the v1 posted in early April. The v2 series posted a couple weeks later gave a lot more important feedback and resulted in the adjustments posted here. So as noted in another response, the v2 review gave the best feedback and is the basis for this simplified approach.
I meant answers to my questions. Esp. on the capability check and usage of flags. If you fix the capability check like I'm suggesting in 4/6 you have my ACK for the whole patch set.
Ironically, as part of review of v2 patch 10, I was asked to remove the check from qemuBuildVMGenIDCommandLine:
https://www.redhat.com/archives/libvir-list/2018-April/msg02253.html
Perhaps it's best to just move it from qemu_process to qemu_command - that just means passing @qemuCaps into qemuBuildVMGenIDCommandLine and using it as well as removing @priv from qemuProcessGenID.
It really doesn't matter in qemu_process whether the capability exists, it was an optimization to put it there rather than an error path in qemu_command... and with that change GenIDCommandLine now could return -1 or 0; whereas, without the caps check it was only ever returning 0.
I can repost the entire series if so desired.
I don't think it's needed. Just fix and push. Michal

[...]
of flags. If you fix the capability check like I'm suggesting in 4/6 you have my ACK for the whole patch set.
Ironically, as part of review of v2 patch 10, I was asked to remove the check from qemuBuildVMGenIDCommandLine:
https://www.redhat.com/archives/libvir-list/2018-April/msg02253.html
Perhaps it's best to just move it from qemu_process to qemu_command - that just means passing @qemuCaps into qemuBuildVMGenIDCommandLine and using it as well as removing @priv from qemuProcessGenID.
It really doesn't matter in qemu_process whether the capability exists, it was an optimization to put it there rather than an error path in qemu_command... and with that change GenIDCommandLine now could return -1 or 0; whereas, without the caps check it was only ever returning 0.
I can repost the entire series if so desired.
I don't think it's needed. Just fix and push.
OK - thanks. The removal of the caps check will be done in patch 3 since that's where qemuProcessGenID was introduced, I've also beefed up the [sparse] comments to the function to be: * If this domain is requesting to use genid, then update the GUID * value if the VIR_QEMU_PROCESS_START_GEN_VMID flag is set. This * flag is set on specific paths during domain start processing when * there is the possibility that the VM is potentially re-executing * something that has already been executed before. FWIW: The last part of the wording is taken from Daniel's v2 response. John
participants (2)
-
John Ferlan
-
Michal Privoznik