[libvirt] [PATCH] Compressed save image format for Qemu.
Daniel P. Berrange
berrange at redhat.com
Wed Aug 12 11:04:28 UTC 2009
On Tue, Aug 11, 2009 at 01:25:59PM +0200, Chris Lalancette wrote:
> Implement a compressed save image format for qemu. While ideally
> we would have the choice between compressed/non-compressed
> available to the libvirt API, unfortunately there is no "flags"
> parameter to the virDomainSave() API. Therefore, implement this
> as a qemu.conf option. Both gzip and bzip2 are implemented, and
> it should be very easy to implement additional compression
> methods.
>
> One open question is if/how we should detect the gzip and bzip2
> binaries. One way to do it is to do compile-time setting of the
> paths (via configure.in), but that doesn't seem like a great thing
> to do. Another solution (my preferred solution) is not to detect
> at all; when we go to run the commands that need them, if they
> aren't available, or aren't available in one of the standard paths,
> then we'll fail. Maybe somebody else has another option or
> opinion, though.
>
> In the future, we'll have a more robust (managed) save/restore API,
> at which time we can expose this functionality properly in the API.
>
> V2: get rid of redundant dd command and just use >> to append data.
> V3: Add back the missing pieces for the enum and bumping the save version.
> diff --git a/src/qemu_driver.c b/src/qemu_driver.c
> index 20906ef..8d700bf 100644
> --- a/src/qemu_driver.c
> +++ b/src/qemu_driver.c
> @@ -3411,18 +3411,26 @@ static char *qemudEscapeShellArg(const char *in)
> }
>
> #define QEMUD_SAVE_MAGIC "LibvirtQemudSave"
> -#define QEMUD_SAVE_VERSION 1
> +#define QEMUD_SAVE_VERSION 2
> +
> +enum qemud_save_formats {
> + QEMUD_SAVE_FORMAT_RAW,
> + QEMUD_SAVE_FORMAT_GZIP,
> + QEMUD_SAVE_FORMAT_BZIP2,
> +};
>
> struct qemud_save_header {
> char magic[sizeof(QEMUD_SAVE_MAGIC)-1];
> int version;
> int xml_len;
> int was_running;
> - int unused[16];
> + char compressed;
> + int unused[15];
> };
Little mistake here - you removed sizeof(int) bytes, but only
added sizeof(char) replacement.
Regards,
Daniel
--
|: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :|
|: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :|
|: http://autobuild.org -o- http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|
More information about the libvir-list
mailing list