Bug 1961353

Summary: Allow migration of vms in between clusters not specifying host
Product: [oVirt] ovirt-ansible-collection Reporter: Guilherme Santos <gdeolive>
Component: GeneralAssignee: Martin Necas <mnecas>
Status: CLOSED WONTFIX QA Contact: Guilherme Santos <gdeolive>
Severity: medium Docs Contact:
Priority: medium    
Version: 1.4.2CC: bugs, michal.skrivanek, mperina
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: No Doc Update
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-05-18 06:28:35 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: Infra RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Guilherme Santos 2021-05-17 18:33:57 UTC
Description of problem:
BZ1933238 adds the functionality of migrate between clusters through the ovirt_vm ansible collection, however the destination host needs to be specified for the migration to work. 
# ansible localhost -c localhost -m ovirt.ovirt.ovirt_vm -a "name=vm_1 cluster=cl_2 state=running migrate=true auth='url=https://<engine-fqdn>/ovirt-engine/api username=admin@internal password=<pass> insecure=true'" -v
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: ovirtsdk4.Error: Fault reason is "Operation Failed". Fault detail is "[Cannot update a VM in this status. Try stopping the VM first.]". HTTP response code is 409.
localhost | FAILED! => {
    "changed": false,
    "msg": "Fault reason is \"Operation Failed\". Fault detail is \"[Cannot update a VM in this status. Try stopping the VM first.]\". HTTP response code is 409."
}

If you stop the vm and then run it, it works (the host is automatically chosen)
I think that, for consistence, it should be possible to migrate not specifying the host and with the vm running.

Version-Release number of selected component (if applicable):
ovirt-engine-4.4.6.6-0.10.el8ev.noarch
ovirt-ansible-collection-1.4.2-1.el8ev.noarch

How reproducible:
always

Steps to Reproduce:
1. Have a running VM and try to migrate it to another cluster
# ansible localhost -c localhost -m ovirt.ovirt.ovirt_vm -a "name=vm_1 cluster=cl_2 state=running migrate=true auth='url=https://<engine-fqdn>/ovirt-engine/api username=admin@internal password=<pass> insecure=true'" -v
2. Try again specifying the host and not specifying the host but with the vm stopped 
3.

Actual results:
Error when trying to migrate with VM on and not host specified. 

Expected results:
running VM successfully migrated with and without specifying the host (like when is not running) 

Additional info:

Comment 1 Michal Skrivanek 2021-05-18 06:28:35 UTC
nack on any improvement in this area. If anything we should add a clear documentation to the ansible role warning that a cross cluster migration is unsupported and dangerous. See bug 1441632 for details.