)]}'
{"/PATCHSET_LEVEL":[{"author":{"_account_id":23950,"name":"Eric Xie","email":"eric_xiett@163.com","username":"ericxie"},"change_message_id":"4f56d920f38289d0e89c3cdab1f797648a864098","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":8,"id":"8ce410c7_dff30bda","updated":"2022-02-12 09:46:15.000000000","message":"I will work on this patch if no one do it.","commit_id":"130e2dfbff7b2bc90849536140439294fe319833"}],"cyborg/accelerator/drivers/fake.py":[{"author":{"_account_id":28748,"name":"chenker","email":"chen.ke14@zte.com.cn","username":"chenke"},"change_message_id":"5c442857190e31dde994bfb32699b358b53211a2","unresolved":false,"context_lines":[{"line_number":131,"context_line":"        return {}"},{"line_number":132,"context_line":""},{"line_number":133,"context_line":"    def program_v2(self, controlpath_id, image_file_path):"},{"line_number":134,"context_line":"        \"\"\"Program the FPGA with the provided bitstream image."},{"line_number":135,"context_line":""},{"line_number":136,"context_line":"           :param: controlpath_id"},{"line_number":137,"context_line":"               Controlpath_id OVO"}],"source_content_type":"text/x-python","patch_set":4,"id":"3fa7e38b_1aeda68d","line":134,"range":{"start_line":134,"start_character":23,"end_line":134,"end_character":27},"updated":"2019-12-04 06:29:12.000000000","message":"fake FPGA.","commit_id":"846d9c4c63debc07edae293c84b94f3f686166b2"},{"author":{"_account_id":28748,"name":"chenker","email":"chen.ke14@zte.com.cn","username":"chenke"},"change_message_id":"5c442857190e31dde994bfb32699b358b53211a2","unresolved":false,"context_lines":[{"line_number":157,"context_line":"            qualified \u003d reduce("},{"line_number":158,"context_line":"                lambda sum, x: sum + ("},{"line_number":159,"context_line":"                    len(x[1]) \u003d\u003d x[0][0] and int(x[1], 16) \u003c\u003d x[0][1]),"},{"line_number":160,"context_line":"                check_bdf, 0)"},{"line_number":161,"context_line":"        except ValueError:"},{"line_number":162,"context_line":"            raise exception.InvalidParameterValue(err)"},{"line_number":163,"context_line":""}],"source_content_type":"text/x-python","patch_set":4,"id":"3fa7e38b_1a17e656","line":160,"range":{"start_line":160,"start_character":26,"end_line":160,"end_character":28},"updated":"2019-12-04 06:29:12.000000000","message":"I think this param could be deleted.","commit_id":"846d9c4c63debc07edae293c84b94f3f686166b2"},{"author":{"_account_id":21672,"name":"Sundar Nadathur","email":"sundar.nadathur@intel.com","username":"nsundar"},"change_message_id":"6668a4c5961fa2cf33c63ecdd04d6b2b8b931054","unresolved":false,"context_lines":[{"line_number":32,"context_line":"@cyborg.privsep.sys_admin_pctxt.entrypoint"},{"line_number":33,"context_line":"def _fpga_program_privileged(cmd_args):"},{"line_number":34,"context_line":"    # NOTE(Sundar): If we take cmd as parameter, this function can"},{"line_number":35,"context_line":"    # be abused to run abritrary commands in privileged mode. So"},{"line_number":36,"context_line":"    # only cmd_args are passed in."},{"line_number":37,"context_line":"    # TODO(Sundar) Do not hardcode fpgaconf."},{"line_number":38,"context_line":"    # Use right tool based on bitstream type."}],"source_content_type":"text/x-python","patch_set":5,"id":"3fa7e38b_971c0f15","line":35,"range":{"start_line":35,"start_character":23,"end_line":35,"end_character":32},"updated":"2020-01-18 18:28:55.000000000","message":"Nit: \"arbitrary\". Same typo in Intel FPGA driver -- I\u0027ll fix that.","commit_id":"7357c61ec21a89a56b8ca9fdc35319f45af27964"},{"author":{"_account_id":21672,"name":"Sundar Nadathur","email":"sundar.nadathur@intel.com","username":"nsundar"},"change_message_id":"6668a4c5961fa2cf33c63ecdd04d6b2b8b931054","unresolved":false,"context_lines":[{"line_number":34,"context_line":"    # NOTE(Sundar): If we take cmd as parameter, this function can"},{"line_number":35,"context_line":"    # be abused to run abritrary commands in privileged mode. So"},{"line_number":36,"context_line":"    # only cmd_args are passed in."},{"line_number":37,"context_line":"    # TODO(Sundar) Do not hardcode fpgaconf."},{"line_number":38,"context_line":"    # Use right tool based on bitstream type."},{"line_number":39,"context_line":"    cmd \u003d [\"/bin/ls\"]"},{"line_number":40,"context_line":"    cmd.extend(cmd_args)"}],"source_content_type":"text/x-python","patch_set":5,"id":"3fa7e38b_774ab324","line":37,"updated":"2020-01-18 18:28:55.000000000","message":"This line and the next are not applicable.","commit_id":"7357c61ec21a89a56b8ca9fdc35319f45af27964"},{"author":{"_account_id":21672,"name":"Sundar Nadathur","email":"sundar.nadathur@intel.com","username":"nsundar"},"change_message_id":"6668a4c5961fa2cf33c63ecdd04d6b2b8b931054","unresolved":false,"context_lines":[{"line_number":137,"context_line":"               Controlpath_id OVO"},{"line_number":138,"context_line":"           :param: image_file_path"},{"line_number":139,"context_line":"               String with the file path"},{"line_number":140,"context_line":"           :returns: True on success, False on failure"},{"line_number":141,"context_line":"        \"\"\""},{"line_number":142,"context_line":"        if controlpath_id[\u0027cpid_type\u0027] !\u003d constants.AH_TYPE_TEST_PCI:"},{"line_number":143,"context_line":"            raise exception.InvalidType(obj\u003d\u0027controlpath_id\u0027,"}],"source_content_type":"text/x-python","patch_set":5,"id":"3fa7e38b_37bafbdf","line":140,"updated":"2020-01-18 18:28:55.000000000","message":"The big question is, how do we force the fake driver to return success or failure? This approach does \u0027ls /path/image\u0027 to determine success. That works for this UT.\n\nBut, for other UT and for functional tests, we should be able to download some Glance image successfully and still fail the programming in the fake driver. That means we should either delete the downloaded file or mock the downloading function to not do that. Does anybody see any catches there?","commit_id":"7357c61ec21a89a56b8ca9fdc35319f45af27964"},{"author":{"_account_id":21672,"name":"Sundar Nadathur","email":"sundar.nadathur@intel.com","username":"nsundar"},"change_message_id":"6668a4c5961fa2cf33c63ecdd04d6b2b8b931054","unresolved":false,"context_lines":[{"line_number":150,"context_line":"        # len(b) \u003d 2, and int(b, 16) \u003c\u003d 255"},{"line_number":151,"context_line":"        # len(d) \u003d 2, and int(b, 16) \u003c\u003d 255"},{"line_number":152,"context_line":"        # len(f) \u003d 1, and int(b, 16) \u003c\u003d 7"},{"line_number":153,"context_line":"        check_bdf \u003d zip([(2, 255), (2, 255), (1, 7)], bdf)"},{"line_number":154,"context_line":"        err \u003d \"BDF (%s) for %s type devices is invalid.\" % ("},{"line_number":155,"context_line":"            bdf_dict, constants.AH_TYPE_TEST_PCI)"},{"line_number":156,"context_line":"        try:"},{"line_number":157,"context_line":"            qualified \u003d reduce("},{"line_number":158,"context_line":"                lambda sum, x: sum + ("},{"line_number":159,"context_line":"                    len(x[1]) \u003d\u003d x[0][0] and int(x[1], 16) \u003c\u003d x[0][1]),"},{"line_number":160,"context_line":"                check_bdf, 0)"},{"line_number":161,"context_line":"        except ValueError:"},{"line_number":162,"context_line":"            raise exception.InvalidParameterValue(err)"},{"line_number":163,"context_line":""},{"line_number":164,"context_line":"        if qualified \u003c len(bdf_key):"},{"line_number":165,"context_line":"            raise exception.InvalidParameterValue(err)"}],"source_content_type":"text/x-python","patch_set":5,"id":"3fa7e38b_372c3b48","line":162,"range":{"start_line":153,"start_character":0,"end_line":162,"end_character":54},"updated":"2020-01-18 18:28:55.000000000","message":"A simpler and more readable way to write this:\n\n bdf_lengths \u003d [2, 2, 1]\n bdf_limits \u003d [255, 255, 7]\n check_bdf \u003d zip(bdf_lengths, bdf_limits, bdf)\n if all([len(bdf_val) \u003d\u003d length and int(bdf_val, 16) \u003c\u003d limit\n        for length, limit, bdf_val in check_bdf]):\n     ....\n\nAlso, these PCI checks can be useful for many drivers. Can we put them n a common place?","commit_id":"7357c61ec21a89a56b8ca9fdc35319f45af27964"},{"author":{"_account_id":21672,"name":"Sundar Nadathur","email":"sundar.nadathur@intel.com","username":"nsundar"},"change_message_id":"6668a4c5961fa2cf33c63ecdd04d6b2b8b931054","unresolved":false,"context_lines":[{"line_number":167,"context_line":"        cmd_args.append(image_file_path)"},{"line_number":168,"context_line":""},{"line_number":169,"context_line":"        try:"},{"line_number":170,"context_line":"            # TODO(Sundar) Check return code if it is retryable"},{"line_number":171,"context_line":"            _fpga_program_privileged(cmd_args)"},{"line_number":172,"context_line":"            return True"},{"line_number":173,"context_line":"        except Exception:"}],"source_content_type":"text/x-python","patch_set":5,"id":"3fa7e38b_d754c7c8","line":170,"updated":"2020-01-18 18:28:55.000000000","message":"Comment not applicable.","commit_id":"7357c61ec21a89a56b8ca9fdc35319f45af27964"},{"author":{"_account_id":21672,"name":"Sundar Nadathur","email":"sundar.nadathur@intel.com","username":"nsundar"},"change_message_id":"6668a4c5961fa2cf33c63ecdd04d6b2b8b931054","unresolved":false,"context_lines":[{"line_number":172,"context_line":"            return True"},{"line_number":173,"context_line":"        except Exception:"},{"line_number":174,"context_line":"            # NOTE(Sundar): processutils.exec will log the error."},{"line_number":175,"context_line":"            # TODO(Sundar): If retryable error, try again."},{"line_number":176,"context_line":"            return False"}],"source_content_type":"text/x-python","patch_set":5,"id":"3fa7e38b_f75783c8","line":175,"updated":"2020-01-18 18:28:55.000000000","message":"Comment not applicable.","commit_id":"7357c61ec21a89a56b8ca9fdc35319f45af27964"},{"author":{"_account_id":22348,"name":"Zuul","username":"zuul","tags":["SERVICE_USER"]},"tag":"autogenerated:zuul:check","change_message_id":"a08d0c5ee446d8b8bf9bcd9c0624f9d0e189dc5a","unresolved":false,"context_lines":[{"line_number":12,"context_line":"#    under the License."},{"line_number":13,"context_line":""},{"line_number":14,"context_line":"import re"},{"line_number":15,"context_line":"from functools import reduce"},{"line_number":16,"context_line":""},{"line_number":17,"context_line":"import os_resource_classes as orc"},{"line_number":18,"context_line":"from oslo_concurrency import processutils"}],"source_content_type":"text/x-python","patch_set":7,"id":"df33271e_cddc9148","line":15,"updated":"2020-04-07 10:03:23.000000000","message":"pep8: H306: imports not in alphabetical order (re, functools.reduce)","commit_id":"540e74081d65fb039447f747acfeba25479e1945"},{"author":{"_account_id":21672,"name":"Sundar Nadathur","email":"sundar.nadathur@intel.com","username":"nsundar"},"change_message_id":"b114d64f2f0cfe51b8fdb4c051ccbf8955ae6efe","unresolved":false,"context_lines":[{"line_number":33,"context_line":"@cyborg.privsep.sys_admin_pctxt.entrypoint"},{"line_number":34,"context_line":"def _fpga_program_privileged(cmd_args):"},{"line_number":35,"context_line":"    # NOTE(Sundar): If we take cmd as parameter, this function can"},{"line_number":36,"context_line":"    # be abused to run arbitrary jjcommands in privileged mode. So"},{"line_number":37,"context_line":"    # only cmd_args are passed in."},{"line_number":38,"context_line":"    cmd \u003d [\"/bin/ls\"]"},{"line_number":39,"context_line":"    cmd.extend(cmd_args)"}],"source_content_type":"text/x-python","patch_set":8,"id":"df33271e_e7ea48d6","line":36,"range":{"start_line":36,"start_character":33,"end_line":36,"end_character":35},"updated":"2020-04-07 16:14:31.000000000","message":"Drop this.","commit_id":"130e2dfbff7b2bc90849536140439294fe319833"},{"author":{"_account_id":21672,"name":"Sundar Nadathur","email":"sundar.nadathur@intel.com","username":"nsundar"},"change_message_id":"b114d64f2f0cfe51b8fdb4c051ccbf8955ae6efe","unresolved":false,"context_lines":[{"line_number":35,"context_line":"    # NOTE(Sundar): If we take cmd as parameter, this function can"},{"line_number":36,"context_line":"    # be abused to run arbitrary jjcommands in privileged mode. So"},{"line_number":37,"context_line":"    # only cmd_args are passed in."},{"line_number":38,"context_line":"    cmd \u003d [\"/bin/ls\"]"},{"line_number":39,"context_line":"    cmd.extend(cmd_args)"},{"line_number":40,"context_line":"    # processutils will log the command line."},{"line_number":41,"context_line":"    return processutils.execute(*cmd)"},{"line_number":42,"context_line":""},{"line_number":43,"context_line":""},{"line_number":44,"context_line":"class FakeDriver(GenericDriver):"}],"source_content_type":"text/x-python","patch_set":8,"id":"df33271e_67ad989a","line":41,"range":{"start_line":38,"start_character":4,"end_line":41,"end_character":37},"updated":"2020-04-07 16:14:31.000000000","message":"Why do we need all this? The return value gets ignored anyway in the caller.","commit_id":"130e2dfbff7b2bc90849536140439294fe319833"},{"author":{"_account_id":21672,"name":"Sundar Nadathur","email":"sundar.nadathur@intel.com","username":"nsundar"},"change_message_id":"b114d64f2f0cfe51b8fdb4c051ccbf8955ae6efe","unresolved":false,"context_lines":[{"line_number":172,"context_line":""},{"line_number":173,"context_line":"        cmd_args.append(image_file_path)"},{"line_number":174,"context_line":""},{"line_number":175,"context_line":"        try:"},{"line_number":176,"context_line":"            _fpga_program_privileged(cmd_args)"},{"line_number":177,"context_line":"            return True"},{"line_number":178,"context_line":"        except Exception:"},{"line_number":179,"context_line":"            return False"}],"source_content_type":"text/x-python","patch_set":8,"id":"df33271e_6710f8a9","line":179,"range":{"start_line":175,"start_character":8,"end_line":179,"end_character":24},"updated":"2020-04-07 16:14:31.000000000","message":"Is there a way we can make this return success or failure in a controlled way? For example, if the image path contains some substring like \"failure\", make this fail, otherwise succeed. This is just an example or a suggestion. But we should look for ways to simulate programming failures with the fake driver.","commit_id":"130e2dfbff7b2bc90849536140439294fe319833"}],"cyborg/tests/unit/accelerator/drivers/test_fake_driver.py":[{"author":{"_account_id":21672,"name":"Sundar Nadathur","email":"sundar.nadathur@intel.com","username":"nsundar"},"change_message_id":"6668a4c5961fa2cf33c63ecdd04d6b2b8b931054","unresolved":false,"context_lines":[{"line_number":164,"context_line":"        fake_drv.program(cpid, \"/path/image\")"},{"line_number":165,"context_line":"        mock_prog.assert_called_with(expect_cmd)"},{"line_number":166,"context_line":""},{"line_number":167,"context_line":"    def test_fake_driver_program_with_bad_bdf(self):"},{"line_number":168,"context_line":"        b \u003d \"pp\""},{"line_number":169,"context_line":"        d \u003d \"yy\""},{"line_number":170,"context_line":"        f \u003d \"0x0\""}],"source_content_type":"text/x-python","patch_set":5,"id":"3fa7e38b_57ebf7db","line":167,"updated":"2020-01-18 18:28:55.000000000","message":"Can we have separate test cases for \u0027bad due to length\u0027 and \u0027bad due to value\u0027? These tests can also be in a common place, if we factor out the original code into a common place.","commit_id":"7357c61ec21a89a56b8ca9fdc35319f45af27964"},{"author":{"_account_id":22348,"name":"Zuul","username":"zuul","tags":["SERVICE_USER"]},"tag":"autogenerated:zuul:check","change_message_id":"09ac07f112130544ce5f7933e2764e02f48ed3f6","unresolved":false,"context_lines":[{"line_number":153,"context_line":"    @mock.patch(\u0027cyborg.accelerator.drivers.fake._fpga_program_privileged\u0027)"},{"line_number":154,"context_line":"    def test_fake_driver_program(self, mock_prog):"},{"line_number":155,"context_line":"        cpid \u003d self._get_cpid(\"5e\", \"00\", \"0\")"},{"line_number":156,"context_line":"        path \u003d \u0027/path/image\u0027"},{"line_number":157,"context_line":"        expect_cmd \u003d [\u0027/path/image\u0027]"},{"line_number":158,"context_line":""},{"line_number":159,"context_line":"        fake_drv \u003d FakeDriver()"}],"source_content_type":"text/x-python","patch_set":8,"id":"df33271e_62e62f47","line":156,"updated":"2020-04-07 12:24:34.000000000","message":"pep8: F841 local variable \u0027path\u0027 is assigned to but never used","commit_id":"130e2dfbff7b2bc90849536140439294fe319833"},{"author":{"_account_id":21672,"name":"Sundar Nadathur","email":"sundar.nadathur@intel.com","username":"nsundar"},"change_message_id":"b114d64f2f0cfe51b8fdb4c051ccbf8955ae6efe","unresolved":false,"context_lines":[{"line_number":153,"context_line":"    @mock.patch(\u0027cyborg.accelerator.drivers.fake._fpga_program_privileged\u0027)"},{"line_number":154,"context_line":"    def test_fake_driver_program(self, mock_prog):"},{"line_number":155,"context_line":"        cpid \u003d self._get_cpid(\"5e\", \"00\", \"0\")"},{"line_number":156,"context_line":"        path \u003d \u0027/path/image\u0027"},{"line_number":157,"context_line":"        expect_cmd \u003d [\u0027/path/image\u0027]"},{"line_number":158,"context_line":""},{"line_number":159,"context_line":"        fake_drv \u003d FakeDriver()"}],"source_content_type":"text/x-python","patch_set":8,"id":"df33271e_277b90f4","line":156,"in_reply_to":"df33271e_62e62f47","updated":"2020-04-07 16:14:31.000000000","message":"Use \u0027path\u0027 in Lines 157 and 162 below.","commit_id":"130e2dfbff7b2bc90849536140439294fe319833"}]}
