oVirt / ovirt-ansible-collection

Ansible collection with official oVirt modules and roles
72 stars 89 forks source link

Logical names of disks are not assigned as expected #751

Open denkk0 opened 3 weeks ago

denkk0 commented 3 weeks ago
SUMMARY

I am creating several disks, and I would expect them to get the logical names assigned as they are created in the playbook - sequentially. E.g.: disk_1 - /dev/sda, disk_2 - /dev/sdb, and so on... However what I am experiencing is that the logical names are not assigned sequentially nor deterministically. This has happened to me multiple times, and sometimes the logical names are in the correct order, but sometimes the order is mixed.

Versions: ansible - 2.15.12 ovirt.ovirt collection - 3.2.0

COMPONENT NAME

ovirt.ovirt.ovirt_disk

STEPS TO REPRODUCE
---
- name: Auth ovirt
  ovirt.ovirt.ovirt_auth:
    url: https://ovirt.example.com/ovirt-engine/api
    # ...

- name: Create vm vm.example.com
  ovirt.ovirt.ovirt_vm:
    high_availability: true
    auth: "{{ ovirt_auth }}"
    state: stopped
    cpu_cores: "2"
    memory: "6GiB"
    memory_max: "6GiB"
    name: "vm.example.com"
    template: "linux"
    cluster: "prod"
    type: server
    graphical_console:
      headless_mode: true
    operating_system: "linux"
    nics:
      - name: eth0
        profile_name: "vlan"
    cloud_init_persist: true
    cloud_init:
      dns_servers: "1.1.1.1 1.0.0.1"
      host_name: "vm.example.com"
      user_name: root
      root_password: "ROOT_PASSWORD"
      authorized_ssh_keys: "SSH_KEY"
    cloud_init_nics:
      - nic_name: enp1s0
    nic_boot_protocol: static
    nic_ip_address: "10.0.0.1"
    nic_netmask: "255.255.255.0"
    nic_gateway: "10.0.0.254"

- ovirt.ovirt.ovirt_disk:
    name: "disk_1"
    bootable: true
    vm_name: "vm.example.com"
    auth: "{{ ovirt_auth }}"
    state: "present"
    wait: true

- ovirt.ovirt.ovirt_disk:
    name: "disk_2"
    auth: "{{ ovirt_auth }}"
    vm_name: "vm.example.com"
    size: "2GiB"
    format: cow
    interface: virtio_scsi
    storage_domain: "STORAGE_DOMAIN"
    state: "present"
    wait: true

- ovirt.ovirt.ovirt_disk:
    name: "disk_3"
    auth: "{{ ovirt_auth }}"
    vm_name: "vm.example.com"
    size: "5GiB"
    format: cow
    interface: virtio_scsi
    storage_domain: "STORAGE_DOMAIN"
    state: "present"
    wait: true

- ovirt.ovirt.ovirt_vm:
    auth: "{{ ovirt_auth }}"
    state: running
    name: "vm.example.com"
EXPECTED RESULTS

When I inspect the VM's disks in the oVirt GUI, this is what I would expect

Alias Logical Name
disk_1 /dev/sda
disk_2 /dev/sdb
disk_3 /dev/sdc
ACTUAL RESULTS

However sometimes the logical names are switched, for example like this:

Alias Logical Name
disk_1 /dev/sda
disk_2 /dev/sdc
disk_3 /dev/sdb