mirror of
https://gitlab.com/libvirt/libvirt-python.git
synced 2025-07-27 11:41:52 +03:00
virDomainSnapshot(dom, _obj) expects a reference to the virDomain as its first argument, but virDomainSnapshot.listAllChildren() passes `self` instead: libvirt.py:6459: error: Argument 1 to "virDomainSnapshot" has incompatible type "virDomainSnapshot"; expected "virDomain" >>> import libvirt >>> con = libvirt.open('test:///default') >>> dom = con.lookupByName("test") >>> first = dom.snapshotCreateXML("""<domainsnapshot><name>First</name></domainsnapshot>""") >>> second = dom.snapshotCreateXML("""<domainsnapshot><name>Second</name></domainsnapshot>""") >>> child, = first.listAllChildren() >>> second.domain() <libvirt.virDomain object at 0x7fb32be3cfd0> ^^^^^^^^^ >>> child.domain() <libvirt.virDomainSnapshot object at 0x7fb32bdb9080> ^^^^^^^^^^^^^^^^^ Signed-off-by: Philipp Hahn <hahn@univention.de>
20 lines
715 B
Python
20 lines
715 B
Python
def getConnect(self):
|
|
"""Get the connection that owns the domain that a snapshot was created for"""
|
|
return self.connect()
|
|
|
|
def getDomain(self):
|
|
"""Get the domain that a snapshot was created for"""
|
|
return self.domain()
|
|
|
|
def listAllChildren(self, flags=0):
|
|
"""List all child snapshots and returns a list of snapshot objects"""
|
|
ret = libvirtmod.virDomainSnapshotListAllChildren(self._o, flags)
|
|
if ret is None:
|
|
raise libvirtError("virDomainSnapshotListAllChildren() failed", conn=self)
|
|
|
|
retlist = list()
|
|
for snapptr in ret:
|
|
retlist.append(virDomainSnapshot(self.domain(), _obj=snapptr))
|
|
|
|
return retlist
|