From: Kevin Wolf <kwolf@redhat.com>
To: Stefan Hajnoczi <stefanha@redhat.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
imain@redhat.com, Fam Zheng <famz@redhat.com>,
qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] block: add drive_backup HMP command
Date: Tue, 25 Jun 2013 15:26:38 +0200 [thread overview]
Message-ID: <20130625132638.GL3539@dhcp-200-207.str.redhat.com> (raw)
In-Reply-To: <1372163039-28332-1-git-send-email-stefanha@redhat.com>
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 <stefanha@redhat.com>
> ---
> 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
next prev parent reply other threads:[~2013-06-25 13:26 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-25 12:23 [Qemu-devel] [PATCH] block: add drive_backup HMP command Stefan Hajnoczi
2013-06-25 13:26 ` Kevin Wolf [this message]
2013-06-25 13:49 ` Paolo Bonzini
2013-06-25 14:06 ` Kevin Wolf
2013-06-25 14:36 ` Paolo Bonzini
2013-06-25 14:43 ` Kevin Wolf
2013-06-25 17:40 ` Ian Main
2013-06-26 7:44 ` Stefan Hajnoczi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20130625132638.GL3539@dhcp-200-207.str.redhat.com \
--to=kwolf@redhat.com \
--cc=famz@redhat.com \
--cc=imain@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).