From da274611e2b91cc94accf4f1c963609c9e1d499d Mon Sep 17 00:00:00 2001 From: waleed mousa Date: Tue, 19 Mar 2019 02:46:22 -0400 Subject: [PATCH] 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. Change-Id: Id41c0899e416ea53255850944e9105a1dba37567 --- os_net_config/sriov_config.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/os_net_config/sriov_config.py b/os_net_config/sriov_config.py index 934e02e3..2a6c8029 100644 --- a/os_net_config/sriov_config.py +++ b/os_net_config/sriov_config.py @@ -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: