)]}'
{"/COMMIT_MSG":[{"author":{"_account_id":15334,"name":"Stephen Finucane","display_name":"stephenfin","email":"stephenfin@redhat.com","username":"sfinucan"},"change_message_id":"60228bf04a3fc0e0322f0d3b74138f791db32130","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":5,"id":"7f231b9d_13d618c5","line":23,"updated":"2017-06-20 09:05:04.000000000","message":"There should really be a co-authored-by moi tag here for the doc changes","commit_id":"b4f22aea9ef4f8fc2f3029e431cf41e96e18b6b9"},{"author":{"_account_id":12171,"name":"Moshe Levi","email":"moshele@nvidia.com","username":"moshele"},"change_message_id":"7194405fee3c550723442cb4f4e274714421fb4c","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":5,"id":"7f231b9d_b9dbc51f","line":23,"in_reply_to":"7f231b9d_13d618c5","updated":"2017-06-20 11:38:48.000000000","message":"how co-authored-by  related to doc changes?\ndid we use DocImpact or something like that?","commit_id":"b4f22aea9ef4f8fc2f3029e431cf41e96e18b6b9"},{"author":{"_account_id":15334,"name":"Stephen Finucane","display_name":"stephenfin","email":"stephenfin@redhat.com","username":"sfinucan"},"change_message_id":"12602b15b5de0300d7914a2e9ab7e8e13bfa7d1a","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":6,"id":"7f231b9d_ebdba01e","line":23,"updated":"2017-06-20 10:36:10.000000000","message":"Still missing that Co-Authored-By, buddy :)","commit_id":"99d9f50c94f150ad21a3b1ead10777d4c341c899"},{"author":{"_account_id":12171,"name":"Moshe Levi","email":"moshele@nvidia.com","username":"moshele"},"change_message_id":"330f2d377acdf32fa4bc782c1a3ec3c09ae12cfb","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":6,"id":"7f231b9d_a15a6780","line":23,"in_reply_to":"7f231b9d_ebdba01e","updated":"2017-06-20 11:53:04.000000000","message":"yes did understand why we need it","commit_id":"99d9f50c94f150ad21a3b1ead10777d4c341c899"}],"doc/source/plugins/ovs.rst":[{"author":{"_account_id":7,"name":"Jay Pipes","email":"jaypipes@gmail.com","username":"jaypipes"},"change_message_id":"1a69946d143447e821e11eb7712075a9653e8792","unresolved":false,"context_lines":[{"line_number":42,"context_line":""},{"line_number":43,"context_line":"      ethtool -K \u003cPF\u003e hw-tc-offload"},{"line_number":44,"context_line":""},{"line_number":45,"context_line":"  This will create *VF representor* per VF. The VF representor plays the same"},{"line_number":46,"context_line":"  role as TAP devices in Para-Virtual (PV) setup. In this case the ``plug()``"},{"line_number":47,"context_line":"  method connects the VF representor to the OpenVSwitch bridge."},{"line_number":48,"context_line":""}],"source_content_type":"text/x-rst","patch_set":4,"id":"7f231b9d_e5cac06c","line":45,"updated":"2017-06-19 21:17:20.000000000","message":"s/create/create a/","commit_id":"e65ba07d3358d7242a074a5282d183a0a2719fdb"},{"author":{"_account_id":12171,"name":"Moshe Levi","email":"moshele@nvidia.com","username":"moshele"},"change_message_id":"86a7b2a6819cf82063a06c82ce9aed9c9a4fc582","unresolved":false,"context_lines":[{"line_number":42,"context_line":""},{"line_number":43,"context_line":"      ethtool -K \u003cPF\u003e hw-tc-offload"},{"line_number":44,"context_line":""},{"line_number":45,"context_line":"  This will create *VF representor* per VF. The VF representor plays the same"},{"line_number":46,"context_line":"  role as TAP devices in Para-Virtual (PV) setup. In this case the ``plug()``"},{"line_number":47,"context_line":"  method connects the VF representor to the OpenVSwitch bridge."},{"line_number":48,"context_line":""}],"source_content_type":"text/x-rst","patch_set":4,"id":"7f231b9d_315eb745","line":45,"in_reply_to":"7f231b9d_e5cac06c","updated":"2017-06-20 03:13:04.000000000","message":"Done","commit_id":"e65ba07d3358d7242a074a5282d183a0a2719fdb"},{"author":{"_account_id":11604,"name":"sean mooney","email":"smooney@redhat.com","username":"sean-k-mooney"},"change_message_id":"854a2ac4f725b2dcf96734a682b8bfc1f4c06834","unresolved":false,"context_lines":[{"line_number":40,"context_line":""},{"line_number":41,"context_line":"  .. code-block:: shell"},{"line_number":42,"context_line":""},{"line_number":43,"context_line":"      ethtool -K \u003cPF\u003e hw-tc-offload"},{"line_number":44,"context_line":""},{"line_number":45,"context_line":"  This will create a *VF representor* per VF. The VF representor plays the same"},{"line_number":46,"context_line":"  role as TAP devices in Para-Virtual (PV) setup. In this case the ``plug()``"}],"source_content_type":"text/x-rst","patch_set":9,"id":"5f201791_55318359","line":43,"range":{"start_line":43,"start_character":6,"end_line":43,"end_character":35},"updated":"2017-06-26 20:39:26.000000000","message":"out of interested is the the only way to enable the representors or can this be done also via a kernel module argument or some other way that spans reboots.","commit_id":"2a09ede8fb15df6c3ef520d1107437df1d16aa89"},{"author":{"_account_id":12171,"name":"Moshe Levi","email":"moshele@nvidia.com","username":"moshele"},"change_message_id":"80b747390c4cbe36a9897f9c16af633638e17abc","unresolved":false,"context_lines":[{"line_number":40,"context_line":""},{"line_number":41,"context_line":"  .. code-block:: shell"},{"line_number":42,"context_line":""},{"line_number":43,"context_line":"      ethtool -K \u003cPF\u003e hw-tc-offload"},{"line_number":44,"context_line":""},{"line_number":45,"context_line":"  This will create a *VF representor* per VF. The VF representor plays the same"},{"line_number":46,"context_line":"  role as TAP devices in Para-Virtual (PV) setup. In this case the ``plug()``"}],"source_content_type":"text/x-rst","patch_set":9,"id":"5f201791_f7af6fe0","line":43,"range":{"start_line":43,"start_character":6,"end_line":43,"end_character":35},"in_reply_to":"5f201791_55318359","updated":"2017-06-27 01:08:29.000000000","message":"this is the only way","commit_id":"2a09ede8fb15df6c3ef520d1107437df1d16aa89"}],"vif_plug_ovs/linux_net.py":[{"author":{"_account_id":7,"name":"Jay Pipes","email":"jaypipes@gmail.com","username":"jaypipes"},"change_message_id":"1a69946d143447e821e11eb7712075a9653e8792","unresolved":false,"context_lines":[{"line_number":247,"context_line":"                device_sw_id \u003d open(device_sw_id_file).readline().rstrip()"},{"line_number":248,"context_line":"            except IOError:"},{"line_number":249,"context_line":"                continue"},{"line_number":250,"context_line":"            if device_sw_id !\u003d pf_sw_id:"},{"line_number":251,"context_line":"                continue"},{"line_number":252,"context_line":"            device_port_name_file \u003d os.path.join(device_path, \u0027phys_port_name\u0027)"},{"line_number":253,"context_line":"            if not os.path.isfile(device_port_name_file):"}],"source_content_type":"text/x-python","patch_set":4,"id":"7f231b9d_c51fc4b5","line":250,"updated":"2017-06-19 21:17:20.000000000","message":"Just curious, but in what ways can the VF\u0027s physical switch ID not match the physical switch ID of its physical function?","commit_id":"e65ba07d3358d7242a074a5282d183a0a2719fdb"},{"author":{"_account_id":12171,"name":"Moshe Levi","email":"moshele@nvidia.com","username":"moshele"},"change_message_id":"8fe0a4b6fb078eea81fb63ef875529874a930c1d","unresolved":false,"context_lines":[{"line_number":247,"context_line":"                device_sw_id \u003d open(device_sw_id_file).readline().rstrip()"},{"line_number":248,"context_line":"            except IOError:"},{"line_number":249,"context_line":"                continue"},{"line_number":250,"context_line":"            if device_sw_id !\u003d pf_sw_id:"},{"line_number":251,"context_line":"                continue"},{"line_number":252,"context_line":"            device_port_name_file \u003d os.path.join(device_path, \u0027phys_port_name\u0027)"},{"line_number":253,"context_line":"            if not os.path.isfile(device_port_name_file):"}],"source_content_type":"text/x-python","patch_set":4,"id":"7f231b9d_160cd140","line":250,"in_reply_to":"7f231b9d_c51fc4b5","updated":"2017-06-20 02:07:19.000000000","message":"when you have dual port NIC if os.listdir under \"/sys/class/net/\u003cpf\u003e/subsystem\" you will see the PF and VFs of the other port. therefore we need to make sure we select a VF with the same switch_id as the PF.","commit_id":"e65ba07d3358d7242a074a5282d183a0a2719fdb"},{"author":{"_account_id":7,"name":"Jay Pipes","email":"jaypipes@gmail.com","username":"jaypipes"},"change_message_id":"1a69946d143447e821e11eb7712075a9653e8792","unresolved":false,"context_lines":[{"line_number":285,"context_line":"def get_ifname_by_pci_address(pci_addr, pf_interface\u003dFalse):"},{"line_number":286,"context_line":"    \"\"\"Get the interface name based on a VF\u0027s pci address"},{"line_number":287,"context_line":""},{"line_number":288,"context_line":"    The returned interface name is either the parent PF\u0027s or that of the VF"},{"line_number":289,"context_line":"    itself based on the argument of pf_interface."},{"line_number":290,"context_line":"    \"\"\""},{"line_number":291,"context_line":"    dev_path \u003d _get_sysfs_netdev_path(pci_addr, pf_interface)"}],"source_content_type":"text/x-python","patch_set":4,"id":"7f231b9d_a5a60853","line":288,"range":{"start_line":288,"start_character":55,"end_line":288,"end_character":57},"updated":"2017-06-19 21:17:20.000000000","message":"s/PF\u0027s/PF/","commit_id":"e65ba07d3358d7242a074a5282d183a0a2719fdb"},{"author":{"_account_id":12171,"name":"Moshe Levi","email":"moshele@nvidia.com","username":"moshele"},"change_message_id":"86a7b2a6819cf82063a06c82ce9aed9c9a4fc582","unresolved":false,"context_lines":[{"line_number":285,"context_line":"def get_ifname_by_pci_address(pci_addr, pf_interface\u003dFalse):"},{"line_number":286,"context_line":"    \"\"\"Get the interface name based on a VF\u0027s pci address"},{"line_number":287,"context_line":""},{"line_number":288,"context_line":"    The returned interface name is either the parent PF\u0027s or that of the VF"},{"line_number":289,"context_line":"    itself based on the argument of pf_interface."},{"line_number":290,"context_line":"    \"\"\""},{"line_number":291,"context_line":"    dev_path \u003d _get_sysfs_netdev_path(pci_addr, pf_interface)"}],"source_content_type":"text/x-python","patch_set":4,"id":"7f231b9d_f12cbfad","line":288,"range":{"start_line":288,"start_character":55,"end_line":288,"end_character":57},"in_reply_to":"7f231b9d_a5a60853","updated":"2017-06-20 03:13:04.000000000","message":"Done","commit_id":"e65ba07d3358d7242a074a5282d183a0a2719fdb"},{"author":{"_account_id":7,"name":"Jay Pipes","email":"jaypipes@gmail.com","username":"jaypipes"},"change_message_id":"1a69946d143447e821e11eb7712075a9653e8792","unresolved":false,"context_lines":[{"line_number":291,"context_line":"    dev_path \u003d _get_sysfs_netdev_path(pci_addr, pf_interface)"},{"line_number":292,"context_line":"    try:"},{"line_number":293,"context_line":"        dev_info \u003d os.listdir(dev_path)"},{"line_number":294,"context_line":"        return dev_info.pop()"},{"line_number":295,"context_line":"    except Exception:"},{"line_number":296,"context_line":"        raise exception.PciDeviceNotFoundById(id\u003dpci_addr)"},{"line_number":297,"context_line":""}],"source_content_type":"text/x-python","patch_set":4,"id":"7f231b9d_e571a0e0","line":294,"updated":"2017-06-19 21:17:20.000000000","message":"Is this relying on a particular order of dev_info?","commit_id":"e65ba07d3358d7242a074a5282d183a0a2719fdb"},{"author":{"_account_id":12171,"name":"Moshe Levi","email":"moshele@nvidia.com","username":"moshele"},"change_message_id":"8fe0a4b6fb078eea81fb63ef875529874a930c1d","unresolved":false,"context_lines":[{"line_number":291,"context_line":"    dev_path \u003d _get_sysfs_netdev_path(pci_addr, pf_interface)"},{"line_number":292,"context_line":"    try:"},{"line_number":293,"context_line":"        dev_info \u003d os.listdir(dev_path)"},{"line_number":294,"context_line":"        return dev_info.pop()"},{"line_number":295,"context_line":"    except Exception:"},{"line_number":296,"context_line":"        raise exception.PciDeviceNotFoundById(id\u003dpci_addr)"},{"line_number":297,"context_line":""}],"source_content_type":"text/x-python","patch_set":4,"id":"7f231b9d_11373be6","line":294,"in_reply_to":"7f231b9d_e571a0e0","updated":"2017-06-20 02:07:19.000000000","message":"no, it will have only one interface to return. In this case we use it to get the pf interface name when we have the VF pci address.   \n\nThis function is the same as in pci/utils.py in nova see \nhttps://github.com/openstack/nova/blob/master/nova/pci/utils.py#L127-L138","commit_id":"e65ba07d3358d7242a074a5282d183a0a2719fdb"},{"author":{"_account_id":15334,"name":"Stephen Finucane","display_name":"stephenfin","email":"stephenfin@redhat.com","username":"sfinucan"},"change_message_id":"60228bf04a3fc0e0322f0d3b74138f791db32130","unresolved":false,"context_lines":[{"line_number":234,"context_line":"    the requested VF."},{"line_number":235,"context_line":"    \"\"\""},{"line_number":236,"context_line":"    try:"},{"line_number":237,"context_line":"        pf_path \u003d \"/sys/class/net/%s\" % pf_ifname"},{"line_number":238,"context_line":"        pf_sw_id_file \u003d os.path.join(pf_path, \"phys_switch_id\")"},{"line_number":239,"context_line":"        pf_sw_id \u003d open(pf_sw_id_file).readline().rstrip()"},{"line_number":240,"context_line":"        pf_subsystem_file \u003d os.path.join(pf_path, \"subsystem\")"},{"line_number":241,"context_line":"        for device in os.listdir(pf_subsystem_file):"}],"source_content_type":"text/x-python","patch_set":5,"id":"7f231b9d_13adf830","line":238,"range":{"start_line":237,"start_character":0,"end_line":238,"end_character":63},"updated":"2017-06-20 09:05:04.000000000","message":"A lot of these don\u0027t need to be inside the try-except","commit_id":"b4f22aea9ef4f8fc2f3029e431cf41e96e18b6b9"},{"author":{"_account_id":7,"name":"Jay Pipes","email":"jaypipes@gmail.com","username":"jaypipes"},"change_message_id":"6cdcfb60d029125712834f496394e09d5422de45","unresolved":false,"context_lines":[{"line_number":234,"context_line":"    the requested VF."},{"line_number":235,"context_line":"    \"\"\""},{"line_number":236,"context_line":"    try:"},{"line_number":237,"context_line":"        pf_path \u003d \"/sys/class/net/%s\" % pf_ifname"},{"line_number":238,"context_line":"        pf_sw_id_file \u003d os.path.join(pf_path, \"phys_switch_id\")"},{"line_number":239,"context_line":"        pf_sw_id \u003d open(pf_sw_id_file).readline().rstrip()"},{"line_number":240,"context_line":"        pf_subsystem_file \u003d os.path.join(pf_path, \"subsystem\")"},{"line_number":241,"context_line":"        for device in os.listdir(pf_subsystem_file):"}],"source_content_type":"text/x-python","patch_set":5,"id":"7f231b9d_4423a106","line":238,"range":{"start_line":237,"start_character":0,"end_line":238,"end_character":63},"in_reply_to":"7f231b9d_13adf830","updated":"2017-06-20 12:16:04.000000000","message":"Actually, Stephen, the above lines definitely do need to be inside the try/except block. On systems without SR-IOV-enabled NICs, you\u0027ll get an IOError EOPNOTSUPP when attempting to access either of the above pseudo-files:\n\n jaypipes@uberbox:~$ ll /sys/class/net/enp0s25\n lrwxrwxrwx 1 root root 0 Jun 20 00:16 /sys/class/net/enp0s25 -\u003e ../../devices/pci0000:00/0000:00:19.0/net/enp0s25/\n jaypipes@uberbox:~$ ll /sys/class/net/enp0s25/phys_switch_id \n -r--r--r-- 1 root root 4096 Jun 20 08:11 /sys/class/net/enp0s25/phys_switch_id\n jaypipes@uberbox:~$ cat /sys/class/net/enp0s25/phys_switch_id \n cat: /sys/class/net/enp0s25/phys_switch_id: Operation not supported","commit_id":"b4f22aea9ef4f8fc2f3029e431cf41e96e18b6b9"},{"author":{"_account_id":12171,"name":"Moshe Levi","email":"moshele@nvidia.com","username":"moshele"},"change_message_id":"7194405fee3c550723442cb4f4e274714421fb4c","unresolved":false,"context_lines":[{"line_number":234,"context_line":"    the requested VF."},{"line_number":235,"context_line":"    \"\"\""},{"line_number":236,"context_line":"    try:"},{"line_number":237,"context_line":"        pf_path \u003d \"/sys/class/net/%s\" % pf_ifname"},{"line_number":238,"context_line":"        pf_sw_id_file \u003d os.path.join(pf_path, \"phys_switch_id\")"},{"line_number":239,"context_line":"        pf_sw_id \u003d open(pf_sw_id_file).readline().rstrip()"},{"line_number":240,"context_line":"        pf_subsystem_file \u003d os.path.join(pf_path, \"subsystem\")"},{"line_number":241,"context_line":"        for device in os.listdir(pf_subsystem_file):"}],"source_content_type":"text/x-python","patch_set":5,"id":"7f231b9d_f9d81d1f","line":238,"range":{"start_line":237,"start_character":0,"end_line":238,"end_character":63},"in_reply_to":"7f231b9d_13adf830","updated":"2017-06-20 11:38:48.000000000","message":"Done","commit_id":"b4f22aea9ef4f8fc2f3029e431cf41e96e18b6b9"},{"author":{"_account_id":15334,"name":"Stephen Finucane","display_name":"stephenfin","email":"stephenfin@redhat.com","username":"sfinucan"},"change_message_id":"6bece097821f08c66fd6ae7f4740b3254ab9a3f4","unresolved":false,"context_lines":[{"line_number":234,"context_line":"    the requested VF."},{"line_number":235,"context_line":"    \"\"\""},{"line_number":236,"context_line":"    try:"},{"line_number":237,"context_line":"        pf_path \u003d \"/sys/class/net/%s\" % pf_ifname"},{"line_number":238,"context_line":"        pf_sw_id_file \u003d os.path.join(pf_path, \"phys_switch_id\")"},{"line_number":239,"context_line":"        pf_sw_id \u003d open(pf_sw_id_file).readline().rstrip()"},{"line_number":240,"context_line":"        pf_subsystem_file \u003d os.path.join(pf_path, \"subsystem\")"},{"line_number":241,"context_line":"        for device in os.listdir(pf_subsystem_file):"}],"source_content_type":"text/x-python","patch_set":5,"id":"7f231b9d_7f03ca74","line":238,"range":{"start_line":237,"start_character":0,"end_line":238,"end_character":63},"in_reply_to":"7f231b9d_4423a106","updated":"2017-06-20 12:44:34.000000000","message":"But we\u0027re not actually opening anything here - we\u0027re only building a path","commit_id":"b4f22aea9ef4f8fc2f3029e431cf41e96e18b6b9"},{"author":{"_account_id":15334,"name":"Stephen Finucane","display_name":"stephenfin","email":"stephenfin@redhat.com","username":"sfinucan"},"change_message_id":"60228bf04a3fc0e0322f0d3b74138f791db32130","unresolved":false,"context_lines":[{"line_number":236,"context_line":"    try:"},{"line_number":237,"context_line":"        pf_path \u003d \"/sys/class/net/%s\" % pf_ifname"},{"line_number":238,"context_line":"        pf_sw_id_file \u003d os.path.join(pf_path, \"phys_switch_id\")"},{"line_number":239,"context_line":"        pf_sw_id \u003d open(pf_sw_id_file).readline().rstrip()"},{"line_number":240,"context_line":"        pf_subsystem_file \u003d os.path.join(pf_path, \"subsystem\")"},{"line_number":241,"context_line":"        for device in os.listdir(pf_subsystem_file):"},{"line_number":242,"context_line":"            if device \u003d\u003d pf_ifname:"}],"source_content_type":"text/x-python","patch_set":5,"id":"7f231b9d_13ff3835","line":239,"range":{"start_line":239,"start_character":8,"end_line":239,"end_character":58},"updated":"2017-06-20 09:05:04.000000000","message":"You\u0027re leaving this file descriptor open. You should probably use context managers instead","commit_id":"b4f22aea9ef4f8fc2f3029e431cf41e96e18b6b9"},{"author":{"_account_id":12171,"name":"Moshe Levi","email":"moshele@nvidia.com","username":"moshele"},"change_message_id":"7194405fee3c550723442cb4f4e274714421fb4c","unresolved":false,"context_lines":[{"line_number":236,"context_line":"    try:"},{"line_number":237,"context_line":"        pf_path \u003d \"/sys/class/net/%s\" % pf_ifname"},{"line_number":238,"context_line":"        pf_sw_id_file \u003d os.path.join(pf_path, \"phys_switch_id\")"},{"line_number":239,"context_line":"        pf_sw_id \u003d open(pf_sw_id_file).readline().rstrip()"},{"line_number":240,"context_line":"        pf_subsystem_file \u003d os.path.join(pf_path, \"subsystem\")"},{"line_number":241,"context_line":"        for device in os.listdir(pf_subsystem_file):"},{"line_number":242,"context_line":"            if device \u003d\u003d pf_ifname:"}],"source_content_type":"text/x-python","patch_set":5,"id":"7f231b9d_b92985f3","line":239,"range":{"start_line":239,"start_character":8,"end_line":239,"end_character":58},"in_reply_to":"7f231b9d_13ff3835","updated":"2017-06-20 11:38:48.000000000","message":"Done","commit_id":"b4f22aea9ef4f8fc2f3029e431cf41e96e18b6b9"},{"author":{"_account_id":15334,"name":"Stephen Finucane","display_name":"stephenfin","email":"stephenfin@redhat.com","username":"sfinucan"},"change_message_id":"60228bf04a3fc0e0322f0d3b74138f791db32130","unresolved":false,"context_lines":[{"line_number":254,"context_line":"                continue"},{"line_number":255,"context_line":"            try:"},{"line_number":256,"context_line":"                representor_num \u003d ("},{"line_number":257,"context_line":"                    open(device_port_name_file).readline().rstrip())"},{"line_number":258,"context_line":"                if int(representor_num) \u003d\u003d int(vf_num):"},{"line_number":259,"context_line":"                    return device"},{"line_number":260,"context_line":"            except IOError as e:"}],"source_content_type":"text/x-python","patch_set":5,"id":"7f231b9d_d3f8a04a","line":257,"range":{"start_line":257,"start_character":20,"end_line":257,"end_character":68},"updated":"2017-06-20 09:05:04.000000000","message":"ditto","commit_id":"b4f22aea9ef4f8fc2f3029e431cf41e96e18b6b9"},{"author":{"_account_id":12171,"name":"Moshe Levi","email":"moshele@nvidia.com","username":"moshele"},"change_message_id":"7194405fee3c550723442cb4f4e274714421fb4c","unresolved":false,"context_lines":[{"line_number":254,"context_line":"                continue"},{"line_number":255,"context_line":"            try:"},{"line_number":256,"context_line":"                representor_num \u003d ("},{"line_number":257,"context_line":"                    open(device_port_name_file).readline().rstrip())"},{"line_number":258,"context_line":"                if int(representor_num) \u003d\u003d int(vf_num):"},{"line_number":259,"context_line":"                    return device"},{"line_number":260,"context_line":"            except IOError as e:"}],"source_content_type":"text/x-python","patch_set":5,"id":"7f231b9d_7933ed63","line":257,"range":{"start_line":257,"start_character":20,"end_line":257,"end_character":68},"in_reply_to":"7f231b9d_d3f8a04a","updated":"2017-06-20 11:38:48.000000000","message":"Done","commit_id":"b4f22aea9ef4f8fc2f3029e431cf41e96e18b6b9"},{"author":{"_account_id":15334,"name":"Stephen Finucane","display_name":"stephenfin","email":"stephenfin@redhat.com","username":"sfinucan"},"change_message_id":"12602b15b5de0300d7914a2e9ab7e8e13bfa7d1a","unresolved":false,"context_lines":[{"line_number":256,"context_line":"                continue"},{"line_number":257,"context_line":"            try:"},{"line_number":258,"context_line":"                representor_num \u003d ("},{"line_number":259,"context_line":"                    open(device_port_name_file).readline().rstrip())"},{"line_number":260,"context_line":"                if int(representor_num) \u003d\u003d int(vf_num):"},{"line_number":261,"context_line":"                    return device"},{"line_number":262,"context_line":"            except IOError as e:"}],"source_content_type":"text/x-python","patch_set":6,"id":"7f231b9d_2bc4f83f","line":259,"range":{"start_line":259,"start_character":20,"end_line":259,"end_character":67},"updated":"2017-06-20 10:36:10.000000000","message":"got another one here","commit_id":"99d9f50c94f150ad21a3b1ead10777d4c341c899"},{"author":{"_account_id":12171,"name":"Moshe Levi","email":"moshele@nvidia.com","username":"moshele"},"change_message_id":"330f2d377acdf32fa4bc782c1a3ec3c09ae12cfb","unresolved":false,"context_lines":[{"line_number":256,"context_line":"                continue"},{"line_number":257,"context_line":"            try:"},{"line_number":258,"context_line":"                representor_num \u003d ("},{"line_number":259,"context_line":"                    open(device_port_name_file).readline().rstrip())"},{"line_number":260,"context_line":"                if int(representor_num) \u003d\u003d int(vf_num):"},{"line_number":261,"context_line":"                    return device"},{"line_number":262,"context_line":"            except IOError as e:"}],"source_content_type":"text/x-python","patch_set":6,"id":"7f231b9d_e1ee1f8a","line":259,"range":{"start_line":259,"start_character":20,"end_line":259,"end_character":67},"in_reply_to":"7f231b9d_2bc4f83f","updated":"2017-06-20 11:53:04.000000000","message":"Done","commit_id":"99d9f50c94f150ad21a3b1ead10777d4c341c899"},{"author":{"_account_id":15334,"name":"Stephen Finucane","display_name":"stephenfin","email":"stephenfin@redhat.com","username":"sfinucan"},"change_message_id":"12602b15b5de0300d7914a2e9ab7e8e13bfa7d1a","unresolved":false,"context_lines":[{"line_number":239,"context_line":"        with open(pf_sw_id_file, \u0027r\u0027) as fd:"},{"line_number":240,"context_line":"            pf_sw_id \u003d fd.readline().rstrip()"},{"line_number":241,"context_line":"        pf_subsystem_file \u003d os.path.join(pf_path, \"subsystem\")"},{"line_number":242,"context_line":"        for device in os.listdir(pf_subsystem_file):"},{"line_number":243,"context_line":"            if device \u003d\u003d pf_ifname:"},{"line_number":244,"context_line":"                continue"},{"line_number":245,"context_line":"            try:"},{"line_number":246,"context_line":"                device_path \u003d \"/sys/class/net/%s\" % device"},{"line_number":247,"context_line":"                device_sw_id_file \u003d os.path.join(device_path, \"phys_switch_id\")"},{"line_number":248,"context_line":"                with open(device_sw_id_file, \u0027r\u0027) as fd:"},{"line_number":249,"context_line":"                    device_sw_id \u003d fd.readline().rstrip()"},{"line_number":250,"context_line":"            except IOError:"},{"line_number":251,"context_line":"                continue"},{"line_number":252,"context_line":"            if device_sw_id !\u003d pf_sw_id:"},{"line_number":253,"context_line":"                continue"},{"line_number":254,"context_line":"            device_port_name_file \u003d os.path.join(device_path, \u0027phys_port_name\u0027)"},{"line_number":255,"context_line":"            if not os.path.isfile(device_port_name_file):"},{"line_number":256,"context_line":"                continue"},{"line_number":257,"context_line":"            try:"},{"line_number":258,"context_line":"                representor_num \u003d ("},{"line_number":259,"context_line":"                    open(device_port_name_file).readline().rstrip())"},{"line_number":260,"context_line":"                if int(representor_num) \u003d\u003d int(vf_num):"},{"line_number":261,"context_line":"                    return device"},{"line_number":262,"context_line":"            except IOError as e:"},{"line_number":263,"context_line":"                # We want to ignore interfaces which we can\u0027t read their"},{"line_number":264,"context_line":"                # phys_port_name file."},{"line_number":265,"context_line":"                with excutils.save_and_reraise_exception() as ctxt:"},{"line_number":266,"context_line":"                    if e.errno \u003d\u003d errno.EOPNOTSUPP:"},{"line_number":267,"context_line":"                        ctxt.reraise \u003d False"},{"line_number":268,"context_line":"            except ValueError:"},{"line_number":269,"context_line":"                # skip representor_num which we can\u0027t convert to integer"},{"line_number":270,"context_line":"                continue"},{"line_number":271,"context_line":""},{"line_number":272,"context_line":"    except IOError:"},{"line_number":273,"context_line":"        pass"}],"source_content_type":"text/x-python","patch_set":6,"id":"7f231b9d_6bcaf04f","line":270,"range":{"start_line":242,"start_character":8,"end_line":270,"end_character":24},"updated":"2017-06-20 10:36:10.000000000","message":"Again, all of this needs to moved out of the try-except - you\u0027re already handling the IOError\u0027s for each open","commit_id":"99d9f50c94f150ad21a3b1ead10777d4c341c899"},{"author":{"_account_id":12171,"name":"Moshe Levi","email":"moshele@nvidia.com","username":"moshele"},"change_message_id":"330f2d377acdf32fa4bc782c1a3ec3c09ae12cfb","unresolved":false,"context_lines":[{"line_number":239,"context_line":"        with open(pf_sw_id_file, \u0027r\u0027) as fd:"},{"line_number":240,"context_line":"            pf_sw_id \u003d fd.readline().rstrip()"},{"line_number":241,"context_line":"        pf_subsystem_file \u003d os.path.join(pf_path, \"subsystem\")"},{"line_number":242,"context_line":"        for device in os.listdir(pf_subsystem_file):"},{"line_number":243,"context_line":"            if device \u003d\u003d pf_ifname:"},{"line_number":244,"context_line":"                continue"},{"line_number":245,"context_line":"            try:"},{"line_number":246,"context_line":"                device_path \u003d \"/sys/class/net/%s\" % device"},{"line_number":247,"context_line":"                device_sw_id_file \u003d os.path.join(device_path, \"phys_switch_id\")"},{"line_number":248,"context_line":"                with open(device_sw_id_file, \u0027r\u0027) as fd:"},{"line_number":249,"context_line":"                    device_sw_id \u003d fd.readline().rstrip()"},{"line_number":250,"context_line":"            except IOError:"},{"line_number":251,"context_line":"                continue"},{"line_number":252,"context_line":"            if device_sw_id !\u003d pf_sw_id:"},{"line_number":253,"context_line":"                continue"},{"line_number":254,"context_line":"            device_port_name_file \u003d os.path.join(device_path, \u0027phys_port_name\u0027)"},{"line_number":255,"context_line":"            if not os.path.isfile(device_port_name_file):"},{"line_number":256,"context_line":"                continue"},{"line_number":257,"context_line":"            try:"},{"line_number":258,"context_line":"                representor_num \u003d ("},{"line_number":259,"context_line":"                    open(device_port_name_file).readline().rstrip())"},{"line_number":260,"context_line":"                if int(representor_num) \u003d\u003d int(vf_num):"},{"line_number":261,"context_line":"                    return device"},{"line_number":262,"context_line":"            except IOError as e:"},{"line_number":263,"context_line":"                # We want to ignore interfaces which we can\u0027t read their"},{"line_number":264,"context_line":"                # phys_port_name file."},{"line_number":265,"context_line":"                with excutils.save_and_reraise_exception() as ctxt:"},{"line_number":266,"context_line":"                    if e.errno \u003d\u003d errno.EOPNOTSUPP:"},{"line_number":267,"context_line":"                        ctxt.reraise \u003d False"},{"line_number":268,"context_line":"            except ValueError:"},{"line_number":269,"context_line":"                # skip representor_num which we can\u0027t convert to integer"},{"line_number":270,"context_line":"                continue"},{"line_number":271,"context_line":""},{"line_number":272,"context_line":"    except IOError:"},{"line_number":273,"context_line":"        pass"}],"source_content_type":"text/x-python","patch_set":6,"id":"7f231b9d_61232fc0","line":270,"range":{"start_line":242,"start_character":8,"end_line":270,"end_character":24},"in_reply_to":"7f231b9d_6bcaf04f","updated":"2017-06-20 11:53:04.000000000","message":"we can\u0027t because of Line 265 which raise again the IOError","commit_id":"99d9f50c94f150ad21a3b1ead10777d4c341c899"},{"author":{"_account_id":7,"name":"Jay Pipes","email":"jaypipes@gmail.com","username":"jaypipes"},"change_message_id":"cdc66515fba13e30cdc7dc0f923df538b8c9f325","unresolved":false,"context_lines":[{"line_number":234,"context_line":"    the requested VF."},{"line_number":235,"context_line":"    \"\"\""},{"line_number":236,"context_line":"    pf_path \u003d \"/sys/class/net/%s\" % pf_ifname"},{"line_number":237,"context_line":"    pf_sw_id_file \u003d os.path.join(pf_path, \"phys_switch_id\")"},{"line_number":238,"context_line":"    try:"},{"line_number":239,"context_line":"        with open(pf_sw_id_file, \u0027r\u0027) as fd:"},{"line_number":240,"context_line":"            pf_sw_id \u003d fd.readline().rstrip()"}],"source_content_type":"text/x-python","patch_set":7,"id":"7f231b9d_64b0dd8c","line":237,"updated":"2017-06-20 12:19:10.000000000","message":"ah, ok, good to put the above outside the try/except block.","commit_id":"715bd23a0b0e973258e6d31a47b64a15f80726a7"},{"author":{"_account_id":15334,"name":"Stephen Finucane","display_name":"stephenfin","email":"stephenfin@redhat.com","username":"sfinucan"},"change_message_id":"2da3734e27619cb99b97145db22f5ea01ebf6f36","unresolved":false,"context_lines":[{"line_number":236,"context_line":"    pf_path \u003d \"/sys/class/net/%s\" % pf_ifname"},{"line_number":237,"context_line":"    pf_sw_id_file \u003d os.path.join(pf_path, \"phys_switch_id\")"},{"line_number":238,"context_line":"    try:"},{"line_number":239,"context_line":"        with open(pf_sw_id_file, \u0027r\u0027) as fd:"},{"line_number":240,"context_line":"            pf_sw_id \u003d fd.readline().rstrip()"},{"line_number":241,"context_line":"        pf_subsystem_file \u003d os.path.join(pf_path, \"subsystem\")"},{"line_number":242,"context_line":"        for device in os.listdir(pf_subsystem_file):"},{"line_number":243,"context_line":"            if device \u003d\u003d pf_ifname:"}],"source_content_type":"text/x-python","patch_set":7,"id":"7f231b9d_1f4736bf","line":240,"range":{"start_line":239,"start_character":0,"end_line":240,"end_character":45},"updated":"2017-06-20 12:44:04.000000000","message":"This has to be inside the try","commit_id":"715bd23a0b0e973258e6d31a47b64a15f80726a7"},{"author":{"_account_id":15334,"name":"Stephen Finucane","display_name":"stephenfin","email":"stephenfin@redhat.com","username":"sfinucan"},"change_message_id":"2da3734e27619cb99b97145db22f5ea01ebf6f36","unresolved":false,"context_lines":[{"line_number":238,"context_line":"    try:"},{"line_number":239,"context_line":"        with open(pf_sw_id_file, \u0027r\u0027) as fd:"},{"line_number":240,"context_line":"            pf_sw_id \u003d fd.readline().rstrip()"},{"line_number":241,"context_line":"        pf_subsystem_file \u003d os.path.join(pf_path, \"subsystem\")"},{"line_number":242,"context_line":"        for device in os.listdir(pf_subsystem_file):"},{"line_number":243,"context_line":"            if device \u003d\u003d pf_ifname:"},{"line_number":244,"context_line":"                continue"},{"line_number":245,"context_line":"            try:"},{"line_number":246,"context_line":"                device_path \u003d \"/sys/class/net/%s\" % device"},{"line_number":247,"context_line":"                device_sw_id_file \u003d os.path.join(device_path, \"phys_switch_id\")"}],"source_content_type":"text/x-python","patch_set":7,"id":"7f231b9d_df12deb4","line":244,"range":{"start_line":241,"start_character":0,"end_line":244,"end_character":24},"updated":"2017-06-20 12:44:04.000000000","message":"this does not","commit_id":"715bd23a0b0e973258e6d31a47b64a15f80726a7"},{"author":{"_account_id":11604,"name":"sean mooney","email":"smooney@redhat.com","username":"sean-k-mooney"},"change_message_id":"3f83449b0a38576b4b501e411ccc318e2211d7bf","unresolved":false,"context_lines":[{"line_number":238,"context_line":"    try:"},{"line_number":239,"context_line":"        with open(pf_sw_id_file, \u0027r\u0027) as fd:"},{"line_number":240,"context_line":"            pf_sw_id \u003d fd.readline().rstrip()"},{"line_number":241,"context_line":"        pf_subsystem_file \u003d os.path.join(pf_path, \"subsystem\")"},{"line_number":242,"context_line":"        for device in os.listdir(pf_subsystem_file):"},{"line_number":243,"context_line":"            if device \u003d\u003d pf_ifname:"},{"line_number":244,"context_line":"                continue"},{"line_number":245,"context_line":"            try:"},{"line_number":246,"context_line":"                device_path \u003d \"/sys/class/net/%s\" % device"},{"line_number":247,"context_line":"                device_sw_id_file \u003d os.path.join(device_path, \"phys_switch_id\")"}],"source_content_type":"text/x-python","patch_set":7,"id":"5f201791_88667a51","line":244,"range":{"start_line":241,"start_character":0,"end_line":244,"end_character":24},"in_reply_to":"7f231b9d_df12deb4","updated":"2017-06-20 20:46:15.000000000","message":"based on \nhttps://docs.python.org/3/library/exceptions.html#NotADirectoryError\nos.listdir may throw an excpetion in python3\nif pf_subsystem_file is not a directory.","commit_id":"715bd23a0b0e973258e6d31a47b64a15f80726a7"},{"author":{"_account_id":15334,"name":"Stephen Finucane","display_name":"stephenfin","email":"stephenfin@redhat.com","username":"sfinucan"},"change_message_id":"2da3734e27619cb99b97145db22f5ea01ebf6f36","unresolved":false,"context_lines":[{"line_number":243,"context_line":"            if device \u003d\u003d pf_ifname:"},{"line_number":244,"context_line":"                continue"},{"line_number":245,"context_line":"            try:"},{"line_number":246,"context_line":"                device_path \u003d \"/sys/class/net/%s\" % device"},{"line_number":247,"context_line":"                device_sw_id_file \u003d os.path.join(device_path, \"phys_switch_id\")"},{"line_number":248,"context_line":"                with open(device_sw_id_file, \u0027r\u0027) as fd:"},{"line_number":249,"context_line":"                    device_sw_id \u003d fd.readline().rstrip()"},{"line_number":250,"context_line":"            except IOError:"}],"source_content_type":"text/x-python","patch_set":7,"id":"7f231b9d_7f118aac","line":247,"range":{"start_line":246,"start_character":0,"end_line":247,"end_character":79},"updated":"2017-06-20 12:44:04.000000000","message":"this doesn\u0027t need to be inside this try-except, and it definitely doesn\u0027t need to be inside two of them","commit_id":"715bd23a0b0e973258e6d31a47b64a15f80726a7"},{"author":{"_account_id":11604,"name":"sean mooney","email":"smooney@redhat.com","username":"sean-k-mooney"},"change_message_id":"3f83449b0a38576b4b501e411ccc318e2211d7bf","unresolved":false,"context_lines":[{"line_number":243,"context_line":"            if device \u003d\u003d pf_ifname:"},{"line_number":244,"context_line":"                continue"},{"line_number":245,"context_line":"            try:"},{"line_number":246,"context_line":"                device_path \u003d \"/sys/class/net/%s\" % device"},{"line_number":247,"context_line":"                device_sw_id_file \u003d os.path.join(device_path, \"phys_switch_id\")"},{"line_number":248,"context_line":"                with open(device_sw_id_file, \u0027r\u0027) as fd:"},{"line_number":249,"context_line":"                    device_sw_id \u003d fd.readline().rstrip()"},{"line_number":250,"context_line":"            except IOError:"}],"source_content_type":"text/x-python","patch_set":7,"id":"5f201791_68d0beca","line":247,"range":{"start_line":246,"start_character":0,"end_line":247,"end_character":79},"in_reply_to":"7f231b9d_7f118aac","updated":"2017-06-20 20:46:15.000000000","message":"yes that can go outside the try.","commit_id":"715bd23a0b0e973258e6d31a47b64a15f80726a7"},{"author":{"_account_id":15334,"name":"Stephen Finucane","display_name":"stephenfin","email":"stephenfin@redhat.com","username":"sfinucan"},"change_message_id":"2da3734e27619cb99b97145db22f5ea01ebf6f36","unresolved":false,"context_lines":[{"line_number":247,"context_line":"                device_sw_id_file \u003d os.path.join(device_path, \"phys_switch_id\")"},{"line_number":248,"context_line":"                with open(device_sw_id_file, \u0027r\u0027) as fd:"},{"line_number":249,"context_line":"                    device_sw_id \u003d fd.readline().rstrip()"},{"line_number":250,"context_line":"            except IOError:"},{"line_number":251,"context_line":"                continue"},{"line_number":252,"context_line":"            if device_sw_id !\u003d pf_sw_id:"},{"line_number":253,"context_line":"                continue"}],"source_content_type":"text/x-python","patch_set":7,"id":"7f231b9d_3f51d263","line":250,"range":{"start_line":250,"start_character":0,"end_line":250,"end_character":27},"updated":"2017-06-20 12:44:04.000000000","message":"nested exception handlers for the same exception. Am I actually missing something or is this unnecessary","commit_id":"715bd23a0b0e973258e6d31a47b64a15f80726a7"},{"author":{"_account_id":11604,"name":"sean mooney","email":"smooney@redhat.com","username":"sean-k-mooney"},"change_message_id":"3f83449b0a38576b4b501e411ccc318e2211d7bf","unresolved":false,"context_lines":[{"line_number":247,"context_line":"                device_sw_id_file \u003d os.path.join(device_path, \"phys_switch_id\")"},{"line_number":248,"context_line":"                with open(device_sw_id_file, \u0027r\u0027) as fd:"},{"line_number":249,"context_line":"                    device_sw_id \u003d fd.readline().rstrip()"},{"line_number":250,"context_line":"            except IOError:"},{"line_number":251,"context_line":"                continue"},{"line_number":252,"context_line":"            if device_sw_id !\u003d pf_sw_id:"},{"line_number":253,"context_line":"                continue"}],"source_content_type":"text/x-python","patch_set":7,"id":"5f201791_2803e644","line":250,"range":{"start_line":250,"start_character":0,"end_line":250,"end_character":27},"in_reply_to":"7f231b9d_3f51d263","updated":"2017-06-20 20:46:15.000000000","message":"well here this catch is to deal with the case that the defice file for the vf is not found.\nthe outter try is catch the edgecase where the pf is not found in sysfs","commit_id":"715bd23a0b0e973258e6d31a47b64a15f80726a7"},{"author":{"_account_id":15334,"name":"Stephen Finucane","display_name":"stephenfin","email":"stephenfin@redhat.com","username":"sfinucan"},"change_message_id":"2da3734e27619cb99b97145db22f5ea01ebf6f36","unresolved":false,"context_lines":[{"line_number":257,"context_line":"            try:"},{"line_number":258,"context_line":"                with open(device_sw_id_file, \u0027r\u0027) as fd:"},{"line_number":259,"context_line":"                    representor_num \u003d fd.readline().rstrip()"},{"line_number":260,"context_line":"                    if int(representor_num) \u003d\u003d int(vf_num):"},{"line_number":261,"context_line":"                        return device"},{"line_number":262,"context_line":"            except IOError as e:"},{"line_number":263,"context_line":"                # We want to ignore interfaces which we can\u0027t read their"},{"line_number":264,"context_line":"                # phys_port_name file."}],"source_content_type":"text/x-python","patch_set":7,"id":"7f231b9d_ff4a3aaa","line":261,"range":{"start_line":260,"start_character":0,"end_line":261,"end_character":37},"updated":"2017-06-20 12:44:04.000000000","message":"This doesn\u0027t need to be inside the context manager (or even inside the try-except, though you may want to handle ValueError?","commit_id":"715bd23a0b0e973258e6d31a47b64a15f80726a7"},{"author":{"_account_id":11604,"name":"sean mooney","email":"smooney@redhat.com","username":"sean-k-mooney"},"change_message_id":"3f83449b0a38576b4b501e411ccc318e2211d7bf","unresolved":false,"context_lines":[{"line_number":257,"context_line":"            try:"},{"line_number":258,"context_line":"                with open(device_sw_id_file, \u0027r\u0027) as fd:"},{"line_number":259,"context_line":"                    representor_num \u003d fd.readline().rstrip()"},{"line_number":260,"context_line":"                    if int(representor_num) \u003d\u003d int(vf_num):"},{"line_number":261,"context_line":"                        return device"},{"line_number":262,"context_line":"            except IOError as e:"},{"line_number":263,"context_line":"                # We want to ignore interfaces which we can\u0027t read their"},{"line_number":264,"context_line":"                # phys_port_name file."}],"source_content_type":"text/x-python","patch_set":7,"id":"5f201791_a89496e9","line":261,"range":{"start_line":260,"start_character":0,"end_line":261,"end_character":37},"in_reply_to":"5f201791_98d6d9f1","updated":"2017-06-20 20:46:15.000000000","message":"+1","commit_id":"715bd23a0b0e973258e6d31a47b64a15f80726a7"},{"author":{"_account_id":12171,"name":"Moshe Levi","email":"moshele@nvidia.com","username":"moshele"},"change_message_id":"0ff55a5b0887bee0f56f342309f3fdeb65ebc259","unresolved":false,"context_lines":[{"line_number":257,"context_line":"            try:"},{"line_number":258,"context_line":"                with open(device_sw_id_file, \u0027r\u0027) as fd:"},{"line_number":259,"context_line":"                    representor_num \u003d fd.readline().rstrip()"},{"line_number":260,"context_line":"                    if int(representor_num) \u003d\u003d int(vf_num):"},{"line_number":261,"context_line":"                        return device"},{"line_number":262,"context_line":"            except IOError as e:"},{"line_number":263,"context_line":"                # We want to ignore interfaces which we can\u0027t read their"},{"line_number":264,"context_line":"                # phys_port_name file."}],"source_content_type":"text/x-python","patch_set":7,"id":"5f201791_663205f4","line":261,"range":{"start_line":260,"start_character":0,"end_line":261,"end_character":37},"in_reply_to":"5f201791_98d6d9f1","updated":"2017-06-22 03:02:28.000000000","message":"so the \"with open\" statement catch the exceptions so if I will move it out of the with I will need to check that representor_num is not None which is kind ugly (I think)","commit_id":"715bd23a0b0e973258e6d31a47b64a15f80726a7"},{"author":{"_account_id":15334,"name":"Stephen Finucane","display_name":"stephenfin","email":"stephenfin@redhat.com","username":"sfinucan"},"change_message_id":"e1c8160210bffed68f7b4ff12912f01c7b5770ba","unresolved":false,"context_lines":[{"line_number":257,"context_line":"            try:"},{"line_number":258,"context_line":"                with open(device_sw_id_file, \u0027r\u0027) as fd:"},{"line_number":259,"context_line":"                    representor_num \u003d fd.readline().rstrip()"},{"line_number":260,"context_line":"                    if int(representor_num) \u003d\u003d int(vf_num):"},{"line_number":261,"context_line":"                        return device"},{"line_number":262,"context_line":"            except IOError as e:"},{"line_number":263,"context_line":"                # We want to ignore interfaces which we can\u0027t read their"},{"line_number":264,"context_line":"                # phys_port_name file."}],"source_content_type":"text/x-python","patch_set":7,"id":"5f201791_98d6d9f1","line":261,"range":{"start_line":260,"start_character":0,"end_line":261,"end_character":37},"in_reply_to":"7f231b9d_ff4a3aaa","updated":"2017-06-20 13:44:10.000000000","message":"Additionally, this is the only place that this function can return but it\u0027s kind of lost in here. Moving it out to its own statement would be very helpful","commit_id":"715bd23a0b0e973258e6d31a47b64a15f80726a7"},{"author":{"_account_id":7,"name":"Jay Pipes","email":"jaypipes@gmail.com","username":"jaypipes"},"change_message_id":"f02f297fc46d0dd4dc6fa29c3674fe8dab1783c2","unresolved":false,"context_lines":[{"line_number":236,"context_line":"    pf_sw_id_file \u003d os.path.join(pf_path, \"phys_switch_id\")"},{"line_number":237,"context_line":""},{"line_number":238,"context_line":"    pf_sw_id \u003d None"},{"line_number":239,"context_line":"    with open(pf_sw_id_file, \u0027r\u0027) as fd:"},{"line_number":240,"context_line":"        pf_sw_id \u003d fd.readline().rstrip()"},{"line_number":241,"context_line":""},{"line_number":242,"context_line":"    if pf_sw_id is None:"}],"source_content_type":"text/x-python","patch_set":8,"id":"5f201791_b2fa6472","line":239,"updated":"2017-06-23 14:32:27.000000000","message":"This needs to be in a try/except block, since systems that do not have SR-IOV PCIe NIC support will throw EOPNOTSUPP when attempting to open the /sys/class/net/{device}/phys_switch_id pseudo-file from sysfs:\n\n jaypipes@uberbox:~$ cat /sys/class/net/enp0s25/phys_switch_id \n cat: /sys/class/net/enp0s25/phys_switch_id: Operation not supported","commit_id":"0687f3972e3419a437845f17abf38bba6b5afff5"},{"author":{"_account_id":12171,"name":"Moshe Levi","email":"moshele@nvidia.com","username":"moshele"},"change_message_id":"9d3379cf35f75495775ad210eb8092f1ae005fbf","unresolved":false,"context_lines":[{"line_number":236,"context_line":"    pf_sw_id_file \u003d os.path.join(pf_path, \"phys_switch_id\")"},{"line_number":237,"context_line":""},{"line_number":238,"context_line":"    pf_sw_id \u003d None"},{"line_number":239,"context_line":"    with open(pf_sw_id_file, \u0027r\u0027) as fd:"},{"line_number":240,"context_line":"        pf_sw_id \u003d fd.readline().rstrip()"},{"line_number":241,"context_line":""},{"line_number":242,"context_line":"    if pf_sw_id is None:"}],"source_content_type":"text/x-python","patch_set":8,"id":"5f201791_5f7543ca","line":239,"in_reply_to":"5f201791_b2fa6472","updated":"2017-06-25 06:21:47.000000000","message":"Done","commit_id":"0687f3972e3419a437845f17abf38bba6b5afff5"},{"author":{"_account_id":7,"name":"Jay Pipes","email":"jaypipes@gmail.com","username":"jaypipes"},"change_message_id":"f02f297fc46d0dd4dc6fa29c3674fe8dab1783c2","unresolved":false,"context_lines":[{"line_number":254,"context_line":""},{"line_number":255,"context_line":"        device_path \u003d \"/sys/class/net/%s\" % device"},{"line_number":256,"context_line":"        device_sw_id_file \u003d os.path.join(device_path, \"phys_switch_id\")"},{"line_number":257,"context_line":"        with open(device_sw_id_file, \u0027r\u0027) as fd:"},{"line_number":258,"context_line":"            device_sw_id \u003d fd.readline().rstrip()"},{"line_number":259,"context_line":"            if device_sw_id !\u003d pf_sw_id:"},{"line_number":260,"context_line":"                continue"}],"source_content_type":"text/x-python","patch_set":8,"id":"5f201791_1218f8d0","line":257,"updated":"2017-06-23 14:32:27.000000000","message":"here too.\n\nYou can just wrap the call to with open() with the try/except block:\n\n try:\n     with open(device_sw_id_file, \u0027r\u0027) as fd:\n         device_sw_id \u003d fd.readline().rstrip()\n except (OSError, IOError):\n     continue\n\n if device_sw_id !\u003d pf_sw_id:\n     ....","commit_id":"0687f3972e3419a437845f17abf38bba6b5afff5"},{"author":{"_account_id":12171,"name":"Moshe Levi","email":"moshele@nvidia.com","username":"moshele"},"change_message_id":"9d3379cf35f75495775ad210eb8092f1ae005fbf","unresolved":false,"context_lines":[{"line_number":254,"context_line":""},{"line_number":255,"context_line":"        device_path \u003d \"/sys/class/net/%s\" % device"},{"line_number":256,"context_line":"        device_sw_id_file \u003d os.path.join(device_path, \"phys_switch_id\")"},{"line_number":257,"context_line":"        with open(device_sw_id_file, \u0027r\u0027) as fd:"},{"line_number":258,"context_line":"            device_sw_id \u003d fd.readline().rstrip()"},{"line_number":259,"context_line":"            if device_sw_id !\u003d pf_sw_id:"},{"line_number":260,"context_line":"                continue"}],"source_content_type":"text/x-python","patch_set":8,"id":"5f201791_1f7b4bbe","line":257,"in_reply_to":"5f201791_1218f8d0","updated":"2017-06-25 06:21:47.000000000","message":"Done","commit_id":"0687f3972e3419a437845f17abf38bba6b5afff5"},{"author":{"_account_id":11604,"name":"sean mooney","email":"smooney@redhat.com","username":"sean-k-mooney"},"change_message_id":"854a2ac4f725b2dcf96734a682b8bfc1f4c06834","unresolved":false,"context_lines":[{"line_number":232,"context_line":"    VF number in the phys_port_name. That interface is the representor for"},{"line_number":233,"context_line":"    the requested VF."},{"line_number":234,"context_line":"    \"\"\""},{"line_number":235,"context_line":"    pf_path \u003d \"/sys/class/net/%s\" % pf_ifname"},{"line_number":236,"context_line":"    pf_sw_id_file \u003d os.path.join(pf_path, \"phys_switch_id\")"},{"line_number":237,"context_line":""},{"line_number":238,"context_line":"    pf_sw_id \u003d None"},{"line_number":239,"context_line":"    try:"},{"line_number":240,"context_line":"        with open(pf_sw_id_file, \u0027r\u0027) as fd:"},{"line_number":241,"context_line":"            pf_sw_id \u003d fd.readline().rstrip()"},{"line_number":242,"context_line":"    except (OSError, IOError):"},{"line_number":243,"context_line":"        raise exception.RepresentorNotFound(ifname\u003dpf_ifname, vf_num\u003dvf_num)"},{"line_number":244,"context_line":""},{"line_number":245,"context_line":"    pf_subsystem_file \u003d os.path.join(pf_path, \"subsystem\")"},{"line_number":246,"context_line":"    try:"},{"line_number":247,"context_line":"        devices \u003d os.listdir(pf_subsystem_file)"},{"line_number":248,"context_line":"    except (OSError, IOError):"},{"line_number":249,"context_line":"        raise exception.RepresentorNotFound(ifname\u003dpf_ifname, vf_num\u003dvf_num)"},{"line_number":250,"context_line":""},{"line_number":251,"context_line":"    for device in devices:"},{"line_number":252,"context_line":"        if device \u003d\u003d pf_ifname:"}],"source_content_type":"text/x-python","patch_set":9,"id":"5f201791_35b5e77e","line":249,"range":{"start_line":235,"start_character":3,"end_line":249,"end_character":76},"updated":"2017-06-26 20:39:26.000000000","message":"we may want to split this out into its own fuction and cache it in the future but it is fine as it is for now \nas https://review.openstack.org/#/c/472773/ is not merged.","commit_id":"2a09ede8fb15df6c3ef520d1107437df1d16aa89"},{"author":{"_account_id":25733,"name":"Jan Gutter","email":"github@jangutter.com","username":"jangutter"},"change_message_id":"60d6275bc024adf424345611eaa943ee89fb5760","unresolved":false,"context_lines":[{"line_number":269,"context_line":"            continue"},{"line_number":270,"context_line":""},{"line_number":271,"context_line":"        try:"},{"line_number":272,"context_line":"            with open(device_sw_id_file, \u0027r\u0027) as fd:"},{"line_number":273,"context_line":"                representor_num \u003d fd.readline().rstrip()"},{"line_number":274,"context_line":"        except (OSError, IOError):"},{"line_number":275,"context_line":"            continue"}],"source_content_type":"text/x-python","patch_set":9,"id":"3f1d235d_044306b1","line":272,"range":{"start_line":272,"start_character":22,"end_line":272,"end_character":39},"updated":"2017-07-04 09:55:35.000000000","message":"Should this be device_port_name_file? It looks like you\u0027re trying to parse the switchdev ID again here.","commit_id":"2a09ede8fb15df6c3ef520d1107437df1d16aa89"},{"author":{"_account_id":12171,"name":"Moshe Levi","email":"moshele@nvidia.com","username":"moshele"},"change_message_id":"785174ab6ce9258aedf490f2adfe83e9a0039aaa","unresolved":false,"context_lines":[{"line_number":269,"context_line":"            continue"},{"line_number":270,"context_line":""},{"line_number":271,"context_line":"        try:"},{"line_number":272,"context_line":"            with open(device_sw_id_file, \u0027r\u0027) as fd:"},{"line_number":273,"context_line":"                representor_num \u003d fd.readline().rstrip()"},{"line_number":274,"context_line":"        except (OSError, IOError):"},{"line_number":275,"context_line":"            continue"}],"source_content_type":"text/x-python","patch_set":9,"id":"3f1d235d_877278ac","line":272,"range":{"start_line":272,"start_character":22,"end_line":272,"end_character":39},"in_reply_to":"3f1d235d_044306b1","updated":"2017-07-04 10:04:44.000000000","message":"yes you are right, I guess I made a mistake in the refactoring part","commit_id":"2a09ede8fb15df6c3ef520d1107437df1d16aa89"},{"author":{"_account_id":25733,"name":"Jan Gutter","email":"github@jangutter.com","username":"jangutter"},"change_message_id":"60d6275bc024adf424345611eaa943ee89fb5760","unresolved":false,"context_lines":[{"line_number":270,"context_line":""},{"line_number":271,"context_line":"        try:"},{"line_number":272,"context_line":"            with open(device_sw_id_file, \u0027r\u0027) as fd:"},{"line_number":273,"context_line":"                representor_num \u003d fd.readline().rstrip()"},{"line_number":274,"context_line":"        except (OSError, IOError):"},{"line_number":275,"context_line":"            continue"},{"line_number":276,"context_line":""}],"source_content_type":"text/x-python","patch_set":9,"id":"3f1d235d_a4ce922a","line":273,"range":{"start_line":273,"start_character":16,"end_line":273,"end_character":56},"updated":"2017-07-04 09:55:35.000000000","message":"Would it be possible to parse the trailing number as in the virtfn case? In this case if phys_port_name is of the format \"arbitrary_string2\" in a multi-PF scenario, this would be more robust.","commit_id":"2a09ede8fb15df6c3ef520d1107437df1d16aa89"},{"author":{"_account_id":11604,"name":"sean mooney","email":"smooney@redhat.com","username":"sean-k-mooney"},"change_message_id":"f1b9167b9b78781181156a023c07c8ace00a6c36","unresolved":false,"context_lines":[{"line_number":270,"context_line":""},{"line_number":271,"context_line":"        try:"},{"line_number":272,"context_line":"            with open(device_sw_id_file, \u0027r\u0027) as fd:"},{"line_number":273,"context_line":"                representor_num \u003d fd.readline().rstrip()"},{"line_number":274,"context_line":"        except (OSError, IOError):"},{"line_number":275,"context_line":"            continue"},{"line_number":276,"context_line":""}],"source_content_type":"text/x-python","patch_set":9,"id":"3f1d235d_8d805948","line":273,"range":{"start_line":273,"start_character":16,"end_line":273,"end_character":56},"in_reply_to":"3f1d235d_67e87ce1","updated":"2017-07-04 11:14:48.000000000","message":"intel nics also have multiple pf\ni have not tested allocating representotr netdevs yet\ni belive fortvile supports them as of kernel 4.10/4.11 but\ni think the netdev name will be something along the lines of \nVF1@PF2\n\nwe may need to make this vendor agnostic in a follow up patch.\nfor now until there is support for intel or netronome nics with a similar hardware offload in upstream ovs just supporting melonox format is probably fine.","commit_id":"2a09ede8fb15df6c3ef520d1107437df1d16aa89"},{"author":{"_account_id":12171,"name":"Moshe Levi","email":"moshele@nvidia.com","username":"moshele"},"change_message_id":"7e449564050dff40f800d2e038f12b66c462729e","unresolved":false,"context_lines":[{"line_number":270,"context_line":""},{"line_number":271,"context_line":"        try:"},{"line_number":272,"context_line":"            with open(device_sw_id_file, \u0027r\u0027) as fd:"},{"line_number":273,"context_line":"                representor_num \u003d fd.readline().rstrip()"},{"line_number":274,"context_line":"        except (OSError, IOError):"},{"line_number":275,"context_line":"            continue"},{"line_number":276,"context_line":""}],"source_content_type":"text/x-python","patch_set":9,"id":"3f1d235d_7e75a163","line":273,"range":{"start_line":273,"start_character":16,"end_line":273,"end_character":56},"in_reply_to":"3f1d235d_8d805948","updated":"2017-07-04 12:44:43.000000000","message":"So in Mellanox case we put for the representor the   phys_port_name is VF number \nphys_switch_id  is id of the PF.\nsee that I am checking to match phys_switch_id of the PF to the phys_switch_id  of the represnetor. Can\u0027t it work with your case as well? I just want to make sure we are all aligned here","commit_id":"2a09ede8fb15df6c3ef520d1107437df1d16aa89"},{"author":{"_account_id":12171,"name":"Moshe Levi","email":"moshele@nvidia.com","username":"moshele"},"change_message_id":"785174ab6ce9258aedf490f2adfe83e9a0039aaa","unresolved":false,"context_lines":[{"line_number":270,"context_line":""},{"line_number":271,"context_line":"        try:"},{"line_number":272,"context_line":"            with open(device_sw_id_file, \u0027r\u0027) as fd:"},{"line_number":273,"context_line":"                representor_num \u003d fd.readline().rstrip()"},{"line_number":274,"context_line":"        except (OSError, IOError):"},{"line_number":275,"context_line":"            continue"},{"line_number":276,"context_line":""}],"source_content_type":"text/x-python","patch_set":9,"id":"3f1d235d_a76d74cd","line":273,"range":{"start_line":273,"start_character":16,"end_line":273,"end_character":56},"in_reply_to":"3f1d235d_a4ce922a","updated":"2017-07-04 10:04:44.000000000","message":"my understanding  is that phys_port_name is just the number of the VF? what else can it be?","commit_id":"2a09ede8fb15df6c3ef520d1107437df1d16aa89"},{"author":{"_account_id":25733,"name":"Jan Gutter","email":"github@jangutter.com","username":"jangutter"},"change_message_id":"4210bee73744e3a7043324d276616c470339d7c0","unresolved":false,"context_lines":[{"line_number":270,"context_line":""},{"line_number":271,"context_line":"        try:"},{"line_number":272,"context_line":"            with open(device_sw_id_file, \u0027r\u0027) as fd:"},{"line_number":273,"context_line":"                representor_num \u003d fd.readline().rstrip()"},{"line_number":274,"context_line":"        except (OSError, IOError):"},{"line_number":275,"context_line":"            continue"},{"line_number":276,"context_line":""}],"source_content_type":"text/x-python","patch_set":9,"id":"3f1d235d_67e87ce1","line":273,"range":{"start_line":273,"start_character":16,"end_line":273,"end_character":56},"in_reply_to":"3f1d235d_a76d74cd","updated":"2017-07-04 10:22:01.000000000","message":"It\u0027s technically an arbitrary string. For example, Netronome\u0027s implementation can use multiple PF\u0027s meaning that pf2vf4 is a valid result. It might be reasonable to assume that the last parseable int refers to the VF number and anything before that is vendor specific (or opaque from the perspective of OpenStack).","commit_id":"2a09ede8fb15df6c3ef520d1107437df1d16aa89"},{"author":{"_account_id":15334,"name":"Stephen Finucane","display_name":"stephenfin","email":"stephenfin@redhat.com","username":"sfinucan"},"change_message_id":"3c36ed30b08b3f8b36d2ecfe30f055d5a01eb1bc","unresolved":false,"context_lines":[{"line_number":272,"context_line":"            with open(device_sw_id_file, \u0027r\u0027) as fd:"},{"line_number":273,"context_line":"                representor_num \u003d fd.readline().rstrip()"},{"line_number":274,"context_line":"        except (OSError, IOError):"},{"line_number":275,"context_line":"            continue"},{"line_number":276,"context_line":""},{"line_number":277,"context_line":"        try:"},{"line_number":278,"context_line":"            if int(representor_num) \u003d\u003d int(vf_num):"}],"source_content_type":"text/x-python","patch_set":9,"id":"5f201791_43b09b43","line":275,"updated":"2017-06-27 08:34:24.000000000","message":"This is much better. Thank you, Moshe :)","commit_id":"2a09ede8fb15df6c3ef520d1107437df1d16aa89"},{"author":{"_account_id":11604,"name":"sean mooney","email":"smooney@redhat.com","username":"sean-k-mooney"},"change_message_id":"854a2ac4f725b2dcf96734a682b8bfc1f4c06834","unresolved":false,"context_lines":[{"line_number":289,"context_line":"    Assumes a networking device - will not check for the existence of the path."},{"line_number":290,"context_line":"    \"\"\""},{"line_number":291,"context_line":"    if pf_interface:"},{"line_number":292,"context_line":"        return \"/sys/bus/pci/devices/%s/physfn/net\" % (pci_addr)"},{"line_number":293,"context_line":"    return \"/sys/bus/pci/devices/%s/net\" % (pci_addr)"},{"line_number":294,"context_line":""},{"line_number":295,"context_line":""}],"source_content_type":"text/x-python","patch_set":9,"id":"5f201791_15854bcf","line":292,"range":{"start_line":292,"start_character":16,"end_line":292,"end_character":50},"updated":"2017-06-26 20:39:26.000000000","message":"can this be vendor dependent or does the kernel api mandate pyical fuction driver expose themseves via sys at this location.","commit_id":"2a09ede8fb15df6c3ef520d1107437df1d16aa89"},{"author":{"_account_id":12171,"name":"Moshe Levi","email":"moshele@nvidia.com","username":"moshele"},"change_message_id":"80b747390c4cbe36a9897f9c16af633638e17abc","unresolved":false,"context_lines":[{"line_number":289,"context_line":"    Assumes a networking device - will not check for the existence of the path."},{"line_number":290,"context_line":"    \"\"\""},{"line_number":291,"context_line":"    if pf_interface:"},{"line_number":292,"context_line":"        return \"/sys/bus/pci/devices/%s/physfn/net\" % (pci_addr)"},{"line_number":293,"context_line":"    return \"/sys/bus/pci/devices/%s/net\" % (pci_addr)"},{"line_number":294,"context_line":""},{"line_number":295,"context_line":""}],"source_content_type":"text/x-python","patch_set":9,"id":"5f201791_f7dd2f70","line":292,"range":{"start_line":292,"start_character":16,"end_line":292,"end_character":50},"in_reply_to":"5f201791_15854bcf","updated":"2017-06-27 01:08:29.000000000","message":"it is not a vendor dependent. This is the path to get the ifname of the SR-IOV PF see https://github.com/openstack/nova/blob/master/nova/pci/utils.py#L117-L124","commit_id":"2a09ede8fb15df6c3ef520d1107437df1d16aa89"},{"author":{"_account_id":25733,"name":"Jan Gutter","email":"github@jangutter.com","username":"jangutter"},"change_message_id":"4210bee73744e3a7043324d276616c470339d7c0","unresolved":false,"context_lines":[{"line_number":301,"context_line":"    \"\"\""},{"line_number":302,"context_line":"    dev_path \u003d _get_sysfs_netdev_path(pci_addr, pf_interface)"},{"line_number":303,"context_line":"    try:"},{"line_number":304,"context_line":"        dev_info \u003d os.listdir(dev_path)"},{"line_number":305,"context_line":"        return dev_info.pop()"},{"line_number":306,"context_line":"    except Exception:"},{"line_number":307,"context_line":"        raise exception.PciDeviceNotFoundById(id\u003dpci_addr)"},{"line_number":308,"context_line":""}],"source_content_type":"text/x-python","patch_set":9,"id":"3f1d235d_67299ce4","line":305,"range":{"start_line":304,"start_character":0,"end_line":305,"end_character":29},"updated":"2017-07-04 10:22:01.000000000","message":"Netronome\u0027s implementation has a valid PF and a PF representor in this directory. In stead of just returning the first netdev, you should look for the first netdev that returns a valid phys_switch_id.","commit_id":"2a09ede8fb15df6c3ef520d1107437df1d16aa89"},{"author":{"_account_id":11604,"name":"sean mooney","email":"smooney@redhat.com","username":"sean-k-mooney"},"change_message_id":"854a2ac4f725b2dcf96734a682b8bfc1f4c06834","unresolved":false,"context_lines":[{"line_number":313,"context_line":"    A VF is associated with an VF number, which ip link command uses to"},{"line_number":314,"context_line":"    configure it. This number can be obtained from the PCI device filesystem."},{"line_number":315,"context_line":"    \"\"\""},{"line_number":316,"context_line":"    virtfns_path \u003d \"/sys/bus/pci/devices/%s/physfn/virtfn*\" % (pci_addr)"},{"line_number":317,"context_line":"    vf_num \u003d None"},{"line_number":318,"context_line":"    try:"},{"line_number":319,"context_line":"        for vf_path in glob.iglob(virtfns_path):"}],"source_content_type":"text/x-python","patch_set":9,"id":"5f201791_d56a3318","line":316,"range":{"start_line":316,"start_character":20,"end_line":316,"end_character":58},"updated":"2017-06-26 20:39:26.000000000","message":"same as above.","commit_id":"2a09ede8fb15df6c3ef520d1107437df1d16aa89"},{"author":{"_account_id":12171,"name":"Moshe Levi","email":"moshele@nvidia.com","username":"moshele"},"change_message_id":"80b747390c4cbe36a9897f9c16af633638e17abc","unresolved":false,"context_lines":[{"line_number":313,"context_line":"    A VF is associated with an VF number, which ip link command uses to"},{"line_number":314,"context_line":"    configure it. This number can be obtained from the PCI device filesystem."},{"line_number":315,"context_line":"    \"\"\""},{"line_number":316,"context_line":"    virtfns_path \u003d \"/sys/bus/pci/devices/%s/physfn/virtfn*\" % (pci_addr)"},{"line_number":317,"context_line":"    vf_num \u003d None"},{"line_number":318,"context_line":"    try:"},{"line_number":319,"context_line":"        for vf_path in glob.iglob(virtfns_path):"}],"source_content_type":"text/x-python","patch_set":9,"id":"5f201791_b7bc5706","line":316,"range":{"start_line":316,"start_character":20,"end_line":316,"end_character":58},"in_reply_to":"5f201791_d56a3318","updated":"2017-06-27 01:08:29.000000000","message":"This is the way in SR-IOV to get the vf_num by pci address\nIt is not vendor specific code. \nhttps://github.com/openstack/nova/blob/master/nova/pci/utils.py#L127-L138","commit_id":"2a09ede8fb15df6c3ef520d1107437df1d16aa89"}]}
