XenServer: Documentation improvements and fixes for XenServer related modules (#53498)

- More info added to module docs.
 - Fixed errors and typos in module docs.
 - Added parameter types to module docs.
 - Some error messages are fixed and/or changed to be more helpful.
 - Some code comments changed and added.
 - Updated unit tests that test changed error messages.
 - Improved module examples.
 - Improved docs for custom_params xenserver_guest module parameter
This commit is contained in:
Bojan Vitnik 2019-03-11 04:26:17 +01:00 committed by Abhijeet Kasurde
commit e775434a52
7 changed files with 138 additions and 99 deletions

View file

@ -19,12 +19,12 @@ testcase_set_vm_power_state_bad_transitions = {
('restarted', 'Suspended', "Cannot restart VM in state 'suspended'!"),
('suspended', 'Halted', "Cannot suspend VM in state 'poweredoff'!"),
('suspended', 'Paused', "Cannot suspend VM in state 'paused'!"),
('shutdownguest', 'Halted', "Cannot shutdown guest when VM is in state 'poweredoff'."),
('shutdownguest', 'Suspended', "Cannot shutdown guest when VM is in state 'suspended'."),
('shutdownguest', 'Paused', "Cannot shutdown guest when VM is in state 'paused'."),
('rebootguest', 'Halted', "Cannot reboot guest when VM is in state 'poweredoff'."),
('rebootguest', 'Suspended', "Cannot reboot guest when VM is in state 'suspended'."),
('rebootguest', 'Paused', "Cannot reboot guest when VM is in state 'paused'."),
('shutdownguest', 'Halted', "Cannot shutdown guest when VM is in state 'poweredoff'!"),
('shutdownguest', 'Suspended', "Cannot shutdown guest when VM is in state 'suspended'!"),
('shutdownguest', 'Paused', "Cannot shutdown guest when VM is in state 'paused'!"),
('rebootguest', 'Halted', "Cannot reboot guest when VM is in state 'poweredoff'!"),
('rebootguest', 'Suspended', "Cannot reboot guest when VM is in state 'suspended'!"),
('rebootguest', 'Paused', "Cannot reboot guest when VM is in state 'paused'!"),
],
"ids": [
"poweredoff->restarted",

View file

@ -20,7 +20,9 @@ def test_xenserverobject_xenapi_lib_detection(mocker, fake_ansible_module, xense
with pytest.raises(FailJsonException) as exc_info:
xenserver.XenServerObject(fake_ansible_module)
assert exc_info.value.kwargs['msg'] == "XenAPI.py required for this module! Please download XenServer SDK and copy XenAPI.py to your site-packages."
assert exc_info.value.kwargs['msg'] == ("XenAPI Python library is required for this module! "
"Please download XenServer SDK and copy XenAPI.py to your Python site-packages. "
"Check Notes section in module documentation for more info.")
def test_xenserverobject_xenapi_failure(mock_xenapi_failure, fake_ansible_module, xenserver):