Bug 1718141

Summary: Cannot retrieve Host NIC VF configuration via REST API
Product: Red Hat Enterprise Virtualization Manager Reporter: Germano Veit Michel <gveitmic>
Component: ovirt-engine-sdk-pythonAssignee: Ori Liel <oliel>
Status: CLOSED CURRENTRELEASE QA Contact: Guilherme Santos <gdeolive>
Severity: low Docs Contact:
Priority: low    
Version: 4.3.0CC: amashah, dagur, dholler, emarcus, lleistne, mburman, mperina, oliel, omachace, pelauter, rdlugyhe, Rhev-m-bugs
Target Milestone: ovirt-4.4.0Keywords: ZStream
Target Release: ---Flags: lsvaty: testing_plan_complete-
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: rhv-4.4.0-29 Doc Type: Bug Fix
Doc Text:
Previously, the python3-ovirt-engine-sdk4 package did not include the all_content attribute of the HostNicService and HostNicsService. As a result, this attribute was effectively unavailable to python3-ovirt-engine-sdk4 users. The current release fixes this issue by adding the all_content parameter to the python3-ovirt-engine-sdk4.
Story Points: ---
Clone Of:
: 1725660 (view as bug list) Environment:
Last Closed: 2020-04-16 10:36:27 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: Infra RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1725660    

Description Germano Veit Michel 2019-06-07 04:32:03 UTC
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

Comment 2 Ondra Machacek 2019-06-10 08:12:32 UTC
We need to add this to module documentation. It should be populated in case you send header 'All-content: true'.

Comment 3 Ondra Machacek 2019-06-10 08:18:19 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})

Comment 4 amashah 2019-06-10 18:57:24 UTC
Hi Ondra,

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


Cheers,

Amar

Comment 5 Germano Veit Michel 2019-06-10 22:11:23 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

Comment 6 Ondra Machacek 2019-06-11 13:06:10 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.

Comment 7 Dominik Holler 2019-06-11 13:07:05 UTC
Dominik, is this a bug in REST-API or in SDK?

Comment 8 Dominik Holler 2019-06-12 13:09:58 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.

Comment 9 Dominik Holler 2019-06-26 13:28:30 UTC
Michael, can you please formally ack the bug?

Comment 16 Daniel Gur 2019-08-28 13:14:39 UTC
sync2jira

Comment 17 Daniel Gur 2019-08-28 13:19:42 UTC
sync2jira

Comment 21 Lukas Svaty 2020-04-16 10:36:27 UTC
Closing low severity bugs, based on QE capacity, if you would like to still verify this issue please reopen.

Comment 32 Red Hat Bugzilla 2023-09-14 05:29:53 UTC
The needinfo request[s] on this closed bug have been removed as they have been unresolved for 1000 days