Adding a udev rule to rename the vf representors.

The vf representors will be created after moving to switchdev mode,
so it's preffered to rename them such  like phys_port_name.

Closes-Bug: #1821931
Change-Id: Id41c0899e416ea53255850944e9105a1dba37567
(cherry picked from commit da274611e2)
This commit is contained in:
waleed mousa 2019-03-19 02:46:22 -04:00
parent f386f12b50
commit db52a40628
1 changed files with 8 additions and 0 deletions

View File

@ -125,6 +125,7 @@ def configure_sriov_pf():
f.write("%s" % vf_pci)
# Adding a udev rule to save the sriov_pf name
add_udev_rule_for_sriov_pf(item['name'])
add_udev_rule_for_vf_representors()
configure_switchdev(item['name'])
if_up_interface(item['name'])
@ -166,6 +167,13 @@ def add_udev_rule_for_sriov_pf(pf_name):
add_udev_rule(udev_data_line, _UDEV_RULE_FILE)
def add_udev_rule_for_vf_representors():
udev_data_line = 'SUBSYSTEM=="net", ACTION=="add", ATTR{phys_switch_id}'\
'!="", ATTR{phys_port_name}=="pf*vf*", '\
'NAME="$attr{phys_port_name}"\n'
add_udev_rule(udev_data_line, _UDEV_RULE_FILE)
def add_udev_rule(udev_data, udev_file):
if not os.path.exists(udev_file):
with open(udev_file, "w") as f: