)]}'
{"nova/pci/utils.py":[{"author":{"_account_id":28714,"name":"Adrian Chiris","email":"adrianc@nvidia.com","username":"adrianc"},"change_message_id":"df4b6794fb8177b78e2f20c0a4009db5ec5bf729","unresolved":false,"context_lines":[{"line_number":114,"context_line":"            with open(os.path.join(dev_path, _SRIOV_NUMVFS)) as fd:"},{"line_number":115,"context_line":"                sriov_numvfs \u003d int(fd.read())"},{"line_number":116,"context_line":"                return (os.readlink(dev_path).strip(\"./\"),"},{"line_number":117,"context_line":"                        sriov_numvfs \u003e 0)"},{"line_number":118,"context_line":"        except (IOError, ValueError):"},{"line_number":119,"context_line":"            return os.readlink(dev_path).strip(\"./\"), False"},{"line_number":120,"context_line":"    return None, False"}],"source_content_type":"text/x-python","patch_set":11,"id":"9fdfeff1_b5c07652","line":117,"updated":"2019-01-21 11:08:12.000000000","message":"you can also rely on the following (which is more sensible IMO)\n\ntaken from: https://www.kernel.org/doc/Documentation/ABI/testing/sysfs-bus-pci\n\n\nWhat:\t\t/sys/bus/pci/devices/.../physfn\nDate:\t\tMarch 2009\nContact:\tYu Zhao \u003cyu.zhao@intel.com\u003e\nDescription:\n\t\tThis symbolic link appears when a device is a Virtual Function.\n\t\tThe symbolic link points to the PCI device sysfs entry of the\n\t\tPhysical Function this device associates with.\n\n\n\nWhat:\t\t/sys/bus/pci/devices/.../virtfnN\nDate:\t\tMarch 2009\nContact:\tYu Zhao \u003cyu.zhao@intel.com\u003e\nDescription:\n\t\tThis symbolic link appears when hardware supports the SR-IOV\n\t\tcapability and the Physical Function driver has enabled it.\n\t\tThe symbolic link points to the PCI device sysfs entry of the\n\t\tVirtual Function whose index is N (0...MaxVFs-1).","commit_id":"6752322f55744cda6008700d6627772bd3e6578b"},{"author":{"_account_id":28714,"name":"Adrian Chiris","email":"adrianc@nvidia.com","username":"adrianc"},"change_message_id":"df4b6794fb8177b78e2f20c0a4009db5ec5bf729","unresolved":false,"context_lines":[{"line_number":114,"context_line":"            with open(os.path.join(dev_path, _SRIOV_NUMVFS)) as fd:"},{"line_number":115,"context_line":"                sriov_numvfs \u003d int(fd.read())"},{"line_number":116,"context_line":"                return (os.readlink(dev_path).strip(\"./\"),"},{"line_number":117,"context_line":"                        sriov_numvfs \u003e 0)"},{"line_number":118,"context_line":"        except (IOError, ValueError):"},{"line_number":119,"context_line":"            return os.readlink(dev_path).strip(\"./\"), False"},{"line_number":120,"context_line":"    return None, False"}],"source_content_type":"text/x-python","patch_set":11,"id":"9fdfeff1_7588ce1e","line":117,"range":{"start_line":117,"start_character":23,"end_line":117,"end_character":40},"updated":"2019-01-21 11:08:12.000000000","message":"you can use is_physical_function() and have one flow right ?\nseems duplicate logic.","commit_id":"6752322f55744cda6008700d6627772bd3e6578b"},{"author":{"_account_id":28714,"name":"Adrian Chiris","email":"adrianc@nvidia.com","username":"adrianc"},"change_message_id":"c39ce263f834b8833a511a1dd8c85f420864e468","unresolved":false,"context_lines":[{"line_number":114,"context_line":"            with open(os.path.join(dev_path, _SRIOV_NUMVFS)) as fd:"},{"line_number":115,"context_line":"                sriov_numvfs \u003d int(fd.read())"},{"line_number":116,"context_line":"                return (os.readlink(dev_path).strip(\"./\"),"},{"line_number":117,"context_line":"                        sriov_numvfs \u003e 0)"},{"line_number":118,"context_line":"        except (IOError, ValueError):"},{"line_number":119,"context_line":"            return os.readlink(dev_path).strip(\"./\"), False"},{"line_number":120,"context_line":"    return None, False"}],"source_content_type":"text/x-python","patch_set":11,"id":"9fdfeff1_b58a2467","line":117,"range":{"start_line":117,"start_character":23,"end_line":117,"end_character":40},"in_reply_to":"9fdfeff1_74206bb1","updated":"2019-01-29 13:36:39.000000000","message":"Understood about the refactoring, thank you!\n\nI feel like nova\u0027s definition of a physical function and the OS definition of a physical function is different.\nThe former also requires active VFs.\n\nI feel like it should have been handled in upper layers (differentiate between PF and PF with active VFs), however this is not really related to your change as the original code did roughly the same :).","commit_id":"6752322f55744cda6008700d6627772bd3e6578b"},{"author":{"_account_id":25588,"name":"Maciej Kucia","email":"maciej@kucia.net","username":"m.kucia"},"change_message_id":"2977be14db7043b9a035b7f0a289e54a2976b40c","unresolved":false,"context_lines":[{"line_number":114,"context_line":"            with open(os.path.join(dev_path, _SRIOV_NUMVFS)) as fd:"},{"line_number":115,"context_line":"                sriov_numvfs \u003d int(fd.read())"},{"line_number":116,"context_line":"                return (os.readlink(dev_path).strip(\"./\"),"},{"line_number":117,"context_line":"                        sriov_numvfs \u003e 0)"},{"line_number":118,"context_line":"        except (IOError, ValueError):"},{"line_number":119,"context_line":"            return os.readlink(dev_path).strip(\"./\"), False"},{"line_number":120,"context_line":"    return None, False"}],"source_content_type":"text/x-python","patch_set":11,"id":"9fdfeff1_74206bb1","line":117,"range":{"start_line":117,"start_character":23,"end_line":117,"end_character":40},"in_reply_to":"9fdfeff1_7588ce1e","updated":"2019-01-25 20:38:45.000000000","message":"I can refactor in a separate change :)\n\nUltimately I would love to introduce more complex refactorings than extract method. For example sysfs abstraction like in https://stackoverflow.com/questions/4648792/is-there-a-python-module-to-parse-linuxs-sysfs","commit_id":"6752322f55744cda6008700d6627772bd3e6578b"},{"author":{"_account_id":28714,"name":"Adrian Chiris","email":"adrianc@nvidia.com","username":"adrianc"},"change_message_id":"df4b6794fb8177b78e2f20c0a4009db5ec5bf729","unresolved":false,"context_lines":[{"line_number":127,"context_line":"        try:"},{"line_number":128,"context_line":"            with open(dev_path + _SRIOV_NUMVFS) as fd:"},{"line_number":129,"context_line":"                sriov_numvfs \u003d int(fd.read())"},{"line_number":130,"context_line":"                return sriov_numvfs \u003e 0"},{"line_number":131,"context_line":"        except (IOError, ValueError):"},{"line_number":132,"context_line":"            pass"},{"line_number":133,"context_line":"    return False"}],"source_content_type":"text/x-python","patch_set":11,"id":"9fdfeff1_70877cd9","line":130,"range":{"start_line":130,"start_character":16,"end_line":130,"end_character":39},"updated":"2019-01-21 11:08:12.000000000","message":"see comment above,\n\nanother way to perform the check:\na PCI function is physical if /sys/bus/pci/devices/\u003cd:b:d.f\u003e/physfn does not exist.\n\nthe check if sriov_numvfs \u003e0 means : the PCI function is physical and has VFs enabled on the PF.\n\nif thats the intended logic then it might be worth to add some docstring to this method explaining this. (and in get_function_by_ifname())","commit_id":"6752322f55744cda6008700d6627772bd3e6578b"},{"author":{"_account_id":25588,"name":"Maciej Kucia","email":"maciej@kucia.net","username":"m.kucia"},"change_message_id":"2977be14db7043b9a035b7f0a289e54a2976b40c","unresolved":false,"context_lines":[{"line_number":127,"context_line":"        try:"},{"line_number":128,"context_line":"            with open(dev_path + _SRIOV_NUMVFS) as fd:"},{"line_number":129,"context_line":"                sriov_numvfs \u003d int(fd.read())"},{"line_number":130,"context_line":"                return sriov_numvfs \u003e 0"},{"line_number":131,"context_line":"        except (IOError, ValueError):"},{"line_number":132,"context_line":"            pass"},{"line_number":133,"context_line":"    return False"}],"source_content_type":"text/x-python","patch_set":11,"id":"9fdfeff1_b75a5527","line":130,"range":{"start_line":130,"start_character":16,"end_line":130,"end_character":39},"in_reply_to":"9fdfeff1_70877cd9","updated":"2019-01-25 20:38:45.000000000","message":"There are 2 reasons why this change looks like it looks:\n\n1. Very simple review, basically a variable is replaced\n\n2. Operator can configure SRIOV_NUMVFS using sysfs\nAs a result the code directly reflects how operator interacts with the OS. I hope such approach would make this easier to read and understand for future developers.","commit_id":"6752322f55744cda6008700d6627772bd3e6578b"}],"nova/tests/unit/pci/test_utils.py":[{"author":{"_account_id":22348,"name":"Zuul","username":"zuul","tags":["SERVICE_USER"]},"tag":"autogenerated:zuul:check","change_message_id":"cf2abe3fda6ad98a68d6d33a5fde45d08690c822","unresolved":false,"context_lines":[{"line_number":108,"context_line":"        numvf_path \u003d \"/sys/class/net/{interface}/device/{attribute}\".format("},{"line_number":109,"context_line":"            interface\u003difname, attribute\u003dutils._SRIOV_NUMVFS)"},{"line_number":110,"context_line":"        mock_readlink.return_value \u003d \u0027../../../0000:00:00.1\u0027"},{"line_number":111,"context_line":"        with self.patch_open(totalvf_path, \u00274\u0027) as mock_open:"},{"line_number":112,"context_line":"            address, physical_function \u003d utils.get_function_by_ifname(\u0027eth0\u0027)"},{"line_number":113,"context_line":"            self.assertEqual(address, \u00270000:00:00.1\u0027)"},{"line_number":114,"context_line":"            self.assertTrue(physical_function)"}],"source_content_type":"text/x-python","patch_set":16,"id":"ff570b3c_f4469f21","line":111,"updated":"2020-05-11 18:59:06.000000000","message":"pep8: F821 undefined name \u0027totalvf_path\u0027","commit_id":"f76bcb6248e0758013e79908afac8318fb476151"}]}
