)]}'
{"/COMMIT_MSG":[{"author":{"_account_id":9708,"name":"Balazs Gibizer","display_name":"gibi","email":"gibizer@gmail.com","username":"gibi"},"change_message_id":"6e8321a22c76514d83d610bec32fd6f225910a49","unresolved":false,"context_lines":[{"line_number":11,"context_line":""},{"line_number":12,"context_line":"This should reduce noise in the logs at runtime as well as during unit"},{"line_number":13,"context_line":"and functional tests runs where these modules are not present."},{"line_number":14,"context_line":""},{"line_number":15,"context_line":"Change-Id: I150e70629f6ae579ccfe0bf585c8a27df14fb51d"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":3,"id":"1f621f24_d724dcb1","line":14,"updated":"2020-11-06 16:18:36.000000000","message":"Closes-Bug: #1903316","commit_id":"66f68c8e960d4ba5a45360b38b2dca01f2446ac5"}],"nova/storage/rbd_utils.py":[{"author":{"_account_id":4393,"name":"Dan Smith","email":"dms@danplanet.com","username":"danms"},"change_message_id":"53f574210c8841ddc1614ed4c68447d14f198b62","unresolved":false,"context_lines":[{"line_number":123,"context_line":""},{"line_number":124,"context_line":"    def __init__(self, pool\u003dNone, user\u003dNone, ceph_conf\u003dNone,"},{"line_number":125,"context_line":"                 connect_timeout\u003dNone):"},{"line_number":126,"context_line":"        # NOTE(lyarwood): Log exceptions if we fail to import rbd or rados in"},{"line_number":127,"context_line":"        # order to provide context to anyone debugging the failure."},{"line_number":128,"context_line":"        if rbd is None or rados is None:"},{"line_number":129,"context_line":"            try:"}],"source_content_type":"text/x-python","patch_set":2,"id":"1f621f24_cc6f33fa","line":126,"range":{"start_line":126,"start_character":47,"end_line":126,"end_character":51},"updated":"2020-11-06 16:01:48.000000000","message":"To be clear, \"failed\", as in \"failed above\". I think you might want to reword this comment to make it clear to someone coming later that you\u0027re not importing these for use, but just to replicate the failures above for logging. As confused as Sylvain was, I\u0027m sure in the future someone will come along and be like \"wtf? these aren\u0027t even used, I can nuke this code.\"","commit_id":"cd4d95274e5b5b158869f4d9deca751c25d8b675"},{"author":{"_account_id":4393,"name":"Dan Smith","email":"dms@danplanet.com","username":"danms"},"change_message_id":"53f574210c8841ddc1614ed4c68447d14f198b62","unresolved":false,"context_lines":[{"line_number":139,"context_line":"                # NOTE(lyarwood): noqa is required here as the import if"},{"line_number":140,"context_line":"                # successful is unused (F401), however we only attempt this"},{"line_number":141,"context_line":"                # import *if* the original imports above had failed as a way of"},{"line_number":142,"context_line":"                # logging additional context so ignore this rule."},{"line_number":143,"context_line":"                import rbd # noqa"},{"line_number":144,"context_line":"            except ImportError:"},{"line_number":145,"context_line":"                LOG.exception(\"Unable to import the rbd module\")"}],"source_content_type":"text/x-python","patch_set":2,"id":"1f621f24_8c69bbfa","line":142,"updated":"2020-11-06 16:01:48.000000000","message":"This is overly repetitive, IMHO.\n\nAlso, I don\u0027t really think these two imports need to be in separate try..except blocks, just like they\u0027re not at the top, which would give you less reason to duplicate the comment.","commit_id":"cd4d95274e5b5b158869f4d9deca751c25d8b675"},{"author":{"_account_id":7166,"name":"Sylvain Bauza","email":"sbauza@redhat.com","username":"sbauza"},"change_message_id":"b1fbf316a70f39a8eee893400a402e58c7a28eb3","unresolved":false,"context_lines":[{"line_number":139,"context_line":"                # NOTE(lyarwood): noqa is required here as the import if"},{"line_number":140,"context_line":"                # successful is unused (F401), however we only attempt this"},{"line_number":141,"context_line":"                # import *if* the original imports above had failed as a way of"},{"line_number":142,"context_line":"                # logging additional context so ignore this rule."},{"line_number":143,"context_line":"                import rbd # noqa"},{"line_number":144,"context_line":"            except ImportError:"},{"line_number":145,"context_line":"                LOG.exception(\"Unable to import the rbd module\")"}],"source_content_type":"text/x-python","patch_set":2,"id":"1f621f24_ac4d979b","line":142,"in_reply_to":"1f621f24_8c69bbfa","updated":"2020-11-06 16:16:10.000000000","message":"+1","commit_id":"cd4d95274e5b5b158869f4d9deca751c25d8b675"},{"author":{"_account_id":7166,"name":"Sylvain Bauza","email":"sbauza@redhat.com","username":"sbauza"},"change_message_id":"b1fbf316a70f39a8eee893400a402e58c7a28eb3","unresolved":false,"context_lines":[{"line_number":134,"context_line":"                import rados # noqa"},{"line_number":135,"context_line":"                import rbd # noqa"},{"line_number":136,"context_line":"            except ImportError:"},{"line_number":137,"context_line":"                LOG.exception(\"Unable to import the rados or rbd modules\")"},{"line_number":138,"context_line":""},{"line_number":139,"context_line":"            raise RuntimeError(_(\u0027rbd python libraries not found\u0027))"},{"line_number":140,"context_line":""}],"source_content_type":"text/x-python","patch_set":3,"id":"1f621f24_173ad4ca","line":137,"updated":"2020-11-06 16:16:10.000000000","message":"nit: you could just have gotten the exception and logged e.message, but wfm.","commit_id":"66f68c8e960d4ba5a45360b38b2dca01f2446ac5"},{"author":{"_account_id":10135,"name":"Lee Yarwood","display_name":"Lee Yarwood","email":"lyarwood@redhat.com","username":"lyarwood"},"change_message_id":"e47a2c92749daf6a87585ae1407b619ffb839b7d","unresolved":false,"context_lines":[{"line_number":127,"context_line":"        # modules failed then repeat the imports at runtime within this driver"},{"line_number":128,"context_line":"        # to log the full exception in order to provide context to anyone"},{"line_number":129,"context_line":"        # debugging the failure in the logs."},{"line_number":130,"context_line":"        if rbd is None or rados is None:"},{"line_number":131,"context_line":"            try:"},{"line_number":132,"context_line":"                # NOTE(lyarwood): noqa is required on both imports here as they"},{"line_number":133,"context_line":"                # are unused (F401) even if successful."}],"source_content_type":"text/x-python","patch_set":4,"id":"1f621f24_b77a00ee","line":130,"range":{"start_line":130,"start_character":0,"end_line":130,"end_character":40},"updated":"2020-11-06 17:19:07.000000000","message":"https://storage.bhs.cloud.ovh.net/v1/AUTH_dcaab5e32b234d56b626f72581e3644c/zuul_opendev_logs_eaf/761762/4/check/openstack-tox-cover/eaf8a81/testr_results.html\n\nTraceback (most recent call last):\n  File \"/home/zuul/src/opendev.org/openstack/nova/.tox/shared/lib/python3.8/site-packages/mock/mock.py\", line 1330, in patched\n    return func(*args, **keywargs)\n  File \"/home/zuul/src/opendev.org/openstack/nova/nova/tests/unit/image/test_glance.py\", line 1380, in test_rbd_download_export_failure\n    self.assertRaisesRegex(\n  File \"/home/zuul/src/opendev.org/openstack/nova/.tox/shared/lib/python3.8/site-packages/unittest2/case.py\", line 1278, in assertRaisesRegex\n    return context.handle(\u0027assertRaisesRegex\u0027, args, kwargs)\n  File \"/home/zuul/src/opendev.org/openstack/nova/.tox/shared/lib/python3.8/site-packages/unittest2/case.py\", line 194, in handle\n    callable_obj(*args, **kwargs)\n  File \"/home/zuul/src/opendev.org/openstack/nova/nova/image/glance.py\", line 252, in rbd_download\n    rbd_driver \u003d rbd_utils.RBDDriver(\n  File \"/home/zuul/src/opendev.org/openstack/nova/nova/storage/rbd_utils.py\", line 130, in __init__\n    if rbd is None or rados is None:\nUnboundLocalError: local variable \u0027rbd\u0027 referenced before assignment","commit_id":"10f8098c14cf6f0f3ee8e608ca40e865ba4727b4"},{"author":{"_account_id":15334,"name":"Stephen Finucane","display_name":"stephenfin","email":"stephenfin@redhat.com","username":"sfinucan"},"change_message_id":"e79d8aa0542502ea64fb3d5c37d2f3cbd2142177","unresolved":false,"context_lines":[{"line_number":127,"context_line":"        # modules failed then repeat the imports at runtime within this driver"},{"line_number":128,"context_line":"        # to log the full exception in order to provide context to anyone"},{"line_number":129,"context_line":"        # debugging the failure in the logs."},{"line_number":130,"context_line":"        if rbd is None or rados is None:"},{"line_number":131,"context_line":"            try:"},{"line_number":132,"context_line":"                # NOTE(lyarwood): noqa is required on both imports here as they"},{"line_number":133,"context_line":"                # are unused (F401) even if successful."}],"source_content_type":"text/x-python","patch_set":4,"id":"1f621f24_725236e0","line":130,"range":{"start_line":130,"start_character":0,"end_line":130,"end_character":40},"in_reply_to":"1f621f24_126822b7","updated":"2020-11-06 18:04:43.000000000","message":"No, it\u0027s because you\u0027re setting (via the import) this attribute within this scope. If you were only reading it, you wouldn\u0027t need the global keyword.\n\nThis was an issue on Python 2 too. Look at what we did for the libvirt driver [1]\n\n[1] https://github.com/openstack/nova/blob/c0fe95fcc5aec99a83dd57093dc230ef67b36b39/nova/virt/libvirt/driver.py#L317","commit_id":"10f8098c14cf6f0f3ee8e608ca40e865ba4727b4"},{"author":{"_account_id":4393,"name":"Dan Smith","email":"dms@danplanet.com","username":"danms"},"change_message_id":"eec2580bbe3e6d917a915bd88d8e215913f16026","unresolved":false,"context_lines":[{"line_number":127,"context_line":"        # modules failed then repeat the imports at runtime within this driver"},{"line_number":128,"context_line":"        # to log the full exception in order to provide context to anyone"},{"line_number":129,"context_line":"        # debugging the failure in the logs."},{"line_number":130,"context_line":"        if rbd is None or rados is None:"},{"line_number":131,"context_line":"            try:"},{"line_number":132,"context_line":"                # NOTE(lyarwood): noqa is required on both imports here as they"},{"line_number":133,"context_line":"                # are unused (F401) even if successful."}],"source_content_type":"text/x-python","patch_set":4,"id":"1f621f24_126822b7","line":130,"range":{"start_line":130,"start_character":0,"end_line":130,"end_character":40},"in_reply_to":"1f621f24_5729ec98","updated":"2020-11-06 17:55:25.000000000","message":"This is for the case where we run L35-L36 right? That\u0027s an unfortunate regression (IMHO) in behavior from python2 to python3 I think. Definitely confusing when the import is global but a variable set right next to it is not.","commit_id":"10f8098c14cf6f0f3ee8e608ca40e865ba4727b4"},{"author":{"_account_id":15334,"name":"Stephen Finucane","display_name":"stephenfin","email":"stephenfin@redhat.com","username":"sfinucan"},"change_message_id":"1c3651f3e3af17dc7e0c029fce2973e904c378fb","unresolved":false,"context_lines":[{"line_number":127,"context_line":"        # modules failed then repeat the imports at runtime within this driver"},{"line_number":128,"context_line":"        # to log the full exception in order to provide context to anyone"},{"line_number":129,"context_line":"        # debugging the failure in the logs."},{"line_number":130,"context_line":"        if rbd is None or rados is None:"},{"line_number":131,"context_line":"            try:"},{"line_number":132,"context_line":"                # NOTE(lyarwood): noqa is required on both imports here as they"},{"line_number":133,"context_line":"                # are unused (F401) even if successful."}],"source_content_type":"text/x-python","patch_set":4,"id":"1f621f24_5729ec98","line":130,"range":{"start_line":130,"start_character":0,"end_line":130,"end_character":40},"in_reply_to":"1f621f24_b77a00ee","updated":"2020-11-06 17:43:46.000000000","message":"Oh, you need to mark this as \u0027global\u0027, of course /o\\ This and \u0027nonlocal\u0027 are definitely quirks on Python...","commit_id":"10f8098c14cf6f0f3ee8e608ca40e865ba4727b4"},{"author":{"_account_id":15334,"name":"Stephen Finucane","display_name":"stephenfin","email":"stephenfin@redhat.com","username":"sfinucan"},"change_message_id":"1d9d04e7da1b2d1a77370197e7154850516202d9","unresolved":false,"context_lines":[{"line_number":131,"context_line":"            try:"},{"line_number":132,"context_line":"                # NOTE(lyarwood): noqa is required on both imports here as they"},{"line_number":133,"context_line":"                # are unused (F401) even if successful."},{"line_number":134,"context_line":"                import rados # noqa"},{"line_number":135,"context_line":"                import rbd # noqa"},{"line_number":136,"context_line":"            except ImportError:"},{"line_number":137,"context_line":"                LOG.exception(\"Unable to import the rados or rbd modules\")"}],"source_content_type":"text/x-python","patch_set":4,"id":"1f621f24_97c26458","line":134,"range":{"start_line":134,"start_character":28,"end_line":134,"end_character":29},"updated":"2020-11-06 16:48:07.000000000","message":"nit: missing space here, also\n\n  # noqa: F401","commit_id":"10f8098c14cf6f0f3ee8e608ca40e865ba4727b4"},{"author":{"_account_id":9708,"name":"Balazs Gibizer","display_name":"gibi","email":"gibizer@gmail.com","username":"gibi"},"change_message_id":"0b0442b924979d58ee391517ee83e6acb41b10b7","unresolved":false,"context_lines":[{"line_number":148,"context_line":"                import rados  # noqa: F401"},{"line_number":149,"context_line":"                import rbd  # noqa: F401"},{"line_number":150,"context_line":"            except ImportError:"},{"line_number":151,"context_line":"                LOG.exception(\"Unable to import the rados or rbd modules\")"},{"line_number":152,"context_line":""},{"line_number":153,"context_line":"            raise RuntimeError(_(\u0027rbd python libraries not found\u0027))"},{"line_number":154,"context_line":""},{"line_number":155,"context_line":"    def _connect_to_rados(self, pool\u003dNone):"},{"line_number":156,"context_line":"        client \u003d rados.Rados(rados_id\u003dself.rbd_user,"}],"source_content_type":"text/x-python","patch_set":6,"id":"1f621f24_58a10f94","line":153,"range":{"start_line":151,"start_character":0,"end_line":153,"end_character":67},"updated":"2020-11-09 11:14:39.000000000","message":"I guess we keep this two exception separate to avoid changing any code depending on the RuntimeError from here.","commit_id":"4916ab7a4cb67edc0b54a8ee67c58b1302769792"}]}
