[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 4/7] block: distinguish id and name in bdrv_find
From: |
Eric Blake |
Subject: |
Re: [Qemu-devel] [PATCH 4/7] block: distinguish id and name in bdrv_find_snapshot() |
Date: |
Fri, 26 Apr 2013 08:47:37 -0600 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130402 Thunderbird/17.0.5 |
On 04/26/2013 08:34 AM, Stefan Hajnoczi wrote:
> On Fri, Apr 26, 2013 at 05:31:12PM +0800, Wenchao Xia wrote:
>> To make it clear about id and name in searching, the API is changed
>> a bit to distinguish them, and caller can choose to search by id or name.
>> If not found, *errp will be set to tip why.
>>
>> Note that the caller logic is changed a bit:
>> 1) In del_existing_snapshots() called by do_savevm(), it travers twice
>
> s/travers/traverse/
>
> Also in comments in the code.
>
>> to find the snapshot, instead once, so matching sequence may change
>> if there are unwisely chosen, mixed id and names.
>> 2) In do_savevm(), same with del_existing_snapshot(), when it tries to
>> find the snapshot to overwrite, matching sequence may change for same
>> reason.
>> 3) In load_vmstate(), first when it tries to find the snapshot to be loaded,
>> sequence may change for the same reason of above. Later in validation, the
>> logic is changed to be more strict to require both id and name matching.
>> 4) In do_info_snapshot(), in validation, the logic is changed to be more
>> strict to require both id and name matching.
>
> It's easy to avoid changing semantics: keep the old name or id behavior
> around. Use the new name-and-id behavior for #3 and #4.
>
> Please include a justification for breaking the search order.
A good start for such a justification would be to edit parts of my email
[1] into your commit message, showing how the old semantics make it
IMPOSSIBLE to delete or load 'id 2 tag 1' without first getting 'id 1
tag 2' out of the way, assuming that a qcow2 file with poor naming
conventions exists (even if such a bad file can only be created
externally). The goal of a commit message is to convince the readers
that a change in semantics is appropriate because the alternative of
leaving things broken is worse.
[1]https://lists.gnu.org/archive/html/qemu-devel/2013-04/msg03501.html
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature
- [Qemu-devel] [PATCH 0/7] qapi and snapshot code clean up in block layer, Wenchao Xia, 2013/04/26
- [Qemu-devel] [PATCH 1/7] block: drop bs_snapshots global variable, Wenchao Xia, 2013/04/26
- [Qemu-devel] [PATCH 2/7] block: move bdrv_snapshot_find() to block/snapshot.c, Wenchao Xia, 2013/04/26
- [Qemu-devel] [PATCH 3/7] block: move snapshot code in block.c to block/snapshot.c, Wenchao Xia, 2013/04/26
- [Qemu-devel] [PATCH 4/7] block: distinguish id and name in bdrv_find_snapshot(), Wenchao Xia, 2013/04/26
- Re: [Qemu-devel] [PATCH 4/7] block: distinguish id and name in bdrv_find_snapshot(), Eric Blake, 2013/04/30
- [Qemu-devel] [PATCH 5/7] block: move collect_snapshots() and collect_image_info() to block/qapi.c, Wenchao Xia, 2013/04/26
- [Qemu-devel] [PATCH 6/7] block: move qmp and info dump related code to block/qapi.c, Wenchao Xia, 2013/04/26
- [Qemu-devel] [PATCH 7/7] block: dump to monitor for bdrv_snapshot_dump() and bdrv_image_info_dump(), Wenchao Xia, 2013/04/26