[libvirt] [PATCH v3 13/18] snapshot: Add VIR_DOMAIN_SNAPSHOT_CREATE_REDEFINE_LIST flag

Ján Tomko jtomko at redhat.com
Thu Mar 7 16:13:07 UTC 2019


On Mon, Mar 04, 2019 at 09:34:40PM -0600, Eric Blake wrote:
>Continue the work of the previous patch in making it possible
>to copy the state of a transient domain with snapshots from one
>host to another, by allowing the destination to perform bulk
>redefines.  Note that the destination still has to do separate
>calls for creating/defining the domain first, and then redefining
>the snapshots (that is, there is intentional asymmetry between
>dumping the list in virDomainGetXMLDesc() but redefining it via
>virDomainSnapshotCreateXML()), but this is better than the
>previous state of having to make multiple REDEFINE calls.

What is the intention behind the assymetry?

It feels odd to request the list by a flag to virDomainGetXMLDesc
(because we're not going to reuse the whole <domain>, just the
<snapshots> sub-element here). Having a counterpart to the API doing the
redefine would only mean two calls (GetXMLDesc, GetSnapshots) instead of
getting every snapshot separately.

Also, virDomainSnapshotCreateXML is designed for a single snapshot,
using a flag to turn it into a different API ('virDomainSnapshotsCreateXML'?
'virDomainSnapshotsRedefine'?) leads to strangeness like returning
a single snapshot while making no guarantees on which one it is
or a repetition of this pattern:
if (flags & REDEFINE_LIST) {
    /* ... */
    goto cleanup; /* <- no fallthrough here */
}

Jano

>The
>bulk flag requires no pre-existing snapshot metadata (as that
>makes life much easier if there is a failure encountered partway
>through the list processing - simply remove all other snapshot
>metadatas), and makes no guarantees on which snapshot (when there
>are multiple) will actually be returned.
>
>Actual driver implementations will be in later patches.
>
>Signed-off-by: Eric Blake <eblake at redhat.com>
>Reviewed-by: John Ferlan <jferlan at redhat.com>
>---
> include/libvirt/libvirt-domain-snapshot.h |  3 +++
> src/libvirt-domain-snapshot.c             | 23 +++++++++++++++++++----
> 2 files changed, 22 insertions(+), 4 deletions(-)
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20190307/eadb8d23/attachment-0001.sig>


More information about the libvir-list mailing list