fakevirt: return hypervisor_version as an int instead of a string

The compute_nodes.hypervisor_version type in the database is an integer
not a string. This is only caught in postgres and not MySQL. Changing
the fakevirt driver to return the proper type allows for the
test_virt_drivers test to make check this for all drivers it currently
tests.

Change-Id: I25e4dba855b954a2451bced9a53172b51eb47238
This commit is contained in:
Joe Gordon 2013-11-25 16:38:19 -08:00
parent 18d3a0b07f
commit 9e770e6213
2 changed files with 3 additions and 1 deletions

View File

@ -573,6 +573,7 @@ class _VirtDriverTestCase(_FakeDriverBackendTestCase):
def test_get_host_stats(self):
host_status = self.connection.get_host_stats()
self._check_available_resouce_fields(host_status)
self.assertTrue(isinstance(host_status['hypervisor_version'], int))
@catch_notimplementederror
def test_get_available_resource(self):

View File

@ -34,6 +34,7 @@ from nova import db
from nova import exception
from nova.openstack.common.gettextutils import _
from nova.openstack.common import log as logging
from nova import utils
from nova.virt import driver
from nova.virt import virtapi
@ -98,7 +99,7 @@ class FakeDriver(driver.ComputeDriver):
'memory_mb_used': 0,
'local_gb_used': 100000000000,
'hypervisor_type': 'fake',
'hypervisor_version': '1.0',
'hypervisor_version': utils.convert_version_to_int('1.0'),
'hypervisor_hostname': CONF.host,
'cpu_info': {},
'disk_available_least': 500000000000,