From: Kevin Wolf <kwolf@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH v3 10/16] qmp: add drive-mirror command
Date: Fri, 19 Oct 2012 14:54:48 +0200 [thread overview]
Message-ID: <50814D98.8050408@redhat.com> (raw)
In-Reply-To: <1350571770-9836-11-git-send-email-pbonzini@redhat.com>
Am 18.10.2012 16:49, schrieb Paolo Bonzini:
> This adds the monitor commands that start the mirroring job.
>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
> v2->v3: bdrv_is_inserted pulled before dereference of bs->drv
>
> blockdev.c | 124 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
> hmp-commands.hx | 21 ++++++++++
> hmp.c | 28 +++++++++++++
> hmp.h | 1 +
> qapi-schema.json | 34 +++++++++++++++
> qmp-commands.hx | 42 +++++++++++++++++++
> 6 file modificati, 250 inserzioni(+)
>
> diff --git a/blockdev.c b/blockdev.c
> index 1068960..53f5c54 100644
> --- a/blockdev.c
> +++ b/blockdev.c
> @@ -1180,6 +1180,130 @@ void qmp_block_commit(const char *device,
> drive_get_ref(drive_get_by_blockdev(bs));
> }
>
> +void qmp_drive_mirror(const char *device, const char *target,
> + bool has_format, const char *format,
> + enum MirrorSyncMode sync,
> + bool has_mode, enum NewImageMode mode,
> + bool has_speed, int64_t speed, Error **errp)
> +{
> + BlockDriverInfo bdi;
> + BlockDriverState *bs;
> + BlockDriverState *source, *target_bs;
> + BlockDriver *proto_drv;
> + BlockDriver *drv = NULL;
> + Error *local_err = NULL;
> + int flags;
> + uint64_t size;
> + int ret;
> +
> + if (!has_speed) {
> + speed = 0;
> + }
> + if (!has_mode) {
> + mode = NEW_IMAGE_MODE_ABSOLUTE_PATHS;
> + }
> +
> + bs = bdrv_find(device);
> + if (!bs) {
> + error_set(errp, QERR_DEVICE_NOT_FOUND, device);
> + return;
> + }
> +
> + if (!bdrv_is_inserted(bs)) {
> + error_set(errp, QERR_DEVICE_HAS_NO_MEDIUM, device);
> + return;
> + }
> +
> + if (!has_format) {
> + format = mode == NEW_IMAGE_MODE_EXISTING ? NULL : bs->drv->format_name;
> + }
> + if (format) {
> + drv = bdrv_find_format(format);
> + if (!drv) {
> + error_set(errp, QERR_INVALID_BLOCK_FORMAT, format);
> + return;
> + }
> + }
> +
> + if (bdrv_in_use(bs)) {
> + error_set(errp, QERR_DEVICE_IN_USE, device);
> + return;
> + }
> +
> + flags = bs->open_flags | BDRV_O_RDWR;
> + source = bs->backing_hd;
> + if (!source && sync == MIRROR_SYNC_MODE_TOP) {
> + sync = MIRROR_SYNC_MODE_FULL;
> + }
> +
> + proto_drv = bdrv_find_protocol(target);
> + if (!proto_drv) {
> + error_set(errp, QERR_INVALID_BLOCK_FORMAT, format);
This error message is still not fixed, and totally confusing, pointing
at the wrong cause. No matter what changes to the error reporting we do
later, we should add a better error string right now.
Kevin
next prev parent reply other threads:[~2012-10-19 12:55 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-18 14:49 [Qemu-devel] [PULL for Kevin 00/16] Block job improvements part 2 Paolo Bonzini
2012-10-18 14:49 ` [Qemu-devel] [PATCH v3 01/16] block: add bdrv_query_info Paolo Bonzini
2012-10-18 14:49 ` [Qemu-devel] [PATCH v3 02/16] block: add bdrv_query_stats Paolo Bonzini
2012-10-18 14:49 ` [Qemu-devel] [PATCH v3 03/16] block: add bdrv_open_backing_file Paolo Bonzini
2012-10-18 14:49 ` [Qemu-devel] [PATCH v3 04/16] block: introduce new dirty bitmap functionality Paolo Bonzini
2012-10-18 14:49 ` [Qemu-devel] [PATCH v3 05/16] block: export dirty bitmap information in query-block Paolo Bonzini
2012-10-18 16:51 ` Eric Blake
2012-10-18 14:49 ` [Qemu-devel] [PATCH v3 06/16] block: rename block_job_complete to block_job_completed Paolo Bonzini
2012-10-18 14:49 ` [Qemu-devel] [PATCH v3 07/16] block: add block-job-complete Paolo Bonzini
2012-10-18 14:49 ` [Qemu-devel] [PATCH v3 08/16] block: introduce BLOCK_JOB_READY event Paolo Bonzini
2012-10-18 16:58 ` Eric Blake
2012-10-18 14:49 ` [Qemu-devel] [PATCH v3 09/16] mirror: introduce mirror job Paolo Bonzini
2012-10-18 14:49 ` [Qemu-devel] [PATCH v3 10/16] qmp: add drive-mirror command Paolo Bonzini
2012-10-18 17:34 ` Eric Blake
2012-10-19 12:54 ` Kevin Wolf [this message]
2012-10-19 13:13 ` Paolo Bonzini
2012-10-18 14:49 ` [Qemu-devel] [PATCH v3 11/16] mirror: implement completion Paolo Bonzini
2012-10-18 14:49 ` [Qemu-devel] [PATCH v3 12/16] qemu-iotests: add mirroring test case Paolo Bonzini
2012-10-19 16:19 ` Kevin Wolf
2012-10-20 13:47 ` Paolo Bonzini
2012-10-22 8:44 ` Kevin Wolf
2012-10-22 15:38 ` Paolo Bonzini
2012-10-23 14:39 ` [Qemu-devel] [PATCH v4 " Paolo Bonzini
2012-10-23 14:39 ` [Qemu-devel] [PATCH v4 16/16] qemu-iotests: add testcases for mirroring on-source-error/on-target-error Paolo Bonzini
2012-10-19 17:24 ` [Qemu-devel] [PATCH v3 12/16] qemu-iotests: add mirroring test case Kevin Wolf
2012-10-18 14:49 ` [Qemu-devel] [PATCH v3 13/16] iostatus: forward block_job_iostatus_reset to block job Paolo Bonzini
2012-10-18 14:49 ` [Qemu-devel] [PATCH v3 14/16] mirror: add support for on-source-error/on-target-error Paolo Bonzini
2012-10-18 14:49 ` [Qemu-devel] [PATCH v3 15/16] qmp: add pull_event function Paolo Bonzini
2012-10-18 14:49 ` [Qemu-devel] [PATCH v3 16/16] qemu-iotests: add testcases for mirroring on-source-error/on-target-error Paolo Bonzini
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=50814D98.8050408@redhat.com \
--to=kwolf@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.