Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.
Bug 1047887 - Update vnic_profile fails for VM vnic.
Summary: Update vnic_profile fails for VM vnic.
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Enterprise Virtualization Manager
Classification: Red Hat
Component: ovirt-engine-restapi
Version: 3.3.0
Hardware: x86_64
OS: Linux
high
urgent
Target Milestone: ---
: 3.4.0
Assignee: Moti Asayag
QA Contact: GenadiC
URL:
Whiteboard: network
Depends On:
Blocks: 1064429 1064823 rhev3.4beta 1142926
TreeView+ depends on / blocked
 
Reported: 2014-01-02 13:59 UTC by Meni Yakove
Modified: 2016-02-10 19:50 UTC (History)
15 users (show)

Fixed In Version: ovirt-3.4.0-beta3
Doc Type: Bug Fix
Doc Text:
Clone Of:
: 1064429 1064823 (view as bug list)
Environment:
Last Closed: 2014-06-12 14:04:00 UTC
oVirt Team: Network
Target Upstream Version:


Attachments (Terms of Use)


Links
System ID Priority Status Summary Last Updated
oVirt gerrit 24330 None None None Never
oVirt gerrit 24348 None None None Never

Description Meni Yakove 2014-01-02 13:59:16 UTC
Description of problem:
can't update update vnic_profile for vnic (on VM) using python-sdk
No error and vnic is not updated.

Update the network on vnic works as expected.


Version-Release number of selected component (if applicable):
rhevm-sdk-python-3.3.0.21-1.el6ev.noarch

How reproducible:
100%

Comment 2 Ilia Meerovich 2014-01-02 14:33:48 UTC
similar failure occurs with Java SDK

Comment 3 Moti Asayag 2014-01-30 22:00:32 UTC
There are 2 signatures for the add/update vm nic via the api, via url:
- name: /vms/{vm:id}/nics/{nic:id}|rel=update

signatures:
      - mandatoryArguments: {}
        optionalArguments: {nic.vnic_profile.id: 'xs:string', nic.linked: 'xs:boolean', nic.name: 'xs:string', nic.mac.address: 'xs:string', nic.interface: 'xs:string', nic.plugged: 'xs:boolean'}
        description: update the network interface for the given virtual machine
      - mandatoryArguments: {}
        optionalArguments: {nic.network.id|name: 'xs:string', nic.linked: 'xs:boolean', nic.name: 'xs:string', nic.mac.address: 'xs:string', nic.interface: 'xs:string', nic.port_mirroring.networks.network--COLLECTION: {network.id: 'xs:string'}, nic.plugged: 'xs:boolean'}

Where the first signature expects the vnic profile id only, and the second supports the network name for backward compatibility.

On 4.0 we should clear the deprecated signature and support vnic actions only with the profile id.

In order to work with the vnic profile, here are 2 samples both for python-sdk 
and for java-sdk where the network name should be nullified:

example of ovirt-engine-sdk-python:
vm1 = api.vms.get('vm1')
nic = vm1.nics.get('nic1')
nic.vnic_profile = api.vnicprofiles.get('vnic-profile-name')
nic.network = None # required so no mix of old-new api
nic.update()

example of ovirt-engine-sdk-java:
VnicProfile profile = api.getVnicProfiles().get("vnic-profile-name");
VM vm = api.getVMs().get("vm1");
VMNIC vnic = vm.getNics().get("nic1");
vnic.setVnicProfile(profile);
vnic.setNetwork(null);
vnic.update();

Comment 4 Ilia Meerovich 2014-01-31 07:25:27 UTC
Moti, 

This nullification is not trivial to end user.
When user uses update in other places - he just sets needed parameters.
In this case how user will know that should nullify network? You can see that your first users that are familiar with API were confused.
Maybe it worth to add some RN for it?

Comment 5 Moti Asayag 2014-02-03 11:47:54 UTC
After additional testing with the nic.update() api, i've noticed that regardless of the vnic profile id/network name being provided in the parameters, the result of that action will shuffle the vnic profile assigned to the nic.

The engine logic for backward compatibility of the vm/template nic api should be fixed in the following manner:

1. If network name is provided, and unchanged - the vnic profile id from the parameters is used.
2. If the network name is provided and changed, use it instead of the vnic profile id.

In this way the engine assumes that only proactive changes should be considered when finding a vnic profile id for the given network.

Comment 7 GenadiC 2014-02-18 10:58:36 UTC
Verified in ovirt-engine-3.4.0-0.7.beta2.el6.noarch

Comment 8 Sandro Bonazzola 2014-02-19 12:26:40 UTC
This bug is referenced in ovirt-engine-3.4.0-beta3 logs. Moving to ON_QA

Comment 9 GenadiC 2014-02-19 13:27:00 UTC
Verified in ovirt-engine-3.4.0-0.11.beta3.el6.noarch

Comment 10 Itamar Heim 2014-06-12 14:04:00 UTC
Closing as part of 3.4.0


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