mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-03 03:25:20 +00:00
virdomainmomentobjlist: introduce virDomainMomentIsAncestor
This new helper will allow us to check if we are able to delete external snapshot after user did revert to non-leaf snapshot. Signed-off-by: Pavel Hrdina <phrdina@redhat.com> Reviewed-by: Peter Krempa <pkrempa@redhat.com>
This commit is contained in:
parent
1392be7092
commit
f879eae3e7
@ -582,3 +582,20 @@ virDomainMomentFindLeaf(virDomainMomentObjList *list)
|
||||
return moment;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
/* Check if @moment is descendant of @ancestor. */
|
||||
bool
|
||||
virDomainMomentIsAncestor(virDomainMomentObj *moment,
|
||||
virDomainMomentObj *ancestor)
|
||||
{
|
||||
if (moment == ancestor)
|
||||
return false;
|
||||
|
||||
for (moment = moment->parent; moment; moment = moment->parent) {
|
||||
if (moment == ancestor)
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
@ -157,3 +157,7 @@ virDomainMomentCheckCycles(virDomainMomentObjList *list,
|
||||
|
||||
virDomainMomentObj *
|
||||
virDomainMomentFindLeaf(virDomainMomentObjList *list);
|
||||
|
||||
bool
|
||||
virDomainMomentIsAncestor(virDomainMomentObj *moment,
|
||||
virDomainMomentObj *ancestor);
|
||||
|
@ -1221,6 +1221,7 @@ virDomainMomentDropChildren;
|
||||
virDomainMomentDropParent;
|
||||
virDomainMomentForEachChild;
|
||||
virDomainMomentForEachDescendant;
|
||||
virDomainMomentIsAncestor;
|
||||
virDomainMomentMoveChildren;
|
||||
virDomainMomentObjFree;
|
||||
virDomainMomentObjNew;
|
||||
|
Loading…
Reference in New Issue
Block a user