)]}'
{"/COMMIT_MSG":[{"author":{"_account_id":20813,"name":"Sofia Enriquez","email":"lsofia.enriquez@gmail.com","username":"enriquetaso"},"change_message_id":"ae2893268facd7747757ffc92e8ae7befbf6c0f4","unresolved":true,"context_lines":[{"line_number":10,"context_line":"of the connections to the iSCSI portal are not reinitiated and missing"},{"line_number":11,"context_line":"iSCSI devices are observed. This patchset introduced retries for this"},{"line_number":12,"context_line":"particular scenario."},{"line_number":13,"context_line":""},{"line_number":14,"context_line":"Change-Id: I60ee7421f7b792e8324286908a9fdd8fb53e433e"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":2,"id":"338d357c_86695232","line":13,"updated":"2021-09-22 13:34:53.000000000","message":":-1: Please add reference to https://bugs.launchpad.net/os-brick/+bug/1944474\n\n```Closes-Bug: 1944474```","commit_id":"d9c331e079fea38b6ce4d7d4381451399c30dd24"},{"author":{"_account_id":18236,"name":"Sophie Huang","email":"sophieh01@yahoo.com","username":"SophieHuang"},"change_message_id":"41cabf2e25e55b499c38c92cb4146000478c7fdd","unresolved":false,"context_lines":[{"line_number":10,"context_line":"of the connections to the iSCSI portal are not reinitiated and missing"},{"line_number":11,"context_line":"iSCSI devices are observed. This patchset introduced retries for this"},{"line_number":12,"context_line":"particular scenario."},{"line_number":13,"context_line":""},{"line_number":14,"context_line":"Change-Id: I60ee7421f7b792e8324286908a9fdd8fb53e433e"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":2,"id":"f5fc313e_27a2ef56","line":13,"in_reply_to":"338d357c_86695232","updated":"2021-09-24 16:46:03.000000000","message":"Thanks, Sofia!","commit_id":"d9c331e079fea38b6ce4d7d4381451399c30dd24"}],"os_brick/initiator/connectors/iscsi.py":[{"author":{"_account_id":5314,"name":"Brian Rosmaita","email":"rosmaita.fossdev@gmail.com","username":"brian-rosmaita"},"change_message_id":"9cc6bd709396f8b2ec3c727f99c9b6919a217b85","unresolved":true,"context_lines":[{"line_number":1050,"context_line":"                iqns.append(data[1])"},{"line_number":1051,"context_line":"        return ips, iqns"},{"line_number":1052,"context_line":""},{"line_number":1053,"context_line":"    @utils.retry((exception.VolumeDeviceNotFound))"},{"line_number":1054,"context_line":"    def _connect_to_iscsi_portal(self, connection_properties):"},{"line_number":1055,"context_line":"        \"\"\"Connect to an iSCSI portal-target an return the session id.\"\"\""},{"line_number":1056,"context_line":"        portal \u003d connection_properties[\u0027target_portal\u0027].split(\",\")[0]"}],"source_content_type":"text/x-python","patch_set":5,"id":"cd078d7e_fb373f7e","line":1053,"range":{"start_line":1053,"start_character":48,"end_line":1053,"end_character":49},"updated":"2021-09-28 19:34:04.000000000","message":"This is the only file in os_brick that puts the exception in parentheses.  Not sure why, they don\u0027t do anything, but might as well be consistent, I guess.\n\nThe real question I wanted to ask, though, is I guess your experiments have shown that the default retries\u003d3 works fine for this fix?","commit_id":"1795e273eacdf0cd767e7f00bf726abbdc2d4e45"},{"author":{"_account_id":18236,"name":"Sophie Huang","email":"sophieh01@yahoo.com","username":"SophieHuang"},"change_message_id":"7eebdf2af0f374677192a42f2d51620ba39cde02","unresolved":false,"context_lines":[{"line_number":1050,"context_line":"                iqns.append(data[1])"},{"line_number":1051,"context_line":"        return ips, iqns"},{"line_number":1052,"context_line":""},{"line_number":1053,"context_line":"    @utils.retry((exception.VolumeDeviceNotFound))"},{"line_number":1054,"context_line":"    def _connect_to_iscsi_portal(self, connection_properties):"},{"line_number":1055,"context_line":"        \"\"\"Connect to an iSCSI portal-target an return the session id.\"\"\""},{"line_number":1056,"context_line":"        portal \u003d connection_properties[\u0027target_portal\u0027].split(\",\")[0]"}],"source_content_type":"text/x-python","patch_set":5,"id":"7b65cf17_e1589730","line":1053,"range":{"start_line":1053,"start_character":48,"end_line":1053,"end_character":49},"in_reply_to":"cd078d7e_fb373f7e","updated":"2021-09-28 20:17:12.000000000","message":"I have tested using PureStorage backend and saw that all the iscsiadm -m node -T \u003ctarget\u003e -p \u003cportal\u003e were sent out and got the return code of 21 in about 0.01s. And then all the iscsiadm -m node -T \u003ctarget\u003e -p \u003cportal\u003e --interface default --op new sent out at about the same time and got the return code of 0 or 6 back in about 0.02s. After 2 second sleep, the failed one(s) retried and passed.","commit_id":"1795e273eacdf0cd767e7f00bf726abbdc2d4e45"},{"author":{"_account_id":9535,"name":"Gorka Eguileor","email":"geguileo@redhat.com","username":"Gorka"},"change_message_id":"3ba7cb5d1c68fadb73df088a9204c3d6188887e4","unresolved":true,"context_lines":[{"line_number":1050,"context_line":"                iqns.append(data[1])"},{"line_number":1051,"context_line":"        return ips, iqns"},{"line_number":1052,"context_line":""},{"line_number":1053,"context_line":"    @utils.retry((exception.VolumeDeviceNotFound))"},{"line_number":1054,"context_line":"    def _connect_to_iscsi_portal(self, connection_properties):"},{"line_number":1055,"context_line":"        \"\"\"Connect to an iSCSI portal-target an return the session id.\"\"\""},{"line_number":1056,"context_line":"        portal \u003d connection_properties[\u0027target_portal\u0027].split(\",\")[0]"}],"source_content_type":"text/x-python","patch_set":6,"id":"bdd16c58_882e4eb5","line":1053,"range":{"start_line":1053,"start_character":0,"end_line":1053,"end_character":50},"updated":"2021-09-29 15:40:40.000000000","message":"The database error reported in the bug is \"Could not make /etc/iscsi/nodes/iqn.xxxxxxxxxxxxxxx: File exists\" which seems like yet another race condition within Open iSCSI when there are concurrent requests from os-brick, and the concurrent requests happen because os-brick has a race condition between L1067 and L1070 with another os-brick thread.\n\nSo in my opinion a nicer solution would be to use an in-process lock using the target and portal as the lock name, because it would reduce the load on the system (fewer iscsiadm calls that can fail) and doesn\u0027t have the issue that the retry does, where it can reach the retry limit with high concurrency.","commit_id":"5cfb2bb7102d38a87cf6c936e9e3107808559f92"},{"author":{"_account_id":18236,"name":"Sophie Huang","email":"sophieh01@yahoo.com","username":"SophieHuang"},"change_message_id":"fcb60e89661340dc1058de256f369d48c1b036c3","unresolved":true,"context_lines":[{"line_number":1050,"context_line":"                iqns.append(data[1])"},{"line_number":1051,"context_line":"        return ips, iqns"},{"line_number":1052,"context_line":""},{"line_number":1053,"context_line":"    @utils.retry((exception.VolumeDeviceNotFound))"},{"line_number":1054,"context_line":"    def _connect_to_iscsi_portal(self, connection_properties):"},{"line_number":1055,"context_line":"        \"\"\"Connect to an iSCSI portal-target an return the session id.\"\"\""},{"line_number":1056,"context_line":"        portal \u003d connection_properties[\u0027target_portal\u0027].split(\",\")[0]"}],"source_content_type":"text/x-python","patch_set":6,"id":"33fa49be_aa753217","line":1053,"range":{"start_line":1053,"start_character":0,"end_line":1053,"end_character":50},"in_reply_to":"40966b1e_6aba44aa","updated":"2021-09-30 22:49:03.000000000","message":"I can also remove the retries as below because the exit code 6 will not happen if we lock the method.\n    @utils.trace\n    @synchronized(\u0027connect_to_iscsi_portal\u0027)\n    def _connect_to_iscsi_portal(self, connection_properties):\nPlease advise and I\u0027ll get it implemented. We are waiting for this patchset. Thanks!","commit_id":"5cfb2bb7102d38a87cf6c936e9e3107808559f92"},{"author":{"_account_id":18236,"name":"Sophie Huang","email":"sophieh01@yahoo.com","username":"SophieHuang"},"change_message_id":"b11cd0e5bff0e363b98d30525bf1edfc5e2d2366","unresolved":true,"context_lines":[{"line_number":1050,"context_line":"                iqns.append(data[1])"},{"line_number":1051,"context_line":"        return ips, iqns"},{"line_number":1052,"context_line":""},{"line_number":1053,"context_line":"    @utils.retry((exception.VolumeDeviceNotFound))"},{"line_number":1054,"context_line":"    def _connect_to_iscsi_portal(self, connection_properties):"},{"line_number":1055,"context_line":"        \"\"\"Connect to an iSCSI portal-target an return the session id.\"\"\""},{"line_number":1056,"context_line":"        portal \u003d connection_properties[\u0027target_portal\u0027].split(\",\")[0]"}],"source_content_type":"text/x-python","patch_set":6,"id":"40966b1e_6aba44aa","line":1053,"range":{"start_line":1053,"start_character":0,"end_line":1053,"end_character":50},"in_reply_to":"77d88529_952d6360","updated":"2021-09-30 20:39:20.000000000","message":"Please let me know if I can add a lock to _connect_to_iscsi_portal as below such that we\u0027ll run this method sequentially for the multiple threads in _connect_multipath_volume. \n\n    @utils.trace\n    @synchronized(\u0027connect_to_iscsi_portal\u0027)\n    @utils.retry((exception.BrickException))\n    def _connect_to_iscsi_portal(self, connection_properties):","commit_id":"5cfb2bb7102d38a87cf6c936e9e3107808559f92"},{"author":{"_account_id":18236,"name":"Sophie Huang","email":"sophieh01@yahoo.com","username":"SophieHuang"},"change_message_id":"cc2039a1fffbff2bed96583d1e7ac63b56835f30","unresolved":true,"context_lines":[{"line_number":1050,"context_line":"                iqns.append(data[1])"},{"line_number":1051,"context_line":"        return ips, iqns"},{"line_number":1052,"context_line":""},{"line_number":1053,"context_line":"    @utils.retry((exception.VolumeDeviceNotFound))"},{"line_number":1054,"context_line":"    def _connect_to_iscsi_portal(self, connection_properties):"},{"line_number":1055,"context_line":"        \"\"\"Connect to an iSCSI portal-target an return the session id.\"\"\""},{"line_number":1056,"context_line":"        portal \u003d connection_properties[\u0027target_portal\u0027].split(\",\")[0]"}],"source_content_type":"text/x-python","patch_set":6,"id":"77d88529_952d6360","line":1053,"range":{"start_line":1053,"start_character":0,"end_line":1053,"end_character":50},"in_reply_to":"b442dbc9_508dc3e1","updated":"2021-09-30 15:26:45.000000000","message":"Gorka, Thanks for your comments and understood your concerns. Based on the logs, it seems that the database error is introduced by the database access of all the threads, not the same thread for a target plus portal - I only have one lun in that testing. To add a lock, do you think I can just lock the _connect_to_iscsi_portal method for all access, instead of target and portal? Please advise. If you agree, I\u0027ll go ahead add the lock","commit_id":"5cfb2bb7102d38a87cf6c936e9e3107808559f92"},{"author":{"_account_id":18236,"name":"Sophie Huang","email":"sophieh01@yahoo.com","username":"SophieHuang"},"change_message_id":"999dddc66c3483424ed9e1b1f1a3c32a7e3c3363","unresolved":true,"context_lines":[{"line_number":1050,"context_line":"                iqns.append(data[1])"},{"line_number":1051,"context_line":"        return ips, iqns"},{"line_number":1052,"context_line":""},{"line_number":1053,"context_line":"    @utils.retry((exception.VolumeDeviceNotFound))"},{"line_number":1054,"context_line":"    def _connect_to_iscsi_portal(self, connection_properties):"},{"line_number":1055,"context_line":"        \"\"\"Connect to an iSCSI portal-target an return the session id.\"\"\""},{"line_number":1056,"context_line":"        portal \u003d connection_properties[\u0027target_portal\u0027].split(\",\")[0]"}],"source_content_type":"text/x-python","patch_set":6,"id":"d996f658_efd9461a","line":1053,"range":{"start_line":1053,"start_character":0,"end_line":1053,"end_character":50},"in_reply_to":"bdd16c58_882e4eb5","updated":"2021-09-29 18:27:16.000000000","message":"Gorka, thanks for providing the comments. Currently the lock is on connect_volume. In case of multipath, multi-threads are created before invoking _connect_vol. Based on the logs, it seems that somehow the database error is caused by the interaction of all the threads. Do you think we can add another lock at the _connect_vol? Or shall we just use the retry mechanism for now? Please refer to below log and please let me know. Thanks!\n\n2021-09-22 21:53:32.747 172209 DEBUG oslo_concurrency.processutils [-] Running cmd (subprocess): iscsiadm -m node -T iqn.2010-06.com.purestorage:flasharray.3d75f52157933f4e -p 172.31.0.252:3260 --interface default --op new execute /var/lib/openstack/lib/python3.6/site-packages/oslo_concurrency/processutils.py:379\n2021-09-22 21:53:32.762 172209 DEBUG oslo_concurrency.processutils [-] CMD \"iscsiadm -m node -T iqn.2010-06.com.purestorage:flasharray.3d75f52157933f4e -p 172.31.0.248:3260 --interface default --op new\" returned: 0 in 0.023s execute /var/lib/openstack/lib/python3.6/site-packages/oslo_concurrency/processutils.py:416\n2021-09-22 21:53:32.762 172209 DEBUG oslo_concurrency.processutils [-] CMD \"iscsiadm -m node -T iqn.2010-06.com.purestorage:flasharray.3d75f52157933f4e -p 172.31.0.247:3260 --interface default --op new\" returned: 6 in 0.028s execute /var/lib/openstack/lib/python3.6/site-packages/oslo_concurrency/processutils.py:416\n2021-09-22 21:53:32.762 172209 DEBUG oslo.privsep.daemon [-] privsep: reply[140222308533816]: (4, (\u0027\u0027, \u0027iscsiadm: Could not make /etc/iscsi/nodes/iqn.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx: File exists\\niscsiadm: Error while adding record: encountered iSCSI database failure\\n\u0027)) _call_back /var/lib/openstack/lib/python3.6/site-packages/oslo_privsep/daemon.py:511\n2021-09-22 21:53:32.762 172209 DEBUG oslo_concurrency.processutils [-] CMD \"iscsiadm -m node -T iqn.xxxxxxxxxxxxxxxxxxxxxxxxxx -p 172.31.0.251:3260 --interface default --op new\" returned: 0 in 0.023s execute /var/lib/openstack/lib/python3.6/site-packages/oslo_concurrency/processutils.py:416\n2021-09-22 21:53:32.763 172209 DEBUG oslo.privsep.daemon [-] privsep: reply[140222308534120]: (4, (\u0027New iSCSI node [tcp:[hw\u003d,ip\u003d,net_if\u003d,iscsi_if\u003ddefault] 172.31.0.251,3260,-1 iqn.2010-06.com.purestorage:flasharray.3d75f52157933f4e] added\\n\u0027, \u0027\u0027)) _call_back /var/lib/openstack/lib/python3.6/site-packages/oslo_privsep/daemon.py:511\n2021-09-22 21:53:32.763 171181 DEBUG os_brick.initiator.connectors.iscsi [req-ce76511c-924a-4a57-883c-539cd0d7b27d - - - - -] iscsiadm (\u0027--interface\u0027, \u0027default\u0027, \u0027--op\u0027, \u0027new\u0027): stdout\u003d stderr\u003discsiadm: Could not make /etc/iscsi/nodes/iqn.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx: File exists\niscsiadm: Error while adding record: encountered iSCSI database failure","commit_id":"5cfb2bb7102d38a87cf6c936e9e3107808559f92"},{"author":{"_account_id":9535,"name":"Gorka Eguileor","email":"geguileo@redhat.com","username":"Gorka"},"change_message_id":"9a03ebe1d8856ce8dacd8bf8fad13a4b3fba0606","unresolved":true,"context_lines":[{"line_number":1050,"context_line":"                iqns.append(data[1])"},{"line_number":1051,"context_line":"        return ips, iqns"},{"line_number":1052,"context_line":""},{"line_number":1053,"context_line":"    @utils.retry((exception.VolumeDeviceNotFound))"},{"line_number":1054,"context_line":"    def _connect_to_iscsi_portal(self, connection_properties):"},{"line_number":1055,"context_line":"        \"\"\"Connect to an iSCSI portal-target an return the session id.\"\"\""},{"line_number":1056,"context_line":"        portal \u003d connection_properties[\u0027target_portal\u0027].split(\",\")[0]"}],"source_content_type":"text/x-python","patch_set":6,"id":"b442dbc9_508dc3e1","line":1053,"range":{"start_line":1053,"start_character":0,"end_line":1053,"end_character":50},"in_reply_to":"d996f658_efd9461a","updated":"2021-09-30 14:43:49.000000000","message":"Your analysis is correct, the issue is on multipathing and it would only happen on arrays that share the target and portal (only LUN changes between different volumes).\n\nSo we could add a lock using the target and portal to prevent multiple _connect_to_iscsi_portal so it only blocks the cases that can fail.  And since there is no limit we wouldn\u0027t have the problem the retry has.\n\nAlso, we could have similar Open iSCSI DB problems on all thee _iscsiadm_update commands in this method and on the login (L1116), so a locking would prevent any errors there as well, whereas with retry we have to go one by one making sure that we raise the right exception for the retry.","commit_id":"5cfb2bb7102d38a87cf6c936e9e3107808559f92"},{"author":{"_account_id":9535,"name":"Gorka Eguileor","email":"geguileo@redhat.com","username":"Gorka"},"change_message_id":"3ba7cb5d1c68fadb73df088a9204c3d6188887e4","unresolved":true,"context_lines":[{"line_number":1074,"context_line":"                                                  check_exit_code\u003d(0, 6))"},{"line_number":1075,"context_line":"            if err_new:"},{"line_number":1076,"context_line":"                # retry if iscsiadm returns 6 for \"database failure\""},{"line_number":1077,"context_line":"                LOG.info(\"Retrying to connect to iSCSI portal %s\", portal)"},{"line_number":1078,"context_line":"                raise exception.VolumeDeviceNotFound(device\u003d\u0027\u0027)"},{"line_number":1079,"context_line":""},{"line_number":1080,"context_line":"        # Try to set the scan mode to manual"}],"source_content_type":"text/x-python","patch_set":6,"id":"f2a04201_e4327cb8","line":1077,"range":{"start_line":1077,"start_character":20,"end_line":1077,"end_character":24},"updated":"2021-09-29 15:40:40.000000000","message":"-1: Please move it to debug level","commit_id":"5cfb2bb7102d38a87cf6c936e9e3107808559f92"},{"author":{"_account_id":18236,"name":"Sophie Huang","email":"sophieh01@yahoo.com","username":"SophieHuang"},"change_message_id":"c48092df5033b0323bcdd190a46611de5a418949","unresolved":false,"context_lines":[{"line_number":1074,"context_line":"                                                  check_exit_code\u003d(0, 6))"},{"line_number":1075,"context_line":"            if err_new:"},{"line_number":1076,"context_line":"                # retry if iscsiadm returns 6 for \"database failure\""},{"line_number":1077,"context_line":"                LOG.info(\"Retrying to connect to iSCSI portal %s\", portal)"},{"line_number":1078,"context_line":"                raise exception.VolumeDeviceNotFound(device\u003d\u0027\u0027)"},{"line_number":1079,"context_line":""},{"line_number":1080,"context_line":"        # Try to set the scan mode to manual"}],"source_content_type":"text/x-python","patch_set":6,"id":"a79c0d61_febc689b","line":1077,"range":{"start_line":1077,"start_character":20,"end_line":1077,"end_character":24},"in_reply_to":"f2a04201_e4327cb8","updated":"2021-09-29 21:45:54.000000000","message":"updated","commit_id":"5cfb2bb7102d38a87cf6c936e9e3107808559f92"},{"author":{"_account_id":9535,"name":"Gorka Eguileor","email":"geguileo@redhat.com","username":"Gorka"},"change_message_id":"3ba7cb5d1c68fadb73df088a9204c3d6188887e4","unresolved":true,"context_lines":[{"line_number":1075,"context_line":"            if err_new:"},{"line_number":1076,"context_line":"                # retry if iscsiadm returns 6 for \"database failure\""},{"line_number":1077,"context_line":"                LOG.info(\"Retrying to connect to iSCSI portal %s\", portal)"},{"line_number":1078,"context_line":"                raise exception.VolumeDeviceNotFound(device\u003d\u0027\u0027)"},{"line_number":1079,"context_line":""},{"line_number":1080,"context_line":"        # Try to set the scan mode to manual"},{"line_number":1081,"context_line":"        res \u003d self._iscsiadm_update(connection_properties,"}],"source_content_type":"text/x-python","patch_set":6,"id":"8001849e_2bf486e7","line":1078,"range":{"start_line":1078,"start_character":32,"end_line":1078,"end_character":52},"updated":"2021-09-29 15:40:40.000000000","message":"-1: It seems weird to raise this exception, since we are not searching for the device.  We can use the generic BrickException instead","commit_id":"5cfb2bb7102d38a87cf6c936e9e3107808559f92"},{"author":{"_account_id":18236,"name":"Sophie Huang","email":"sophieh01@yahoo.com","username":"SophieHuang"},"change_message_id":"c48092df5033b0323bcdd190a46611de5a418949","unresolved":false,"context_lines":[{"line_number":1075,"context_line":"            if err_new:"},{"line_number":1076,"context_line":"                # retry if iscsiadm returns 6 for \"database failure\""},{"line_number":1077,"context_line":"                LOG.info(\"Retrying to connect to iSCSI portal %s\", portal)"},{"line_number":1078,"context_line":"                raise exception.VolumeDeviceNotFound(device\u003d\u0027\u0027)"},{"line_number":1079,"context_line":""},{"line_number":1080,"context_line":"        # Try to set the scan mode to manual"},{"line_number":1081,"context_line":"        res \u003d self._iscsiadm_update(connection_properties,"}],"source_content_type":"text/x-python","patch_set":6,"id":"1732fae6_b5fae4c4","line":1078,"range":{"start_line":1078,"start_character":32,"end_line":1078,"end_character":52},"in_reply_to":"8001849e_2bf486e7","updated":"2021-09-29 21:45:54.000000000","message":"updated","commit_id":"5cfb2bb7102d38a87cf6c936e9e3107808559f92"},{"author":{"_account_id":9535,"name":"Gorka Eguileor","email":"geguileo@redhat.com","username":"Gorka"},"change_message_id":"9a03ebe1d8856ce8dacd8bf8fad13a4b3fba0606","unresolved":true,"context_lines":[{"line_number":1050,"context_line":"                iqns.append(data[1])"},{"line_number":1051,"context_line":"        return ips, iqns"},{"line_number":1052,"context_line":""},{"line_number":1053,"context_line":"    @utils.retry((exception.BrickException))"},{"line_number":1054,"context_line":"    def _connect_to_iscsi_portal(self, connection_properties):"},{"line_number":1055,"context_line":"        \"\"\"Connect to an iSCSI portal-target an return the session id.\"\"\""},{"line_number":1056,"context_line":"        portal \u003d connection_properties[\u0027target_portal\u0027].split(\",\")[0]"}],"source_content_type":"text/x-python","patch_set":7,"id":"2c02ddd5_14e67bdd","line":1053,"range":{"start_line":1053,"start_character":0,"end_line":1053,"end_character":44},"updated":"2021-09-30 14:43:49.000000000","message":"I believe we should use a lock using the target and portal instead, for the reasons explained on Patchset #6","commit_id":"1068742c75216befb2bb098cf848bacffd2e0a4a"},{"author":{"_account_id":9535,"name":"Gorka Eguileor","email":"geguileo@redhat.com","username":"Gorka"},"change_message_id":"2bd5b70f0077d0f1b1397abb6b3225ad54d6b1bb","unresolved":true,"context_lines":[{"line_number":1051,"context_line":"        return ips, iqns"},{"line_number":1052,"context_line":""},{"line_number":1053,"context_line":"    @utils.trace"},{"line_number":1054,"context_line":"    @synchronized(\u0027connect_to_iscsi_portal\u0027)"},{"line_number":1055,"context_line":"    @utils.retry((exception.BrickException))"},{"line_number":1056,"context_line":"    def _connect_to_iscsi_portal(self, connection_properties):"},{"line_number":1057,"context_line":"        \"\"\"Connect to an iSCSI portal-target an return the session id.\"\"\""}],"source_content_type":"text/x-python","patch_set":9,"id":"333665ed_c3f779c3","line":1054,"range":{"start_line":1054,"start_character":0,"end_line":1054,"end_character":44},"updated":"2021-10-06 08:24:53.000000000","message":"-1: Adding it this way introduces a regression for all arrays that don\u0027t do shared targets, because it will unnecessarily serialize this operation.\n\nI think locking on the portal and iqn and leaving the retry is the best course of action in case Open iSCSI can also fail when it\u0027s using the same portal.\n\nThere are multiple ways to implement this, we can either create an os-brick specific synchronized method that supports using the method arguments (like we did in Cinder https://github.com/openstack/cinder/blob/91d0a6512fcc829c90505d57a404b3390ea18e1b/cinder/coordination.py#L161-L165 )\n\nOr we can just do the locking inside the method.\n\nI think this could be an implementation of the second option. Changing this patch L1053 to L1056 with:\n\n    def _connect_to_iscsi_portal(self, connection_properties):\n        \"\"\"Safely connect to iSCSI portal-target an return the session id.\"\"\"\n        portal \u003d connection_properties[\u0027target_portal\u0027].split(\",\")[0]\n        target_iqn \u003d connection_properties[\u0027target_iqn\u0027]\n\n        lock_name \u003d f\u0027connect_to_iscsi_portal-{portal}-{target_iqn}\u0027\n        method \u003d synchronized(lock_name)(self._connect_to_iscsi_portal_unsafe)\n        return method(connection_properties)\n\n    @utils.retry((exception.BrickException))\n    def _connect_to_iscsi_portal_unsafe(self, connection_properties):\n\n\nOr if you think it\u0027s easier to read with an additional method:\n\n    def _connect_to_iscsi_portal(self, connection_properties):\n        \"\"\"Safely connect to iSCSI portal-target an return the session id.\"\"\"\n        portal \u003d connection_properties[\u0027target_portal\u0027].split(\",\")[0]\n        target_iqn \u003d connection_properties[\u0027target_iqn\u0027]\n\n        @synchronized(f\u0027connect_to_iscsi_portal-{portal}-{target_iqn}\u0027)\n        def safe_connect(connection_properties):\n             return self._connect_to_iscsi_portal_unsafe(connection_properties)\n\n        return safe_connect(connetion_properties)\n\n    @utils.retry((exception.BrickException))\n    def _connect_to_iscsi_portal_unsafe(self, connection_properties):","commit_id":"a0283df2781d975d2a417c6ffad1af7dfe722d84"}],"releasenotes/notes/bug-1944474-55c5ebb3a37801aa.yaml":[{"author":{"_account_id":5314,"name":"Brian Rosmaita","email":"rosmaita.fossdev@gmail.com","username":"brian-rosmaita"},"change_message_id":"9cc6bd709396f8b2ec3c727f99c9b6919a217b85","unresolved":true,"context_lines":[{"line_number":1,"context_line":"---"},{"line_number":2,"context_line":"fixes:"},{"line_number":3,"context_line":"  - |"},{"line_number":4,"context_line":"    `Bug #1944474 \u003chttps://bugs.launchpad.net/os-brick/+bug/1944474\u003e`_: Fix"},{"line_number":5,"context_line":"    missed retries to reinitiate iSCSI connections after compute host reboot"},{"line_number":6,"context_line":"    with multipath enabled."}],"source_content_type":"text/x-yaml","patch_set":5,"id":"11645033_d7b19cca","line":4,"range":{"start_line":4,"start_character":72,"end_line":4,"end_character":75},"updated":"2021-09-28 19:34:04.000000000","message":"This should be \u0027Fixed\u0027 -- see https://docs.openstack.org/cinder/latest/contributor/releasenotes.html#bugs","commit_id":"1795e273eacdf0cd767e7f00bf726abbdc2d4e45"},{"author":{"_account_id":18236,"name":"Sophie Huang","email":"sophieh01@yahoo.com","username":"SophieHuang"},"change_message_id":"7eebdf2af0f374677192a42f2d51620ba39cde02","unresolved":false,"context_lines":[{"line_number":1,"context_line":"---"},{"line_number":2,"context_line":"fixes:"},{"line_number":3,"context_line":"  - |"},{"line_number":4,"context_line":"    `Bug #1944474 \u003chttps://bugs.launchpad.net/os-brick/+bug/1944474\u003e`_: Fix"},{"line_number":5,"context_line":"    missed retries to reinitiate iSCSI connections after compute host reboot"},{"line_number":6,"context_line":"    with multipath enabled."}],"source_content_type":"text/x-yaml","patch_set":5,"id":"912d2c66_18aec53d","line":4,"range":{"start_line":4,"start_character":72,"end_line":4,"end_character":75},"in_reply_to":"11645033_d7b19cca","updated":"2021-09-28 20:17:12.000000000","message":"updated","commit_id":"1795e273eacdf0cd767e7f00bf726abbdc2d4e45"},{"author":{"_account_id":9535,"name":"Gorka Eguileor","email":"geguileo@redhat.com","username":"Gorka"},"change_message_id":"3ba7cb5d1c68fadb73df088a9204c3d6188887e4","unresolved":true,"context_lines":[{"line_number":1,"context_line":"---"},{"line_number":2,"context_line":"fixes:"},{"line_number":3,"context_line":"  - |"},{"line_number":4,"context_line":"    `Bug #1944474 \u003chttps://bugs.launchpad.net/os-brick/+bug/1944474\u003e`_: Fixed"},{"line_number":5,"context_line":"    missed retries to reinitiate iSCSI connections after compute host reboot"},{"line_number":6,"context_line":"    with multipath enabled."}],"source_content_type":"text/x-yaml","patch_set":6,"id":"34404856_d3e6bdb3","line":6,"range":{"start_line":4,"start_character":72,"end_line":6,"end_character":27},"updated":"2021-09-29 15:40:40.000000000","message":"nit: I think it\u0027s worth mentioning that this happens with high concurrency of connections (it could also happen without the reboot)","commit_id":"5cfb2bb7102d38a87cf6c936e9e3107808559f92"},{"author":{"_account_id":18236,"name":"Sophie Huang","email":"sophieh01@yahoo.com","username":"SophieHuang"},"change_message_id":"c48092df5033b0323bcdd190a46611de5a418949","unresolved":false,"context_lines":[{"line_number":1,"context_line":"---"},{"line_number":2,"context_line":"fixes:"},{"line_number":3,"context_line":"  - |"},{"line_number":4,"context_line":"    `Bug #1944474 \u003chttps://bugs.launchpad.net/os-brick/+bug/1944474\u003e`_: Fixed"},{"line_number":5,"context_line":"    missed retries to reinitiate iSCSI connections after compute host reboot"},{"line_number":6,"context_line":"    with multipath enabled."}],"source_content_type":"text/x-yaml","patch_set":6,"id":"bbada2f7_8ccde7c9","line":6,"range":{"start_line":4,"start_character":72,"end_line":6,"end_character":27},"in_reply_to":"34404856_d3e6bdb3","updated":"2021-09-29 21:45:54.000000000","message":"updated","commit_id":"5cfb2bb7102d38a87cf6c936e9e3107808559f92"}]}
