mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-22 04:25:18 +00:00
snapshot: implement LIST_LEAVES flag in qemu
With the recent refactoring of qemu snapshot relationships, it is now trivial to filter on leaves. * src/conf/domain_conf.c (virDomainSnapshotObjListCount) (virDomainSnapshotObjListCopyNames): Handle new flag. * src/qemu/qemu_driver.c (qemuDomainSnapshotListNames) (qemuDomainSnapshotNum, qemuDomainSnapshotListChildrenNames) (qemuDomainSnapshotNumChildren): Pass new flag through.
This commit is contained in:
parent
8b6d1a2068
commit
5cf56c4b23
@ -12170,7 +12170,9 @@ static void virDomainSnapshotObjListCopyNames(void *payload,
|
||||
|
||||
if (data->oom)
|
||||
return;
|
||||
if ((data->flags & VIR_DOMAIN_SNAPSHOT_LIST_ROOTS) && obj->def->parent)
|
||||
/* LIST_ROOTS/LIST_DESCENDANTS was handled by caller,
|
||||
* LIST_METADATA is a no-op if we get this far. */
|
||||
if ((data->flags & VIR_DOMAIN_SNAPSHOT_LIST_LEAVES) && obj->nchildren)
|
||||
return;
|
||||
|
||||
if (data->numnames < data->maxnames) {
|
||||
@ -12255,7 +12257,9 @@ static void virDomainSnapshotObjListCount(void *payload,
|
||||
virDomainSnapshotObjPtr obj = payload;
|
||||
struct virDomainSnapshotNumData *data = opaque;
|
||||
|
||||
if ((data->flags & VIR_DOMAIN_SNAPSHOT_LIST_ROOTS) && obj->def->parent)
|
||||
/* LIST_ROOTS/LIST_DESCENDANTS was handled by caller,
|
||||
* LIST_METADATA is a no-op if we get this far. */
|
||||
if ((data->flags & VIR_DOMAIN_SNAPSHOT_LIST_LEAVES) && obj->nchildren)
|
||||
return;
|
||||
data->count++;
|
||||
}
|
||||
|
@ -9415,7 +9415,8 @@ static int qemuDomainSnapshotListNames(virDomainPtr domain, char **names,
|
||||
int n = -1;
|
||||
|
||||
virCheckFlags(VIR_DOMAIN_SNAPSHOT_LIST_ROOTS |
|
||||
VIR_DOMAIN_SNAPSHOT_LIST_METADATA, -1);
|
||||
VIR_DOMAIN_SNAPSHOT_LIST_METADATA |
|
||||
VIR_DOMAIN_SNAPSHOT_LIST_LEAVES, -1);
|
||||
|
||||
qemuDriverLock(driver);
|
||||
vm = virDomainFindByUUID(&driver->domains, domain->uuid);
|
||||
@ -9445,7 +9446,8 @@ static int qemuDomainSnapshotNum(virDomainPtr domain,
|
||||
int n = -1;
|
||||
|
||||
virCheckFlags(VIR_DOMAIN_SNAPSHOT_LIST_ROOTS |
|
||||
VIR_DOMAIN_SNAPSHOT_LIST_METADATA, -1);
|
||||
VIR_DOMAIN_SNAPSHOT_LIST_METADATA |
|
||||
VIR_DOMAIN_SNAPSHOT_LIST_LEAVES, -1);
|
||||
|
||||
qemuDriverLock(driver);
|
||||
vm = virDomainFindByUUID(&driver->domains, domain->uuid);
|
||||
@ -9482,7 +9484,8 @@ qemuDomainSnapshotListChildrenNames(virDomainSnapshotPtr snapshot,
|
||||
int n = -1;
|
||||
|
||||
virCheckFlags(VIR_DOMAIN_SNAPSHOT_LIST_DESCENDANTS |
|
||||
VIR_DOMAIN_SNAPSHOT_LIST_METADATA, -1);
|
||||
VIR_DOMAIN_SNAPSHOT_LIST_METADATA |
|
||||
VIR_DOMAIN_SNAPSHOT_LIST_LEAVES, -1);
|
||||
|
||||
qemuDriverLock(driver);
|
||||
vm = virDomainFindByUUID(&driver->domains, snapshot->domain->uuid);
|
||||
@ -9521,7 +9524,8 @@ qemuDomainSnapshotNumChildren(virDomainSnapshotPtr snapshot,
|
||||
int n = -1;
|
||||
|
||||
virCheckFlags(VIR_DOMAIN_SNAPSHOT_LIST_DESCENDANTS |
|
||||
VIR_DOMAIN_SNAPSHOT_LIST_METADATA, -1);
|
||||
VIR_DOMAIN_SNAPSHOT_LIST_METADATA |
|
||||
VIR_DOMAIN_SNAPSHOT_LIST_LEAVES, -1);
|
||||
|
||||
qemuDriverLock(driver);
|
||||
vm = virDomainFindByUUID(&driver->domains, snapshot->domain->uuid);
|
||||
|
Loading…
x
Reference in New Issue
Block a user