Merge lp:~justin-fathomdb/nova/libvirt-getversion-whackamole into lp:~hudson-openstack/nova/trunk

Proposed by justinsb
Status: Merged
Approved by: Josh Kearney
Approved revision: 854
Merged at revision: 867
Proposed branch: lp:~justin-fathomdb/nova/libvirt-getversion-whackamole
Merge into: lp:~hudson-openstack/nova/trunk
Diff against target: 23 lines (+12/-1)
1 file modified
nova/virt/libvirt_conn.py (+12/-1)
To merge this branch: bzr merge lp:~justin-fathomdb/nova/libvirt-getversion-whackamole
Reviewer Review Type Date Requested Status
Jesse Andrews (community) Approve
Josh Kearney (community) Approve
Jay Pipes (community) Approve
Vish Ishaya Pending
Soren Hansen Pending
Review via email: mp+54475@code.launchpad.net

Commit message

Detect if user is running the default Lucid version of libvirt, and give a nicer error message

Description of the change

Check both libvirt connection object (Maverick) and libvirt namespace (Lucid) for getVersion function

Earlier versions of the python libvirt binding had getVersion in the libvirt namespace, not on the connection object. Check both.

To post a comment you must log in.
Revision history for this message
Jay Pipes (jaypipes) wrote :

lgtm.

review: Approve
Revision history for this message
justinsb (justin-fathomdb) wrote :

Though this patch let me get further, I think hit this error when launching an image " virConnect instance has no attribute 'nwfilterDefineXML'"

Paging Soren...

Soren: Is it a lost cause trying to support Lucid's libvirt? If so, there's no point merging this patch (but I could change it to give a friendly error message if an old libvirt is installed!)

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

I think it is a lost cause. That is why we have a backported libvirt in the ppa.

Vish

On Mar 23, 2011, at 10:01 AM, justinsb wrote:

> Though this patch let me get further, I think hit this error when launching an image " virConnect instance has no attribute 'nwfilterDefineXML'"
>
> Paging Soren...
>
> Soren: Is it a lost cause trying to support Lucid's libvirt? If so, there's no point merging this patch (but I could change it to give a friendly error message if an old libvirt is installed!)
> --
> https://code.launchpad.net/~justin-fathomdb/nova/libvirt-getversion-whackamole/+merge/54475
> You are subscribed to branch lp:nova.

Revision history for this message
justinsb (justin-fathomdb) wrote :

OK... changed this so that it gives a nicer error message if getVersion isn't available on the connection object, along with a note on where to find it in case anyone needs it in future...

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

> I think it is a lost cause.

+1

Revision history for this message
Josh Kearney (jk0) wrote :

Looks good to me. I don't see any harm in making an error message more friendly.

review: Approve
Revision history for this message
Jesse Andrews (anotherjesse) wrote :

Not sure if it is a lost cause - since it makes it easier to run on other platforms that we don't have a PPA for.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'nova/virt/libvirt_conn.py'
--- nova/virt/libvirt_conn.py 2011-03-23 05:29:32 +0000
+++ nova/virt/libvirt_conn.py 2011-03-23 20:33:34 +0000
@@ -981,7 +981,18 @@
981981
982 """982 """
983983
984 return self._conn.getVersion()984 # NOTE(justinsb): getVersion moved between libvirt versions
985 # Trying to do be compatible with older versions is a lost cause
986 # But ... we can at least give the user a nice message
987 method = getattr(self._conn, 'getVersion', None)
988 if method is None:
989 raise exception.Error(_("libvirt version is too old"
990 " (does not support getVersion)"))
991 # NOTE(justinsb): If we wanted to get the version, we could:
992 # method = getattr(libvirt, 'getVersion', None)
993 # NOTE(justinsb): This would then rely on a proper version check
994
995 return method()
985996
986 def get_cpu_info(self):997 def get_cpu_info(self):
987 """Get cpuinfo information.998 """Get cpuinfo information.