mirror of
https://gitlab.com/libvirt/libvirt-python.git
synced 2025-07-10 00:59:41 +03:00
list: provide python bindings for snapshots
This adds support for the new virDomainListAllSnapshots (a domain function) and virDomainSnapshotListAllChildren (a snapshot function) to the libvirt-python bindings. The implementation is done manually as the generator does not support wrapping lists of C pointers into python objects. * python/libvirt-override.c (libvirt_virDomainListAllSnapshots) (libvirt_virDomainSnapshotListAllChildren): New functions. * python/libvirt-override-api.xml: Document them. * python/libvirt-override-virDomain.py (listAllSnapshots): New file. * python/libvirt-override-virDomainSnapshot.py (listAllChildren): Likewise. * python/Makefile.am (CLASSES_EXTRA): Ship them.
This commit is contained in:
11
libvirt-override-virDomain.py
Normal file
11
libvirt-override-virDomain.py
Normal file
@ -0,0 +1,11 @@
|
||||
def listAllSnapshots(self, flags):
|
||||
"""List all snapshots and returns a list of snapshot objects"""
|
||||
ret = libvirtmod.virDomainListAllSnapshots(self._o, flags)
|
||||
if ret is None:
|
||||
raise libvirtError("virDomainListAllSnapshots() failed", conn=self)
|
||||
|
||||
retlist = list()
|
||||
for snapptr in ret:
|
||||
retlist.append(virDomainSnapshot(self, _obj=snapptr))
|
||||
|
||||
return retlist
|
Reference in New Issue
Block a user