Fix a bug that caused exception on XenServer 7.1 with Cummulative Update (#52303)

- xenserver module_util: fixed a bug in gather_vm_params function where
   an exception was generated if XenServer product_version_text_short
   parameter contained non numeric characters, e.g. "7.1 CU1" on
   XenServer version 7.1 with Cummulative Update 1. Code was changed
   to use product_version parameter instead which is all numeric.
 - xenserver module_util: get_xenserver_version function is changed
   to return a list of integers for major, minor and update version
   instead of list of strings.
 - xenserver module_util: unit tests are updated according to changes.
 - xenserver module_util: removed unused imports.
This commit is contained in:
Bojan Vitnik 2019-02-19 13:36:57 +01:00 committed by John R Barker
parent 409345ee97
commit 922af44d7d
3 changed files with 13 additions and 9 deletions

View file

@ -39,7 +39,7 @@ def test_xenserverobject(mocker, fake_ansible_module, XenAPI, xenserver):
"pool.get_all.return_value": [fake_xenapi_ref('pool')],
"pool.get_default_SR.return_value": fake_xenapi_ref('SR'),
"session.get_this_host.return_value": fake_xenapi_ref('host'),
"host.get_software_version.return_value": {"product_version_text_short": "7.2"},
"host.get_software_version.return_value": {"product_version": "7.2.0"},
}
mocked_xenapi.configure_mock(**mocked_returns)
@ -47,4 +47,4 @@ def test_xenserverobject(mocker, fake_ansible_module, XenAPI, xenserver):
xso = xenserver.XenServerObject(fake_ansible_module)
assert xso.pool_ref == fake_xenapi_ref('pool')
assert xso.xenserver_version == ['7', '2']
assert xso.xenserver_version == [7, 2, 0]