Make hypervisor_version an int in fakeVirt driver
This is a follow up to 9e770e6213
, which
missed the change in a duplicate copy of host_status.
Add regression test to test_virt_drivers.
This requires changes to the API samples, because they were wrong. virt
drivers use convert_version_to_int which converts a version string to a
4 digit number ("1.0" becomes to 1000)
Change-Id: I28ce23509e3c9feae183a49a8fc5bf3c7c601295
Closes-Bug: #1285035
This commit is contained in:
parent
3265368d73
commit
026583e60e
@ -8,7 +8,7 @@
|
||||
"free_ram_mb": 7680,
|
||||
"hypervisor_hostname": "fake-mini",
|
||||
"hypervisor_type": "fake",
|
||||
"hypervisor_version": 1,
|
||||
"hypervisor_version": 1000,
|
||||
"id": 1,
|
||||
"local_gb": 1028,
|
||||
"local_gb_used": 0,
|
||||
|
@ -1,4 +1,4 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<hypervisor vcpus_used="0" hypervisor_type="fake" local_gb_used="0" hypervisor_hostname="fake-mini" memory_mb_used="512" memory_mb="8192" current_workload="0" vcpus="1" cpu_info="?" running_vms="0" free_disk_gb="1028" hypervisor_version="1" disk_available_least="0" host_ip="1.1.1.1" local_gb="1028" free_ram_mb="7680" id="1">
|
||||
<hypervisor vcpus_used="0" hypervisor_type="fake" local_gb_used="0" hypervisor_hostname="fake-mini" memory_mb_used="512" memory_mb="8192" current_workload="0" vcpus="1" cpu_info="?" running_vms="0" free_disk_gb="1028" hypervisor_version="1000" disk_available_least="0" host_ip="1.1.1.1" local_gb="1028" free_ram_mb="7680" id="1">
|
||||
<service host="807e1a43ceb740138eea32969c3e9fe5" id="2"/>
|
||||
</hypervisor>
|
||||
|
@ -8,7 +8,7 @@
|
||||
"free_ram_mb": 7680,
|
||||
"hypervisor_hostname": "fake-mini",
|
||||
"hypervisor_type": "fake",
|
||||
"hypervisor_version": 1,
|
||||
"hypervisor_version": 1000,
|
||||
"id": 1,
|
||||
"local_gb": 1028,
|
||||
"local_gb_used": 0,
|
||||
@ -23,4 +23,4 @@
|
||||
"vcpus_used": 0
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<hypervisors>
|
||||
<hypervisor vcpus_used="0" hypervisor_type="fake" local_gb_used="0" hypervisor_hostname="fake-mini" memory_mb_used="512" memory_mb="8192" current_workload="0" vcpus="1" cpu_info="?" running_vms="0" free_disk_gb="1028" hypervisor_version="1" disk_available_least="None" local_gb="1028" free_ram_mb="7680" id="1">
|
||||
<hypervisor vcpus_used="0" hypervisor_type="fake" local_gb_used="0" hypervisor_hostname="fake-mini" memory_mb_used="512" memory_mb="8192" current_workload="0" vcpus="1" cpu_info="?" running_vms="0" free_disk_gb="1028" hypervisor_version="1000" disk_available_least="None" local_gb="1028" free_ram_mb="7680" id="1">
|
||||
<service host="4400f556a66d44ce95dfa61e75a23aaf" id="2"/>
|
||||
</hypervisor>
|
||||
</hypervisors>
|
||||
</hypervisors>
|
||||
|
@ -7,7 +7,7 @@
|
||||
"free_ram_mb": 7680,
|
||||
"hypervisor_hostname": "fake-mini",
|
||||
"hypervisor_type": "fake",
|
||||
"hypervisor_version": 1,
|
||||
"hypervisor_version": 1000,
|
||||
"id": 1,
|
||||
"local_gb": 1028,
|
||||
"local_gb_used": 0,
|
||||
|
@ -1,4 +1,4 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<hypervisor vcpus_used="0" hypervisor_type="fake" local_gb_used="0" hypervisor_hostname="fake-mini" memory_mb_used="512" memory_mb="8192" current_workload="0" vcpus="1" cpu_info="?" running_vms="0" free_disk_gb="1028" hypervisor_version="1" disk_available_least="0" local_gb="1028" free_ram_mb="7680" id="1">
|
||||
<hypervisor vcpus_used="0" hypervisor_type="fake" local_gb_used="0" hypervisor_hostname="fake-mini" memory_mb_used="512" memory_mb="8192" current_workload="0" vcpus="1" cpu_info="?" running_vms="0" free_disk_gb="1028" hypervisor_version="1000" disk_available_least="0" local_gb="1028" free_ram_mb="7680" id="1">
|
||||
<service host="807e1a43ceb740138eea32969c3e9fe5" id="2"/>
|
||||
</hypervisor>
|
||||
|
@ -9,7 +9,7 @@
|
||||
"free_ram_mb": 7680,
|
||||
"hypervisor_hostname": "fake-mini",
|
||||
"hypervisor_type": "fake",
|
||||
"hypervisor_version": 1,
|
||||
"hypervisor_version": 1000,
|
||||
"id": 1,
|
||||
"local_gb": 1028,
|
||||
"local_gb_used": 0,
|
||||
|
@ -8,7 +8,7 @@
|
||||
"free_ram_mb": 7680,
|
||||
"hypervisor_hostname": "fake-mini",
|
||||
"hypervisor_type": "fake",
|
||||
"hypervisor_version": 1,
|
||||
"hypervisor_version": 1000,
|
||||
"id": 1,
|
||||
"local_gb": 1028,
|
||||
"local_gb_used": 0,
|
||||
|
@ -9,7 +9,7 @@
|
||||
"free_ram_mb": 7680,
|
||||
"hypervisor_hostname": "fake-mini",
|
||||
"hypervisor_type": "fake",
|
||||
"hypervisor_version": 1,
|
||||
"hypervisor_version": 1000,
|
||||
"id": 1,
|
||||
"local_gb": 1028,
|
||||
"local_gb_used": 0,
|
||||
|
@ -8,7 +8,7 @@
|
||||
"free_ram_mb": 7680,
|
||||
"hypervisor_hostname": "fake-mini",
|
||||
"hypervisor_type": "fake",
|
||||
"hypervisor_version": 1,
|
||||
"hypervisor_version": 1000,
|
||||
"id": 1,
|
||||
"local_gb": 1028,
|
||||
"local_gb_used": 0,
|
||||
|
@ -8,7 +8,7 @@
|
||||
"free_ram_mb": 7680,
|
||||
"hypervisor_hostname": "fake-mini",
|
||||
"hypervisor_type": "fake",
|
||||
"hypervisor_version": 1,
|
||||
"hypervisor_version": 1000,
|
||||
"id": %(hypervisor_id)s,
|
||||
"local_gb": 1028,
|
||||
"local_gb_used": 0,
|
||||
|
@ -1,4 +1,4 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<hypervisor vcpus_used="0" hypervisor_type="fake" local_gb_used="0" hypervisor_hostname="fake-mini" memory_mb_used="512" memory_mb="8192" current_workload="0" vcpus="1" cpu_info="?" running_vms="0" free_disk_gb="1028" hypervisor_version="1" disk_available_least="0" host_ip="%(ip)s" local_gb="1028" free_ram_mb="7680" id="%(hypervisor_id)s">
|
||||
<hypervisor vcpus_used="0" hypervisor_type="fake" local_gb_used="0" hypervisor_hostname="fake-mini" memory_mb_used="512" memory_mb="8192" current_workload="0" vcpus="1" cpu_info="?" running_vms="0" free_disk_gb="1028" hypervisor_version="1000" disk_available_least="0" host_ip="%(ip)s" local_gb="1028" free_ram_mb="7680" id="%(hypervisor_id)s">
|
||||
<service host="%(host_name)s" id="2"/>
|
||||
</hypervisor>
|
||||
|
@ -9,7 +9,7 @@
|
||||
"free_ram_mb": 7680,
|
||||
"hypervisor_hostname": "fake-mini",
|
||||
"hypervisor_type": "fake",
|
||||
"hypervisor_version": 1,
|
||||
"hypervisor_version": 1000,
|
||||
"id": 1,
|
||||
"local_gb": 1028,
|
||||
"local_gb_used": 0,
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<hypervisors>
|
||||
<hypervisor vcpus_used="0" hypervisor_type="fake" local_gb_used="0" hypervisor_hostname="fake-mini" memory_mb_used="512" memory_mb="8192" current_workload="0" vcpus="1" cpu_info="?" running_vms="0" free_disk_gb="1028" hypervisor_version="1" disk_available_least="None" host_ip="%(ip)s" local_gb="1028" free_ram_mb="7680" id="1">
|
||||
<hypervisor vcpus_used="0" hypervisor_type="fake" local_gb_used="0" hypervisor_hostname="fake-mini" memory_mb_used="512" memory_mb="8192" current_workload="0" vcpus="1" cpu_info="?" running_vms="0" free_disk_gb="1028" hypervisor_version="1000" disk_available_least="None" host_ip="%(ip)s" local_gb="1028" free_ram_mb="7680" id="1">
|
||||
<service host="%(host_name)s" id="2"/>
|
||||
</hypervisor>
|
||||
</hypervisors>
|
||||
|
@ -7,7 +7,7 @@
|
||||
"free_ram_mb": 7680,
|
||||
"hypervisor_hostname": "fake-mini",
|
||||
"hypervisor_type": "fake",
|
||||
"hypervisor_version": 1,
|
||||
"hypervisor_version": 1000,
|
||||
"id": %(hypervisor_id)s,
|
||||
"local_gb": 1028,
|
||||
"local_gb_used": 0,
|
||||
|
@ -1,4 +1,4 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<hypervisor vcpus_used="0" hypervisor_type="fake" local_gb_used="0" hypervisor_hostname="fake-mini" memory_mb_used="512" memory_mb="8192" current_workload="0" vcpus="1" cpu_info="?" running_vms="0" free_disk_gb="1028" hypervisor_version="1" disk_available_least="0" local_gb="1028" free_ram_mb="7680" id="%(hypervisor_id)s">
|
||||
<hypervisor vcpus_used="0" hypervisor_type="fake" local_gb_used="0" hypervisor_hostname="fake-mini" memory_mb_used="512" memory_mb="8192" current_workload="0" vcpus="1" cpu_info="?" running_vms="0" free_disk_gb="1028" hypervisor_version="1000" disk_available_least="0" local_gb="1028" free_ram_mb="7680" id="%(hypervisor_id)s">
|
||||
<service host="%(host_name)s" id="2"/>
|
||||
</hypervisor>
|
||||
|
@ -1969,7 +1969,8 @@ class AdminActionsSamplesJsonTest(ServersSampleBase):
|
||||
report_count=1,
|
||||
updated_at='foo',
|
||||
hypervisor_type='bar',
|
||||
hypervisor_version='1',
|
||||
hypervisor_version=
|
||||
utils.convert_version_to_int('1.0'),
|
||||
disabled=False)
|
||||
return {'compute_node': [service]}
|
||||
self.stubs.Set(db, "service_get_by_compute_host", fake_get_compute)
|
||||
|
@ -9,7 +9,7 @@
|
||||
"free_ram_mb": 7680,
|
||||
"hypervisor_hostname": "fake-mini",
|
||||
"hypervisor_type": "fake",
|
||||
"hypervisor_version": 1,
|
||||
"hypervisor_version": 1000,
|
||||
"id": %(hypervisor_id)s,
|
||||
"local_gb": 1028,
|
||||
"local_gb_used": 0,
|
||||
|
@ -8,7 +8,7 @@
|
||||
"free_ram_mb": 7680,
|
||||
"hypervisor_hostname": "fake-mini",
|
||||
"hypervisor_type": "fake",
|
||||
"hypervisor_version": 1,
|
||||
"hypervisor_version": 1000,
|
||||
"id": %(hypervisor_id)s,
|
||||
"local_gb": 1028,
|
||||
"local_gb_used": 0,
|
||||
|
@ -9,7 +9,7 @@
|
||||
"free_ram_mb": 7680,
|
||||
"hypervisor_hostname": "fake-mini",
|
||||
"hypervisor_type": "fake",
|
||||
"hypervisor_version": 1,
|
||||
"hypervisor_version": 1000,
|
||||
"id": 1,
|
||||
"local_gb": 1028,
|
||||
"local_gb_used": 0,
|
||||
|
@ -8,7 +8,7 @@
|
||||
"free_ram_mb": 7680,
|
||||
"hypervisor_hostname": "fake-mini",
|
||||
"hypervisor_type": "fake",
|
||||
"hypervisor_version": 1,
|
||||
"hypervisor_version": 1000,
|
||||
"id": 1,
|
||||
"local_gb": 1028,
|
||||
"local_gb_used": 0,
|
||||
|
@ -55,7 +55,7 @@ class MigrateServerSamplesJsonTest(test_servers.ServersSampleBase):
|
||||
report_count=1,
|
||||
updated_at='foo',
|
||||
hypervisor_type='bar',
|
||||
hypervisor_version='1',
|
||||
hypervisor_version='1000',
|
||||
disabled=False)
|
||||
return {'compute_node': [service]}
|
||||
self.stubs.Set(db, "service_get_by_compute_host", fake_get_compute)
|
||||
|
@ -87,7 +87,7 @@ class ExtendedHyervisorPciSampleJsonTest(api_sample_base.ApiSampleTestBaseV3):
|
||||
"free_ram_mb": 7680,
|
||||
"hypervisor_hostname": "fake-mini",
|
||||
"hypervisor_type": "fake",
|
||||
"hypervisor_version": 1,
|
||||
"hypervisor_version": 1000,
|
||||
"id": 1,
|
||||
"local_gb": 1028,
|
||||
"local_gb_used": 0,
|
||||
|
@ -591,6 +591,7 @@ class _VirtDriverTestCase(_FakeDriverBackendTestCase):
|
||||
'supported_instances']
|
||||
for key in keys:
|
||||
self.assertIn(key, host_status)
|
||||
self.assertIsInstance(host_status['hypervisor_version'], int)
|
||||
|
||||
@catch_notimplementederror
|
||||
def test_get_host_stats(self):
|
||||
|
@ -363,7 +363,7 @@ class FakeDriver(driver.ComputeDriver):
|
||||
'memory_mb_used': 0,
|
||||
'local_gb_used': 0,
|
||||
'hypervisor_type': 'fake',
|
||||
'hypervisor_version': '1.0',
|
||||
'hypervisor_version': utils.convert_version_to_int('1.0'),
|
||||
'hypervisor_hostname': nodename,
|
||||
'disk_available_least': 0,
|
||||
'cpu_info': '?',
|
||||
|
Loading…
Reference in New Issue
Block a user