summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJustin Santa Barbara <justin@fathomdb.com>2011-03-24 17:33:01 +0000
committerTarmac <>2011-03-24 17:33:01 +0000
commitb45f4c2f8b5537b758dad7d62dc73e7be216f516 (patch)
tree83f5fa377b1705703e82b62b80a9aec7d6481a09
parentab997441766f3d7454706ea9d630958287f53f01 (diff)
parentd966b1989224b8ba7bf580a3f3f8fc0f04b9a566 (diff)
Detect if user is running the default Lucid version of libvirt, and give a nicer error message
-rw-r--r--nova/virt/libvirt_conn.py13
1 files changed, 12 insertions, 1 deletions
diff --git a/nova/virt/libvirt_conn.py b/nova/virt/libvirt_conn.py
index e1a0a6f29..2bb96f819 100644
--- a/nova/virt/libvirt_conn.py
+++ b/nova/virt/libvirt_conn.py
@@ -1008,7 +1008,18 @@ class LibvirtConnection(driver.ComputeDriver):
"""
- return self._conn.getVersion()
+ # NOTE(justinsb): getVersion moved between libvirt versions
+ # Trying to do be compatible with older versions is a lost cause
+ # But ... we can at least give the user a nice message
+ method = getattr(self._conn, 'getVersion', None)
+ if method is None:
+ raise exception.Error(_("libvirt version is too old"
+ " (does not support getVersion)"))
+ # NOTE(justinsb): If we wanted to get the version, we could:
+ # method = getattr(libvirt, 'getVersion', None)
+ # NOTE(justinsb): This would then rely on a proper version check
+
+ return method()
def get_cpu_info(self):
"""Get cpuinfo information.