From f28731c1941e57b776b519783b0337e52e1484ab Mon Sep 17 00:00:00 2001 From: Dan Prince Date: Wed, 13 Jun 2012 10:11:04 -0400 Subject: Add libvirt min version check. Fixes LP Bug #1012689. Change-Id: I91c0b7c41804b2b25026cbe672b9210c305dc29b --- nova/tests/fakelibvirt.py | 3 +++ nova/virt/libvirt/connection.py | 16 ++++++++++++++-- 2 files changed, 17 insertions(+), 2 deletions(-) (limited to 'nova') diff --git a/nova/tests/fakelibvirt.py b/nova/tests/fakelibvirt.py index 563677cca..3e4c63719 100644 --- a/nova/tests/fakelibvirt.py +++ b/nova/tests/fakelibvirt.py @@ -509,6 +509,9 @@ class Connection(object): if self._uri == 'qemu:///system': return 'QEMU' + def getLibVersion(self): + return 9007 + def getVersion(self): return 14000 diff --git a/nova/virt/libvirt/connection.py b/nova/virt/libvirt/connection.py index 0dfc91928..c1d8669e1 100644 --- a/nova/virt/libvirt/connection.py +++ b/nova/virt/libvirt/connection.py @@ -219,6 +219,8 @@ LIBVIRT_POWER_STATE = { VIR_DOMAIN_PMSUSPENDED: power_state.SUSPENDED, } +MIN_LIBVIRT_VERSION = (0, 9, 7) + def _late_load_cheetah(): global Template @@ -296,8 +298,18 @@ class LibvirtDriver(driver.ComputeDriver): return self._host_state def init_host(self, host): - # NOTE(nsokolov): moved instance restarting to ComputeManager - pass + libvirt_version = self._conn.getLibVersion() + + def _munge_version(ver): + return ver[0] * 1000000 + ver[1] * 1000 + ver[2] + + if libvirt_version < _munge_version(MIN_LIBVIRT_VERSION): + major = MIN_LIBVIRT_VERSION[0] + minor = MIN_LIBVIRT_VERSION[1] + micro = MIN_LIBVIRT_VERSION[2] + LOG.error(_('Nova requires libvirt version ' + '%(major)i.%(minor)i.%(micro)i or greater.') % + locals()) def _get_connection(self): if not self._wrapped_conn or not self._test_connection(): -- cgit