Bug 1303640

Summary: [SR-IOV] - PF is no longer considered as a PF after the VM shuts down, if it was attached/added directly to VM via Host Devices sub tab
Product: [oVirt] ovirt-engine Reporter: Michael Burman <mburman>
Component: BLL.NetworkAssignee: Alona Kaplan <alkaplan>
Status: CLOSED CURRENTRELEASE QA Contact: Michael Burman <mburman>
Severity: high Docs Contact:
Priority: medium    
Version: 3.6.2.6CC: alkaplan, bugs, danken, sbonazzo, ylavi
Target Milestone: ovirt-3.6.5Flags: rule-engine: ovirt-3.6.z+
rule-engine: exception+
ylavi: planning_ack+
danken: devel_ack+
rule-engine: testing_ack+
Target Release: 3.6.5   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-04-21 14:42:26 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:
Embargoed:

Description Michael Burman 2016-02-01 14:46:44 UTC
Description of problem:
[SR-IOV] - PF is no longer considered as a PF after the VM shuts down, if it was attached/added directly to VM via Host Devices sub tab.

Direct attachment of a PF to VM via Host Devices sub tab and then shutting the VM down, will cause the NIC to no longer be considered as a PF. 

Once running VM with PF a direct attachment, his record deleted from host_nic_vfs_config table, since it has a foreign key on the vds_interface table and after shutting the VM, the host_nic_vfs_config record is not recovered. 
  
Version-Release number of selected component (if applicable):
3.6.3-0.1.el6

How reproducible:
100

Steps to Reproduce:
1. Attach a PF to VM as direct attachment via the Host Devices sub tab
2. Run the VM
3. Shut down the VM

Actual results:
PF/s no longer considered as PF/s, but as regular NICs(no sr-iov icon, no edit option).

Expected results:
PF should remain PF

Comment 1 Alona Kaplan 2016-02-01 17:09:22 UTC
An oVirt user had a similar problem-
http://lists.ovirt.org/pipermail/users/2016-January/037509.html

The names of the nics were switched.

The user had a host with 4 sriov nics.
The sriov nics were - eth2, eth3, eth4 and eth5.
After a reboot, the names were switched - eth1, eth3, eth4 and eth6 became the sriov nics.

Since the pci devices didn't change and only the 'net_iface_name' on the net devices was changed, 'host_nic_vfs_config' table is not being updated (currently, the code updates it only if the pci devices are changed).
Since the id value in vds_interface table is resolved by the nic_name reported from by getVdsCap. The vds_interface table ids and names are staying the same, just the data is switched. If previously id 'id1' referenced to name 'eth1', after the name switching id 'id1' will still reference to name 'eth1'.

The entries in 'host_nic_vfs_config' table refer via the nic_id to 'vds_interface' table.
It means that they refer to the same nic_names they referred before the switch.

Since after the names switch this nic_name no longer refer to sriov nic. It cause NPE when trying to open the 'Host setup networks' dialog of the related host (it assumes the nic is sriov and has 'total_num_of_vfs'. This assumption is wrong and causes NPE).

Comment 2 Michael Burman 2016-03-31 09:12:22 UTC
Verified on - 3.6.5-0.1.el6 and vdsm-4.17.25-0.el7ev.noarch