Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ovirt_disk :: Duplicate disk names causes wrong disk to be extended #41008

Closed
nickcmaynard opened this issue Jun 1, 2018 · 6 comments
Closed
Labels
affects_2.5 This issue/PR affects Ansible v2.5 bug This issue/PR relates to a bug. cloud deprecated This issue/PR relates to a deprecated module. module This issue/PR relates to a module. ovirt oVirt and RHV community support:community This issue/PR relates to code supported by the Ansible community. traceback This issue/PR includes a traceback.

Comments

@nickcmaynard
Copy link

SUMMARY

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.

ISSUE TYPE
  • Bug Report
COMPONENT NAME

ovirt_disks

ANSIBLE VERSION
ansible 2.5.2
  config file = /Users/nick/Documents/red-hat/hetzner-server/ansible.cfg
  configured module search path = [u'/Users/nick/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/Cellar/ansible/2.5.2/libexec/lib/python2.7/site-packages/ansible
  executable location = /usr/local/bin/ansible
  python version = 2.7.15 (default, May  1 2018, 16:44:08) [GCC 4.2.1 Compatible Apple LLVM 9.1.0 (clang-902.0.39.1)]
CONFIGURATION
ANSIBLE_PIPELINING(/Users/nick/Documents/red-hat/hetzner-server/ansible.cfg) = True
DEFAULT_HOST_LIST(/Users/nick/Documents/red-hat/hetzner-server/ansible.cfg) = [u'/Users/nick/Documents/red-hat/hetzner-server/inventory.yml']
DEFAULT_VAULT_PASSWORD_FILE(/Users/nick/Documents/red-hat/hetzner-server/ansible.cfg) = /Users/nick/Documents/red-hat/hetzner-server/vault-pass.txt
OS / ENVIRONMENT

Running from: MacOS
Managing: Red Hat Enterprise Linux 7.4

STEPS TO REPRODUCE
- name: 'expand root volume'
  ovirt_disk:
    vm_name: 'the-vm'
    name: 'root-disk'
    size: '32GiB'
    interface: virtio
    storage_domain: vm_storage
    bootable: yes
    auth: '{{ rhv_auth }}'
EXPECTED RESULTS

The disk to be expanded.

ACTUAL RESULTS

The wrong disk is "found" and ovirt attempts expansion (unsuccessfully, in this case).

The full traceback is:
Traceback (most recent call last):
  File "/tmp/ansible_TPhQxP/ansible_module_ovirt_disk.py", line 688, in main
    ret = disk_attachments_module.create()
  File "/tmp/ansible_TPhQxP/ansible_modlib.zip/ansible/module_utils/ovirt.py", line 580, in create
    **kwargs
  File "/usr/lib64/python2.7/site-packages/ovirtsdk4/services.py", line 6074, in add
    return self._internal_add(attachment, headers, query, wait)
  File "/usr/lib64/python2.7/site-packages/ovirtsdk4/service.py", line 232, in _internal_add
    return future.wait() if wait else future
  File "/usr/lib64/python2.7/site-packages/ovirtsdk4/service.py", line 55, in wait
    return self._code(response)
  File "/usr/lib64/python2.7/site-packages/ovirtsdk4/service.py", line 229, in callback
    self._check_fault(response)
  File "/usr/lib64/python2.7/site-packages/ovirtsdk4/service.py", line 132, in _check_fault
    self._raise_error(response, body)
  File "/usr/lib64/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.

fatal: [rh-hetzner]: FAILED! => {
    "changed": false, 
    "invocation": {
        "module_args": {
            "auth": {
                "insecure": true, 
                "password": "ndSA4iLENQbNwnGLPXjuCByu9d3C6SXm8CYKoCe52DXA6MjTqvRqbWFa6vikZzkb", 
                "url": "https://manager.rh-hetzner-vm.dittobit.co.uk/ovirt-engine/api", 
                "username": "admin@internal"
            }, 
            "bootable": true, 
            "description": null, 
            "download_image_path": null, 
            "fetch_nested": false, 
            "force": false, 
            "format": "cow", 
            "id": "52e1f4b6-10de-48ed-89c6-4668f0d97f49", 
            "image_provider": null, 
            "interface": "virtio", 
            "logical_unit": null, 
            "name": "rhel7.5-update-1", 
            "nested_attributes": [], 
            "openstack_volume_type": null, 
            "poll_interval": 3, 
            "profile": null, 
            "quota_id": null, 
            "shareable": null, 
            "size": "32GiB", 
            "sparse": null, 
            "sparsify": null, 
            "state": "present", 
            "storage_domain": "vm_storage", 
            "storage_domains": null, 
            "timeout": 180, 
            "upload_image_path": null, 
            "vm_id": null, 
            "vm_name": "ocp-master", 
            "wait": true
        }
    }, 
    "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."
}

@nickcmaynard
Copy link
Author

This will happen for all situations where:

  1. A disk is defined in a template.
  2. A VM is instantiated from the template.
  3. Ansible attempts to expand the VM's root disk by name and vm_name.

@ansibot
Copy link
Contributor

ansibot commented Jun 1, 2018

@ansibot ansibot added affects_2.5 This issue/PR affects Ansible v2.5 bug This issue/PR relates to a bug. cloud deprecated This issue/PR relates to a deprecated module. module This issue/PR relates to a module. needs_triage Needs a first human triage before being processed. virt Virt community (incl. QEMU, KVM, libvirt, ovirt, RHV and Proxmox) support:community This issue/PR relates to code supported by the Ansible community. traceback This issue/PR includes a traceback. labels Jun 1, 2018
@s-hertel s-hertel removed the needs_triage Needs a first human triage before being processed. label Jun 1, 2018
@machacekondra
Copy link
Contributor

I've sent following fix: #40934
Here is backport for 2.6: #41092

I would appreciate if you can test and let me know if it resolves you issue, thanks.

@nickcmaynard
Copy link
Author

Thanks will take a look.

@nickcmaynard
Copy link
Author

nickcmaynard commented Jun 5, 2018

Tested on stable-2.6 and it works as expected - thank you:

- name: 'expand root volume'
  ovirt_disk:
    vm_name: '{{ host }}'
    name: '{{ vm_config.root_disk_name }}'
    size: '{{ vm_config.root_disk_size }}'
    auth: '{{ rhv_auth }}'

@machacekondra
Copy link
Contributor

resolved_by_pr 41092

@ansibot ansibot closed this as completed Jun 5, 2018
@dagwieers dagwieers added ovirt oVirt and RHV community and removed virt Virt community (incl. QEMU, KVM, libvirt, ovirt, RHV and Proxmox) labels Feb 28, 2019
@ansible ansible locked and limited conversation to collaborators Jun 11, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
affects_2.5 This issue/PR affects Ansible v2.5 bug This issue/PR relates to a bug. cloud deprecated This issue/PR relates to a deprecated module. module This issue/PR relates to a module. ovirt oVirt and RHV community support:community This issue/PR relates to code supported by the Ansible community. traceback This issue/PR includes a traceback.
Projects
None yet
Development

No branches or pull requests

5 participants