Bug 824962 - REST API: hotPlugNic - update vms/id/nics/id <active></ctive> doesn't work
Summary: REST API: hotPlugNic - update vms/id/nics/id <active></ctive> doesn't work
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Red Hat Enterprise Virtualization Manager
Classification: Red Hat
Component: ovirt-engine-restapi
Version: 3.1.0
Hardware: x86_64
OS: Linux
high
high
Target Milestone: ---
: ---
Assignee: Mike Kolesnik
QA Contact: Yaniv Kaul
URL:
Whiteboard: network
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-05-24 17:22 UTC by Avi Tal
Modified: 2016-04-22 04:59 UTC (History)
9 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2012-06-14 07:38:46 UTC
oVirt Team: Network
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
engine log (33.08 KB, application/x-compressed-tar)
2012-05-24 17:22 UTC, Avi Tal
no flags Details

Description Avi Tal 2012-05-24 17:22:04 UTC
Created attachment 586674 [details]
engine log

Description of problem:
Using PUT command to update vm nic active state doesn't work.

Try to move active False to True
Sending :
<nic>
 <name>nic3</name>
 <network id='6806a25c-532d-4bf2-a298-8a6ecfc43319'/>
 <interface>virtio</interface>
 <mac address='00:1a:4a:23:61:05'/>
 <vm id='84f4d03b-5a4e-4558-9fc6-c9a06cdd7426'/>
 <active>true</active>
</nic>

Receive 200
    <nic id="64143029-dc74-4b74-8387-6baa122c3575">
            <name>nic3</name>
            <vm href="/api/vms/84f4d03b-5a4e-4558-9fc6-c9a06cdd7426" id="84f4d03b-5a4e-4558-9fc6-c9a06cdd7426"/>
            <network href="/api/networks/6806a25c-532d-4bf2-a298-8a6ecfc43319" id="6806a25c-532d-4bf2-a298-8a6ecfc43319"/>
            <interface>virtio</interface>
            <mac address="00:1a:4a:23:61:05"/>
            <active>false</active>
    </nic>




engine.log:
2012-05-24 20:12:52,582 INFO  [org.ovirt.engine.core.bll.UpdateVmInterfaceCommand] (ajp--0.0.0.0-8009-1) [2172616] Running command: UpdateVmInterfaceCommand internal: false. Entities affected :  ID: 84f4d03b-5a4e-4558-9fc6-c9a06cdd7426 Type: VM

Comment 2 Mike Kolesnik 2012-06-13 07:39:33 UTC
REST API behavior is not to change the resource state by updating the status field, but rather by actions.
This is true for all other areas, so it is also what happens here.

There are actions to activate/deactivate the vNIC, so that's the correct way to do it.

Comment 3 Avi Tal 2012-06-13 08:50:32 UTC
It is no clear if you don't have <action> element inside <nic>!

As for the "state", it is true that rest doesn't allow to update state but in this case it doesn't represent as a "state" field.
Please go to <host> or any other element that holds state filed and see the it displayed as followed:
<status>
 <state>active</state>
</status>

So please decide if you like to add actions to hotplugnic and if so, add an <action> element. other then that, decide if you'd like to display the state and if so, follow the REST API behavior.

Comment 4 Mike Kolesnik 2012-06-13 12:19:05 UTC
I understand that bug 825499 is just about the actions elements.

Regarding the state, it is only a boolean value so it cannot be anything other than true or false. It is the same modelling which is used for other devices (Please look at Disk) so if you think this should change then it should change across the API.

Comment 5 Avi Tal 2012-06-13 13:34:56 UTC
moving 825499 to TestBlocker and open discussion on upstream

Comment 6 Mike Kolesnik 2012-06-14 07:38:46 UTC
Colsing since the other bug is the real issue.

If the active field needs to be changed then it should be a new bug which also covers disks (since this field is on the VM device level).


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