Bug 1725660 - [downstream clone - 4.3.5] Cannot retrieve Host NIC VF configuration via REST API
Summary: [downstream clone - 4.3.5] Cannot retrieve Host NIC VF configuration via REST...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Virtualization Manager
Classification: Red Hat
Component: ovirt-engine-sdk-python
Version: 4.3.0
Hardware: x86_64
OS: Linux
low
low
Target Milestone: ovirt-4.3.5
: 4.3.5
Assignee: Ondra Machacek
QA Contact: samuel macko
URL:
Whiteboard:
Depends On: 1718141
Blocks:
TreeView+ depends on / blocked
 
Reported: 2019-07-01 08:24 UTC by RHV bug bot
Modified: 2020-08-03 15:39 UTC (History)
10 users (show)

Fixed In Version: python-ovirt-engine-sdk4-4.3.2
Doc Type: Bug Fix
Doc Text:
The Red Hat Virtualization REST API Guide did not include the all_content attribute of the HostNicService, and it was not possible to use this parameter with ovirt-engine-sdk-python. The REST API Guide has been updated to include the all_content parameter as part of HostNicService.
Clone Of: 1718141
Environment:
Last Closed: 2019-08-12 11:55:27 UTC
oVirt Team: Infra
Target Upstream Version:
Embargoed:
lsvaty: testing_plan_complete-


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Knowledge Base (Solution) 4210511 0 Customize or extend None How can I list Virtual Function Configuration within the RHV API / Python SDK? 2019-07-01 08:25:02 UTC
Red Hat Product Errata RHBA-2019:2447 0 None None None 2019-08-12 11:55:29 UTC
oVirt gerrit 100737 0 'None' MERGED Add allContent to HostNic Services 2020-07-01 06:37:56 UTC
oVirt gerrit 101244 0 'None' MERGED Add allContent to HostNic Services 2020-07-01 06:37:56 UTC
oVirt gerrit 101469 0 'None' MERGED restapi: Update to model 4.3.26 2020-07-01 06:37:56 UTC

Description RHV bug bot 2019-07-01 08:24:28 UTC
+++ This bug is a downstream clone. The original bug is: +++
+++   bug 1718141 +++
======================================================================

Description of problem:

A GET on api/hosts/host:id/nics/nic:id should return a HostNic struct. One of the attributes of this struct is virtual_functions_configuration of type HostNicVirtualFunctionsConfiguration.

However, this is not returned, even if the NIC is SR-IOV capable or already configured with several VFs:

# curl -X GET -H "Accept: application/xml" -u admin@internal:redhat --cacert /etc/pki/ovirt-engine/apache-ca.pem https://FQDN/ovirt-engine/api/hosts/878c17db-b9b3-4bb7-8569-f6249159e74d/nics/8fdbac61-7c14-443a-94e5-1a90a223c535
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<host_nic href="/ovirt-engine/api/hosts/878c17db-b9b3-4bb7-8569-f6249159e74d/nics/8fdbac61-7c14-443a-94e5-1a90a223c535" id="8fdbac61-7c14-443a-94e5-1a90a223c535">
    <actions/>
    <name>eno3</name>
    <link href="/ovirt-engine/api/hosts/878c17db-b9b3-4bb7-8569-f6249159e74d/nics/8fdbac61-7c14-443a-94e5-1a90a223c535/networklabels" rel="networklabels"/>
    <link href="/ovirt-engine/api/hosts/878c17db-b9b3-4bb7-8569-f6249159e74d/nics/8fdbac61-7c14-443a-94e5-1a90a223c535/networkattachments" rel="networkattachments"/>
    <link href="/ovirt-engine/api/hosts/878c17db-b9b3-4bb7-8569-f6249159e74d/nics/8fdbac61-7c14-443a-94e5-1a90a223c535/linklayerdiscoveryprotocolelements" rel="linklayerdiscoveryprotocolelements"/>
    <link href="/ovirt-engine/api/hosts/878c17db-b9b3-4bb7-8569-f6249159e74d/nics/8fdbac61-7c14-443a-94e5-1a90a223c535/statistics" rel="statistics"/>
    <boot_protocol>none</boot_protocol>
    <bridged>false</bridged>
    <ip>
        <address></address>
        <netmask></netmask>
        <version>v4</version>
    </ip>
    <ipv6_boot_protocol>autoconf</ipv6_boot_protocol>
    <mac>
        <address>40:f2:e9:08:96:d4</address>
    </mac>
    <mtu>1500</mtu>
    <status>down</status>
    <host href="/ovirt-engine/api/hosts/878c17db-b9b3-4bb7-8569-f6249159e74d" id="878c17db-b9b3-4bb7-8569-f6249159e74d"/>
</host_nic>

I might be wrong, but it looks like that to include vdsConfig this the GET on HostNic would need to call lookupNic[1] with the second parameter as `true`, so that it runs doPopulate which apparently makes it include vfsConfig[2].

[1] https://github.com/oVirt/ovirt-engine/blob/master/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendHostNicResource.java#L44

[2] https://github.com/oVirt/ovirt-engine/blob/master/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendHostNicsResource.java#L174

Version-Release number of selected component (if applicable):
rhvm-4.2.8.7-0.1.el7ev.noarch (don't see a related code change on 4.3 or master)

How reproducible:
Always

Steps to Reproduce:
1. curl -X GET -H "Accept: application/xml" https://<FQDN>/ovirt-engine/api/hosts/host:id/nics/nic:id

Actual results:
Missing virtual_functions_configuration

Expected results:
With virtual_functions_configuration

Additional info:
HostNic struct: https://access.redhat.com/documentation/en-us/red_hat_virtualization/4.3/html/rest_api_guide/types#types-host_nic

(Originally by Germano Veit Michel)

Comment 2 RHV bug bot 2019-07-01 08:24:32 UTC
We need to add this to module documentation. It should be populated in case you send header 'All-content: true'.

(Originally by Ondra Machacek)

Comment 3 RHV bug bot 2019-07-01 08:24:34 UTC
Actually I see customer reported it on SDK, usually if it defined in model, and documented, you can use all_content as follows:

 my_service.list(search='name=myentity', all_content=True)

but it's not for the host nics service. So you can workaround it using:

 my_service.list(search='name=myentity', headers={'All-content': True})

(Originally by Ondra Machacek)

Comment 4 RHV bug bot 2019-07-01 08:24:35 UTC
Hi Ondra,

Thanks for the quick response, the workaround works for the customer.


Cheers,

Amar

(Originally by Amar Shah)

Comment 5 RHV bug bot 2019-07-01 08:24:37 UTC
(In reply to Ondra Machacek from comment #3)
> but it's not for the host nics service. So you can workaround it using:
> 
>  my_service.list(search='name=myentity', headers={'All-content': True})

Its only for vms_service() right? I did try on nics_service and it indeed is not implemented there.

I think you had a few bugs from me where the problem is all_content. Maybe we should review everything that might be missing it?

Thanks

(Originally by Germano Veit Michel)

Comment 6 RHV bug bot 2019-07-01 08:24:39 UTC
(In reply to Germano Veit Michel from comment #5)
> 
> Maybe we should review everything that might be missing it?
> 

Yeah, in order to not have similar bugs in future, it would be good to review all places and fix them if needed.

(Originally by Ondra Machacek)

Comment 7 RHV bug bot 2019-07-01 08:24:41 UTC
Dominik, is this a bug in REST-API or in SDK?

(Originally by Dominik Holler)

Comment 8 RHV bug bot 2019-07-01 08:24:44 UTC
(In reply to Dominik Holler from comment #7)
> Dominik, is this a bug in REST-API or in SDK?

REST-API.

If this bug is fixed, the virtual_functions_configuration will be included, if the HTTP request contains the header
"All-Content: True".
Please note that the query string ?all_content=true is ignored because of bug 1383746.

(Originally by Dominik Holler)

Comment 9 RHV bug bot 2019-07-01 08:24:45 UTC
Michael, can you please formally ack the bug?

(Originally by Dominik Holler)

Comment 13 Sandro Bonazzola 2019-07-10 09:56:22 UTC
Is this on wrong component? Or does this require a sdk rebuild? I found reference to this bug in ovirt-engine-4.3.5.4 code commits but not in SDK.

Comment 14 Ondra Machacek 2019-07-10 10:24:54 UTC
This needs SDK rebuild. I've added appropriate fixed-in-version.

Comment 16 samuel macko 2019-07-15 13:08:20 UTC
Verified on ovirt version 4.3.5.4-0.1.el7.
If a request contains a header "All-Content: True", a result contains
<virtual_functions_configuration>
    ...
</virtual_functions_configuration>

Comment 17 Steve Goodman 2019-08-01 12:56:46 UTC
The doc_text field said:

"The all_content parameter is added to the documentation of the HostNicService"

Which documentation? The REST API Guide? It's not published yet, will the model be updated for RHV 4.3.5?

_______________

> Cause: The documentation did not include the all_content attribute of the HostNicService.

> Consequence: The ovirt-engine-sdk-pyton did not offer this parameter to the user.
_______________

I don't understand. Are you saying that because the documentation (again, not sure which document) didn't include the all_content parameter (and the HostNicService?), the Python SDK didn't offer this parameter? Do you mean that the parameter existed, but because it wasn't documented, the user had no way of knowing that this parameter existed?

I updated the doc_text field according to my understanding based on what appears in this bug and in the upstream version, but I can't find it mentioned in any published guide, neither upstream nor downstream. If it is published, please include a URL to the document.

Comment 18 Dominik Holler 2019-08-01 13:10:49 UTC
(In reply to Steve Goodman from comment #17)
> The doc_text field said:
> 
> "The all_content parameter is added to the documentation of the
> HostNicService"
> 
> Which documentation? The REST API Guide?

Yes.

> It's not published yet, will the
> model be updated for RHV 4.3.5?
> 

Yes, the REST API Guide should be updated.

> _______________
> 
> > Cause: The documentation did not include the all_content attribute of the HostNicService.
> 
> > Consequence: The ovirt-engine-sdk-pyton did not offer this parameter to the user.
> _______________
> 
> I don't understand. Are you saying that because the documentation (again,
> not sure which document) didn't include the all_content parameter (and the
> HostNicService?), the Python SDK didn't offer this parameter? 

Parts of the REST API Guide and the SDK are generated from the same source, the ovirt-engine-api-model.

> Do you mean
> that the parameter existed, but because it wasn't documented, the user had
> no way of knowing that this parameter existed?
> 

The plain REST API user could have guess this, but the parameter was not available to Python SDK users.

> I updated the doc_text field according to my understanding based on what

Both, the REST API Guide and the ovirt-engine-sdk-python are both generated,
so the change in the doc is not the reason why ovirt-engine-sdk-python is updated.
The reason is the update of the ovirt-engine-api-model, but I think this is not relevant to the user.
Maybe it is enough to mention that both is updated.
Maybe:
The Red Hat Virtualization REST API Guide did not include the all_content attribute of the HostNicService. Consequently, it was not possible to use this parameter with ovirt-engine-sdk-python. 
->
The Red Hat Virtualization REST API Guide did not include the all_content attribute of the HostNicService. And it was not possible to use this parameter with ovirt-engine-sdk-python. 

> appears in this bug and in the upstream version, but I can't find it
> mentioned in any published guide, neither upstream nor downstream. If it is
> published, please include a URL to the document.
http://ovirt.github.io/ovirt-engine-api-model/4.3/#services/host_nic/methods/get

Comment 19 Steve Goodman 2019-08-01 13:30:23 UTC
OK, thanks Dominik.

So I believe that the doc_text is correct. Correct?

Comment 20 Dominik Holler 2019-08-01 13:31:58 UTC
I think the "Consequently" should be replaced by "And".

Comment 21 Dominik Holler 2019-08-01 14:28:38 UTC
Thanks Steve!

Comment 24 errata-xmlrpc 2019-08-12 11:55:27 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2019:2447

Comment 26 Daniel Gur 2019-08-28 13:15:03 UTC
sync2jira

Comment 27 Daniel Gur 2019-08-28 13:20:06 UTC
sync2jira


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