Bug 1932188

Summary: The nic href in the response of getting template nics is wrong
Product: [oVirt] ovirt-engine Reporter: Qin Yuan <qiyuan>
Component: RestAPIAssignee: Ori Liel <oliel>
Status: CLOSED CURRENTRELEASE QA Contact: Raul Aghayev <raghayev>
Severity: medium Docs Contact:
Priority: medium    
Version: 4.4.5.6CC: bugs, mburman, mperina, pmatyas
Target Milestone: ovirt-4.4.5Keywords: Automation
Target Release: ---Flags: pm-rhel: ovirt-4.4+
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: ovirt-engine-4.4.5.8 Doc Type: No Doc Update
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-03-18 15:16:28 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:

Description Qin Yuan 2021-02-24 08:07:14 UTC
Description of problem:
Request to get template nics after a nic is added to the template gets wrong nic href in the response occasionally.

2021-02-22 02:30:47,623 - MainThread - nics - DEBUG - CREATE request content is --  url:/ovirt-engine/api/templates/6e969eca-b3d7-4b10-9022-34542d483415/nics body:<nic>
    <name>template_nic</name>
    <vnic_profile href="/ovirt-engine/api/vnicprofiles/ef311433-8459-42b3-b65e-6ae01e77201c" id="ef311433-8459-42b3-b65e-6ae01e77201c">
        <name>ovirtmgmt</name>
        <link href="/ovirt-engine/api/vnicprofiles/ef311433-8459-42b3-b65e-6ae01e77201c/permissions" rel="permissions"/>
        <pass_through>
            <mode>disabled</mode>
        </pass_through>
        <port_mirroring>false</port_mirroring>
        <network href="/ovirt-engine/api/networks/4e2ef15d-07ae-4894-acec-4a5426bf2028" id="4e2ef15d-07ae-4894-acec-4a5426bf2028"/>
        <network_filter href="/ovirt-engine/api/networkfilters/d2370ab4-fee3-11e9-a310-8c1645ce738e" id="d2370ab4-fee3-11e9-a310-8c1645ce738e"/>
    </vnic_profile>
</nic>

2021-02-22 02:30:47,723 - MainThread - nics - DEBUG - Response body for CREATE request is: 
<nic href="/ovirt-engine/api/templates/6e969eca-b3d7-4b10-9022-34542d483415/nics/da832111-c541-468d-927c-ac03335216da" id="da832111-c541-468d-927c-ac03335216da">
    <actions>
        <link href="/ovirt-engine/api/templates/6e969eca-b3d7-4b10-9022-34542d483415/nics/da832111-c541-468d-927c-ac03335216da/activate" rel="activate"/>
        <link href="/ovirt-engine/api/templates/6e969eca-b3d7-4b10-9022-34542d483415/nics/da832111-c541-468d-927c-ac03335216da/deactivate" rel="deactivate"/>
    </actions>
    <name>template_nic</name>
    <template href="/ovirt-engine/api/templates/6e969eca-b3d7-4b10-9022-34542d483415" id="6e969eca-b3d7-4b10-9022-34542d483415"/>
    <vm href="/ovirt-engine/api/vms/6e969eca-b3d7-4b10-9022-34542d483415" id="6e969eca-b3d7-4b10-9022-34542d483415"/>
    <interface>virtio</interface>
    <linked>true</linked>
    <plugged>true</plugged>
    <vnic_profile href="/ovirt-engine/api/vnicprofiles/ef311433-8459-42b3-b65e-6ae01e77201c" id="ef311433-8459-42b3-b65e-6ae01e77201c"/>
</nic>

2021-02-22 02:30:47,803 - MainThread - templates - DEBUG - GET request content is --  url:/ovirt-engine/api/templates/6e969eca-b3d7-4b10-9022-34542d483415/nics 
2021-02-22 02:30:47,823 - MainThread - templates - DEBUG - Response body for GET request is: 
<nics>
    <nic href="/ovirt-engine/api/vms/6e969eca-b3d7-4b10-9022-34542d483415/nics/da832111-c541-468d-927c-ac03335216da" id="da832111-c541-468d-927c-ac03335216da">
        <actions>
            <link href="/ovirt-engine/api/vms/6e969eca-b3d7-4b10-9022-34542d483415/nics/da832111-c541-468d-927c-ac03335216da/activate" rel="activate"/>
            <link href="/ovirt-engine/api/vms/6e969eca-b3d7-4b10-9022-34542d483415/nics/da832111-c541-468d-927c-ac03335216da/deactivate" rel="deactivate"/>
        </actions>
        <name>template_nic</name>
        <template href="/ovirt-engine/api/templates/6e969eca-b3d7-4b10-9022-34542d483415" id="6e969eca-b3d7-4b10-9022-34542d483415"/>
        <vm href="/ovirt-engine/api/vms/6e969eca-b3d7-4b10-9022-34542d483415" id="6e969eca-b3d7-4b10-9022-34542d483415"/>
        <interface>virtio</interface>
        <linked>true</linked>
        <plugged>true</plugged>
        <vnic_profile href="/ovirt-engine/api/vnicprofiles/ef311433-8459-42b3-b65e-6ae01e77201c" id="ef311433-8459-42b3-b65e-6ae01e77201c"/>
    </nic>
</nics>

As you can see in the get response, the nic href is "/ovirt-engine/api/vms/...", but it should be "/ovirt-engine/api/templates/..."


Version-Release number of selected component (if applicable):
ovirt-engine-4.4.5.6-0.11.el8ev.noarch


How reproducible:
Occurred occasionally in automation tests.

Steps to Reproduce:
1. Create a new template
2. Add a nic to the template
3. Get template nics

Actual results:
1. The nic href is wrong in the get response as above

Expected results:
1. The nic href in get response should be "/ovirt-engine/api/templates/..."

Additional info:

Comment 1 Ori Liel 2021-02-24 08:10:19 UTC
Patch posted:

  https://gerrit.ovirt.org/c/ovirt-engine/+/113675

Comment 2 Martin Perina 2021-03-01 09:30:39 UTC
*** Bug 1932186 has been marked as a duplicate of this bug. ***

Comment 3 Raul Aghayev 2021-03-17 12:55:38 UTC
Verified on ovirt-engine-4.4.5.9-0.1.el8ev.noarch

Comment 4 Sandro Bonazzola 2021-03-18 15:16:28 UTC
This bugzilla is included in oVirt 4.4.5 release, published on March 18th 2021.

Since the problem described in this bug report should be resolved in oVirt 4.4.5 release, it has been closed with a resolution of CURRENT RELEASE.

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