Ansible ovirt_disk module: how to attach disk without activation

Hello, root problem in a 4.3.8 environment is that sometimes when I hot add a floating disk to a VM in web admin gui, it attaches and also activates it by default (the flag is checked by default, but you can uncheck it) and this two-phases action fails as a single step. What I get is: VDSM ovhost command HotPlugDiskVDS failed: Requested operation is not valid: Domain already contains a disk with that address And then the VM event regarding hot add disk failure. I'm going to investigate more: it should be a past bug already solved in theory by my libvirt sw version (I've to crosscheck its id)... but I still get the error sometimes. What programmatically works is to attach the disk without activating it (this step always completes with success) and then activate the disk as a separate operation (this one typically fails the first time when I have the "problematic" situation, but then the second time succeeds). So I would like to use it as a workaround in the mean time. The problem reflects using the ansible module ovirt_disk, that by default activates the disk. So I have tried to specify "activate: no" (introduced in 2.8, readings the docs) when I attach it, but it seems not to work as expected. I'm testing using awx and its info says: AWX 9.0.1.0 Ansible 2.8.5 I tried this on a VM that (as usual when you want to reproduce... ;-) doesn't show the problem: ovirt_disk: auth: "{{ ovirt_auth }}" state: attached activate: no name: "{{ tobe_sw_disk_name }}" vm_name: "{{ ansible_hostname }}" size: "{{ current_sw_disk_size }}" interface: virtio_scsi delegate_to: localhost register: disk_attach_info But going to see registered variable it contains "active: true": "disk_activate_info": { "changed": false, "id": "6f7cdf02-cf8b-4fa8-ac00-6b47f6e0c827", "diskattachment": { "href": "/ovirt-engine/api/vms/b5c67c93-bd5d-42b6-a873-05f69cece2f1/diskattachments/6f7cdf02-cf8b-4fa8-ac00-6b47f6e0c827", "id": "6f7cdf02-cf8b-4fa8-ac00-6b47f6e0c827", "active": true, "bootable": false, "disk": { .... In fact I followed with the step to activate the disk: ovirt_disk: auth: "{{ ovirt_auth }}" state: present activate: yes name: "{{ tobe_sw_disk_name }}" vm_name: "{{ ansible_hostname }}" size: "{{ current_sw_disk_size }}" interface: virtio_scsi delegate_to: localhost register: disk_activate_info But in playbook run I got: ok: [target_vm -> localhost] And inside registered variable "changed: false": "disk_activate_info": { "changed": false, "id": "6f7cdf02-cf8b-4fa8-ac00-6b47f6e0c827", "diskattachment": { "href": "/ovirt-engine/api/vms/b5c67c93-bd5d-42b6-a873-05f69cece2f1/diskattachments/6f7cdf02-cf8b-4fa8-ac00-6b47f6e0c827", "id": "6f7cdf02-cf8b-4fa8-ac00-6b47f6e0c827", "active": true, ... Any tip to realize what needed: task to only attach disk without activating it and then task to activate the disk? Thanks in advance, Gianluca

On Mon, Jun 15, 2020 at 11:47 PM Gianluca Cecchi <gianluca.cecchi@gmail.com> wrote:
register: disk_attach_info
But going to see registered variable it contains "active: true":
"disk_activate_info": { "changed": false, "id": "6f7cdf02-cf8b-4fa8-ac00-6b47f6e0c827", "diskattachment": { "href": "/ovirt-engine/api/vms/b5c67c93-bd5d-42b6-a873-05f69cece2f1/diskattachments/6f7cdf02-cf8b-4fa8-ac00-6b47f6e0c827", "id": "6f7cdf02-cf8b-4fa8-ac00-6b47f6e0c827", "active": true, "bootable": false, "disk": { ....
Unfortunately I copied two times the disk_activate_info registered value in the previous e-mail. Here below the correct disk_attach_info var contents that contains "active: true": "disk_attach_info": { "changed": true, "id": "6f7cdf02-cf8b-4fa8-ac00-6b47f6e0c827", "diskattachment": { "href": "/ovirt-engine/api/vms/b5c67c93-bd5d-42b6-a873-05f69cece2f1/diskattachments/6f7cdf02-cf8b-4fa8-ac00-6b47f6e0c827", "id": "6f7cdf02-cf8b-4fa8-ac00-6b47f6e0c827", "active": true, "bootable": false, "disk": { "href": "/ovirt-engine/api/disks/6f7cdf02-cf8b-4fa8-ac00-6b47f6e0c827", "id": "6f7cdf02-cf8b-4fa8-ac00-6b47f6e0c827" }, ... Gianluca

Hi Gianluca, this looks like an issue in the module. I have created PR which should fix the problem [1]. Please check it out. You can manually create an ansible library to which you would copy the module and add the fix there or wait till it is added to ansible 2.9. Further issues/requests recommend to create on the repo. [1] https://github.com/oVirt/ovirt-ansible-collection/pull/61 Martin Necas On Mon, Jun 15, 2020 at 11:57 PM Gianluca Cecchi <gianluca.cecchi@gmail.com> wrote:
On Mon, Jun 15, 2020 at 11:47 PM Gianluca Cecchi < gianluca.cecchi@gmail.com> wrote:
register: disk_attach_info
But going to see registered variable it contains "active: true":
"disk_activate_info": { "changed": false, "id": "6f7cdf02-cf8b-4fa8-ac00-6b47f6e0c827", "diskattachment": { "href": "/ovirt-engine/api/vms/b5c67c93-bd5d-42b6-a873-05f69cece2f1/diskattachments/6f7cdf02-cf8b-4fa8-ac00-6b47f6e0c827", "id": "6f7cdf02-cf8b-4fa8-ac00-6b47f6e0c827", "active": true, "bootable": false, "disk": { ....
Unfortunately I copied two times the disk_activate_info registered value in the previous e-mail. Here below the correct disk_attach_info var contents that contains "active: true":
"disk_attach_info": { "changed": true, "id": "6f7cdf02-cf8b-4fa8-ac00-6b47f6e0c827", "diskattachment": { "href": "/ovirt-engine/api/vms/b5c67c93-bd5d-42b6-a873-05f69cece2f1/diskattachments/6f7cdf02-cf8b-4fa8-ac00-6b47f6e0c827", "id": "6f7cdf02-cf8b-4fa8-ac00-6b47f6e0c827", "active": true, "bootable": false, "disk": { "href": "/ovirt-engine/api/disks/6f7cdf02-cf8b-4fa8-ac00-6b47f6e0c827", "id": "6f7cdf02-cf8b-4fa8-ac00-6b47f6e0c827" }, ...
Gianluca _______________________________________________ Users mailing list -- users@ovirt.org To unsubscribe send an email to users-leave@ovirt.org Privacy Statement: https://www.ovirt.org/privacy-policy.html oVirt Code of Conduct: https://www.ovirt.org/community/about/community-guidelines/ List Archives: https://lists.ovirt.org/archives/list/users@ovirt.org/message/ANQCN5GFPSWJG3...

On Tue, Jun 16, 2020 at 10:04 AM Martin Necas <mnecas@redhat.com> wrote:
Hi Gianluca,
this looks like an issue in the module. I have created PR which should fix the problem [1]. Please check it out. You can manually create an ansible library to which you would copy the module and add the fix there or wait till it is added to ansible 2.9.
Further issues/requests recommend to create on the repo.
[1] https://github.com/oVirt/ovirt-ansible-collection/pull/61
Martin Necas
Thanks Martin! I verified correct behavior after applying the patch both using ansible-playbook on a 2.9.9 ansible environment and using awx with patched ansible 2.8.5 venv I put my feedback on github page too Gianluca
participants (2)
-
Gianluca Cecchi
-
Martin Necas