From: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
To: Kevin Wolf <kwolf@redhat.com>
Cc: phrdina@redhat.com, famz@redhat.com, armbru@redhat.com,
qemu-devel@nongnu.org, lcapitulino@redhat.com,
stefanha@redhat.com, pbonzini@redhat.com, dietmar@proxmox.com
Subject: Re: [Qemu-devel] [PATCH V7 2/8] snapshot: distinguish id and name in snapshot delete
Date: Wed, 11 Sep 2013 10:30:18 +0800 [thread overview]
Message-ID: <522FD5BA.8040102@linux.vnet.ibm.com> (raw)
In-Reply-To: <20130910123620.GD2797@dhcp-200-207.str.redhat.com>
于 2013/9/10 20:36, Kevin Wolf 写道:
> Am 07.08.2013 um 05:00 hat Wenchao Xia geschrieben:
>> Snapshot creation actually already distinguish id and name since it take
>> a structured parameter *sn, but delete can't. Later an accurate delete
>> is needed in qmp_transaction abort and blockdev-snapshot-delete-sync,
>> so change its prototype. Also *errp is added to tip error, but return
>> value is kepted to let caller check what kind of error happens. Existing
>> caller for it are savevm, delvm and qemu-img, they are not impacted by
>> introducing a new function bdrv_snapshot_delete_by_id_or_name(), which
>> check the return value and do the operation again.
>>
>> Before this patch:
>> For qcow2, it search id first then name to find the one to delete.
>> For rbd, it search name.
>> For sheepdog, it does nothing.
>>
>> After this patch:
>> For qcow2, logic is the same by call it twice in caller.
>> For rbd, it always fails in delete with id, but still search for name
>> in second try, no change to user.
>>
>> Some code for *errp is based on Pavel's patch.
>>
>> Signed-off-by: Wenchao Xia<xiawenc@linux.vnet.ibm.com>
>> Signed-off-by: Pavel Hrdina<phrdina@redhat.com>
>> diff --git a/savevm.c b/savevm.c
>> index 03fc4d9..0808414 100644
>> --- a/savevm.c
>> +++ b/savevm.c
>> @@ -2325,18 +2325,21 @@ static int del_existing_snapshots(Monitor *mon, const char *name)
>> {
>> BlockDriverState *bs;
>> QEMUSnapshotInfo sn1, *snapshot =&sn1;
>> - int ret;
>> + Error *err = NULL;
>>
>> bs = NULL;
>> while ((bs = bdrv_next(bs))) {
>> if (bdrv_can_snapshot(bs)&&
>> bdrv_snapshot_find(bs, snapshot, name)>= 0)
>> {
>> - ret = bdrv_snapshot_delete(bs, name);
>> - if (ret< 0) {
>> + bdrv_snapshot_delete_by_id_or_name(bs, name,&err);
>> + if (error_is_set(&err)) {
>> monitor_printf(mon,
>> - "Error while deleting snapshot on '%s'\n",
>> - bdrv_get_device_name(bs));
>> + "Error while deleting snapshot on device '%s', "
>> + "reason: %s\n",
> More commonly, error messages just use a colon before the detailed
> error code instead of saying ", reason:"
>
>> + bdrv_get_device_name(bs),
>> + error_get_pretty(err));
>> + error_free(err);
>> return -1;
>> }
>> }
> Kevin
>
Thanks for reviewing, will fix and rebase.
next prev parent reply other threads:[~2013-09-11 2:30 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-07 3:00 [Qemu-devel] [PATCH V7 0/8] add internal snapshot support at block device level Wenchao Xia
2013-08-07 3:00 ` [Qemu-devel] [PATCH V7 1/8] snapshot: new function bdrv_snapshot_find_by_id_and_name() Wenchao Xia
2013-08-07 3:00 ` [Qemu-devel] [PATCH V7 2/8] snapshot: distinguish id and name in snapshot delete Wenchao Xia
2013-09-10 12:36 ` Kevin Wolf
2013-09-11 2:30 ` Wenchao Xia [this message]
2013-08-07 3:00 ` [Qemu-devel] [PATCH V7 3/8] qmp: add internal snapshot support in qmp_transaction Wenchao Xia
2013-08-07 3:00 ` [Qemu-devel] [PATCH V7 4/8] qmp: add interface blockdev-snapshot-internal-sync Wenchao Xia
2013-08-07 3:00 ` [Qemu-devel] [PATCH V7 5/8] qmp: add interface blockdev-snapshot-delete-internal-sync Wenchao Xia
2013-08-07 3:00 ` [Qemu-devel] [PATCH V7 6/8] hmp: add interface hmp_snapshot_blkdev_internal Wenchao Xia
2013-08-07 3:00 ` [Qemu-devel] [PATCH V7 7/8] hmp: add interface hmp_snapshot_delete_blkdev_internal Wenchao Xia
2013-08-07 3:00 ` [Qemu-devel] [PATCH V7 8/8] qemu-iotests: add 057 internal snapshot for block device test case Wenchao Xia
2013-08-16 2:16 ` [Qemu-devel] [PATCH V7 0/8] add internal snapshot support at block device level Wenchao Xia
2013-08-16 15:36 ` Stefan Hajnoczi
2013-09-02 1:44 ` Wenchao Xia
2013-09-10 12:26 ` Kevin Wolf
2013-09-10 13:09 ` Kevin Wolf
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=522FD5BA.8040102@linux.vnet.ibm.com \
--to=xiawenc@linux.vnet.ibm.com \
--cc=armbru@redhat.com \
--cc=dietmar@proxmox.com \
--cc=famz@redhat.com \
--cc=kwolf@redhat.com \
--cc=lcapitulino@redhat.com \
--cc=pbonzini@redhat.com \
--cc=phrdina@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).