From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46618) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UrTGe-000315-A2 for qemu-devel@nongnu.org; Tue, 25 Jun 2013 09:26:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UrTGb-0001RJ-Eb for qemu-devel@nongnu.org; Tue, 25 Jun 2013 09:26:44 -0400 Received: from mx1.redhat.com ([209.132.183.28]:6383) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UrTGb-0001R9-4C for qemu-devel@nongnu.org; Tue, 25 Jun 2013 09:26:41 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r5PDQeuq000676 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 25 Jun 2013 09:26:40 -0400 Date: Tue, 25 Jun 2013 15:26:38 +0200 From: Kevin Wolf Message-ID: <20130625132638.GL3539@dhcp-200-207.str.redhat.com> References: <1372163039-28332-1-git-send-email-stefanha@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1372163039-28332-1-git-send-email-stefanha@redhat.com> Subject: Re: [Qemu-devel] [PATCH] block: add drive_backup HMP command List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Hajnoczi Cc: Paolo Bonzini , imain@redhat.com, Fam Zheng , qemu-devel@nongnu.org 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 > --- > 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