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: