ovirt vm when creating Nonetypefix (#59377)
* ovirt vm when creating Nonetypefix * update fix and add comment * add changelog * Update 59377-ovirt-vm-when-creating-fix.yml
This commit is contained in:
parent
8a886a6bee
commit
c7f414dece
2 changed files with 6 additions and 1 deletions
|
@ -0,0 +1,2 @@
|
||||||
|
bugfixes:
|
||||||
|
- ovirt_vm - fix for module failure on creation (https://github.com/ansible/ansible/issues/59385)
|
|
@ -2404,6 +2404,8 @@ def main():
|
||||||
)
|
)
|
||||||
vm = vms_module.search_entity(list_params={'all_content': True})
|
vm = vms_module.search_entity(list_params={'all_content': True})
|
||||||
|
|
||||||
|
# Boolean variable to mark if vm existed before module was executed
|
||||||
|
vm_existed = True if vm else False
|
||||||
control_state(vm, vms_service, module)
|
control_state(vm, vms_service, module)
|
||||||
if state in ('present', 'running', 'next_run'):
|
if state in ('present', 'running', 'next_run'):
|
||||||
if module.params['xen'] or module.params['kvm'] or module.params['vmware']:
|
if module.params['xen'] or module.params['kvm'] or module.params['vmware']:
|
||||||
|
@ -2488,6 +2490,7 @@ def main():
|
||||||
wait_condition=lambda vm: vm.status == otypes.VmStatus.UP,
|
wait_condition=lambda vm: vm.status == otypes.VmStatus.UP,
|
||||||
)
|
)
|
||||||
# Allow migrate vm when state present.
|
# Allow migrate vm when state present.
|
||||||
|
if vm_existed:
|
||||||
vms_module._migrate_vm(vm)
|
vms_module._migrate_vm(vm)
|
||||||
ret['changed'] = vms_module.changed
|
ret['changed'] = vms_module.changed
|
||||||
elif state == 'stopped':
|
elif state == 'stopped':
|
||||||
|
|
Loading…
Reference in a new issue