[libvirt] [PATCH 6/7] domain: Add VIR_DOMAIN_XML_SNAPSHOTS flag
Eric Blake
eblake at redhat.com
Thu Feb 21 04:21:05 UTC 2019
On 2/20/19 9:53 AM, Eric Blake wrote:
> Right now, copying the state of a transient domain with snapshots
> from one host to another requires multiple API calls on both
> machines - on the host: get the domain XML, get a list of the
> snapshots, and then for each snapshot get the snapshot's XML;
> then on the destination: create the domain, then multiple
> domain snapshot create calls with the REDEFINE flag. This
> patch aims to make the process use fewer APIs by making it
> possible to grab the XML for all snapshots at the same time as
> grabbing the domain XML. Note that we had to do the modification
> to virDomainGetXMLDesc(), rather than virDomainSnapshotGetXMLDesc(),
> since the latter requires a single non-NULL snapshot object,
> whereas we want the list of all snapshots for the domain (even
> if the list has 0 elements).
>
>
> Plumb the new flag into the test and qemu driver, and into virsh
> dumpxml.
>
> Signed-off-by: Eric Blake <eblake at redhat.com>
> ---
> include/libvirt/libvirt-domain.h | 1 +
> src/conf/domain_conf.c | 13 ++++++++-----
> src/libvirt-domain.c | 5 +++++
> src/qemu/qemu_domain.c | 23 +++++++++++++++++------
> src/qemu/qemu_driver.c | 4 ++--
> src/test/test_driver.c | 7 ++++---
> tools/virsh-domain.c | 7 +++++++
> 7 files changed, 44 insertions(+), 16 deletions(-)
>
> diff --git a/include/libvirt/libvirt-domain.h b/include/libvirt/libvirt-domain.h
Needs this squashed in, now that I've rebased on top of the flag cleanups:
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index da0fde78a6..dad1db2eb9 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -7727,7 +7727,8 @@ qemuDomainDefFormatBufInternal(virQEMUDriverPtr
driver,
virQEMUCapsPtr qemuCaps = NULL;
bool snapshots = flags & VIR_DOMAIN_XML_SNAPSHOTS;
- virCheckFlags(VIR_DOMAIN_XML_COMMON_FLAGS |
VIR_DOMAIN_XML_UPDATE_CPU, -1);
+ virCheckFlags(VIR_DOMAIN_XML_COMMON_FLAGS | VIR_DOMAIN_XML_UPDATE_CPU |
+ VIR_DOMAIN_XML_SNAPSHOTS, -1);
if (!(caps = virQEMUDriverGetCapabilities(driver, false)))
goto cleanup;
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3226
Virtualization: qemu.org | libvirt.org
More information about the libvir-list
mailing list