1
0
mirror of https://gitlab.com/libvirt/libvirt-python.git synced 2025-07-17 00:59:36 +03:00
Files
libvirt-python/libvirt-override-virDomainCheckpoint.py
Philipp Hahn 932055e3cb generator: Fix domainCheckpoint.listAllChildren()
virDomainCheckpoint(dom, _obj)
expects a reference to the virDomain as its first argument, but
    virDomainCheckpoint.listAllChildren()
passes `self` instead:

libvirt.py:7056: error: Argument 1 to "virDomainCheckpoint" has incompatible type "virDomainCheckpoint"; expected "virDomain"

>>> import libvirt
>>> con = libvirt.open('test:///default')
>>> dom = con.lookupByName("test")
>>> first = dom.checkpointCreateXML("""<domaincheckpoint><name>First</name></domaincheckpoint>""")
>>> second = dom.checkpointCreateXML("""<domaincheckpoint><name>Second</name></domaincheckpoint>""")
>>> child, = first.listAllChildren()
>>> second.domain()
<libvirt.virDomain object at 0x7f828d777b80>
         ^^^^^^^^^
>>> child.domain()
<libvirt.virDomainCheckpoint object at 0x7f828d8160a0>
         ^^^^^^^^^^^^^^^^^^^

Signed-off-by: Philipp Hahn <hahn@univention.de>
2020-07-27 13:24:36 +02:00

20 lines
727 B
Python

def getConnect(self):
"""Get the connection that owns the domain that a checkpoint was created for"""
return self.connect()
def getDomain(self):
"""Get the domain that a checkpoint was created for"""
return self.domain()
def listAllChildren(self, flags=0):
"""List all child checkpoints and returns a list of checkpoint objects"""
ret = libvirtmod.virDomainCheckpointListAllChildren(self._o, flags)
if ret is None:
raise libvirtError("virDomainCheckpointListAllChildren() failed", conn=self)
retlist = list()
for chkptr in ret:
retlist.append(virDomainCheckpoint(self.domain(), _obj=chkptr))
return retlist