
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?
- 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