diff options
| author | Dan Prince <dprince@redhat.com> | 2012-06-13 10:11:04 -0400 |
|---|---|---|
| committer | Dan Prince <dprince@redhat.com> | 2012-06-14 12:45:20 -0400 |
| commit | f28731c1941e57b776b519783b0337e52e1484ab (patch) | |
| tree | 87b740d9ed8fee547d42753fae2db10121fad280 /nova | |
| parent | 2adeb5a76d8376d3506f4c63ec73211bfa1e5cc0 (diff) | |
| download | nova-f28731c1941e57b776b519783b0337e52e1484ab.tar.gz nova-f28731c1941e57b776b519783b0337e52e1484ab.tar.xz nova-f28731c1941e57b776b519783b0337e52e1484ab.zip | |
Add libvirt min version check.
Fixes LP Bug #1012689.
Change-Id: I91c0b7c41804b2b25026cbe672b9210c305dc29b
Diffstat (limited to 'nova')
| -rw-r--r-- | nova/tests/fakelibvirt.py | 3 | ||||
| -rw-r--r-- | nova/virt/libvirt/connection.py | 16 |
2 files changed, 17 insertions, 2 deletions
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(): |
