ideadevice / ansible-ahv-provider-plugin

Ansible plugins to interact with AHV APIs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

mismatch in object data structures for nutanix_vm and nutanix_vm_info (for example nic_list and disk_list).

yannickstruyf3 opened this issue · comments

Consider following use-case:
I manually created a virtual machine in PC, but I want to change the powerstate.
In order to change the powerstate, I need to use the nutanix_vm module. This module requires following attributes that need to be passed in order to change the powerstate:
state, cluster, cpu, vcpu, disk_list, nic_list, memory

A user should use the nutanix_vm_info module to fetch these parameters but the data structures do not match for nic_list and disk_list.

disk_list returned via nutanix_vm_info:

                            "disk_list": [
                                {
                                    "data_source_reference": {
                                        "kind": "image",
                                        "uuid": "40082f3d-2f26-4fd2-8625-e4a1291600ba"
                                    },
                                    "device_properties": {
                                        "device_type": "DISK",
                                        "disk_address": {
                                            "adapter_type": "SCSI",
                                            "device_index": 0
                                        }
                                    },
                                    "disk_size_bytes": 10737418240,
                                    "disk_size_mib": 10240,
                                    "storage_config": {
                                        "flash_mode": "DISABLED",
                                        "storage_container_reference": {
                                            "kind": "storage_container",
                                            "name": "SelfServiceContainer",
                                            "uuid": "a499e476-fc91-46f6-8fe7-6683105a847a"
                                        }
                                    },
                                    "uuid": "a0128020-f982-45ae-8e94-515f12499ba7"
                                },

disk_list in nutanix_vm:

disk_list:
        description:
        - Virtual Machine Disk list
        type: list
        elements: dict
        suboptions:
            clone_from_image:
                description:
                - Name/UUID of the image
                type: str
            size_mib:
                description:
                - Disk Size
                type: int
            device_type:
                description:
                - Disk Device type
                - 'Accepted value for this field:'
                - '    - C(DISK)'
                - '    - C(CDROM)'
                choices:
                - DISK
                - CDROM
                type: str
                required: True
            adapter_type:
                description:
                - Disk Adapter type
                - 'Accepted value for this field:'
                - '    - C(SCSI)'
                - '    - C(PCI)'
                - '    - C(SATA)'
                - '    - C(IDE)'
                choices:
                - SCSI
                - PCI
                - SATA
                - IDE
                type: str
                required: True
        required: True

If the data structures of both modules match, it will be a lot easier to fetch required information without additional parsing of data.