)]}'
{"neutron/tests/common/exclusive_resources/resource_allocator.py":[{"author":{"_account_id":16688,"name":"Rodolfo Alonso","email":"ralonsoh@redhat.com","username":"rodolfo-alonso-hernandez"},"change_message_id":"d6cec3088dfffb36a8197cc48b0c3a7c255ac455","unresolved":false,"context_lines":[{"line_number":27,"context_line":""},{"line_number":28,"context_line":"class ExclusiveResource(fixtures.Fixture):"},{"line_number":29,"context_line":"    def __init__(self, resource_name, allocator_function, validator\u003dNone):"},{"line_number":30,"context_line":"        temp_dir \u003d self.useFixture(fixtures.TempDir())"},{"line_number":31,"context_line":"        self.ra \u003d ResourceAllocator("},{"line_number":32,"context_line":"            resource_name, allocator_function, temp_dir, validator)"},{"line_number":33,"context_line":""}],"source_content_type":"text/x-python","patch_set":4,"id":"3f79a3b5_c7eefe1e","line":30,"range":{"start_line":30,"start_character":8,"end_line":30,"end_character":16},"updated":"2018-10-26 17:21:31.000000000","message":"Here you need the path, so you need to retrieve it from the fixture:\n  temp_dir \u003d self.useFixture(fixtures.TempDir()).path","commit_id":"f1cad93d3d18875471067ca86ec09d27c9963eee"},{"author":{"_account_id":16688,"name":"Rodolfo Alonso","email":"ralonsoh@redhat.com","username":"rodolfo-alonso-hernandez"},"change_message_id":"d6cec3088dfffb36a8197cc48b0c3a7c255ac455","unresolved":false,"context_lines":[{"line_number":27,"context_line":""},{"line_number":28,"context_line":"class ExclusiveResource(fixtures.Fixture):"},{"line_number":29,"context_line":"    def __init__(self, resource_name, allocator_function, validator\u003dNone):"},{"line_number":30,"context_line":"        temp_dir \u003d self.useFixture(fixtures.TempDir())"},{"line_number":31,"context_line":"        self.ra \u003d ResourceAllocator("},{"line_number":32,"context_line":"            resource_name, allocator_function, temp_dir, validator)"},{"line_number":33,"context_line":""},{"line_number":34,"context_line":"    def _setUp(self):"},{"line_number":35,"context_line":"        self.resource \u003d self.ra.allocate()"}],"source_content_type":"text/x-python","patch_set":4,"id":"3f79a3b5_071ab67a","line":32,"range":{"start_line":30,"start_character":8,"end_line":32,"end_character":67},"updated":"2018-10-26 17:21:31.000000000","message":"You need to move this to _setUp(), because the parent fixture (ExclusiveIPAddress, ExclusivePort, etc) must execute first the setUp() method to call self._clear_cleanups(), to initialize the self._cleanups member.\n\nThis could be something like:\n\nclass ExclusiveResource(fixtures.Fixture):\n    def __init__(self, resource_name, allocator_function, validator\u003dNone):\n        self.resource_name \u003d resource_name\n        self.allocator_function \u003d allocator_function\n        self.validator \u003d validator\n\n    def _setUp(self):\n        temp_dir \u003d self.useFixture(fixtures.TempDir()).path\n        self.ra \u003d ResourceAllocator(\n            self.resource_name, self.allocator_function, temp_dir,\n            self.validator)\n        self.resource \u003d self.ra.allocate()\n        self.addCleanup(self.ra.release, self.resource)","commit_id":"f1cad93d3d18875471067ca86ec09d27c9963eee"},{"author":{"_account_id":1131,"name":"Brian Haley","email":"haleyb.dev@gmail.com","username":"brian-haley"},"change_message_id":"7299bddbd6c612509a8ab3d79ecc88caf7975f2f","unresolved":false,"context_lines":[{"line_number":27,"context_line":""},{"line_number":28,"context_line":"class ExclusiveResource(fixtures.Fixture):"},{"line_number":29,"context_line":"    def __init__(self, resource_name, allocator_function, validator\u003dNone):"},{"line_number":30,"context_line":"        temp_dir \u003d self.useFixture(fixtures.TempDir())"},{"line_number":31,"context_line":"        self.ra \u003d ResourceAllocator("},{"line_number":32,"context_line":"            resource_name, allocator_function, temp_dir, validator)"},{"line_number":33,"context_line":""},{"line_number":34,"context_line":"    def _setUp(self):"},{"line_number":35,"context_line":"        self.resource \u003d self.ra.allocate()"}],"source_content_type":"text/x-python","patch_set":4,"id":"3f79a3b5_9a225b0e","line":32,"range":{"start_line":30,"start_character":8,"end_line":32,"end_character":67},"in_reply_to":"3f79a3b5_071ab67a","updated":"2018-11-13 22:01:54.000000000","message":"Thanks Rodolfo, I\u0027ll give that a try!","commit_id":"f1cad93d3d18875471067ca86ec09d27c9963eee"},{"author":{"_account_id":16688,"name":"Rodolfo Alonso","email":"ralonsoh@redhat.com","username":"rodolfo-alonso-hernandez"},"change_message_id":"461f61d7c184a0b19a4e457d000e918115c334af","unresolved":false,"context_lines":[{"line_number":22,"context_line":""},{"line_number":23,"context_line":"LOG \u003d logging.getLogger(__name__)"},{"line_number":24,"context_line":"MAX_ATTEMPTS \u003d 100"},{"line_number":25,"context_line":"TMP_DIR \u003d \u0027/tmp/neutron_exclusive_resources/\u0027"},{"line_number":26,"context_line":""},{"line_number":27,"context_line":""},{"line_number":28,"context_line":"class ExclusiveResource(fixtures.Fixture):"}],"source_content_type":"text/x-python","patch_set":6,"id":"9fdfeff1_3ded9f24","side":"PARENT","line":25,"range":{"start_line":25,"start_character":0,"end_line":25,"end_character":45},"updated":"2019-02-27 17:11:43.000000000","message":"Now I review the purpose of ResourceAllocator, I have concerns about this patch.\n\nAll resources are stored in the same path with unique file names, depending on the resource. When a process wants to access to this resource, it only needs to know the resource name but not the path. If the path is created randomly by TempDir [1], other processes won\u0027t have this reference path available and won\u0027t be able to access to the resource.\n\n[1] http://paste.openstack.org/show/746450/","commit_id":"dd14501c12243a8e5fb4086ba461482e54ac75bc"},{"author":{"_account_id":16688,"name":"Rodolfo Alonso","email":"ralonsoh@redhat.com","username":"rodolfo-alonso-hernandez"},"change_message_id":"8d0e809bf3618b94aea2a887c32de31df59970dc","unresolved":false,"context_lines":[{"line_number":97,"context_line":"            \u0027Could not allocate a new resource of type %s from pool %s\u0027 %"},{"line_number":98,"context_line":"            (self._resource_name, allocations))"},{"line_number":99,"context_line":""},{"line_number":100,"context_line":"    def release(self, resource):"},{"line_number":101,"context_line":"        with lockutils.lock(\u0027resource_allocator\u0027, runtime.SYNCHRONIZED_PREFIX,"},{"line_number":102,"context_line":"                            external\u003dTrue, lock_path\u003dself._temp_dir):"},{"line_number":103,"context_line":"            self._release(resource)"},{"line_number":104,"context_line":""},{"line_number":105,"context_line":"    def _release(self, resource):"},{"line_number":106,"context_line":"        allocations \u003d self._get_allocations()"},{"line_number":107,"context_line":"        allocations.remove(resource)"},{"line_number":108,"context_line":"        if allocations:"},{"line_number":109,"context_line":"            self._write_allocations(allocations)"},{"line_number":110,"context_line":"        else:  # Clean up the file if we\u0027re releasing the last allocation"},{"line_number":111,"context_line":"            os.remove(self._state_file_path)"},{"line_number":112,"context_line":"        LOG.debug(\u0027Released exclusive resource %s of type %s. The allocations \u0027"},{"line_number":113,"context_line":"                  \u0027are now: %s\u0027,"},{"line_number":114,"context_line":"                  resource, self._resource_name, allocations)"},{"line_number":115,"context_line":""},{"line_number":116,"context_line":"    def _get_allocations(self):"},{"line_number":117,"context_line":"        fileutils.ensure_tree(self._temp_dir, mode\u003d0o755)"}],"source_content_type":"text/x-python","patch_set":6,"id":"9fdfeff1_75ec4e8f","line":114,"range":{"start_line":100,"start_character":0,"end_line":114,"end_character":61},"updated":"2019-02-19 11:40:50.000000000","message":"We don\u0027t need this function anymore. The resources are freed when the temporary directory is deleted and this is done \"automatically\" because this directory is a fixture (with its own cleanUp function)\n\ntemp_dir \u003d self.useFixture(fixtures.TempDir()).path\n\n\n\nThis function should be:\n\n  def release(self, *args):  # *args to avoid pep8 errors\n                             # for unused param.\n      pass","commit_id":"5715ee7de52d5f187c091cba6b585578db1c04cb"},{"author":{"_account_id":1131,"name":"Brian Haley","email":"haleyb.dev@gmail.com","username":"brian-haley"},"change_message_id":"d0dc705957ce5615162a2c72cf64b40518b4bdfd","unresolved":false,"context_lines":[{"line_number":97,"context_line":"            \u0027Could not allocate a new resource of type %s from pool %s\u0027 %"},{"line_number":98,"context_line":"            (self._resource_name, allocations))"},{"line_number":99,"context_line":""},{"line_number":100,"context_line":"    def release(self, resource):"},{"line_number":101,"context_line":"        with lockutils.lock(\u0027resource_allocator\u0027, runtime.SYNCHRONIZED_PREFIX,"},{"line_number":102,"context_line":"                            external\u003dTrue, lock_path\u003dself._temp_dir):"},{"line_number":103,"context_line":"            self._release(resource)"},{"line_number":104,"context_line":""},{"line_number":105,"context_line":"    def _release(self, resource):"},{"line_number":106,"context_line":"        allocations \u003d self._get_allocations()"},{"line_number":107,"context_line":"        allocations.remove(resource)"},{"line_number":108,"context_line":"        if allocations:"},{"line_number":109,"context_line":"            self._write_allocations(allocations)"},{"line_number":110,"context_line":"        else:  # Clean up the file if we\u0027re releasing the last allocation"},{"line_number":111,"context_line":"            os.remove(self._state_file_path)"},{"line_number":112,"context_line":"        LOG.debug(\u0027Released exclusive resource %s of type %s. The allocations \u0027"},{"line_number":113,"context_line":"                  \u0027are now: %s\u0027,"},{"line_number":114,"context_line":"                  resource, self._resource_name, allocations)"},{"line_number":115,"context_line":""},{"line_number":116,"context_line":"    def _get_allocations(self):"},{"line_number":117,"context_line":"        fileutils.ensure_tree(self._temp_dir, mode\u003d0o755)"}],"source_content_type":"text/x-python","patch_set":6,"id":"9fdfeff1_b44a3c24","line":114,"range":{"start_line":100,"start_character":0,"end_line":114,"end_character":61},"in_reply_to":"9fdfeff1_75ec4e8f","updated":"2019-02-25 22:18:02.000000000","message":"I can see how the dir/file would get cleaned-up, but the resource won\u0027t be released for another instance to use.  Maybe I\u0027m missing something.\n\nThese small, seemingly simple changes are always a pain...","commit_id":"5715ee7de52d5f187c091cba6b585578db1c04cb"},{"author":{"_account_id":1131,"name":"Brian Haley","email":"haleyb.dev@gmail.com","username":"brian-haley"},"change_message_id":"37fb343dee0c37028931d9f835efe82a71053e84","unresolved":false,"context_lines":[{"line_number":97,"context_line":"            \u0027Could not allocate a new resource of type %s from pool %s\u0027 %"},{"line_number":98,"context_line":"            (self._resource_name, allocations))"},{"line_number":99,"context_line":""},{"line_number":100,"context_line":"    def release(self, resource):"},{"line_number":101,"context_line":"        with lockutils.lock(\u0027resource_allocator\u0027, runtime.SYNCHRONIZED_PREFIX,"},{"line_number":102,"context_line":"                            external\u003dTrue, lock_path\u003dself._temp_dir):"},{"line_number":103,"context_line":"            self._release(resource)"},{"line_number":104,"context_line":""},{"line_number":105,"context_line":"    def _release(self, resource):"},{"line_number":106,"context_line":"        allocations \u003d self._get_allocations()"},{"line_number":107,"context_line":"        allocations.remove(resource)"},{"line_number":108,"context_line":"        if allocations:"},{"line_number":109,"context_line":"            self._write_allocations(allocations)"},{"line_number":110,"context_line":"        else:  # Clean up the file if we\u0027re releasing the last allocation"},{"line_number":111,"context_line":"            os.remove(self._state_file_path)"},{"line_number":112,"context_line":"        LOG.debug(\u0027Released exclusive resource %s of type %s. The allocations \u0027"},{"line_number":113,"context_line":"                  \u0027are now: %s\u0027,"},{"line_number":114,"context_line":"                  resource, self._resource_name, allocations)"},{"line_number":115,"context_line":""},{"line_number":116,"context_line":"    def _get_allocations(self):"},{"line_number":117,"context_line":"        fileutils.ensure_tree(self._temp_dir, mode\u003d0o755)"}],"source_content_type":"text/x-python","patch_set":6,"id":"3fa7e38b_06f0ccfb","line":114,"range":{"start_line":100,"start_character":0,"end_line":114,"end_character":61},"in_reply_to":"9fdfeff1_9d412b3c","updated":"2020-01-21 20:44:15.000000000","message":"Thanks for this info, I\u0027ve let this change get old, but i\u0027ll send an update.","commit_id":"5715ee7de52d5f187c091cba6b585578db1c04cb"},{"author":{"_account_id":16688,"name":"Rodolfo Alonso","email":"ralonsoh@redhat.com","username":"rodolfo-alonso-hernandez"},"change_message_id":"461f61d7c184a0b19a4e457d000e918115c334af","unresolved":false,"context_lines":[{"line_number":97,"context_line":"            \u0027Could not allocate a new resource of type %s from pool %s\u0027 %"},{"line_number":98,"context_line":"            (self._resource_name, allocations))"},{"line_number":99,"context_line":""},{"line_number":100,"context_line":"    def release(self, resource):"},{"line_number":101,"context_line":"        with lockutils.lock(\u0027resource_allocator\u0027, runtime.SYNCHRONIZED_PREFIX,"},{"line_number":102,"context_line":"                            external\u003dTrue, lock_path\u003dself._temp_dir):"},{"line_number":103,"context_line":"            self._release(resource)"},{"line_number":104,"context_line":""},{"line_number":105,"context_line":"    def _release(self, resource):"},{"line_number":106,"context_line":"        allocations \u003d self._get_allocations()"},{"line_number":107,"context_line":"        allocations.remove(resource)"},{"line_number":108,"context_line":"        if allocations:"},{"line_number":109,"context_line":"            self._write_allocations(allocations)"},{"line_number":110,"context_line":"        else:  # Clean up the file if we\u0027re releasing the last allocation"},{"line_number":111,"context_line":"            os.remove(self._state_file_path)"},{"line_number":112,"context_line":"        LOG.debug(\u0027Released exclusive resource %s of type %s. The allocations \u0027"},{"line_number":113,"context_line":"                  \u0027are now: %s\u0027,"},{"line_number":114,"context_line":"                  resource, self._resource_name, allocations)"},{"line_number":115,"context_line":""},{"line_number":116,"context_line":"    def _get_allocations(self):"},{"line_number":117,"context_line":"        fileutils.ensure_tree(self._temp_dir, mode\u003d0o755)"}],"source_content_type":"text/x-python","patch_set":6,"id":"9fdfeff1_9d412b3c","line":114,"range":{"start_line":100,"start_character":0,"end_line":114,"end_character":61},"in_reply_to":"9fdfeff1_b44a3c24","updated":"2019-02-27 17:11:43.000000000","message":"That\u0027s the point: the resources are stored in files under this tempdir. When the tempdir is deleted, those resources will be \"freed\". This last sentence is not accurate, because ResourceAllocator is just an information blob made permanent in the filesystem, nothing else.\n\nIn L106, because at this point the tempdir is already gone, you\u0027ll have always None. That\u0027s why this implementation is failing.","commit_id":"5715ee7de52d5f187c091cba6b585578db1c04cb"},{"author":{"_account_id":11975,"name":"Slawek Kaplonski","email":"skaplons@redhat.com","username":"slaweq"},"change_message_id":"d25c3a3b15f1b2e82f3faa8870148904724790ec","unresolved":false,"context_lines":[{"line_number":77,"context_line":"    def allocate(self):"},{"line_number":78,"context_line":"        with lockutils.lock(\u0027resource_allocator\u0027, runtime.SYNCHRONIZED_PREFIX,"},{"line_number":79,"context_line":"                            external\u003dTrue, lock_path\u003dself._temp_dir):"},{"line_number":80,"context_line":"            self._allocate()"},{"line_number":81,"context_line":""},{"line_number":82,"context_line":"    def _allocate(self):"},{"line_number":83,"context_line":"        allocations \u003d self._get_allocations()"}],"source_content_type":"text/x-python","patch_set":9,"id":"3fa7e38b_43d98481","line":80,"updated":"2020-01-28 11:33:13.000000000","message":"You forgot about \"return\" here and probably this causes failures of many functional/fullstack tests","commit_id":"adce458bbe04795b8624a7d65dc4abc9216a355b"},{"author":{"_account_id":1131,"name":"Brian Haley","email":"haleyb.dev@gmail.com","username":"brian-haley"},"change_message_id":"d6e245f63d004873078d2de88d34abe8f60c8403","unresolved":false,"context_lines":[{"line_number":77,"context_line":"    def allocate(self):"},{"line_number":78,"context_line":"        with lockutils.lock(\u0027resource_allocator\u0027, runtime.SYNCHRONIZED_PREFIX,"},{"line_number":79,"context_line":"                            external\u003dTrue, lock_path\u003dself._temp_dir):"},{"line_number":80,"context_line":"            self._allocate()"},{"line_number":81,"context_line":""},{"line_number":82,"context_line":"    def _allocate(self):"},{"line_number":83,"context_line":"        allocations \u003d self._get_allocations()"}],"source_content_type":"text/x-python","patch_set":9,"id":"3fa7e38b_82caab16","line":80,"in_reply_to":"3fa7e38b_43d98481","updated":"2020-02-04 22:28:31.000000000","message":"Done","commit_id":"adce458bbe04795b8624a7d65dc4abc9216a355b"}]}
