From 9e770e62135fe9c2c8ac0121a5a79245b25a7847 Mon Sep 17 00:00:00 2001 From: Joe Gordon Date: Mon, 25 Nov 2013 16:38:19 -0800 Subject: [PATCH] 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 --- nova/tests/virt/test_virt_drivers.py | 1 + nova/virt/fake.py | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/nova/tests/virt/test_virt_drivers.py b/nova/tests/virt/test_virt_drivers.py index d16f09354a5b..88cda0cfd006 100644 --- a/nova/tests/virt/test_virt_drivers.py +++ b/nova/tests/virt/test_virt_drivers.py @@ -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): diff --git a/nova/virt/fake.py b/nova/virt/fake.py index b7e4c3590266..f1e8267abf11 100644 --- a/nova/virt/fake.py +++ b/nova/virt/fake.py @@ -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,