Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 1722403

Summary: ovirt_vm module won't migrate VM unless state=running is specified
Product: Red Hat Enterprise Virtualization Manager Reporter: Jan Zmeskal <jzmeskal>
Component: ansibleAssignee: Martin Necas <mnecas>
Status: CLOSED ERRATA QA Contact: Jan Zmeskal <jzmeskal>
Severity: low Docs Contact:
Priority: medium    
Version: 4.3.4CC: lleistne, mperina, omachace, pelauter
Target Milestone: ovirt-4.3.5-1Keywords: ZStream
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: ansible-2.8.3 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-08-26 07:13:50 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:
Bug Depends On:    
Bug Blocks: 1733654    

Description Jan Zmeskal 2019-06-20 09:15:37 UTC
Description of problem:
When running ovirt_vm module with migrate=yes against an existing, running VM, the VM won't be migrated unless you also specify state=running. However this shouldn't be necessary.


Version-Release number of selected component (if applicable):
Ansible 2.8.1
rhvm-4.3.4.3-0.1.el7.noarch

How reproducible:
100 %

Steps to Reproduce:
1. Have a running VM in your RHV engine, let's call it test_vm
2. Run this playbook against your RHV engine:

- name: Test ovirt_vm module
  hosts: localhost
  tasks:
    
    - name: Obtain SSO token with using username/password credentials
      ovirt_auth:
        url: https://<your_engine>/ovirt-engine/api
        username: admin@internal
        password: <your_pass>
        insecure: yes 

    - name: Migrate VM
      ovirt_vm:
        auth: "{{ ovirt_auth }}"
        name: test_vm
        migrate: yes 

You can also add state=present to ovirt_vm invocation, which is the default value. The result wont be changed by this.

Actual results:
VM is not migrated. Ansible result is OK, but not changed.

Expected results:
The VM should be migrated if state=present. There seems to be no good reason why this module should require state=running for the migration to happen.

Comment 1 Sandro Bonazzola 2019-07-30 07:36:41 UTC
ansible-2.8.3 has been released, please check this bug is fixed there.

Comment 2 Jan Zmeskal 2019-08-01 10:06:14 UTC
Verified on:
ovirt-engine-4.3.5.4-0.1.el7.noarch
ansible-2.8.3-1.el7ae.noarch

I prepared this playbook:
- name: Test migration
  gather_facts: false
  hosts: localhost
  tasks:
    - ovirt_vm:
        auth:
          insecure: true
          username: admin@internal
          password: <censored>
          url: https://<censored>/ovirt-engine/api
        name: migrate_vm
        migrate: yes
        force_migrate: no

And ran it like this:
ansible-playbook -i localhost test.yaml

Result: The VM migrated successfully without specifying state: running.

Comment 4 Sandro Bonazzola 2019-08-26 07:13:50 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2019:1935