Description of problem: Current way of getting Long OS name: api.operatingsysteminfos.get(name=api.vms.get(name="test").get_os()).get_description() Proposed way: api.operatingsysteminfos.get(name=api.vms.get(name="test").get_os_description() Version-Release number of selected component (if applicable): rhevm-sdk-python-3.6.2.0-1.el6ev.noarch
Note that the correct way to get the name of the operating system is the following: api.operatingsysteminfos.get( name=api.vms.get(name="myvm").get_os().get_type() ).get_description() I guess that you are suggesting to allow something like this: api.vms.get(name="myvm").get_os().get_description() This can't be done within the SDK, as the "Vm" class and the "OperatingSystem" class (returned by the Vm.get_os method) are generated from the XML schema of the API by the generateDS.py tool, and we don't have any mechanism to add additional methods. If we really want this then we would need to modify the specification of the API so that the "OperatingSystem" type includes a "Description" property. The server implementation will then need to populate this property, which will probably require an additional query per VM (afecting performance when retrieving multiple virtual machines). If this is really needed then I'd suggest the following approach: 1. Add a new "operatingSystem" property to the "Vm" type. This property should be of type "OperatingSystemInfo", not "OperatingSystem". The reason is that the "OperatingSystemInfo" type can be used as a link: <vm> ... <operating_system id="123" href="/operatingsystems/123"/> ... </vm> 2. Modify the server so that it populates this link. This shouldn't be too expensive because it only needs the id, not the description. 3. Add to the Python SDK the capability to follow links, similar to what the new Ruby SDK already provides. For example: https://github.com/oVirt/ovirt-engine-sdk-ruby/blob/master/sdk/examples/follow_vm_links.rb#L39 With these three changes the user could find the description of the operating system in like this: vm = ... os = vm.get_operating_system().follow_link() print(os.get_description()) None of these changes is trivial, and specially the changes required to the Python SDK aren't feasible unless we do a complete overhaul of it. It isn't clear at the moment if we will be able to do this overhaul for oVirt 4.
The "follow_link" method has already been added to version 4 of the SDK, so in order to complete this RFE what is needed is to modify add the "operating_system" property to the "Vm" type. I'm moving the bug to the RestAPI component and to the Virt team.
Hi Michal, can we easily do what is requested in comment #2 Also: Does it have any impact on Performance or other things? Thanks! Martin
Doesn't seem to be worth the effort. Feel free to reopen by submitting a patch