AttributeError: virConnect instance has no attribute 'getVersion'

Bug #627146 reported by Vish Ishaya
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Undecided
Unassigned

Bug Description

It appears there is either a bug in Soren's recent patch or there is an issue with different versions of python-libvirt.
In my version of python-libvirt, getVersion is a function in the libvirt namespace as opposed to a method on virConnect.
The following change fixes the error on my machine, but i don't know if it is actually successfully checking for disconnect.

=== modified file 'nova/virt/libvirt_conn.py'
--- nova/virt/libvirt_conn.py 2010-08-30 12:50:50 +0000
+++ nova/virt/libvirt_conn.py 2010-08-30 23:38:38 +0000
@@ -91,7 +91,7 @@

     def _test_connection(self):
         try:
- self._wrapped_conn.getVersion()
+ libvirt.getVersion()
             return True
         except libvirt.libvirtError as e:
             if e.get_error_code() == libvirt.VIR_ERR_SYSTEM_ERROR and \

Related branches

Revision history for this message
Vish Ishaya (vishvananda) wrote :

formatting was messed up so here is the actual patch

Revision history for this message
Soren Hansen (soren) wrote : Re: [Bug 627146] [NEW] AttributeError: virConnect instance has no attribute 'getVersion'

Which version of libvirt are you using?
--
Sent from my Android phone with K-9 Mail. Please excuse my brevity.

Revision history for this message
Vish Ishaya (vishvananda) wrote : Re: [Bug 627146] [NEW] AttributeError: virConnect instance has no attribute 'getVersion'

Default lucid. 7.5 I think.

On Aug 30, 2010 11:50 PM, "Soren Hansen" <email address hidden> wrote:
> Which version of libvirt are you using?
> --
> Sent from my Android phone with K-9 Mail. Please excuse my brevity.
>
> --
> AttributeError: virConnect instance has no attribute 'getVersion'
> https://bugs.launchpad.net/bugs/627146
> You received this bug notification because you are a direct subscriber
> of the bug.
>
> Status in OpenStack Compute (Nova): New
>
> Bug description:
> It appears there is either a bug in Soren's recent patch or there is an
issue with different versions of python-libvirt.
> In my version of python-libvirt, getVersion is a function in the libvirt
namespace as opposed to a method on virConnect.
> The following change fixes the error on my machine, but i don't know if it
is actually successfully checking for disconnect.
>
> === modified file 'nova/virt/libvirt_conn.py'
> --- nova/virt/libvirt_conn.py 2010-08-30 12:50:50 +0000
> +++ nova/virt/libvirt_conn.py 2010-08-30 23:38:38 +0000
> @@ -91,7 +91,7 @@
>
> def _test_connection(self):
> try:
> - self._wrapped_conn.getVersion()
> + libvirt.getVersion()
> return True
> except libvirt.libvirtError as e:
> if e.get_error_code() == libvirt.VIR_ERR_SYSTEM_ERROR and \
>
> To unsubscribe from this bug, go to:
> https://bugs.launchpad.net/nova/+bug/627146/+subscribe

Revision history for this message
Soren Hansen (soren) wrote :

On 31-08-2010 08:59, vishvananda wrote:
> Default lucid. 7.5 I think.

Yup, it seems the getVersion method on the connection object was
relatively recently added. However, calling it on the libvirt object
will, as you hypothesised, not check for disconnect, as it returns the
local version of libvirt, rather than the remote version.

Well spotted! I shall come up with a more backwards compatible ping
mechanism :)

--
Soren Hansen
Ubuntu Developer
http://www.ubuntu.com/

Revision history for this message
Soren Hansen (soren) wrote :

Fixed. Branch awaiting review.

Soren Hansen (soren)
Changed in nova:
status: New → Fix Committed
Eric Day (eday)
Changed in nova:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.