[libvirt] [PATCH v3 5/5] blockcommit: turn on active commit

Peter Krempa pkrempa at redhat.com
Thu Jun 19 09:52:04 UTC 2014


On 06/19/14 01:22, Eric Blake wrote:
> With this in place, I can (finally!) now do:
> 
> virsh blockcommit $dom vda --shallow --verbose --pivot
> 
> and watch qemu shorten the backing chain by one, followed by
> libvirt automatically updating the dumpxml output, effectively
> undoing the work of virsh snapshot-commit --no-metadata --disk-only.
> Commit is SOOOO much faster than blockpull, when I'm still fairly
> close in time to when the temporary qcow2 wrapper file was created
> via a snapshot operation!
> 
> Still not done: the persistent XML is not updated; which means
> stopping and restarting a persistent guest will use the wrong
> file and likely fail to boot.
> 
> * src/qemu/qemu_driver.c (qemuDomainBlockCommit): Implement live
> commit to regular files.
> 
> Signed-off-by: Eric Blake <eblake at redhat.com>
> ---
>  src/qemu/qemu_driver.c | 40 +++++++++++++++++++++++++++++++++++-----
>  1 file changed, 35 insertions(+), 5 deletions(-)
> 
> diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
> index d19ca18..089668d 100644
> --- a/src/qemu/qemu_driver.c
> +++ b/src/qemu/qemu_driver.c

> @@ -15607,6 +15615,21 @@ qemuDomainBlockCommit(virDomainPtr dom,
>                                                 VIR_DISK_CHAIN_READ_WRITE) < 0))
>          goto endjob;
> 
> +    /* For an active commit, clone enough of the base to act as the mirror */
> +    if (mirror) {
> +        /* XXX Support network commits */

This will be really easy with my deep-copy of the source struct.

> +        if (baseSource->type != VIR_STORAGE_TYPE_FILE &&
> +            baseSource->type != VIR_STORAGE_TYPE_BLOCK) {
> +            virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
> +                           _("active commit to non-file not supported yet"));
> +            goto endjob;
> +        }
> +        mirror->type = baseSource->type;
> +        if (VIR_STRDUP(mirror->path, baseSource->path) < 0)
> +            goto endjob;
> +        mirror->format = baseSource->format;
> +    }
> +
>      /* Start the commit operation.  Pass the user's original spelling,
>       * if any, through to qemu, since qemu may behave differently
>       * depending on whether the input was specified as relative or

ACK,

Peter

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 901 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20140619/70b9788b/attachment-0001.sig>


More information about the libvir-list mailing list