Bug 1875412

Summary: Request to create a nic on template gets wrong response content
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.2.3CC: bugs, dholler, gdeolive, lleistne, mburman, mperina, oliel, pmatyas
Target Milestone: ovirt-4.4.5Keywords: Automation
Target Release: ---Flags: pm-rhel: ovirt-4.4+
gdeolive: testing_ack+
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: ovirt-engine-4.4.5.4 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-03-18 15:13:12 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:
Attachments:
Description Flags
auto-test-logs none

Description Qin Yuan 2020-09-03 13:56:42 UTC
Created attachment 1713625 [details]
auto-test-logs

Description of problem:
A request to create nic on template is:

2020-09-02 16:25:47,889 - MainThread - nics - DEBUG - CREATE request content is --  url:/ovirt-engine/api/templates/b0e22323-3bce-42e6-9215-4d481c215223/nics body:<nic>
    <name>template_nic</name>
    <vnic_profile href="/ovirt-engine/api/vnicprofiles/fc1bbebb-8809-4a4d-8390-39104894cf93" id="fc1bbebb-8809-4a4d-8390-39104894cf93">
        <name>ovirtmgmt</name>
        <link href="/ovirt-engine/api/vnicprofiles/fc1bbebb-8809-4a4d-8390-39104894cf93/permissions" rel="permissions"/>
        <pass_through>
            <mode>disabled</mode>
        </pass_through>
        <port_mirroring>false</port_mirroring>
        <network href="/ovirt-engine/api/networks/4e307f7a-0c5b-4667-9355-e4e2e1a8b01e" id="4e307f7a-0c5b-4667-9355-e4e2e1a8b01e"/>
        <network_filter href="/ovirt-engine/api/networkfilters/d2370ab4-fee3-11e9-a310-8c1645ce738e" id="d2370ab4-fee3-11e9-a310-8c1645ce738e"/>
    </vnic_profile>
</nic>

The nic href in response body is /ovirt-engine/api/vms/b0e22323-3bce-42e6-9215-4d481c215223/nics/.., but not /ovirt-engine/api/templates/b0e22323-3bce-42e6-9215-4d481c215223/nics/.., and it has deactivate/activate actions which shouldn't be present, see:

2020-09-02 16:25:47,955 - MainThread - nics - DEBUG - Response body for CREATE request is: 
<nic href="/ovirt-engine/api/vms/b0e22323-3bce-42e6-9215-4d481c215223/nics/a4f57a1a-ab6a-4e0e-ba39-72522ff049fc" id="a4f57a1a-ab6a-4e0e-ba39-72522ff049fc">
    <actions>
        <link href="/ovirt-engine/api/vms/b0e22323-3bce-42e6-9215-4d481c215223/nics/a4f57a1a-ab6a-4e0e-ba39-72522ff049fc/deactivate" rel="deactivate"/>
        <link href="/ovirt-engine/api/vms/b0e22323-3bce-42e6-9215-4d481c215223/nics/a4f57a1a-ab6a-4e0e-ba39-72522ff049fc/activate" rel="activate"/>
    </actions>
    <name>template_nic</name>
    <template href="/ovirt-engine/api/templates/b0e22323-3bce-42e6-9215-4d481c215223" id="b0e22323-3bce-42e6-9215-4d481c215223"/>
    <vm href="/ovirt-engine/api/vms/b0e22323-3bce-42e6-9215-4d481c215223" id="b0e22323-3bce-42e6-9215-4d481c215223"/>
    <interface>virtio</interface>
    <linked>true</linked>
    <plugged>true</plugged>
    <vnic_profile href="/ovirt-engine/api/vnicprofiles/fc1bbebb-8809-4a4d-8390-39104894cf93" id="fc1bbebb-8809-4a4d-8390-39104894cf93"/>
</nic>


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

How reproducible:
It happened twice on latest tests, RHV-4.4-tier1-PPC #9, RHV-4.4-tier1-PPC #10.
Failed to reproduce it by running the same test from local.

Steps to Reproduce:
1. Add a new vm template_base_vm_1
2. Create template test_template_1_base from vm template_base_vm_1
3. Create vm vm_no_disk_1 from template test_template_1_base
4. Add nic template_nic to template test_template_1_base

Actual results:
1. The create response body is wrong as above

Expected results:
1. The nic href in response body should be /ovirt-engine/api/templates/b0e22323-3bce-42e6-9215-4d481c215223/nics/.., and no deactivate/activate actions.

Additional info:

Comment 3 Sandro Bonazzola 2021-01-15 10:22:39 UTC
Referenced patch has been merged, anything else needed or can this bug be moved to MODIFIED?

Comment 4 Raul Aghayev 2021-02-18 09:04:46 UTC
Verified on ovirt-engine-4.4.5.4-0.6.el8ev.noarch

Comment 5 Sandro Bonazzola 2021-03-18 15:13:12 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.