Description of problem: There is some inconsistencies between WebUI, Rest API and python sdk on instance types attributes: * WebUI allow to change some of attributes that are not available on Rest API (but not all attributes) * Rest API allow les modification than WebUI and oVirt SDK, and documented creation example don't work as expected [1] * ovirt python SDK allow to interact with a lot (all ?) instance type attributes [2] but changes are not reflected on the engine side (because of Rest API limitation) * Some documented attributes (operating_system...) in ansible module [3] don't work (because of lack of support of Rest API, and some operating system types not supported by sdk [4] and API [5], like rhel_7x64) and the ansible module is not idempotent Version-Release number of selected component (if applicable): oVirt engine: 4.3.4.3-1.el7 and lower oVirt python SDK: python-ovirt-engine-sdk4-4.3.1-2.el7.x86_64 ansible-2.8.2-1.el7.noarch How reproducible: Always Steps to Reproduce: * Rest API example: # Use documented example [1] cat > instance_type.xml <<EOF <instance_type> <name>myinstancetype</name> <console> <enabled>true</enabled> </console> <cpu> <topology> <cores>2</cores> <sockets>2</sockets> <threads>1</threads> </topology> </cpu> <custom_cpu_model>AMD Opteron_G2</custom_cpu_model> <custom_emulated_machine>q35</custom_emulated_machine> <display> <monitors>1</monitors> <single_qxl_pci>true</single_qxl_pci> <smartcard_enabled>true</smartcard_enabled> <type>spice</type> </display> <high_availability> <enabled>true</enabled> <priority>1</priority> </high_availability> <io> <threads>2</threads> </io> <memory>4294967296</memory> <memory_policy> <ballooning>true</ballooning> <guaranteed>268435456</guaranteed> </memory_policy> <migration> <auto_converge>inherit</auto_converge> <compressed>inherit</compressed> <policy id="00000000-0000-0000-0000-000000000000"/> </migration> <migration_downtime>2</migration_downtime> <os> <boot> <devices> <device>network</device> <device>hd</device> </devices> </boot> </os> <rng_device> <rate> <bytes>200</bytes> <!-- will not be used --> <period>2</period> <!-- will not be used --> </rate> <source>urandom</source> </rng_device> <soundcard_enabled>true</soundcard_enabled> <usb> <enabled>true</enabled> <!-- will not be used --> <type>native</type> <!-- will not be used --> </usb> <virtio_scsi> <enabled>true</enabled> </virtio_scsi> </instance_type> EOF curl -X POST -H 'Content-Type: application/xml' -d "$(cat data)" -u admin@internal:123 -k https://192.168.201.2/ovirt-engine/api/instancetypes/ <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <instance_type href="/ovirt-engine/api/instancetypes/a15aada9-8cdd-45dc-a878-4be8834aa6bb" id="a15aada9-8cdd-45dc-a878-4be8834aa6bb"> <name>myinstancetype</name> <description></description> <link href="/ovirt-engine/api/instancetypes/a15aada9-8cdd-45dc-a878-4be8834aa6bb/nics" rel="nics"/> <link href="/ovirt-engine/api/instancetypes/a15aada9-8cdd-45dc-a878-4be8834aa6bb/watchdogs" rel="watchdogs"/> <link href="/ovirt-engine/api/instancetypes/a15aada9-8cdd-45dc-a878-4be8834aa6bb/graphicsconsoles" rel="graphicsconsoles"/> <console> <enabled>true</enabled> </console> <cpu> <topology> <cores>2</cores> <sockets>2</sockets> <threads>1</threads> </topology> </cpu> <creation_time>2019-08-01T04:59:21.997-04:00</creation_time> <custom_cpu_model>AMD Opteron_G2</custom_cpu_model> <custom_emulated_machine>q35</custom_emulated_machine> <display> <monitors>1</monitors> <single_qxl_pci>true</single_qxl_pci> <smartcard_enabled>true</smartcard_enabled> <type>spice</type> </display> <high_availability> <enabled>true</enabled> <priority>1</priority> </high_availability> <io> <threads>2</threads> </io> <memory>4294967296</memory> <memory_policy> <ballooning>false</ballooning> <guaranteed>268435456</guaranteed> <max>17179869184</max> </memory_policy> <migration> <auto_converge>inherit</auto_converge> <compressed>inherit</compressed> <policy id="00000000-0000-0000-0000-000000000000"/> </migration> <migration_downtime>2</migration_downtime> <os> <boot> <devices> <device>network</device> <device>hd</device> </devices> </boot> </os> <placement_policy> <affinity>migratable</affinity> </placement_policy> <rng_device> <source>urandom</source> </rng_device> <soundcard_enabled>true</soundcard_enabled> <usb> <enabled>false</enabled> </usb> <virtio_scsi> <enabled>true</enabled> </virtio_scsi> </instance_type> * oVirt SDK example: import ovirtsdk4 as sdk from ovirtsdk4 import types connection = sdk.Connection( url='https://192.168.201.2/ovirt-engine/api', username='admin@internal', password='123', insecure=True, ) system_service = connection.system_service() instance_types_service = system_service.instance_types_service() instance_type_service = instance_types_service.service('00000009-0009-0009-0009-0000000000f1') instance_type = instance_types_service.service('00000009-0009-0009-0009-0000000000f1').get(headers={'All-content': 'true'}) instance_type.origin # return nothing instance_type.origin = 'Foo' instance_type.origin # return 'Foo' instance_type.type # return nothing instance_type.type = types.VmType('server') instance_type.type # return <VmType.SERVER: 'server'> instance_type.bios # return nothing instance_type.bios = types.Bios(boot_menu=types.BootMenu(enabled=True), type=types.BiosType('q35_ovmf')) instance_type.bios # return <ovirtsdk4.types.Bios object at 0x7f71686740d0> instance_type.os # return nothing instance_type.os = types.OperatingSystem(type=types.OsType('rhel_6x64'), boot=types.Boot(devices=[types.BootDevice('network'), types.BootDevice('hd')]) ) instance_type.os # return <ovirtsdk4.types.OperatingSystem object at 0x7fac7e4430d0> instance_type_service.update(instance_type) instance_type = instance_type_service.get() instance_type.origin # return nothing (this is also not accessible via WebUI) instance_type.type # return nothing (this is also not accessible via WebUI) instance_type.bios # return nothing (this work via WebUI) instance_type.os # return nothing (used and documented in ansible module) * Ansible example cat > playbook.yml <<EOF - hosts: localhost gather_facts: false tasks: - name: Obtain SSO token with using username/password credentials ovirt_auth: url: 'https://192.168.201.2/ovirt-engine/api' username: 'admin@internal' insecure: true password: '123' - name: "Import instance" ovirt_instance_type: auth: "{{ ovirt_auth }}" name: myinstance_type2 description: "my description" memory: 4GiB cpu_cores: 2 cpu_sockets: 1 cpu_threads: 1 boot_devices: - network - hd usb_support: true serial_console: true high_availability: true high_availability_priority: 1 soundcard_enabled: true smartcard_enabled: true io_threads: 2 ballooning_enabled: false rng_device: urandom graphical_console: headless_mode: false protocol: - spice virtio_scsi: true state: present EOF (first run) bash-4.2# ansible-playbook playbook.yml [WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all' PLAY [localhost] ***************************************************************************************************************************************************************************************************************************** TASK [Obtain SSO token with using username/password credentials] ***************************************************************************************************************************************************************************** ok: [localhost] TASK [Import instance] *********************************************************************************************************************************************************************************************************************** changed: [localhost] PLAY RECAP *********************************************************************************************************************************************************************************************************************************** localhost : ok=2 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 (second run) bash-4.2# ansible-playbook playbook.yml [WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all' PLAY [localhost] ***************************************************************************************************************************************************************************************************************************** TASK [Obtain SSO token with using username/password credentials] ***************************************************************************************************************************************************************************** ok: [localhost] TASK [Import instance] *********************************************************************************************************************************************************************************************************************** changed: [localhost] PLAY RECAP *********************************************************************************************************************************************************************************************************************************** localhost : ok=2 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 Actual results: * Some instance type attributes are not accessible via WebUI, Rest API, oVirt SDK (and so ansible module) * RestAPI / oVirt SDK don't throw error when unsupported attributes are sent * Ansible module is not idempotent Expected results: * All documented/available attributes used in Rest API should be usable * All documented/available attributes used in sdk should be usable * Rest API should be at least able to make the same things like it can be done via WebUI * Ansible module should be idempotent Additional info: [1] http://ovirt.github.io/ovirt-engine-api-model/4.3/#services/instance_types [2] https://ovirt.github.io/ovirt-engine-sdk/master/types.m.html#ovirtsdk4.types.InstanceType [3] https://docs.ansible.com/ansible/latest/modules/ovirt_instance_type_module.html [4] https://ovirt.github.io/ovirt-engine-sdk/master/types.m.html#ovirtsdk4.types.OsType [5] http://ovirt.github.io/ovirt-engine-api-model/4.3/#types/os_type
Note that Instance Types are not actively maintained in general. They continue to work as is, but we're not fixing any bugs there unless they are breaking other stuff
Ryan, moving back to virt team, until you align functionality between webadmin UI and RESTAPI, we cannot proceed further and improve SDK/ansible modules
This bug didn't get any attention for a while, we didn't have the capacity to make any progress. If you deeply care about it or want to work on it please assign/target accordingly
ok, closing. Please reopen if still relevant/you want to work on it.