[libvirt] [PATCH] snapshot: fix snapshot-delete option check error

Guannan Ren gren at redhat.com
Fri Jun 21 09:37:26 UTC 2013


On 06/21/2013 04:13 PM, Ján Tomko wrote:
> On 06/12/2013 11:27 AM, Guannan Ren wrote:
>> For descendant of a snapshot, we need to check if they are
>> external for both flag VIR_DOMAIN_SNAPSHOT_DELETE_CHILDREN and
>> VIR_DOMAIN_SNAPSHOT_DELETE_CHILDREN_ONLY
>> For the snapshot itself, only check it if
>> VIR_DOMAIN_SNAPSHOT_DELETE_CHILDREN is given.
>> ---
>>   src/qemu/qemu_driver.c | 5 +++--
>>   1 file changed, 3 insertions(+), 2 deletions(-)
>>
>> diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
>> index c886378..3a64c43 100644
>> --- a/src/qemu/qemu_driver.c
>> +++ b/src/qemu/qemu_driver.c
>> @@ -12873,10 +12873,11 @@ static int qemuDomainSnapshotDelete(virDomainSnapshotPtr snapshot,
>>           goto cleanup;
>>   
>>       if (!metadata_only) {
>> -        if (!(flags & VIR_DOMAIN_SNAPSHOT_DELETE_CHILDREN_ONLY) &&
>> +        if ((flags & VIR_DOMAIN_SNAPSHOT_DELETE_CHILDREN) &&
>>               virDomainSnapshotIsExternal(snap))
>>               external++;
> This doesn't look right, what if flags=0?

      Right, I will remove the above code.

>> -        if (flags & VIR_DOMAIN_SNAPSHOT_DELETE_CHILDREN)
>> +        if (flags & (VIR_DOMAIN_SNAPSHOT_DELETE_CHILDREN |
>> +                     VIR_DOMAIN_SNAPSHOT_DELETE_CHILDREN_ONLY))
>>               virDomainSnapshotForEachDescendant(snap,
>>                                                  qemuDomainSnapshotCountExternal,
>>                                                  &external);
>>
> ACK to this hunk.
>
> Jan

     Thanks, I will pushed the ack'ed hunk.




More information about the libvir-list mailing list