Skip to content

Commit

Permalink
vm_manager: add no_start option to create/enable VM
Browse files Browse the repository at this point in the history
Signed-off-by: Florent CARLI <[email protected]>
  • Loading branch information
insatomcat committed Feb 19, 2025
1 parent cdd54b0 commit 95ecf64
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
12 changes: 11 additions & 1 deletion library/cluster_vm.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,12 @@
- Timeout (in seconds) of the remote to add
- This parameter is optional if I(command) is C(add_pacemaker_remote)
type: int
nostart:
description:
- Whether the VM is started after creation/enabling
- This parameter is optional if I(command) is C(create) or C(clone) or C(enable)
type: bool
default: false
requirements:
- python >= 3.7
- librbd
Expand Down Expand Up @@ -569,6 +575,7 @@ def check_parameters(parameters, commands_list):
migrate_to_timeout=dict(type="str", require=False),
migration_downtime=dict(type="str", require=False),
priority=dict(type="str", required=False),
nostart=dict(type="bool", required=False),
clear_constraint=dict(type="bool", required=False, default=False),
strong=dict(type="bool", required=False, default=False),
colocated_vms=dict(type="list", required=False),
Expand Down Expand Up @@ -629,6 +636,7 @@ def check_parameters(parameters, commands_list):
system_image = args.get("system_image", None)
force = args.get("force", False)
enable = args.get("enable", True)
nostart = args.get("nostart", False)
src_name = args.get("src_name", None)
metadata_name = args.get("metadata_name", None)
metadata = args.get("metadata", {})
Expand Down Expand Up @@ -697,6 +705,7 @@ def check_parameters(parameters, commands_list):
"migration_downtime": migration_downtime,
"crm_config_cmd": crm_config_cmd,
"priority": priority,
"nostart": nostart,
"pacemaker_meta": pacemaker_meta,
"pacemaker_params": pacemaker_params,
"pacemaker_utilization": pacemaker_utilization,
Expand All @@ -716,6 +725,7 @@ def check_parameters(parameters, commands_list):
"live_migration": live_migration,
"migration_user": migration_user,
"stop_timeout": stop_timeout,
"nostart": nostart,
"migrate_to_timeout": migrate_to_timeout,
"migration_downtime": migration_downtime,
"clear_constraint": clear_constraint,
Expand All @@ -739,7 +749,7 @@ def check_parameters(parameters, commands_list):
elif command == "status":
result["status"] = vm_manager.status(vm_name)
elif command == "enable":
vm_manager.enable_vm(vm_name)
vm_manager.enable_vm(vm_name, nostart)
elif command == "create_snapshot":
vm_manager.create_snapshot(vm_name, snapshot_name)
elif command == "purge_image":
Expand Down
1 change: 1 addition & 0 deletions roles/deploy_vms_cluster/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
migration_downtime: "{{ hostvars[item].migration_downtime | default(omit) }}"
priority: "{{ hostvars[item].priority | default(omit) }}"
enable: "{{ hostvars[item].enable | default(true) }}"
nostart: "{{ hostvars[item].nostart | default(false) }}"
pinned_host: "{{ hostvars[item].pinned_host | default(omit) }}"
preferred_host: "{{ hostvars[item].preferred_host | default(omit) }}"
crm_config_cmd: "{{ hostvars[item].crm_config_cmd | default(omit) }}"
Expand Down

0 comments on commit 95ecf64

Please sign in to comment.