Skip to content

Commit 0ca1640

Browse files
committed
Fix missing VM start in vm_disk module
Flag .needs_reboot was set on one object, but vm_power_up() was called on different object, so VM was not started back. Signed-off-by: Justin Cinkelj <justin.cinkelj@xlab.si>
1 parent 141d852 commit 0ca1640

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

plugins/module_utils/vm.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1236,13 +1236,15 @@ def ensure_present_or_set(cls, module, rest_client, module_path):
12361236
module, rest_client, vm_before, changed, disk_key
12371237
)
12381238
if called_from_vm_disk:
1239+
vm_before.vm_power_up(module, rest_client)
12391240
vm_after, disks_after = cls.get_vm_by_name(module, rest_client)
12401241
return (
12411242
changed,
12421243
disks_after,
12431244
dict(before=disks_before, after=disks_after),
12441245
vm_before.reboot,
12451246
)
1247+
vm_before.vm_power_up(module, rest_client)
12461248
return changed, vm_before.reboot
12471249

12481250

plugins/modules/vm_disk.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -332,6 +332,7 @@ def ensure_absent(module, rest_client):
332332
)
333333
TaskTag.wait_task(rest_client, task_tag, module.check_mode)
334334
changed = True
335+
vm_before.vm_power_up(module, rest_client)
335336
vm_after, disks_after = ManageVMDisks.get_vm_by_name(module, rest_client)
336337
return (
337338
changed,
@@ -344,15 +345,12 @@ def ensure_absent(module, rest_client):
344345
def run(module, rest_client):
345346
# ensure_absent is located in modules/vm_disk.py, since it's only used here
346347
# ensure_present_or_set is located in module_utils/vm.py, since it's also used in module vm.
347-
vm, disks = ManageVMDisks.get_vm_by_name(module, rest_client)
348348
if module.params["state"] == "absent":
349349
changed, records, diff, reboot = ensure_absent(module, rest_client)
350350
else:
351351
changed, records, diff, reboot = ManageVMDisks.ensure_present_or_set(
352352
module, rest_client, MODULE_PATH
353353
)
354-
if vm:
355-
vm.vm_power_up(module, rest_client)
356354
return changed, records, diff, reboot
357355

358356

0 commit comments

Comments
 (0)