Bug 1662283 - ovirt_vm module - unable to activate or deactivate direct lun disk
Summary: ovirt_vm module - unable to activate or deactivate direct lun disk
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Enterprise Virtualization Manager
Classification: Red Hat
Component: ansible
Version: 4.2.8
Hardware: x86_64
OS: Linux
medium
medium
Target Milestone: ovirt-4.3.4
: 4.3.0
Assignee: Martin Necas
QA Contact: Petr Kubica
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-12-27 10:03 UTC by Ilan Zuckerman
Modified: 2019-06-27 12:13 UTC (History)
3 users (show)

Fixed In Version: ansible-2.8
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2019-06-27 12:13:37 UTC
oVirt Team: Infra
Target Upstream Version:


Attachments (Terms of Use)

Description Ilan Zuckerman 2018-12-27 10:03:13 UTC
Description of problem:
When using ovirt_vm module with 'disks.activate: false' or true in order to activate / deactivate direct lun disk, nothing happens, and the result of module is not changed (remains green in stdout)

Version-Release number of selected component (if applicable):
ansible 2.7.5

I Used python modules from devel branch here (because the fix should be there):
https://github.com/ansible/ansible/blob/devel/lib/ansible/modules/cloud/ovirt/ovirt_vm.py

The commit that was supposed to fix this issue:
https://github.com/ansible/ansible/pull/49762

I copied all ovirt modules from devel branch to the following path on clean VM:
/usr/lib/python2.7/site-packages/ansible/modules/cloud/ovirt/

How reproducible:
100%

Steps to Reproduce:

The following steps are from UI (to prepare the direct lun):
1. Create a VM and bring it down
2. Navigate to disks tab inside that vm and click new
3. From 'Direct LUN' tab add existing ISCSI lun and activate it.

Now execute the following code (with appropriate values) from Ansible:

- name: Deactivate previously added lun for vm "{{ regression_vm_name }}"
  ovirt_vm:
    auth: "{{ ovirt_auth }}"
    name: "{{ regression_vm_name }}"
    disks:
      - id: "1ce97a42-10a1-4ffa-aabc-18bf97a3000d"
        activate: false
 
Actual results:
The disk is not getting deactivated nor activated (if you use activate: true)
The module stdout is not changed (green)

Expected results:
The disk should be deactivated

Additional info:

For making our lives easy when reproducing this, you can use the following env and experience with the code:
Inside private message, you will find:
rhevm engine details (please dont abuse it, as it is being heavily used).
VM details from which the ansible code is being executed.
Inside the vm there is Ansible installed, and the role which creates the vm, attaches is a direct lun disk, and then attempts to activate / deactivate it.

Just make sure to remove from vm the direct lun disk before you try to re-use it.

Comment 3 Sandro Bonazzola 2019-01-28 09:34:34 UTC
This bug has not been marked as blocker for oVirt 4.3.0.
Since we are releasing it tomorrow, January 29th, this bug has been re-targeted to 4.3.1.

Comment 5 Martin Necas 2019-02-21 14:58:42 UTC
 Ilan Zuckerman you cannot eddit disk 'activate' in ovirt_vm module, you can only create it with the variable. You need to use ovirt_disk and edit it. 
This is documented in https://docs.ansible.com/ansible/latest/modules/ovirt_vm_module.html 

"activate - True if the disk should be activated, default is activated.
NOTE - This parameter is used only when state is running or present and is able to only attach disks. To manage disks of the VM in more depth please use ovirt_disks module instead."

Comment 6 Ilan Zuckerman 2019-02-25 06:53:59 UTC
(In reply to Martin Necas from comment #5)
>  Ilan Zuckerman you cannot eddit disk 'activate' in ovirt_vm module, you can
> only create it with the variable. You need to use ovirt_disk and edit it. 
> This is documented in
> https://docs.ansible.com/ansible/latest/modules/ovirt_vm_module.html 
> 
> "activate - True if the disk should be activated, default is activated.
> NOTE - This parameter is used only when state is running or present and is
> able to only attach disks. To manage disks of the VM in more depth please
> use ovirt_disks module instead."

Martin, thank you for your reply.

The scenario i need to Automate is the following:
1. Direct lun disk is attached to vm and activated (This i can achieve with ovirt_vm module)
2. deactivating the direct lun disk (not detaching. DEACTIVATING)
3. activate the same direct lun disk (not attaching. ACTIVATING)

The reason i opened this BZ is because i was told by Ondra regarding section 1 and 2:
quote: "It's possible, but unfortunatelly not from ovirt_disk module, which we should add I think, so feel free to open an issue on that. You can do it via ovirt_vm module:"

So again, i wasnt able to perform steps 1 and 2 from described above with ovirt_vm module.
Please let me know if i am mistaken or there is an issue with this functionality.

Comment 7 Martin Necas 2019-03-04 06:35:29 UTC
Ilan if you want to activate or deactivate disk  you can use this task:

    - name: Deactivate
      ovirt_disk:
        auth: "{{ ovirt_auth }}"
        name: disk_name
        vm_name: vm_name
        activate: false 

but its only from version 2.8 of ansible you might need to upgrade.

Comment 8 Ilan Zuckerman 2019-03-04 08:47:07 UTC
(In reply to Martin Necas from comment #7)
> Ilan if you want to activate or deactivate disk  you can use this task:
> 
>     - name: Deactivate
>       ovirt_disk:
>         auth: "{{ ovirt_auth }}"
>         name: disk_name
>         vm_name: vm_name
>         activate: false 
> 
> but its only from version 2.8 of ansible you might need to upgrade.

Thanks, is that upstream? if so, could you please point me where it could be found / installed from?

Comment 9 Martin Perina 2019-03-04 10:14:28 UTC
(In reply to Ilan Zuckerman from comment #8)
> (In reply to Martin Necas from comment #7)
> > Ilan if you want to activate or deactivate disk  you can use this task:
> > 
> >     - name: Deactivate
> >       ovirt_disk:
> >         auth: "{{ ovirt_auth }}"
> >         name: disk_name
> >         vm_name: vm_name
> >         activate: false 
> > 
> > but its only from version 2.8 of ansible you might need to upgrade.
> 
> Thanks, is that upstream? if so, could you please point me where it could be
> found / installed from?

So far there was no Ansible 2.8 prerelease, so the only thing you can do is to download modules from latest upstream sources and add it to library of your Ansible role. Or if you don't have a role, then you can try to replace the module directly in files installed from Ansible 2.7 RPM.

Comment 11 Petr Kubica 2019-05-30 11:35:12 UTC
Verified in
ansible-2.8.0-0.5.b1.el7ae.noarch


Note You need to log in before you can comment on or make changes to this bug.