Bug 1332611

Summary: vm getting wrong vnic profile
Product: [oVirt] ovirt-engine Reporter: enax
Component: RestAPIAssignee: Dan Kenigsberg <danken>
Status: CLOSED NOTABUG QA Contact: Pavel Stehlik <pstehlik>
Severity: low Docs Contact:
Priority: unspecified    
Version: 3.6.5CC: bugs, juan.hernandez, michal.skrivanek, ylavi
Target Milestone: ---Flags: rule-engine: planning_ack?
rule-engine: devel_ack?
rule-engine: testing_ack?
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-05-04 08:22:28 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: Network RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Attachments:
Description Flags
engine.log none

Description enax 2016-05-03 14:51:10 UTC
Created attachment 1153460 [details]
engine.log

Description of problem:

Vm getting wrong vnic profile after nic attach.

How reproducible:

Steps to Reproduce:
1. Make at least two vnic profile

in my case: 
name:public1011-100 id:dfbd7e0a-7f8a-496a-8488-3c1ef18eafaa
name:public1011-1000 id:41c50e4e-17c9-4266-b041-d4cb396e6732

network id:c89ff8e8-1c34-4af5-b825-cdbd8576ed10

2. create a vm with python sdk
3. add a nic

nic= params.NIC(name='nic1', vnic_profile= params.VnicProfile(id='41c50e4e-17c9-4266-b041-d4cb396e6732'), network=params.Network(id='c89ff8e8-1c34-4af5-b825-cdbd8576ed10'), interface='virtio')

vm.nics.add(nic)

Actual results:

print api.vms.get(id=vm_id).nics.list()[0].vnic_profile.id

dfbd7e0a-7f8a-496a-8488-3c1ef18eafaa

Expected results:
41c50e4e-17c9-4266-b041-d4cb396e6732

Additional info:

Comment 1 Juan Hernández 2016-05-03 16:29:58 UTC
Currently if both the NIC profile and the network are specified then the network takes precedence, and the NIC profile is just ignored. As the NIC profile already contains a reference to the network you can just remove the "network" parameter:

  nic = params.NIC(
    name='nic1', 
    vnic_profile=params.VnicProfile(
      id='41c50e4e-17c9-4266-b041-d4cb396e6732'
    ),
    interface='virtio',
  )

In addition the "network" parameter will be removed in version 4 of the API, so it is good if you stop using it already.

Comment 2 Juan Hernández 2016-05-03 16:35:51 UTC
Michal, not sure if this should be Virt or Network, please correct me as needed.

Comment 3 Michal Skrivanek 2016-05-03 16:58:44 UTC
Since it won't be an issue in 4.0 I suppose we won't do anything in 3.6 anyway. Moving to network in case I missed any semantic probleem it might cause

Comment 4 enax 2016-05-04 08:19:03 UTC
(In reply to Juan Hernández from comment #1)
> Currently if both the NIC profile and the network are specified then the
> network takes precedence, and the NIC profile is just ignored. As the NIC
> profile already contains a reference to the network you can just remove the
> "network" parameter:
> 
>   nic = params.NIC(
>     name='nic1', 
>     vnic_profile=params.VnicProfile(
>       id='41c50e4e-17c9-4266-b041-d4cb396e6732'
>     ),
>     interface='virtio',
>   )
> 
> In addition the "network" parameter will be removed in version 4 of the API,
> so it is good if you stop using it already.

Thanks, working well now.