The ovirt_disks module does not reliably extend disks when they are specified by name and vm_name. If two disks exist that share the same name, then the first result is always selected.
The passed vm_name should be used to filter the search results and select the correct disk.
So I'm now opening the issue here.
config file = /home/manny/ovirttest/ansible.cfg
configured module search path = [u'/home/manny/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
ansible python module location = /home/manny/venv-ansible/local/lib/python2.7/site-packages/ansible
executable location = /home/manny/venv-ansible/bin/ansible
python version = 2.7.17 (default, Nov 7 2019, 10:07:09) [GCC 9.2.1 20191008]
DEFAULT_HOST_LIST(/home/manny/ovirttest/ansible.cfg) = [u'/home/manny/ovirttest/hosts']
DEFAULT_PRIVATE_KEY_FILE(/home/manny/ovirttest/ansible.cfg) = /home/manny/.ssh/id_rsa
DEFAULT_REMOTE_USER(/home/manny/ovirttest/ansible.cfg) = ansible
DEFAULT_TIMEOUT(/home/manny/ovirttest/ansible.cfg) = 60
DEFAULT_VAULT_PASSWORD_FILE(/home/manny/ovirttest/ansible.cfg) = /home/manny/.vault_ovirttest
HOST_KEY_CHECKING(/home/manny/ovirttest/ansible.cfg) = False
RETRY_FILES_ENABLED(/home/manny/ovirttest/ansible.cfg) = False
ovirt_disk:
vm_name: 'the-vm'
name: 'root-disk'
size: '32GiB'
interface: virtio_scsi
storage_domain: vm_storage
bootable: yes
auth: '{{ rhv_auth }}'
The disk to be expanded.
The wrong disk is "found" and ovirt attempts expansion (unsuccessfully, in this case).
Traceback (most recent call last):
File "/tmp/ansible_ovirt_disk_payload_YZT59A/ansible_ovirt_disk_payload.zip/ansible/modules/cloud/ovirt/ovirt_disk.py", line 791, in main
File "/tmp/ansible_ovirt_disk_payload_YZT59A/ansible_ovirt_disk_payload.zip/ansible/module_utils/ovirt.py", line 623, in create
**kwargs
File "/home/manny/.local/lib/python2.7/site-packages/ovirtsdk4/services.py", line 6985, in add
return self._internal_add(attachment, headers, query, wait)
File "/home/manny/.local/lib/python2.7/site-packages/ovirtsdk4/service.py", line 232, in _internal_add
return future.wait() if wait else future
File "/home/manny/.local/lib/python2.7/site-packages/ovirtsdk4/service.py", line 55, in wait
return self._code(response)
File "/home/manny/.local/lib/python2.7/site-packages/ovirtsdk4/service.py", line 229, in callback
self._check_fault(response)
File "/home/manny/.local/lib/python2.7/site-packages/ovirtsdk4/service.py", line 132, in _check_fault
self._raise_error(response, body)
File "/home/manny/.local/lib/python2.7/site-packages/ovirtsdk4/service.py", line 118, in _raise_error
raise error
Error: Fault reason is "Operation Failed". Fault detail is "[Cannot attach Virtual Disk. The disk is not shareable and is already attached to a VM.]". HTTP response code is 409.
failed: [localhost] (item={u'group': u'logging', u'name': u'logger05', u'ram': u'16GiB', u'net2_addr': u'10.12.126.15', u'net1_addr': u'10.12.125.15', u'net3_addr': u'10.12.231.206', u'net0_addr': u'10.12.124.15', u'processors': 4}) => {
"ansible_loop_var": "item",
"changed": false,
"invocation": {
"module_args": {
"activate": true,
"auth": {
"ca_file": null,
"compress": true,
"headers": null,
"insecure": true,
"kerberos": false,
"timeout": 0,
"token": "HX3lA90SCgpsJx9lXACZLHCR3Uv4SzphOV2lkPkbN93zrfzbTTpAIweq4YEfrY08X18N4oV51GB7FJ-Z6nC5qw",
"url": "https://labengine.hk093znit.lab/ovirt-engine/api"
},
"bootable": null,
"content_type": "data",
"description": null,
"download_image_path": null,
"fetch_nested": false,
"force": false,
"format": "cow",
"host": null,
"id": "026b7c41-b186-46ff-a9a3-72fb0a1e4a50",
"image_provider": null,
"interface": "virtio_scsi",
"logical_unit": null,
"name": "logger-vm_Disk2",
"nested_attributes": [],
"openstack_volume_type": null,
"poll_interval": 3,
"profile": null,
"quota_id": null,
"shareable": null,
"size": "500GiB",
"sparse": true,
"sparsify": null,
"state": "present",
"storage_domain": "vm_storage",
"storage_domains": null,
"timeout": 180,
"upload_image_path": null,
"vm_id": null,
"vm_name": "logger05",
"wait": true,
"wipe_after_delete": null
}
},
"item": {
"group": "logging",
"name": "logger05",
"net0_addr": "10.12.124.15",
"net1_addr": "10.12.125.15",
"net2_addr": "10.12.126.15",
"net3_addr": "10.12.231.206",
"processors": 4,
"ram": "16GiB"
},
"msg": "Fault reason is \"Operation Failed\". Fault detail is \"[Cannot attach Virtual Disk. The disk is not shareable and is already attached to a VM.]\". HTTP response code is 409."
}