[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH] block: add drive_backup HMP command
From: |
Kevin Wolf |
Subject: |
Re: [Qemu-devel] [PATCH] block: add drive_backup HMP command |
Date: |
Tue, 25 Jun 2013 15:26:38 +0200 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
Am 25.06.2013 um 14:23 hat Stefan Hajnoczi geschrieben:
> Make "drive_backup" available on the HMP monitor:
>
> drive_backup [-n] [-f] device target [format]
>
> The -n flag requests QEMU to reuse the image found in new-image-file,
> instead of recreating it from scratch.
>
> The -f flag requests QEMU to copy the whole disk, so that the result
> does not need a backing file. Note that this flag *must* currently be
> passed since the other sync modes ('none' and 'top') have not been
> implemented yet.
>
> Signed-off-by: Stefan Hajnoczi <address@hidden>
> ---
> hmp-commands.hx | 20 ++++++++++++++++++++
> hmp.c | 33 +++++++++++++++++++++++++++++++++
> hmp.h | 1 +
> 3 files changed, 54 insertions(+)
> --- a/hmp.c
> +++ b/hmp.c
> @@ -889,6 +889,39 @@ void hmp_drive_mirror(Monitor *mon, const QDict *qdict)
> hmp_handle_error(mon, &errp);
> }
>
> +void hmp_drive_backup(Monitor *mon, const QDict *qdict)
> +{
> + const char *device = qdict_get_str(qdict, "device");
> + const char *filename = qdict_get_str(qdict, "target");
> + const char *format = qdict_get_try_str(qdict, "format");
> + int reuse = qdict_get_try_bool(qdict, "reuse", 0);
> + int full = qdict_get_try_bool(qdict, "full", 0);
> + enum NewImageMode mode;
> + Error *errp = NULL;
> +
> + if (!filename) {
> + error_set(&errp, QERR_MISSING_PARAMETER, "target");
> + hmp_handle_error(mon, &errp);
> + return;
> + }
> +
> + if (reuse) {
> + mode = NEW_IMAGE_MODE_EXISTING;
> + } else {
> + mode = NEW_IMAGE_MODE_ABSOLUTE_PATHS;
> + }
> +
> + if (!full) {
> + error_setg(&errp, "-f is not yet implemented");
> + hmp_handle_error(mon, &errp);
> + return;
> + }
Then why make it a valid option and confuse users in the help text by
describing options that don't really exist?
> + qmp_drive_backup(device, filename, !!format, format,
> + true, mode, false, 0, false, 0, false, 0, &errp);
> + hmp_handle_error(mon, &errp);
> +}
Kevin
- [Qemu-devel] [PATCH] block: add drive_backup HMP command, Stefan Hajnoczi, 2013/06/25
- Re: [Qemu-devel] [PATCH] block: add drive_backup HMP command,
Kevin Wolf <=
- Re: [Qemu-devel] [PATCH] block: add drive_backup HMP command, Paolo Bonzini, 2013/06/25
- Re: [Qemu-devel] [PATCH] block: add drive_backup HMP command, Kevin Wolf, 2013/06/25
- Re: [Qemu-devel] [PATCH] block: add drive_backup HMP command, Paolo Bonzini, 2013/06/25
- Re: [Qemu-devel] [PATCH] block: add drive_backup HMP command, Kevin Wolf, 2013/06/25
- Re: [Qemu-devel] [PATCH] block: add drive_backup HMP command, Ian Main, 2013/06/25
- Re: [Qemu-devel] [PATCH] block: add drive_backup HMP command, Stefan Hajnoczi, 2013/06/26