qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: Pavel Hrdina <phrdina@redhat.com>
Cc: lcapitulino@redhat.com, qemu-devel@nongnu.org, armbru@redhat.com
Subject: Re: [Qemu-devel] [PATCH v3 09/11] block: update return value from bdrv_snapshot_create
Date: Thu, 28 Mar 2013 15:53:44 -0600	[thread overview]
Message-ID: <5154BBE8.2080504@redhat.com> (raw)
In-Reply-To: <a082c70d331676a96aa7912fd67111f1d76cde56.1364487348.git.phrdina@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 1620 bytes --]

On 03/28/2013 10:47 AM, Pavel Hrdina wrote:
> If we provide error message we don't have to also provide return
> value because we could check if there is any error message or not.
> 
> Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
> ---
>  block.c                   | 24 ++++++++++--------------
>  block/qcow2-snapshot.c    | 12 +++++-------
>  block/qcow2.h             |  6 +++---
>  block/rbd.c               | 15 ++++++---------
>  block/sheepdog.c          |  9 ++++-----
>  include/block/block.h     |  6 +++---
>  include/block/block_int.h |  6 +++---
>  qemu-img.c                |  9 ++++-----
>  savevm.c                  |  4 ++--
>  9 files changed, 40 insertions(+), 51 deletions(-)
> 

> @@ -2018,11 +2019,9 @@ static int img_snapshot(int argc, char **argv)
>          sn.date_sec = tv.tv_sec;
>          sn.date_nsec = tv.tv_usec * 1000;
>  
> -        ret = bdrv_snapshot_create(bs, &sn, NULL);
> -        if (ret) {
> -            error_report("Could not create snapshot '%s': %d (%s)",
> -                snapshot_name, ret, strerror(-ret));
> -        }
> +        local_err = NULL;
> +        bdrv_snapshot_create(bs, &sn, &local_err);
> +        ret = qemu_img_handle_error(local_err);

This sets ret==1 on error, but bdrv_snapshot_create used to return <0 on
error.  Then again, the tail of img_snapshot() normalizes all errors to
a 'return 1'.  Took me a few minutes to see, but no problem after all.

Reviewed-by: Eric Blake <eblake@redhat.com>

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 621 bytes --]

  reply	other threads:[~2013-03-28 21:53 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-28 16:47 [Qemu-devel] [PATCH v3 00/11] convert savevm to use qapi and introduce qmp command Pavel Hrdina
2013-03-28 16:47 ` [Qemu-devel] [PATCH v3 01/11] block: add error parameter to bdrv_snapshot_create() and related functions Pavel Hrdina
2013-03-28 21:23   ` Eric Blake
2013-03-28 16:47 ` [Qemu-devel] [PATCH v3 02/11] block: add error parameter to del_existing_snapshots() Pavel Hrdina
2013-03-28 16:47 ` [Qemu-devel] [PATCH v3 03/11] savevm: add error parameter to qemu_savevm_state_begin() Pavel Hrdina
2013-03-28 16:47 ` [Qemu-devel] [PATCH v3 04/11] savevm: add error parameter to qemu_savevm_state_iterate() Pavel Hrdina
2013-03-28 16:47 ` [Qemu-devel] [PATCH v3 05/11] savevm: add error parameter to qemu_savevm_state_complete() Pavel Hrdina
2013-03-28 16:47 ` [Qemu-devel] [PATCH v3 06/11] savevm: add error parameter to qemu_savevm_state() Pavel Hrdina
2013-03-28 16:47 ` [Qemu-devel] [PATCH v3 07/11] qapi: Convert savevm Pavel Hrdina
2013-03-28 21:35   ` Eric Blake
2013-03-28 16:47 ` [Qemu-devel] [PATCH v3 08/11] qemu-img: introduce qemu_img_handle_error Pavel Hrdina
2013-03-28 21:42   ` Eric Blake
2013-03-28 21:55     ` Eric Blake
2013-03-28 16:47 ` [Qemu-devel] [PATCH v3 09/11] block: update return value from bdrv_snapshot_create Pavel Hrdina
2013-03-28 21:53   ` Eric Blake [this message]
2013-03-28 16:47 ` [Qemu-devel] [PATCH v3 10/11] savevm: update return value from qemu_savevm_state Pavel Hrdina
2013-03-28 22:00   ` Eric Blake
2013-03-28 16:47 ` [Qemu-devel] [PATCH v3 11/11] savevm: add force parameter to HMP command and return snapshot info Pavel Hrdina
2013-03-28 22:03   ` Eric Blake

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=5154BBE8.2080504@redhat.com \
    --to=eblake@redhat.com \
    --cc=armbru@redhat.com \
    --cc=lcapitulino@redhat.com \
    --cc=phrdina@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 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).