Bug 1305781 - [RFE] Add python method to get long name of OS directly from VM object
[RFE] Add python method to get long name of OS directly from VM object
Status: NEW
Product: ovirt-engine
Classification: oVirt
Component: RestAPI (Show other bugs)
All Linux
unspecified Severity low (vote)
: ---
: ---
Assigned To: Michal Skrivanek
Pavel Stehlik
: FutureFeature
Depends On:
  Show dependency treegraph
Reported: 2016-02-09 03:52 EST by Lukas Svaty
Modified: 2016-05-04 06:15 EDT (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of:
Last Closed:
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: Virt
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---
oourfali: ovirt‑future?
rule-engine: planning_ack?
rule-engine: devel_ack?
rule-engine: testing_ack?

Attachments (Terms of Use)

  None (edit)
Description Lukas Svaty 2016-02-09 03:52:29 EST
Description of problem:

Current way of getting Long OS name:


Proposed way:

Version-Release number of selected component (if applicable):
Comment 1 Juan Hernández 2016-02-09 05:19:58 EST
Note that the correct way to get the name of the operating system is the following:


I guess that you are suggesting to allow something like this:


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:

    <operating_system id="123" href="/operatingsystems/123"/>

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:


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()

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.
Comment 2 Juan Hernández 2016-05-04 06:15:18 EDT
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.

Note You need to log in before you can comment on or make changes to this bug.