)]}'
{"/COMMIT_MSG":[{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"75685a31a0fe27c6f54c07fb0b9d3a7321028a2d","unresolved":false,"context_lines":[{"line_number":8,"context_line":""},{"line_number":9,"context_line":"The resource tracker has a global lock. This is problematic when"},{"line_number":10,"context_line":"the background process update_available_resources is invoked."},{"line_number":11,"context_line":"If thereare throusands of instances on the compute node then we"},{"line_number":12,"context_line":"see that instances being deployed at the same time will take a"},{"line_number":13,"context_line":"considerable amount of time as the spawn will wait on the task"},{"line_number":14,"context_line":"update_available_resources to complete."}],"source_content_type":"text/x-gerrit-commit-message","patch_set":2,"id":"3fa7e38b_ec7f06a9","line":11,"range":{"start_line":11,"start_character":3,"end_line":11,"end_character":22},"updated":"2019-09-17 21:44:58.000000000","message":"there are thousands","commit_id":"ba3c5260c366321eabd9e8918a271b5328be7f49"},{"author":{"_account_id":1653,"name":"garyk","email":"gkotton@vmware.com","username":"garyk"},"change_message_id":"d194dfd75af7f17f29944a8f81e40669283d8883","unresolved":false,"context_lines":[{"line_number":8,"context_line":""},{"line_number":9,"context_line":"The resource tracker has a global lock. This is problematic when"},{"line_number":10,"context_line":"the background process update_available_resources is invoked."},{"line_number":11,"context_line":"If thereare throusands of instances on the compute node then we"},{"line_number":12,"context_line":"see that instances being deployed at the same time will take a"},{"line_number":13,"context_line":"considerable amount of time as the spawn will wait on the task"},{"line_number":14,"context_line":"update_available_resources to complete."}],"source_content_type":"text/x-gerrit-commit-message","patch_set":2,"id":"3fa7e38b_0ed85351","line":11,"range":{"start_line":11,"start_character":3,"end_line":11,"end_character":22},"in_reply_to":"3fa7e38b_ec7f06a9","updated":"2019-09-18 06:16:23.000000000","message":"Done","commit_id":"ba3c5260c366321eabd9e8918a271b5328be7f49"}],"nova/compute/resource_tracker.py":[{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"75685a31a0fe27c6f54c07fb0b9d3a7321028a2d","unresolved":false,"context_lines":[{"line_number":923,"context_line":"        # Now calculate usage based on instance utilization. The locking"},{"line_number":924,"context_line":"        # will be done only on the critical sections in the method to"},{"line_number":925,"context_line":"        # enable other threads not to be blocked"},{"line_number":926,"context_line":"        instance_by_uuid \u003d self._update_usage_from_instances("},{"line_number":927,"context_line":"            context, instances, nodename)"},{"line_number":928,"context_line":"        instance_by_uuid \u003d self._update_usage_from_instances("},{"line_number":929,"context_line":"            context, instances, nodename)"},{"line_number":930,"context_line":""}],"source_content_type":"text/x-python","patch_set":2,"id":"3fa7e38b_1d5172d9","line":927,"range":{"start_line":926,"start_character":0,"end_line":927,"end_character":41},"updated":"2019-09-17 21:44:58.000000000","message":"duplicated","commit_id":"ba3c5260c366321eabd9e8918a271b5328be7f49"},{"author":{"_account_id":1653,"name":"garyk","email":"gkotton@vmware.com","username":"garyk"},"change_message_id":"d194dfd75af7f17f29944a8f81e40669283d8883","unresolved":false,"context_lines":[{"line_number":923,"context_line":"        # Now calculate usage based on instance utilization. The locking"},{"line_number":924,"context_line":"        # will be done only on the critical sections in the method to"},{"line_number":925,"context_line":"        # enable other threads not to be blocked"},{"line_number":926,"context_line":"        instance_by_uuid \u003d self._update_usage_from_instances("},{"line_number":927,"context_line":"            context, instances, nodename)"},{"line_number":928,"context_line":"        instance_by_uuid \u003d self._update_usage_from_instances("},{"line_number":929,"context_line":"            context, instances, nodename)"},{"line_number":930,"context_line":""}],"source_content_type":"text/x-python","patch_set":2,"id":"3fa7e38b_0ed7f34d","line":927,"range":{"start_line":926,"start_character":0,"end_line":927,"end_character":41},"in_reply_to":"3fa7e38b_1d5172d9","updated":"2019-09-18 06:16:23.000000000","message":"oops. my bad","commit_id":"ba3c5260c366321eabd9e8918a271b5328be7f49"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"75685a31a0fe27c6f54c07fb0b9d3a7321028a2d","unresolved":false,"context_lines":[{"line_number":940,"context_line":"                                             startup\u003dstartup)"},{"line_number":941,"context_line":""},{"line_number":942,"context_line":"    @utils.synchronized(COMPUTE_RESOURCE_SEMAPHORE)"},{"line_number":943,"context_line":"    def _safe_update_available_resource(self, context, resources, migrations,"},{"line_number":944,"context_line":"                                        instance_by_uuid, instances, nodename,"},{"line_number":945,"context_line":"                                        is_new_compute_node, startup\u003dFalse):"},{"line_number":946,"context_line":"        self._update_usage_from_migrations(context, migrations, nodename)"}],"source_content_type":"text/x-python","patch_set":2,"id":"3fa7e38b_9d5ec2e4","line":943,"range":{"start_line":943,"start_character":8,"end_line":943,"end_character":13},"updated":"2019-09-17 21:44:58.000000000","message":"perhaps _locked would be a better prefix?","commit_id":"ba3c5260c366321eabd9e8918a271b5328be7f49"},{"author":{"_account_id":1653,"name":"garyk","email":"gkotton@vmware.com","username":"garyk"},"change_message_id":"d194dfd75af7f17f29944a8f81e40669283d8883","unresolved":false,"context_lines":[{"line_number":940,"context_line":"                                             startup\u003dstartup)"},{"line_number":941,"context_line":""},{"line_number":942,"context_line":"    @utils.synchronized(COMPUTE_RESOURCE_SEMAPHORE)"},{"line_number":943,"context_line":"    def _safe_update_available_resource(self, context, resources, migrations,"},{"line_number":944,"context_line":"                                        instance_by_uuid, instances, nodename,"},{"line_number":945,"context_line":"                                        is_new_compute_node, startup\u003dFalse):"},{"line_number":946,"context_line":"        self._update_usage_from_migrations(context, migrations, nodename)"}],"source_content_type":"text/x-python","patch_set":2,"id":"3fa7e38b_aedc9f46","line":943,"range":{"start_line":943,"start_character":8,"end_line":943,"end_character":13},"in_reply_to":"3fa7e38b_9d5ec2e4","updated":"2019-09-18 06:16:23.000000000","message":"Done","commit_id":"ba3c5260c366321eabd9e8918a271b5328be7f49"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"75685a31a0fe27c6f54c07fb0b9d3a7321028a2d","unresolved":false,"context_lines":[{"line_number":1448,"context_line":"    # periodic task this is called when looping over all of the instances. We"},{"line_number":1449,"context_line":"    # just need to take the lock when invoking this method."},{"line_number":1450,"context_line":"    @utils.synchronized(COMPUTE_RESOURCE_SEMAPHORE)"},{"line_number":1451,"context_line":"    def _safe_update_usage_from_instance(self, context, instance, nodename,"},{"line_number":1452,"context_line":"                                         is_removed\u003dFalse):"},{"line_number":1453,"context_line":"        self._update_usage_from_instance(context, instance, nodename,"},{"line_number":1454,"context_line":"                                         is_removed\u003dis_removed)"}],"source_content_type":"text/x-python","patch_set":2,"id":"3fa7e38b_ecfce63f","line":1451,"range":{"start_line":1451,"start_character":8,"end_line":1451,"end_character":13},"updated":"2019-09-17 21:44:58.000000000","message":"ditto","commit_id":"ba3c5260c366321eabd9e8918a271b5328be7f49"},{"author":{"_account_id":1653,"name":"garyk","email":"gkotton@vmware.com","username":"garyk"},"change_message_id":"d194dfd75af7f17f29944a8f81e40669283d8883","unresolved":false,"context_lines":[{"line_number":1448,"context_line":"    # periodic task this is called when looping over all of the instances. We"},{"line_number":1449,"context_line":"    # just need to take the lock when invoking this method."},{"line_number":1450,"context_line":"    @utils.synchronized(COMPUTE_RESOURCE_SEMAPHORE)"},{"line_number":1451,"context_line":"    def _safe_update_usage_from_instance(self, context, instance, nodename,"},{"line_number":1452,"context_line":"                                         is_removed\u003dFalse):"},{"line_number":1453,"context_line":"        self._update_usage_from_instance(context, instance, nodename,"},{"line_number":1454,"context_line":"                                         is_removed\u003dis_removed)"}],"source_content_type":"text/x-python","patch_set":2,"id":"3fa7e38b_cee1db00","line":1451,"range":{"start_line":1451,"start_character":8,"end_line":1451,"end_character":13},"in_reply_to":"3fa7e38b_ecfce63f","updated":"2019-09-18 06:16:23.000000000","message":"Done","commit_id":"ba3c5260c366321eabd9e8918a271b5328be7f49"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"75685a31a0fe27c6f54c07fb0b9d3a7321028a2d","unresolved":false,"context_lines":[{"line_number":1507,"context_line":"        instances assigned to the local compute host, even if they are not"},{"line_number":1508,"context_line":"        currently powered on."},{"line_number":1509,"context_line":"        \"\"\""},{"line_number":1510,"context_line":"        @utils.synchronized(COMPUTE_RESOURCE_SEMAPHORE)"},{"line_number":1511,"context_line":"        def _locked_cn_reset():"},{"line_number":1512,"context_line":"            self.tracked_instances.clear()"},{"line_number":1513,"context_line":""},{"line_number":1514,"context_line":"            cn \u003d self.compute_nodes[nodename]"}],"source_content_type":"text/x-python","patch_set":2,"id":"3fa7e38b_2c6c3e35","line":1511,"range":{"start_line":1510,"start_character":8,"end_line":1511,"end_character":31},"updated":"2019-09-17 21:44:58.000000000","message":"It would be better to use a context manager here.\n\n[Much later] Well, it would be nice if there was a nova.utils.lock context manager to correspond to the nova.utils.synchronized decorator, but that would require an oslo_concurrency.lockutils.lock_with_prefix partial to correspond to oslo_concurrency.lockutils.synchronized_with_prefix. I made a patch for the latter [1], but that\u0027s not going to be available any time soon, so... this is fine for now.\n\n[1] https://review.opendev.org/682751","commit_id":"ba3c5260c366321eabd9e8918a271b5328be7f49"},{"author":{"_account_id":1653,"name":"garyk","email":"gkotton@vmware.com","username":"garyk"},"change_message_id":"d194dfd75af7f17f29944a8f81e40669283d8883","unresolved":false,"context_lines":[{"line_number":1507,"context_line":"        instances assigned to the local compute host, even if they are not"},{"line_number":1508,"context_line":"        currently powered on."},{"line_number":1509,"context_line":"        \"\"\""},{"line_number":1510,"context_line":"        @utils.synchronized(COMPUTE_RESOURCE_SEMAPHORE)"},{"line_number":1511,"context_line":"        def _locked_cn_reset():"},{"line_number":1512,"context_line":"            self.tracked_instances.clear()"},{"line_number":1513,"context_line":""},{"line_number":1514,"context_line":"            cn \u003d self.compute_nodes[nodename]"}],"source_content_type":"text/x-python","patch_set":2,"id":"3fa7e38b_eebdb768","line":1511,"range":{"start_line":1510,"start_character":8,"end_line":1511,"end_character":31},"in_reply_to":"3fa7e38b_2c6c3e35","updated":"2019-09-18 06:16:23.000000000","message":"do you have an example of the context manager that i can look at?","commit_id":"ba3c5260c366321eabd9e8918a271b5328be7f49"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"b5dffdfbcdb62b141ecd8fc2df6e86545c50c43a","unresolved":false,"context_lines":[{"line_number":1507,"context_line":"        instances assigned to the local compute host, even if they are not"},{"line_number":1508,"context_line":"        currently powered on."},{"line_number":1509,"context_line":"        \"\"\""},{"line_number":1510,"context_line":"        @utils.synchronized(COMPUTE_RESOURCE_SEMAPHORE)"},{"line_number":1511,"context_line":"        def _locked_cn_reset():"},{"line_number":1512,"context_line":"            self.tracked_instances.clear()"},{"line_number":1513,"context_line":""},{"line_number":1514,"context_line":"            cn \u003d self.compute_nodes[nodename]"}],"source_content_type":"text/x-python","patch_set":2,"id":"3fa7e38b_47d92582","line":1511,"range":{"start_line":1510,"start_character":8,"end_line":1511,"end_character":31},"in_reply_to":"3fa7e38b_eebdb768","updated":"2019-12-02 17:08:11.000000000","message":"https://review.opendev.org/682751 is merged now fwiw. If you wanted to use it, it would need to be in a release which would have to be required by this patch.","commit_id":"ba3c5260c366321eabd9e8918a271b5328be7f49"}]}
