Inconsistencies beteween WebUI, API read verbs and API write verbs

Hi All, As I stated in a previous thread, we use instances types and wanted to automate some parts to manage it [1]. Thansk to ovirt-orb/lago and pointers given in the last thread, I'm working on ansible an module to manage ovirt instance types, but I'm facing some troubles for some of instance type attributes. From the API, I don't have access to all fields provided via WebUI (eg: Custom Emulated Machine), and it seems that some fields can be added/updated via the API but are not part of the response when you read an instance type (eg: VirtIO-SCSI Enabled). Provided examples are not exhaustive. I tried to find my way in the oVirt engine code-base to see if the fix will be easy for a non java developer like me. I find, I think, that it seems to be some API definitions for instance type [2] that define, if I understand it well, all verbs that can be applied to each resource and what field can be put when adding an instance type, but nothing about fields to be included when you read a resource (and I'm not sure if its related to v4 API). I find also some java code [3] [4] that seems related to this but As I'm not a java developer, its a little bit difficult for me to find my path in it. For me this inconsistencies are a bug, but as you stated that instance types are in deep maintenance mode, do you think that bug will get some attention ? My objective is to have a ansible module that manage the hardware/bios related stuff (memory, boot sequence, scsi controller, bios type, almost all the things) and HA for instance type. Have a nice day. Cheers. [1]: https://lists.ovirt.org/archives/list/users@ovirt.org/message/TJAXYBMSIAAAYL... [2]: https://github.com/oVirt/ovirt-engine/blob/master/backend/manager/modules/re... [3]: https://github.com/oVirt/ovirt-engine/blob/ede62008318d924556bc9dfc5710d90e9... [4]: https://github.com/oVirt/ovirt-engine/blob/ede62008318d924556bc9dfc5710d90e9... [5]: https://ovirt.github.io/ovirt-engine-sdk/4.1/types.m.html#ovirtsdk4.types.In... -- Baptiste

Hello, instance type module was merged into Ansible 2.8: https://github.com/ansible/ansible/pull/54782 You can try it, if all is working fine for you. But the issue you had is just missing header 'All-content: true', which enable listing all attributes. $ curl -H 'All-content: true' -u user@profile:password -k https://fqdn/ovirt-engine/api/instancetypes Ondra On 16/04/2019 16:26, Baptiste Agasse wrote:
Hi All,
As I stated in a previous thread, we use instances types and wanted to automate some parts to manage it [1]. Thansk to ovirt-orb/lago and pointers given in the last thread, I'm working on ansible an module to manage ovirt instance types, but I'm facing some troubles for some of instance type attributes. From the API, I don't have access to all fields provided via WebUI (eg: Custom Emulated Machine), and it seems that some fields can be added/updated via the API but are not part of the response when you read an instance type (eg: VirtIO-SCSI Enabled). Provided examples are not exhaustive. I tried to find my way in the oVirt engine code-base to see if the fix will be easy for a non java developer like me. I find, I think, that it seems to be some API definitions for instance type [2] that define, if I understand it well, all verbs that can be applied to each resource and what field can be put when adding an instance type, but nothing about fields to be included when you read a resource (and I'm not sure if its related to v4 API). I find also some java code [3] [4] that seems related to this but As I'm not a java developer, its a little bit difficult for me to find my path in it. For me this inconsistencies are a bug, but as you stated that instance types are in deep maintenance mode, do you think that bug will get some attention ?
My objective is to have a ansible module that manage the hardware/bios related stuff (memory, boot sequence, scsi controller, bios type, almost all the things) and HA for instance type.
Have a nice day.
Cheers.
[1]: https://lists.ovirt.org/archives/list/users@ovirt.org/message/TJAXYBMSIAAAYL... [2]: https://github.com/oVirt/ovirt-engine/blob/master/backend/manager/modules/re... [3]: https://github.com/oVirt/ovirt-engine/blob/ede62008318d924556bc9dfc5710d90e9... [4]: https://github.com/oVirt/ovirt-engine/blob/ede62008318d924556bc9dfc5710d90e9... [5]: https://ovirt.github.io/ovirt-engine-sdk/4.1/types.m.html#ovirtsdk4.types.In...

Hello, ----- On 16 Apr, 2019, at 20:24, Ondra Machacek omachace@redhat.com wrote:
Hello,
instance type module was merged into Ansible 2.8:
Nice ! Thanks for your responsiveness and for working on this ! Sadly, I think there is some bugs, I found at least two [6] [7] when reading the code few minutes to see if attributes we wanted to manage are present. I will test it and report what I will found when I will test it. I've a long flight at the end of the week it's a good candidate to pass the time faster ;)
You can try it, if all is working fine for you.
But the issue you had is just missing header 'All-content: true', which enable listing all attributes.
$ curl -H 'All-content: true' -u user@profile:password -k https://fqdn/ovirt-engine/api/instancetypes
I made my tests with the python SDK, I didn't see any references to this header in docs that I had read, thank you for the pointer. Just after your mail the only references I found about it for the python sdk is just what returns this github search [8], so I tried the following: [...]
instance_types_service.list(search='name=C1-Large-BIOS', all_content=True) [<ovirtsdk4.types.InstanceType object at 0x7f6067157610>] instance_types_service.list(search='name=C1-Large-UEFI', all_content=True) [<ovirtsdk4.types.InstanceType object at 0x7f6067157790>] instance_types_service.list(search='name=C1-Large-BIOS', all_content=True)[0].virtio_scsi instance_types_service.list(search='name=C1-Large-UEFI', all_content=True)[0].bios instance_types_service.list(search='name=C1-Large-BIOS', all_content=True)[0].virtio_scsi instance_types_service.list(search='name=C1-Large-UEFI', all_content=True)[0].bios
But it returns nothing. So I tried the curl command that you provided above, I can see the virtio_scsi attribute (that is not present if 'All-content: true' header is not set), but I cannot see any bios reference for an instance type where I defined a different bios type than the default via WebUI. So for me, two conclusion now: * The ovirt python sdk don't pass the 'All-content: true' header on instance type read operations * There is some inconsistencies between WebUI and API (at least for bios attribute) I forgot to mention that I make my tests on the last ovirt-orb 4.3 version (4.3.0.4-1.el7) Have a nice day. Cheers.
Ondra
On 16/04/2019 16:26, Baptiste Agasse wrote:
Hi All,
As I stated in a previous thread, we use instances types and wanted to automate some parts to manage it [1]. Thansk to ovirt-orb/lago and pointers given in the last thread, I'm working on ansible an module to manage ovirt instance types, but I'm facing some troubles for some of instance type attributes. From the API, I don't have access to all fields provided via WebUI (eg: Custom Emulated Machine), and it seems that some fields can be added/updated via the API but are not part of the response when you read an instance type (eg: VirtIO-SCSI Enabled). Provided examples are not exhaustive. I tried to find my way in the oVirt engine code-base to see if the fix will be easy for a non java developer like me. I find, I think, that it seems to be some API definitions for instance type [2] that define, if I understand it well, all verbs that can be applied to each resource and what field can be put when adding an instance type, but nothing about fields to be included when you read a resource (and I'm not sure if its related to v4 API). I find also some java code [3] [4] that seems related to this but As I'm not a java developer, its a little bit difficult for me to find my path in it. For me this inconsistencies are a bug, but as you stated that instance types are in deep maintenance mode, do you think that bug will get some attention ?
My objective is to have a ansible module that manage the hardware/bios related stuff (memory, boot sequence, scsi controller, bios type, almost all the things) and HA for instance type.
Have a nice day.
Cheers.
[1]: https://lists.ovirt.org/archives/list/users@ovirt.org/message/TJAXYBMSIAAAYL... [2]: https://github.com/oVirt/ovirt-engine/blob/master/backend/manager/modules/re... [3]: https://github.com/oVirt/ovirt-engine/blob/ede62008318d924556bc9dfc5710d90e9... [4]: https://github.com/oVirt/ovirt-engine/blob/ede62008318d924556bc9dfc5710d90e9... [5]: https://ovirt.github.io/ovirt-engine-sdk/4.1/types.m.html#ovirtsdk4.types.In...
[6] https://github.com/ansible/ansible/blob/devel/lib/ansible/modules/cloud/ovir... [7] https://github.com/ansible/ansible/blob/devel/lib/ansible/modules/cloud/ovir... (not defined in args spec) [8] https://github.com/oVirt/ovirt-engine-sdk/search?q=all_content&unscoped_q=all_content -- Baptiste AGASSE Lyra Network France, Senior GNU/Linux engineer 109 Rue de l'innovation, 31670 Labège - France Phone: (+33)5.67.22.31.87 Website: https://www.lyra.com
participants (2)
-
Baptiste Agasse
-
Ondra Machacek