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.py doesn't allow different vms to attach a shared disk #418

Open
cmcwales2k opened this issue Jan 24, 2022 · 0 comments
Open
Labels
bug Something isn't working

Comments

@cmcwales2k
Copy link

SUMMARY

Via the UI I can create a sharable disk and attach/detach multiple VMs to it. When using Ansible I can create a shared disk, but can only attach and detach from the original VM it was created with. When trying to attach to a different VM I either get a second disk created or duplicated created in a locked state.

COMPONENT NAME

ovirt_disk

STEPS TO REPRODUCE

run the below once against server1 and then again to server2

---
- name: oVirt ansible collection
  hosts: localhost
  connection: local
  gather_facts: false
  vars_files:
    - auth.yml
  vars:
    sharedvdisk:
      - name: shareddisk
        state: 'attached'
        vm_name: 'server1'
        #vm_name: 'server2'       
        storage_domain:  shareddiskdomain
        interface: virtio
        size: 5GiB
        activate: yes
        format: raw
        shareable: yes
        activate: yes
        sparse: no



  tasks:
    - name: Login
      ovirt_auth:
          url: "https://{{ engine_fqdn }}/ovirt-engine/api"
          password: "{{ engine_password | default(omit) }}"
          username: "{{ engine_user }}"
          ca_file: "{{ engine_cafile }}"

    - name: loop shareddisks 
      ovirt_disk:
        auth: "{{ ovirt_auth }}"
        name: "{{ item.name | default(omit) }}"
        id: "{{ item.id | default(omit)  }}"
        vm_name: "{{ item.vm_name | default(omit)}}"
        size: "{{ item.size | default(omit) }}"
        interface: "{{ item.interface | default(omit) }}"
        storage_domain: "{{ item.storage_domain | default(omit) }}"
        format: "{{ item.format| default(omit) }}"
        state: "{{ item.state | default(omit) }}"
        shareable: "{{ item.shareable | default(omit) }}"
        activate: "{{ item.activate | default(omit) }}"
      loop: "{{ sharedvdisk }}"
      register: shared_disk_ids

    - debug:
        var: shared_disk_ids


  collections:
    - ovirt.ovirt
EXPECTED RESULTS

Shared disk to be attached to 2 VMs

From UI Storage > Disks
shareddisk     xxxxxxxxx-xxxx-xxxx-xxxx-69bb746cf65c    server1,server2   5 GiB OK  Image
ACTUAL RESULTS

Unable to attached to 2 VMs, 2nd disk is created.

From UI Storage > Disks
shareddisk     xxxxxxxxx-xxxx-xxxx-xxxx-69bb746cf65c    server1   5 GiB OK  Image
shareddisk     xxxxxxxxx-xxxx-xxxx-xxxx-1d1fee61be3c    server2   5 GiB OK Image

@cmcwales2k cmcwales2k added the bug Something isn't working label Jan 24, 2022
@mwperina mwperina assigned barpavel and unassigned mnecas Jan 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants