From 03bccdda9223f8b6ab4bb38a264e07b67f4ed890 Mon Sep 17 00:00:00 2001 From: Ondra Machacek Date: Thu, 18 Oct 2018 14:41:54 +0200 Subject: [PATCH] ovirt_vm: Check next_run configuration update if exist (#47280) This PR fixes the update check method so it now check also the next_run configuration of the virtual machine if it exists. So if previously the VM was updated with new parameters, and then reset back, the module didn't set the parameters to be set back in next_run. This PR fixes it so the next run configuration is set back with proper parameters. Signed-off-by: Ondra Machacek Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1639894 Signed-off-by: Ondra Machacek --- lib/ansible/modules/cloud/ovirt/ovirt_vm.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/ansible/modules/cloud/ovirt/ovirt_vm.py b/lib/ansible/modules/cloud/ovirt/ovirt_vm.py index 05f8392d64eb3c..cbb5a0169b2094 100644 --- a/lib/ansible/modules/cloud/ovirt/ovirt_vm.py +++ b/lib/ansible/modules/cloud/ovirt/ovirt_vm.py @@ -1160,6 +1160,13 @@ def build_entity(self): ) def update_check(self, entity): + res = self._update_check(entity) + if entity.next_run_configuration_exists: + res = res and self._update_check(self._service.service(entity.id).get(next_run=True)) + + return res + + def _update_check(self, entity): def check_cpu_pinning(): if self.param('cpu_pinning'): current = [] @@ -1206,7 +1213,7 @@ def check_host(): equal(self.param('smartcard_enabled'), getattr(vm_display, 'smartcard_enabled', False)) and equal(self.param('io_threads'), entity.io.threads) and equal(self.param('ballooning_enabled'), entity.memory_policy.ballooning) and - equal(self.param('serial_console'), entity.console.enabled) and + equal(self.param('serial_console'), getattr(entity.console, 'enabled', None)) and equal(self._get_minor(self.param('custom_compatibility_version')), self._get_minor(entity.custom_compatibility_version)) and equal(self._get_major(self.param('custom_compatibility_version')), self._get_major(entity.custom_compatibility_version)) and equal(self.param('usb_support'), entity.usb.enabled) and