qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Pavel Hrdina <phrdina@redhat.com>
To: Markus Armbruster <armbru@redhat.com>
Cc: qemu-devel@nongnu.org, lcapitulino@redhat.com
Subject: Re: [Qemu-devel] [PATCH v4 02/11] block: add error parameter to del_existing_snapshots()
Date: Wed, 10 Apr 2013 11:57:44 +0200	[thread overview]
Message-ID: <51653798.9020806@redhat.com> (raw)
In-Reply-To: <87mwt7debf.fsf@blackfin.pond.sub.org>

On 9.4.2013 15:27, Markus Armbruster wrote:
> Pavel Hrdina <phrdina@redhat.com> writes:
>
>> Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
>> Reviewed-by: Eric Blake <eblake@redhat.com>
>> ---
>>   savevm.c | 12 +++++++-----
>>   1 file changed, 7 insertions(+), 5 deletions(-)
>>
>> diff --git a/savevm.c b/savevm.c
>> index 77c5291..dc1f4a4 100644
>> --- a/savevm.c
>> +++ b/savevm.c
>> @@ -2224,7 +2224,7 @@ static int bdrv_snapshot_find(BlockDriverState *bs, QEMUSnapshotInfo *sn_info,
>>   /*
>>    * Deletes snapshots of a given name in all opened images.
>>    */
>> -static int del_existing_snapshots(Monitor *mon, const char *name)
>> +static int del_existing_snapshots(const char *name, Error **errp)
>>   {
>>       BlockDriverState *bs;
>>       QEMUSnapshotInfo sn1, *snapshot = &sn1;
>> @@ -2237,9 +2237,8 @@ static int del_existing_snapshots(Monitor *mon, const char *name)
>>           {
>>               ret = bdrv_snapshot_delete(bs, name);
>>               if (ret < 0) {
>> -                monitor_printf(mon,
>> -                               "Error while deleting snapshot on '%s'\n",
>> -                               bdrv_get_device_name(bs));
>> +                error_setg(errp, "error while deleting snapshot on '%s'",
>> +                           bdrv_get_device_name(bs));
>>                   return -1;
>>               }
>>           }
>
> Any particular reason for de-capitalizing "Error"?

Yes, Eric told me that we should start the error message with lover case 
and also we shouldn't print '.' at the end of the error message.

>
>> @@ -2259,6 +2258,7 @@ void do_savevm(Monitor *mon, const QDict *qdict)
>>       qemu_timeval tv;
>>       struct tm tm;
>>       const char *name = qdict_get_try_str(qdict, "name");
>> +    Error *local_err = NULL;
>>
>>       /* Verify if there is a device that doesn't support snapshots and is writable */
>>       bs = NULL;
>> @@ -2307,7 +2307,9 @@ void do_savevm(Monitor *mon, const QDict *qdict)
>>       }
>>
>>       /* Delete old snapshots of the same name */
>> -    if (name && del_existing_snapshots(mon, name) < 0) {
>> +    if (name && del_existing_snapshots(name, &local_err) < 0) {
>> +        monitor_printf(mon, "%s\n", error_get_pretty(local_err));
>> +        error_free(local_err);
>>           goto the_end;
>>       }
>
> Could use hmp_handle_error(), except it's static in hmp.c.  On the other
> hand, even hmp.c doesn't always use it...  Luiz, what do you think?
>

  parent reply	other threads:[~2013-04-10  9:57 UTC|newest]

Thread overview: 53+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-29 14:12 [Qemu-devel] [PATCH v4 00/11] convert savevm to use qapi and introduce qmp command Pavel Hrdina
2013-03-29 14:12 ` [Qemu-devel] [PATCH v4 01/11] block: add error parameter to bdrv_snapshot_create() and related functions Pavel Hrdina
2013-04-09 13:13   ` Markus Armbruster
2013-04-09 13:43     ` Kevin Wolf
2013-04-09 16:21   ` Markus Armbruster
2013-03-29 14:12 ` [Qemu-devel] [PATCH v4 02/11] block: add error parameter to del_existing_snapshots() Pavel Hrdina
2013-04-09 13:27   ` Markus Armbruster
2013-04-09 14:14     ` Luiz Capitulino
2013-04-10  9:57     ` Pavel Hrdina [this message]
2013-04-10 11:33       ` Markus Armbruster
2013-04-10 12:06       ` Eric Blake
2013-03-29 14:12 ` [Qemu-devel] [PATCH v4 03/11] savevm: add error parameter to qemu_savevm_state_begin() Pavel Hrdina
2013-04-09 13:34   ` Markus Armbruster
2013-04-09 13:37     ` Markus Armbruster
2013-04-09 13:47       ` Pavel Hrdina
2013-04-09 13:49       ` Markus Armbruster
2013-03-29 14:12 ` [Qemu-devel] [PATCH v4 04/11] savevm: add error parameter to qemu_savevm_state_iterate() Pavel Hrdina
2013-04-09 13:41   ` Markus Armbruster
2013-03-29 14:12 ` [Qemu-devel] [PATCH v4 05/11] savevm: add error parameter to qemu_savevm_state_complete() Pavel Hrdina
2013-04-09 13:56   ` Markus Armbruster
2013-03-29 14:12 ` [Qemu-devel] [PATCH v4 06/11] savevm: add error parameter to qemu_savevm_state() Pavel Hrdina
2013-04-09 14:00   ` Markus Armbruster
2013-03-29 14:12 ` [Qemu-devel] [PATCH v4 07/11] qapi: Convert savevm Pavel Hrdina
2013-03-29 16:12   ` Eric Blake
2013-03-29 16:21     ` Pavel Hrdina
2013-04-09 16:04   ` Markus Armbruster
2013-04-09 16:12     ` Eric Blake
2013-04-09 17:23       ` Markus Armbruster
2013-04-09 17:46         ` Eric Blake
2013-04-10  8:01           ` Markus Armbruster
2013-03-29 14:12 ` [Qemu-devel] [PATCH v4 08/11] qemu-img: introduce qemu_img_handle_error Pavel Hrdina
2013-04-09 16:10   ` Markus Armbruster
2013-03-29 14:12 ` [Qemu-devel] [PATCH v4 09/11] block: update return value from bdrv_snapshot_create Pavel Hrdina
2013-04-09 16:29   ` Markus Armbruster
2013-03-29 14:12 ` [Qemu-devel] [PATCH v4 10/11] savevm: update return value from qemu_savevm_state Pavel Hrdina
2013-04-09 16:32   ` Markus Armbruster
2013-03-29 14:12 ` [Qemu-devel] [PATCH v4 11/11] savevm: add force parameter to HMP command and return snapshot info Pavel Hrdina
2013-04-09 16:45   ` Markus Armbruster
2013-04-10  8:18 ` [Qemu-devel] [PATCH v4 00/11] convert savevm to use qapi and introduce qmp command Markus Armbruster
2013-04-10 10:53   ` Pavel Hrdina
2013-04-10 12:24     ` Eric Blake
2013-04-10 12:40       ` Luiz Capitulino
2013-04-10 12:49         ` Eric Blake
2013-04-10 13:22           ` Pavel Hrdina
2013-04-10 13:32             ` Luiz Capitulino
2013-04-10 13:50               ` Pavel Hrdina
2013-04-10 14:05       ` Pavel Hrdina
2013-04-10 17:15         ` Eric Blake
2013-04-10 17:33           ` Pavel Hrdina
2013-04-17  2:48             ` Wenchao Xia
2013-04-11  9:20           ` Markus Armbruster
2013-04-15 12:10             ` Kevin Wolf
2013-04-15 13:16               ` 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=51653798.9020806@redhat.com \
    --to=phrdina@redhat.com \
    --cc=armbru@redhat.com \
    --cc=lcapitulino@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).