Skip to content

Commit c692b6e

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 e396139 commit c692b6e

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

plugins/module_utils/vm.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1235,6 +1235,7 @@ def ensure_present_or_set(cls, module, rest_client, module_path):
12351235
changed = cls._delete_not_used_disks(
12361236
module, rest_client, vm_before, changed, disk_key
12371237
)
1238+
vm_before.vm_power_up(module, rest_client)
12381239
if called_from_vm_disk:
12391240
vm_after, disks_after = cls.get_vm_by_name(module, rest_client)
12401241
return (

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)