1
0
mirror of https://gitlab.com/libvirt/libvirt-python.git synced 2024-10-26 07:55:06 +03:00
Commit Graph

5 Commits

Author SHA1 Message Date
Philipp Hahn
5777008197 override: Convert to list comprehension
:%s/retlist = list()\n\s*\(for \w\+ in ret\):\n\s*retlist.append(\(.*\))\n\n\s*return retlist/return [\2 \1]/

Signed-off-by: Philipp Hahn <hahn@univention.de>
2020-08-18 09:48:25 +00:00
Philipp Hahn
abbd47f4ea override: Add manual PEP 484 type annotations
Signed-off-by: Philipp Hahn <hahn@univention.de>
2020-08-18 09:48:25 +00:00
Philipp Hahn
ee5c856af7 Remove legacy libvirtError arguments
The fields have been deprecated in C with
git:f60dc0bc09f09c6817d6706a9edb1579a3e2b2b8

They are only passed to the libvirtError constructor, but not stored for
later or used anywhere else.

sed -ri '/raise libvirtError/s/, \w+=self(\._dom)?//' *.py

Signed-off-by: Philipp Hahn <hahn@univention.de>
2020-08-06 08:50:37 +02:00
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
Eric Blake
358a8640fa Add virDomainCheckpoint APIs
Copies heavily from existing virDomainSnapshot handling, regarding
what special cases the generator has to be taught and what overrides
need to be written.

Signed-off-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2019-07-29 13:39:39 -05:00