From 42c6ed7078407f9577782b9ea5179d1c98c0f548 Mon Sep 17 00:00:00 2001 From: Nijin Ashok Date: Thu, 8 Nov 2018 17:45:45 +0530 Subject: [PATCH] ovirt_vm: Add option to apply the configuration change on "Next Run" (#48286) The PR adds new option "next_run" so that user can decide if the configuration has to be applied on the VM immediately or it has to be configured on next restart. --- lib/ansible/modules/cloud/ovirt/ovirt_vm.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/ansible/modules/cloud/ovirt/ovirt_vm.py b/lib/ansible/modules/cloud/ovirt/ovirt_vm.py index a3677aa823..26e96b2ff6 100644 --- a/lib/ansible/modules/cloud/ovirt/ovirt_vm.py +++ b/lib/ansible/modules/cloud/ovirt/ovirt_vm.py @@ -581,6 +581,12 @@ options: - "If I(true), the VM will migrate even if it is defined as non-migratable." version_added: "2.8" type: bool + next_run: + description: + - "If I(true), the update will not be applied to the VM immediately and will be only applied when virtual machine is restarted." + - NOTE - If there are multiple next run configuration changes on the VM, the first change may get reverted if this option is not passed. + version_added: "2.8" + type: bool notes: - If VM is in I(UNASSIGNED) or I(UNKNOWN) state before any operation, the module will fail. @@ -2049,6 +2055,7 @@ def main(): export_domain=dict(default=None), export_ova=dict(type='dict'), force_migrate=dict(type='bool'), + next_run=dict(type='bool'), ) module = AnsibleModule( argument_spec=argument_spec, @@ -2084,6 +2091,7 @@ def main(): ret = vms_module.create( entity=vm, result_state=otypes.VmStatus.DOWN if vm is None else None, + update_params={'next_run': module.params['next_run']} if module.params['next_run'] is not None else None, clone=module.params['clone'], clone_permissions=module.params['clone_permissions'], )