[PATCH libvirt-python 3/5] generator: Fix domainSnapshot.listAllChildren()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



    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@xxxxxxxxxxxxx>
---
 libvirt-override-virDomainSnapshot.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libvirt-override-virDomainSnapshot.py b/libvirt-override-virDomainSnapshot.py
index ec53358..87eac86 100644
--- a/libvirt-override-virDomainSnapshot.py
+++ b/libvirt-override-virDomainSnapshot.py
@@ -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
-- 
2.20.1






[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux