)]}'
{"/COMMIT_MSG":[{"author":{"_account_id":17973,"name":"Ludovic Beliveau","email":"lbeliveau@gmail.com","username":"lbeliveau"},"change_message_id":"6cf1cc24b849e8ebf66c9ab30b98e92176a73a36","unresolved":false,"context_lines":[{"line_number":6,"context_line":""},{"line_number":7,"context_line":"Fix keypair quota error"},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"It should update the quotas in_use when keypair-add."},{"line_number":10,"context_line":""},{"line_number":11,"context_line":"Change-Id: Iba39cff9fb9b473fd7ca19e1288404279bb8d2f3"},{"line_number":12,"context_line":"Closes-Bug: #1644457"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":2,"id":"3a71b18c_8fcedf58","line":9,"updated":"2016-12-01 13:42:38.000000000","message":"Hard to read what this means.\n\nMaybe: Update in_use for quotas when a keypair is added.","commit_id":"ec554b2a62dd1ef9165cd8431d3d2fab01aff8b9"}],"nova/compute/api.py":[{"author":{"_account_id":5754,"name":"Alex Xu","email":"hejie.xu@intel.com","username":"xuhj"},"change_message_id":"f273542f36a2e047eedd0bc95eac0a58a739432d","unresolved":false,"context_lines":[{"line_number":4417,"context_line":"            quotas.reserve(key_pairs\u003d1)"},{"line_number":4418,"context_line":"        except exception.OverQuota:"},{"line_number":4419,"context_line":"            raise exception.KeypairLimitExceeded()"},{"line_number":4420,"context_line":"        quotas.commit()"},{"line_number":4421,"context_line":""},{"line_number":4422,"context_line":"    @wrap_exception()"},{"line_number":4423,"context_line":"    def import_key_pair(self, context, user_id, key_name, public_key,"}],"source_content_type":"text/x-python","patch_set":2,"id":"3a71b18c_f439f842","line":4420,"updated":"2016-12-01 07:52:29.000000000","message":"we can\u0027t commit immediately. deep into the code, they may have error raise out from _generate_fingerprint at line 4430\n\nWe should commit when everything is ready.","commit_id":"ec554b2a62dd1ef9165cd8431d3d2fab01aff8b9"},{"author":{"_account_id":5754,"name":"Alex Xu","email":"hejie.xu@intel.com","username":"xuhj"},"change_message_id":"f273542f36a2e047eedd0bc95eac0a58a739432d","unresolved":false,"context_lines":[{"line_number":4484,"context_line":"        quotas \u003d objects.Quotas(context\u003dcontext)"},{"line_number":4485,"context_line":"        try:"},{"line_number":4486,"context_line":"            quotas.reserve(project_id\u003dcontext.project_id,"},{"line_number":4487,"context_line":"                           user_id\u003duser_id, key_pairs\u003d-1)"},{"line_number":4488,"context_line":"        except Exception:"},{"line_number":4489,"context_line":"            LOG.exception(_LE(\"Failed to update usages deleting \""},{"line_number":4490,"context_line":"                              \"key pairs\"))"}],"source_content_type":"text/x-python","patch_set":2,"id":"3a71b18c_f45e5875","line":4487,"updated":"2016-12-01 07:52:29.000000000","message":"same problem as above, we should reserve before delete, and rollback when delete failed.","commit_id":"ec554b2a62dd1ef9165cd8431d3d2fab01aff8b9"},{"author":{"_account_id":6849,"name":"Roman Podoliaka","email":"roman.podoliaka@gmail.com","username":"rpodolyaka"},"change_message_id":"a35fd92b25e8b03ce1049e3589347a842284e9cd","unresolved":false,"context_lines":[{"line_number":4416,"context_line":"                        key_type\u003dkeypair_obj.KEYPAIR_TYPE_SSH):"},{"line_number":4417,"context_line":"        \"\"\"Import a key pair using an existing public key.\"\"\""},{"line_number":4418,"context_line":"        self._validate_new_key_pair(context, user_id, key_name, key_type)"},{"line_number":4419,"context_line":""},{"line_number":4420,"context_line":"        self._notify(context, \u0027import.start\u0027, key_name)"},{"line_number":4421,"context_line":""},{"line_number":4422,"context_line":"        fingerprint \u003d self._generate_fingerprint(public_key, key_type)"}],"source_content_type":"text/x-python","patch_set":5,"id":"3a71b18c_99106d5b","line":4419,"updated":"2016-12-05 11:09:39.000000000","message":"Why not try to quota.reserve() here, so that we could avoid sending a notification and creation of a db entry, if we exceed the quota value?","commit_id":"9effb7f10f38345ca92e67b1ddc9606117bf32e3"},{"author":{"_account_id":6849,"name":"Roman Podoliaka","email":"roman.podoliaka@gmail.com","username":"rpodolyaka"},"change_message_id":"a35fd92b25e8b03ce1049e3589347a842284e9cd","unresolved":false,"context_lines":[{"line_number":4446,"context_line":"                        key_type\u003dkeypair_obj.KEYPAIR_TYPE_SSH):"},{"line_number":4447,"context_line":"        \"\"\"Create a new key pair.\"\"\""},{"line_number":4448,"context_line":"        self._validate_new_key_pair(context, user_id, key_name, key_type)"},{"line_number":4449,"context_line":""},{"line_number":4450,"context_line":"        self._notify(context, \u0027create.start\u0027, key_name)"},{"line_number":4451,"context_line":""},{"line_number":4452,"context_line":"        private_key, public_key, fingerprint \u003d self._generate_key_pair("}],"source_content_type":"text/x-python","patch_set":5,"id":"3a71b18c_9c077b17","line":4449,"updated":"2016-12-05 11:09:39.000000000","message":"ditto","commit_id":"9effb7f10f38345ca92e67b1ddc9606117bf32e3"},{"author":{"_account_id":6849,"name":"Roman Podoliaka","email":"roman.podoliaka@gmail.com","username":"rpodolyaka"},"change_message_id":"a35fd92b25e8b03ce1049e3589347a842284e9cd","unresolved":false,"context_lines":[{"line_number":4490,"context_line":"        self._notify(context, \u0027delete.start\u0027, key_name)"},{"line_number":4491,"context_line":"        quotas \u003d objects.Quotas(context\u003dcontext)"},{"line_number":4492,"context_line":"        try:"},{"line_number":4493,"context_line":"            quotas.reserve(project_id\u003dcontext.project_id,"},{"line_number":4494,"context_line":"                           user_id\u003duser_id, key_pairs\u003d-1)"},{"line_number":4495,"context_line":"        except Exception:"},{"line_number":4496,"context_line":"            LOG.exception(_LE(\"Failed to update usages deleting \""}],"source_content_type":"text/x-python","patch_set":5,"id":"3a71b18c_7c337fab","line":4493,"updated":"2016-12-05 11:09:39.000000000","message":"don\u0027t we want to fail on failure of reserve()? My understanding is that this should look like:\n\n  quotas.reserve(...)\n  try:\n      objects.KeyPair.destroy_by_name(context, user_id, key_name)\n  except:\n      quotas.rollback()\n      raise\n  else:\n      quotas.commit()\n      self._notify(...)","commit_id":"9effb7f10f38345ca92e67b1ddc9606117bf32e3"},{"author":{"_account_id":21813,"name":"Andrey Volkov","email":"m@amadev.ru","username":"avolkov"},"change_message_id":"92aff5fa9f4367b03c813d1558947a2a4318ba66","unresolved":false,"context_lines":[{"line_number":4490,"context_line":"        self._notify(context, \u0027delete.start\u0027, key_name)"},{"line_number":4491,"context_line":"        quotas \u003d objects.Quotas(context\u003dcontext)"},{"line_number":4492,"context_line":"        try:"},{"line_number":4493,"context_line":"            quotas.reserve(project_id\u003dcontext.project_id,"},{"line_number":4494,"context_line":"                           user_id\u003duser_id, key_pairs\u003d-1)"},{"line_number":4495,"context_line":"        except Exception:"},{"line_number":4496,"context_line":"            LOG.exception(_LE(\"Failed to update usages deleting \""}],"source_content_type":"text/x-python","patch_set":5,"id":"3a71b18c_68e56f36","line":4493,"in_reply_to":"3a71b18c_7c337fab","updated":"2016-12-05 16:16:32.000000000","message":"Agreed. There should be room for rollback.","commit_id":"9effb7f10f38345ca92e67b1ddc9606117bf32e3"}],"nova/db/sqlalchemy/api.py":[{"author":{"_account_id":5754,"name":"Alex Xu","email":"hejie.xu@intel.com","username":"xuhj"},"change_message_id":"f273542f36a2e047eedd0bc95eac0a58a739432d","unresolved":false,"context_lines":[{"line_number":2999,"context_line":"    \u0027_sync_security_groups\u0027: _sync_security_groups,"},{"line_number":3000,"context_line":"    \u0027_sync_server_groups\u0027: _sync_server_groups,"},{"line_number":3001,"context_line":"    \u0027_sync_key_pairs\u0027: _sync_key_pairs,"},{"line_number":3002,"context_line":"}"},{"line_number":3003,"context_line":""},{"line_number":3004,"context_line":""},{"line_number":3005,"context_line":"###################"}],"source_content_type":"text/x-python","patch_set":2,"id":"3a71b18c_b4cb001e","line":3002,"updated":"2016-12-01 07:52:29.000000000","message":"emm....looks like you needn\u0027t to move all those code down to here.","commit_id":"ec554b2a62dd1ef9165cd8431d3d2fab01aff8b9"},{"author":{"_account_id":6849,"name":"Roman Podoliaka","email":"roman.podoliaka@gmail.com","username":"rpodolyaka"},"change_message_id":"a35fd92b25e8b03ce1049e3589347a842284e9cd","unresolved":false,"context_lines":[{"line_number":2994,"context_line":"                   count()"},{"line_number":2995,"context_line":""},{"line_number":2996,"context_line":""},{"line_number":2997,"context_line":"def _sync_key_pairs(context, project_id, user_id):"},{"line_number":2998,"context_line":"    return dict(key_pairs\u003dkey_pair_count_by_user("},{"line_number":2999,"context_line":"                context, user_id))"},{"line_number":3000,"context_line":""}],"source_content_type":"text/x-python","patch_set":5,"id":"3a71b18c_d9a585a2","line":2997,"updated":"2016-12-05 11:09:39.000000000","message":"nit: why not put this one together with all other _sync_*() functions at the top of the file?","commit_id":"9effb7f10f38345ca92e67b1ddc9606117bf32e3"}],"nova/quota.py":[{"author":{"_account_id":21813,"name":"Andrey Volkov","email":"m@amadev.ru","username":"avolkov"},"change_message_id":"030b962aa29575839ecb4308f37e1f9ae5f6078b","unresolved":false,"context_lines":[{"line_number":195,"context_line":"            if kp_usage is None:"},{"line_number":196,"context_line":"                user_usages[name] \u003d dict(in_use\u003dcount)"},{"line_number":197,"context_line":"            else:"},{"line_number":198,"context_line":"                user_usages[name].update(in_use\u003dcount)"},{"line_number":199,"context_line":""},{"line_number":200,"context_line":"        return self._process_quotas(context, resources, project_id,"},{"line_number":201,"context_line":"                                    user_quotas, quota_class,"}],"source_content_type":"text/x-python","patch_set":11,"id":"ba2be162_5569728a","line":198,"updated":"2017-03-02 09:28:17.000000000","message":"Can we make just user_usages[name] \u003d dict(in_use\u003dcount)?\nIs there in the dict some information we can lose?","commit_id":"fc73c989f829910588611f635009e2c33f9a1d7f"},{"author":{"_account_id":20223,"name":"zhaolihui","email":"zhaolh@awcloud.com","username":"zhaolihui"},"change_message_id":"f62d4a3c8259bd6f840a771973a099a292199bc1","unresolved":false,"context_lines":[{"line_number":195,"context_line":"            if kp_usage is None:"},{"line_number":196,"context_line":"                user_usages[name] \u003d dict(in_use\u003dcount)"},{"line_number":197,"context_line":"            else:"},{"line_number":198,"context_line":"                user_usages[name].update(in_use\u003dcount)"},{"line_number":199,"context_line":""},{"line_number":200,"context_line":"        return self._process_quotas(context, resources, project_id,"},{"line_number":201,"context_line":"                                    user_quotas, quota_class,"}],"source_content_type":"text/x-python","patch_set":11,"id":"9a30ddce_f1dd3315","line":198,"in_reply_to":"ba2be162_5569728a","updated":"2017-03-08 07:27:47.000000000","message":"you are right.","commit_id":"fc73c989f829910588611f635009e2c33f9a1d7f"}],"nova/tests/unit/test_quota.py":[{"author":{"_account_id":21813,"name":"Andrey Volkov","email":"m@amadev.ru","username":"avolkov"},"change_message_id":"030b962aa29575839ecb4308f37e1f9ae5f6078b","unresolved":false,"context_lines":[{"line_number":978,"context_line":"                \u0027quota_get_all_by_project_and_user\u0027,"},{"line_number":979,"context_line":"                \u0027quota_get_all_by_project\u0027,"},{"line_number":980,"context_line":"                \u0027quota_usage_get_all_by_project_and_user\u0027,"},{"line_number":981,"context_line":"                \u0027quota_QUOTAS_count\u0027,"},{"line_number":982,"context_line":"                \u0027quota_class_get_all_by_name\u0027,"},{"line_number":983,"context_line":"                ])"},{"line_number":984,"context_line":"        self.assertEqual(result, dict("}],"source_content_type":"text/x-python","patch_set":11,"id":"ba2be162_15e45a0b","line":981,"updated":"2017-03-02 09:28:17.000000000","message":"Can we add test to ensure objects.KeyPairList.get_count_by_user is called with correct params?","commit_id":"fc73c989f829910588611f635009e2c33f9a1d7f"},{"author":{"_account_id":20223,"name":"zhaolihui","email":"zhaolh@awcloud.com","username":"zhaolihui"},"change_message_id":"f62d4a3c8259bd6f840a771973a099a292199bc1","unresolved":false,"context_lines":[{"line_number":978,"context_line":"                \u0027quota_get_all_by_project_and_user\u0027,"},{"line_number":979,"context_line":"                \u0027quota_get_all_by_project\u0027,"},{"line_number":980,"context_line":"                \u0027quota_usage_get_all_by_project_and_user\u0027,"},{"line_number":981,"context_line":"                \u0027quota_QUOTAS_count\u0027,"},{"line_number":982,"context_line":"                \u0027quota_class_get_all_by_name\u0027,"},{"line_number":983,"context_line":"                ])"},{"line_number":984,"context_line":"        self.assertEqual(result, dict("}],"source_content_type":"text/x-python","patch_set":11,"id":"9a30ddce_51d51fb7","line":981,"in_reply_to":"ba2be162_15e45a0b","updated":"2017-03-08 07:27:47.000000000","message":"I don\u0027t know what this is mean.\nQUOTAS.count(context, name, user_id) actually to call _keypair_get_count_by_user function, and then to call objects.KeyPairList.get_count_by_user(*args, **kwargs),\nis this not correct ?","commit_id":"fc73c989f829910588611f635009e2c33f9a1d7f"}]}
