set default value to 0 instead of ''

hypervisor_version of z/VM driver returned '' but
in fact it is defined as fields.IntegerField() which
means it should be int value by default.

Closes-Bug: 1862750
Change-Id: Ib4f2ecbbb731943eda996d525ddaafd2260fd1a3
This commit is contained in:
jichenjc 2020-02-10 03:31:38 +00:00
parent 1fcd74730d
commit 560987f920
2 changed files with 2 additions and 1 deletions

View File

@ -136,6 +136,7 @@ class TestZVMDriver(test.NoDBTestCase):
self.assertEqual(0, results['vcpus'])
self.assertEqual(0, results['memory_mb_used'])
self.assertEqual(0, results['disk_available_least'])
self.assertEqual(0, results['hypervisor_version'])
self.assertEqual('TESTHOST', results['hypervisor_hostname'])
def test_driver_template_validation(self):

View File

@ -119,7 +119,7 @@ class ZVMDriver(driver.ComputeDriver):
'local_gb_used': host_stats.get('disk_used', 0),
'hypervisor_type': host_stats.get('hypervisor_type',
obj_fields.HVType.ZVM),
'hypervisor_version': host_stats.get('hypervisor_version', ''),
'hypervisor_version': host_stats.get('hypervisor_version', 0),
'hypervisor_hostname': host_stats.get('hypervisor_hostname',
hypervisor_hostname),
'cpu_info': jsonutils.dumps(host_stats.get('cpu_info', {})),