1
0
mirror of https://gitlab.com/libvirt/libvirt-python.git synced 2025-08-04 12:21:57 +03:00

generator: Fix domainSnapshot.listAllChildren()

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>
This commit is contained in:
Philipp Hahn
2020-04-20 18:28:36 +02:00
parent d2de75dd83
commit a65d230ded

View File

@ -14,6 +14,6 @@
retlist = list()
for snapptr in ret:
retlist.append(virDomainSnapshot(self, _obj=snapptr))
retlist.append(virDomainSnapshot(self.domain(), _obj=snapptr))
return retlist