[libvirt] [BUG][PATCH][RRFC][libvirt-python] libvirtError(..., conn=, dom=. vol=, pool=, snap=)

Philipp Hahn hahn at univention.de
Wed Nov 21 07:17:52 UTC 2018


Hi,

while working on the Python type annotations for the Python libvirt
binding I noticed the following code in
libvirt-override-virDomainSnapshot.py:

>     def listAllChildren(self, flags=0):
>         """List all child snapshots and returns a list of snapshot objects"""
...
>             raise libvirtError("..., conn=self)

"self" is an instance of virDomainSnapshot here.

I found two similar cases where "conn" was not a "virConnect" instance
in listAllSnapshots() and listAllVolumes().

Compare that with the declaration of libvirtError in libvirt-override.py:

> class libvirtError(Exception):
>     def __init__(self, defmsg, conn=None, dom=None, net=None, pool=None, vol=None):

Looking further at the implementation of that method only "defmsg" is
used; all other references are not accessed and never stored in an
instance variable.

Should I add a new "snap" argument to libvirtError.__init__() or should
we stop passing those references to the constructor altogether?

Patch 2 and 3 might be applied to the current branch already, patch 1
currently depends on my other work.

Philipp
-- 
Philipp Hahn
Open Source Software Engineer

Univention GmbH
be open.
Mary-Somerville-Str. 1
D-28359 Bremen
Tel.: +49 421 22232-0
Fax : +49 421 22232-99
hahn at univention.de

http://www.univention.de/
Geschäftsführer: Peter H. Ganten
HRB 20755 Amtsgericht Bremen
Steuer-Nr.: 71-597-02876
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-snap-pass-snapshot-reference-to-exception.patch
Type: text/x-patch
Size: 1861 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20181121/e3c651fc/attachment-0003.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-snap-pass-domain-reference-to-exception.patch
Type: text/x-patch
Size: 1300 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20181121/e3c651fc/attachment-0004.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0003-snap-pass-pool-reference-to-exception.patch
Type: text/x-patch
Size: 1344 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20181121/e3c651fc/attachment-0005.bin>


More information about the libvir-list mailing list