mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Currently it's not possible to migrate the VMs if the automatic (#47612)
migration is disabled. The PR adds new option to force migrate the VMs. This is required for hosted engine migration since automatic migration is disabled for HE VM by default.
This commit is contained in:
parent
504921278a
commit
6775ec3cf2
1 changed files with 7 additions and 1 deletions
|
@ -576,6 +576,11 @@ options:
|
|||
- C(directory) - The name of the directory where the OVA has to be exported.
|
||||
- C(filename) - The name of the exported OVA file.
|
||||
version_added: "2.8"
|
||||
force_migrate:
|
||||
description:
|
||||
- "If I(true), the VM will migrate even if it is defined as non-migratable."
|
||||
version_added: "2.8"
|
||||
type: bool
|
||||
|
||||
notes:
|
||||
- If VM is in I(UNASSIGNED) or I(UNKNOWN) state before any operation, the module will fail.
|
||||
|
@ -1374,7 +1379,7 @@ class VmsModule(BaseModule):
|
|||
current_vm_host = hosts_service.host_service(entity.host.id).get().name
|
||||
if vm_host != current_vm_host:
|
||||
if not self._module.check_mode:
|
||||
vm_service.migrate(host=otypes.Host(name=vm_host))
|
||||
vm_service.migrate(host=otypes.Host(name=vm_host), force=self.param('force_migrate'))
|
||||
self._wait_for_UP(vm_service)
|
||||
self.changed = True
|
||||
|
||||
|
@ -2043,6 +2048,7 @@ def main():
|
|||
exclusive=dict(type='bool'),
|
||||
export_domain=dict(default=None),
|
||||
export_ova=dict(type='dict'),
|
||||
force_migrate=dict(type='bool'),
|
||||
)
|
||||
module = AnsibleModule(
|
||||
argument_spec=argument_spec,
|
||||
|
|
Loading…
Reference in a new issue