)]}'
{"cinder/api/contrib/quotas.py":[{"author":{"_account_id":12825,"name":"Szymon Wróblewski","email":"szymon.wroblewski@ovhcloud.com","username":"bluex"},"change_message_id":"0d456e2291cb22a7ac6727480fc41cdd9959a727","unresolved":false,"context_lines":[{"line_number":220,"context_line":"        target_project_id \u003d id"},{"line_number":221,"context_line":"        bad_keys \u003d []"},{"line_number":222,"context_line":""},{"line_number":223,"context_line":"        # NOTE(ankit): Pass #1 - In this loop for body[\u0027quota_set\u0027].items(),"},{"line_number":224,"context_line":"        # we figure out if we have any bad keys."},{"line_number":225,"context_line":""},{"line_number":226,"context_line":"        # NOTE(karthikp): Added to strip volume_type name and replace it"},{"line_number":227,"context_line":"        # with volume_type_id"}],"source_content_type":"text/x-python","patch_set":3,"id":"9a629dbe_a202c46d","line":224,"range":{"start_line":223,"start_character":8,"end_line":224,"end_character":48},"updated":"2016-11-16 21:16:24.000000000","message":"This should stay above for loop at line 239.","commit_id":"93a1ac3760d07a39097ea672843feb9ee6358e4c"},{"author":{"_account_id":12825,"name":"Szymon Wróblewski","email":"szymon.wroblewski@ovhcloud.com","username":"bluex"},"change_message_id":"0d456e2291cb22a7ac6727480fc41cdd9959a727","unresolved":false,"context_lines":[{"line_number":223,"context_line":"        # NOTE(ankit): Pass #1 - In this loop for body[\u0027quota_set\u0027].items(),"},{"line_number":224,"context_line":"        # we figure out if we have any bad keys."},{"line_number":225,"context_line":""},{"line_number":226,"context_line":"        # NOTE(karthikp): Added to strip volume_type name and replace it"},{"line_number":227,"context_line":"        # with volume_type_id"},{"line_number":228,"context_line":"        for key, value in body[\u0027quota_set\u0027].items():"},{"line_number":229,"context_line":"            if (key.find(\"volumes_\") \u003e\u003d 0 or key.find(\"snapshots_\") \u003e\u003d 0"},{"line_number":230,"context_line":"                    or key.find(\"gigabytes_\") \u003e\u003d 0):"}],"source_content_type":"text/x-python","patch_set":3,"id":"9a629dbe_6216eca8","line":227,"range":{"start_line":226,"start_character":8,"end_line":227,"end_character":29},"updated":"2016-11-16 21:16:24.000000000","message":"Don\u0027t explain why code is added, but what it\u0027s doing. \"Strip volume_type name and replace it with volume_type_id\" should be enough.","commit_id":"93a1ac3760d07a39097ea672843feb9ee6358e4c"},{"author":{"_account_id":12825,"name":"Szymon Wróblewski","email":"szymon.wroblewski@ovhcloud.com","username":"bluex"},"change_message_id":"0d456e2291cb22a7ac6727480fc41cdd9959a727","unresolved":false,"context_lines":[{"line_number":225,"context_line":""},{"line_number":226,"context_line":"        # NOTE(karthikp): Added to strip volume_type name and replace it"},{"line_number":227,"context_line":"        # with volume_type_id"},{"line_number":228,"context_line":"        for key, value in body[\u0027quota_set\u0027].items():"},{"line_number":229,"context_line":"            if (key.find(\"volumes_\") \u003e\u003d 0 or key.find(\"snapshots_\") \u003e\u003d 0"},{"line_number":230,"context_line":"                    or key.find(\"gigabytes_\") \u003e\u003d 0):"},{"line_number":231,"context_line":"                    parts \u003d key.split(\"_\")"}],"source_content_type":"text/x-python","patch_set":3,"id":"7a77a97e_8e2f64f5","line":228,"range":{"start_line":228,"start_character":26,"end_line":228,"end_character":51},"updated":"2016-11-16 21:16:24.000000000","message":"Iterating over list that you delete items from causes unexpected results. Create new list to iterate over\n\n list(body[\u0027quota_set\u0027].items())","commit_id":"93a1ac3760d07a39097ea672843feb9ee6358e4c"},{"author":{"_account_id":12825,"name":"Szymon Wróblewski","email":"szymon.wroblewski@ovhcloud.com","username":"bluex"},"change_message_id":"0d456e2291cb22a7ac6727480fc41cdd9959a727","unresolved":false,"context_lines":[{"line_number":226,"context_line":"        # NOTE(karthikp): Added to strip volume_type name and replace it"},{"line_number":227,"context_line":"        # with volume_type_id"},{"line_number":228,"context_line":"        for key, value in body[\u0027quota_set\u0027].items():"},{"line_number":229,"context_line":"            if (key.find(\"volumes_\") \u003e\u003d 0 or key.find(\"snapshots_\") \u003e\u003d 0"},{"line_number":230,"context_line":"                    or key.find(\"gigabytes_\") \u003e\u003d 0):"},{"line_number":231,"context_line":"                    parts \u003d key.split(\"_\")"},{"line_number":232,"context_line":"                    volume_type_id \u003d db.volume_type_get_by_name(context,"},{"line_number":233,"context_line":"                                                                parts[1])"},{"line_number":234,"context_line":"                    value \u003d body[\u0027quota_set\u0027][key]"}],"source_content_type":"text/x-python","patch_set":3,"id":"7a77a97e_1ee81810","line":231,"range":{"start_line":229,"start_character":12,"end_line":231,"end_character":42},"updated":"2016-11-16 21:16:24.000000000","message":"To make it more clear you could write something like this:\n\n res, name \u003d key.split(\u0027_\u0027, 1)\n if res in (\u0027volumes\u0027, \u0027snapshots\u0027, \u0027gigabytes\u0027):","commit_id":"93a1ac3760d07a39097ea672843feb9ee6358e4c"},{"author":{"_account_id":12825,"name":"Szymon Wróblewski","email":"szymon.wroblewski@ovhcloud.com","username":"bluex"},"change_message_id":"0d456e2291cb22a7ac6727480fc41cdd9959a727","unresolved":false,"context_lines":[{"line_number":229,"context_line":"            if (key.find(\"volumes_\") \u003e\u003d 0 or key.find(\"snapshots_\") \u003e\u003d 0"},{"line_number":230,"context_line":"                    or key.find(\"gigabytes_\") \u003e\u003d 0):"},{"line_number":231,"context_line":"                    parts \u003d key.split(\"_\")"},{"line_number":232,"context_line":"                    volume_type_id \u003d db.volume_type_get_by_name(context,"},{"line_number":233,"context_line":"                                                                parts[1])"},{"line_number":234,"context_line":"                    value \u003d body[\u0027quota_set\u0027][key]"},{"line_number":235,"context_line":"                    body[\u0027quota_set\u0027][parts[0] + \"_\" + volume_type_id[\u0027id\u0027]] \u003d \\"},{"line_number":236,"context_line":"                        value"}],"source_content_type":"text/x-python","patch_set":3,"id":"7a77a97e_ae450071","line":233,"range":{"start_line":232,"start_character":37,"end_line":233,"end_character":73},"updated":"2016-11-16 21:16:24.000000000","message":"To avoid lots of db queries you could cache responses:\n\n vol_type \u003d {}\n for ...:\n     ...\n     try:\n         volume_type_id \u003d vol_type[name]\n     except KeyError:\n         (volume_type_id \u003d vol_type[name] \u003d \n          db.volume_type_get_by_name(context, name))","commit_id":"93a1ac3760d07a39097ea672843feb9ee6358e4c"},{"author":{"_account_id":12825,"name":"Szymon Wróblewski","email":"szymon.wroblewski@ovhcloud.com","username":"bluex"},"change_message_id":"0d456e2291cb22a7ac6727480fc41cdd9959a727","unresolved":false,"context_lines":[{"line_number":232,"context_line":"                    volume_type_id \u003d db.volume_type_get_by_name(context,"},{"line_number":233,"context_line":"                                                                parts[1])"},{"line_number":234,"context_line":"                    value \u003d body[\u0027quota_set\u0027][key]"},{"line_number":235,"context_line":"                    body[\u0027quota_set\u0027][parts[0] + \"_\" + volume_type_id[\u0027id\u0027]] \u003d \\"},{"line_number":236,"context_line":"                        value"},{"line_number":237,"context_line":"                    del body[\u0027quota_set\u0027][key]"},{"line_number":238,"context_line":""}],"source_content_type":"text/x-python","patch_set":3,"id":"7a77a97e_be0e4432","line":235,"range":{"start_line":235,"start_character":38,"end_line":235,"end_character":75},"updated":"2016-11-16 21:16:24.000000000","message":"To avoid backslash at the end you can separate this part into variable.","commit_id":"93a1ac3760d07a39097ea672843feb9ee6358e4c"}],"cinder/quota.py":[{"author":{"_account_id":12825,"name":"Szymon Wróblewski","email":"szymon.wroblewski@ovhcloud.com","username":"bluex"},"change_message_id":"0d456e2291cb22a7ac6727480fc41cdd9959a727","unresolved":false,"context_lines":[{"line_number":1156,"context_line":"    def register_resources(self, resources):"},{"line_number":1157,"context_line":"        raise NotImplementedError(_(\"Cannot register resources\"))"},{"line_number":1158,"context_line":""},{"line_number":1159,"context_line":"    def update_quota_resource(self, context, old_type_name, new_type_name,"},{"line_number":1160,"context_line":"                              volume_type_id\u003dNone):"},{"line_number":1161,"context_line":"        \"\"\"Update resource in quota."},{"line_number":1162,"context_line":""},{"line_number":1163,"context_line":"        This is to update resource in quotas, quota_classes, and"}],"source_content_type":"text/x-python","patch_set":3,"id":"7a77a97e_b742ad3c","line":1160,"range":{"start_line":1159,"start_character":45,"end_line":1160,"end_character":49},"updated":"2016-11-16 21:16:24.000000000","message":"Shouldn\u0027t it be just replaced with old_type_id, new_type_id ?","commit_id":"93a1ac3760d07a39097ea672843feb9ee6358e4c"},{"author":{"_account_id":12825,"name":"Szymon Wróblewski","email":"szymon.wroblewski@ovhcloud.com","username":"bluex"},"change_message_id":"0d456e2291cb22a7ac6727480fc41cdd9959a727","unresolved":false,"context_lines":[{"line_number":1171,"context_line":"        for quota in (\u0027volumes\u0027, \u0027gigabytes\u0027, \u0027snapshots\u0027):"},{"line_number":1172,"context_line":"            old_res \u003d \"%s_%s\" % (quota, old_type_name)"},{"line_number":1173,"context_line":""},{"line_number":1174,"context_line":"            index \u003d old_res.rfind(\u0027_\u0027)"},{"line_number":1175,"context_line":"            resource \u003d old_type_name[index + 1:]"},{"line_number":1176,"context_line":"            if resource !\u003d volume_type_id:"},{"line_number":1177,"context_line":"                new_res \u003d \"%s_%s\" % (quota, volume_type_id)"},{"line_number":1178,"context_line":"                db.quota_usage_update_resource(context,"}],"source_content_type":"text/x-python","patch_set":3,"id":"7a77a97e_2555861c","line":1175,"range":{"start_line":1174,"start_character":12,"end_line":1175,"end_character":48},"updated":"2016-11-16 21:16:24.000000000","message":"There is no need to do that, just use quota parameter.","commit_id":"93a1ac3760d07a39097ea672843feb9ee6358e4c"}]}
