From 909f68d0355bc088b6b8e9dd5607fe39d9c13cb9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Ne=C4=8Das?= Date: Wed, 17 Jul 2019 02:50:18 +0200 Subject: [PATCH] Ovirt vm migrate with state present backport (#58720) * ovirt vm migrate with state present (#58136) * ovirt vm migrate with state present init * add migrate comment * add changelog --- .../fragments/58136-ovirt_vm_migrate_with_state_present.yml | 2 ++ lib/ansible/modules/cloud/ovirt/ovirt_vm.py | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 changelogs/fragments/58136-ovirt_vm_migrate_with_state_present.yml diff --git a/changelogs/fragments/58136-ovirt_vm_migrate_with_state_present.yml b/changelogs/fragments/58136-ovirt_vm_migrate_with_state_present.yml new file mode 100644 index 00000000000..c2693073446 --- /dev/null +++ b/changelogs/fragments/58136-ovirt_vm_migrate_with_state_present.yml @@ -0,0 +1,2 @@ +bugfixes: + - ovirt migrate virtual machine with state present and not only running BZ(https://bugzilla.redhat.com/show_bug.cgi?id=1722403) diff --git a/lib/ansible/modules/cloud/ovirt/ovirt_vm.py b/lib/ansible/modules/cloud/ovirt/ovirt_vm.py index c4ba1fd76b4..d2fae8b0e3d 100644 --- a/lib/ansible/modules/cloud/ovirt/ovirt_vm.py +++ b/lib/ansible/modules/cloud/ovirt/ovirt_vm.py @@ -1555,7 +1555,6 @@ class VmsModule(BaseModule): vm_service = self._service.service(entity.id) self._wait_for_UP(vm_service) self._attach_cd(vm_service.get()) - self._migrate_vm(vm_service.get()) def _attach_cd(self, entity): cd_iso = self.param('cd_iso') @@ -2372,6 +2371,8 @@ def main(): action_condition=lambda vm: vm.status == otypes.VmStatus.UP, wait_condition=lambda vm: vm.status == otypes.VmStatus.UP, ) + # Allow migrate vm when state present. + vms_module._migrate_vm(vm) ret['changed'] = vms_module.changed elif state == 'stopped': if module.params['xen'] or module.params['kvm'] or module.params['vmware']: