aboutsummaryrefslogtreecommitdiffstats
path: root/os_net_config/utils.py
diff options
context:
space:
mode:
authorSaravanan KR <skramaja@redhat.com>2016-12-29 17:27:42 +0530
committerSaravanan KR <skramaja@redhat.com>2017-01-04 11:42:59 +0530
commit3a0c8dabfa7ded08fec8aeebf5f432db1dbdc4e7 (patch)
tree36b6f1c0710e7281a4036dc7f1593094c14a7267 /os_net_config/utils.py
parentd621022954195049c96b19064f2eddd46ec95fe4 (diff)
Exclude SR-IOV VFs in the nic numbering
SR-IOV Virtual Functions will be present as an interface in the directory '/sys/class/net'. As these are virtual interface created during the deployment process, it has to be ignored in the nic numbering logic. Closes-Bug: #1653097 Change-Id: I118a7314d496b531c52be45521d393123cdfe915
Diffstat (limited to 'os_net_config/utils.py')
-rw-r--r--os_net_config/utils.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/os_net_config/utils.py b/os_net_config/utils.py
index af359d5..98bfe99 100644
--- a/os_net_config/utils.py
+++ b/os_net_config/utils.py
@@ -107,7 +107,16 @@ def _is_active_nic(interface_name):
with open(_SYS_CLASS_NET + '/%s/address' % interface_name, 'r') as f:
address = f.read().rstrip()
- if has_device_dir and operstate == 'up' and address:
+ # If SR-IOV Virtual Functions (VF) are enabled in an interface, there
+ # will be additional nics created for each VF. It has to be ignored in
+ # the nic numbering. All the VFs will have a reference to the PF with
+ # directory name as 'physfn', if this directory is present it should be
+ # ignored.
+ vf_path_check = _SYS_CLASS_NET + '/%s/device/physfn' % interface_name
+ is_sriov_vf = os.path.isdir(vf_path_check)
+
+ if (has_device_dir and operstate == 'up' and address and
+ not is_sriov_vf):
return True
else:
return False