)]}'
{"/COMMIT_MSG":[{"author":{"_account_id":6549,"name":"Zhi Yan Liu","email":"lzy.dev@gmail.com","username":"lzy-dev"},"change_message_id":"986bcdf41a3e3a3f41975f0ae4c218eb2ba3cda9","unresolved":false,"context_lines":[{"line_number":13,"context_line":"locations as if they were allocating space."},{"line_number":14,"context_line":""},{"line_number":15,"context_line":"Besides this bug, it makes sense to not load deleted / killed /"},{"line_number":16,"context_line":"pending-deleted images from the database if we\u0027re actually not"},{"line_number":17,"context_line":"considering them as valid images."},{"line_number":18,"context_line":""},{"line_number":19,"context_line":"The patch also filters out deleted locations."}],"source_content_type":"text/x-gerrit-commit-message","patch_set":7,"id":"AAAATn%2F82F8%3D","line":16,"updated":"2013-12-19 16:24:46.000000000","message":"this confused me, from this message seems we have not planned to calculate pending-deleted images\u0027 size, but from the code we have calculated those pending-deleted images size in the quota.","commit_id":"947a657d0b5226ce293cc3e32135ab909559a843"}],"glance/db/simple/api.py":[{"author":{"_account_id":6484,"name":"Feilong Wang","email":"hustemb@gmail.com","username":"flwang"},"change_message_id":"d4e8651cae7ba975b6758b2cbac87194f71bb083","unresolved":false,"context_lines":[{"line_number":687,"context_line":"    images \u003d image_get_all(context, filters\u003d{\u0027owner\u0027: owner_id})"},{"line_number":688,"context_line":"    total \u003d 0"},{"line_number":689,"context_line":"    for image in images:"},{"line_number":690,"context_line":"        if image[\u0027deleted\u0027]:"},{"line_number":691,"context_line":"            continue"},{"line_number":692,"context_line":""},{"line_number":693,"context_line":"        if image[\u0027id\u0027] !\u003d image_id:"}],"source_content_type":"text/x-python","patch_set":2,"id":"AAAATn%2F88Sc%3D","line":690,"updated":"2013-12-18 15:00:48.000000000","message":"and killed?","commit_id":"99ea51bf8d2acf7ddafc9b31c727d495e9d1d8d3"},{"author":{"_account_id":6484,"name":"Feilong Wang","email":"hustemb@gmail.com","username":"flwang"},"change_message_id":"fd3f93e5eeb2a785c4721eb39dd7b9bebf2a844c","unresolved":false,"context_lines":[{"line_number":687,"context_line":"    images \u003d image_get_all(context, filters\u003d{\u0027owner\u0027: owner_id})"},{"line_number":688,"context_line":"    total \u003d 0"},{"line_number":689,"context_line":"    for image in images:"},{"line_number":690,"context_line":"        if image[\u0027status\u0027] in [\u0027killed\u0027, \u0027pending_delete\u0027, \u0027deleted\u0027]:"},{"line_number":691,"context_line":"            continue"},{"line_number":692,"context_line":""},{"line_number":693,"context_line":"        if image[\u0027id\u0027] !\u003d image_id:"}],"source_content_type":"text/x-python","patch_set":4,"id":"AAAATn%2F85PQ%3D","line":690,"updated":"2013-12-19 03:11:31.000000000","message":"‘pending-delete\u0027 means the data is still in the store, so it should be counted as well.","commit_id":"d2fd4862d111872992230968b80684f6838b80ff"},{"author":{"_account_id":9209,"name":"Lin Cai","email":"reachlin@gmail.com","username":"reachlin"},"change_message_id":"e2b9f9644ec2abea6206735650925a369a0f50bb","unresolved":false,"context_lines":[{"line_number":582,"context_line":""},{"line_number":583,"context_line":"        # NOTE(flaper87): Move the image to one of the deleted statuses"},{"line_number":584,"context_line":"        # if it hasn\u0027t been done yet."},{"line_number":585,"context_line":"        if (DATA[\u0027images\u0027][image_id][\u0027status\u0027] not in"},{"line_number":586,"context_line":"                [\u0027deleted\u0027, \u0027pending_delete\u0027]):"},{"line_number":587,"context_line":"            DATA[\u0027images\u0027][image_id][\u0027status\u0027] \u003d \u0027deleted\u0027"},{"line_number":588,"context_line":""}],"source_content_type":"text/x-python","patch_set":11,"id":"AAAAUH%2F%2F0lE%3D","line":585,"updated":"2014-01-08 03:02:23.000000000","message":"What happened to \"killed\" status, referring at line 696? Why is not necessary to check it here?","commit_id":"b35728019e0eb89c213eed7bc35a1f062c99dcca"}],"glance/db/sqlalchemy/api.py":[{"author":{"_account_id":6484,"name":"Feilong Wang","email":"hustemb@gmail.com","username":"flwang"},"change_message_id":"d4e8651cae7ba975b6758b2cbac87194f71bb083","unresolved":false,"context_lines":[{"line_number":712,"context_line":"    if image_id is not None:"},{"line_number":713,"context_line":"        query \u003d query.filter(models.Image.id !\u003d image_id)"},{"line_number":714,"context_line":"    query \u003d query.filter(models.Image.size \u003e 0)"},{"line_number":715,"context_line":"    query \u003d query.filter(models.Image.deleted \u003d\u003d False)"},{"line_number":716,"context_line":"    query \u003d query.filter(models.Image.status !\u003d \u0027killed\u0027)"},{"line_number":717,"context_line":"    images \u003d query.all()"},{"line_number":718,"context_line":""}],"source_content_type":"text/x-python","patch_set":2,"id":"AAAATn%2F88Sw%3D","line":715,"updated":"2013-12-18 15:00:48.000000000","message":"we need to consider the \u0027pending-delete\u0027, so I prefer to use below way:\n\nquery \u003d query.filter(~models.Image.status.in_([\u0027killed\u0027, \u0027deleted\u0027]))","commit_id":"99ea51bf8d2acf7ddafc9b31c727d495e9d1d8d3"},{"author":{"_account_id":6484,"name":"Feilong Wang","email":"hustemb@gmail.com","username":"flwang"},"change_message_id":"fd3f93e5eeb2a785c4721eb39dd7b9bebf2a844c","unresolved":false,"context_lines":[{"line_number":712,"context_line":"    if image_id is not None:"},{"line_number":713,"context_line":"        query \u003d query.filter(models.Image.id !\u003d image_id)"},{"line_number":714,"context_line":"    query \u003d query.filter(models.Image.size \u003e 0)"},{"line_number":715,"context_line":"    query \u003d query.filter(~models.Image.status.in_([\u0027killed\u0027,"},{"line_number":716,"context_line":"                                                   \u0027pending_delete\u0027,"},{"line_number":717,"context_line":"                                                   \u0027deleted\u0027]))"},{"line_number":718,"context_line":"    images \u003d query.all()"}],"source_content_type":"text/x-python","patch_set":4,"id":"AAAATn%2F85Os%3D","line":715,"updated":"2013-12-19 03:11:31.000000000","message":"‘pending-delete\u0027 means the data is still in the store, so it should be counted as well. Sorry for the confusing caused by my previous comments, what I mean in previous comments is the way you was using (deleted\u003dFlase) will \u0027miss\u0027 the size of \u0027pending-delete\u0027 images.","commit_id":"d2fd4862d111872992230968b80684f6838b80ff"},{"author":{"_account_id":6159,"name":"Flavio Percoco Premoli","display_name":"flaper87","email":"flavio.percoco@flyrlabs.com","username":"flaper87"},"change_message_id":"0d9827dafdf31091dc6a5b7bebafdcfc1e63c3fc","unresolved":false,"context_lines":[{"line_number":712,"context_line":"    if image_id is not None:"},{"line_number":713,"context_line":"        query \u003d query.filter(models.Image.id !\u003d image_id)"},{"line_number":714,"context_line":"    query \u003d query.filter(models.Image.size \u003e 0)"},{"line_number":715,"context_line":"    query \u003d query.filter(~models.Image.status.in_([\u0027killed\u0027,"},{"line_number":716,"context_line":"                                                   \u0027pending_delete\u0027,"},{"line_number":717,"context_line":"                                                   \u0027deleted\u0027]))"},{"line_number":718,"context_line":"    images \u003d query.all()"}],"source_content_type":"text/x-python","patch_set":4,"id":"AAAATn%2F84L8%3D","line":715,"in_reply_to":"AAAATn%2F85Os%3D","updated":"2013-12-19 09:01:49.000000000","message":"Erm opps. I should\u0027ve known that. I guess I was too focused on getting in done.","commit_id":"d2fd4862d111872992230968b80684f6838b80ff"},{"author":{"_account_id":6549,"name":"Zhi Yan Liu","email":"lzy.dev@gmail.com","username":"lzy-dev"},"change_message_id":"3dbd2be0dedf32284caf5fdb609ac1f9b2d7ed1b","unresolved":false,"context_lines":[{"line_number":717,"context_line":""},{"line_number":718,"context_line":"    total \u003d 0"},{"line_number":719,"context_line":"    for i in images:"},{"line_number":720,"context_line":"        locations \u003d [l for l in i.locations if not l[\u0027deleted\u0027]]"},{"line_number":721,"context_line":"        total +\u003d (i.size * len(locations))"},{"line_number":722,"context_line":"    return total"},{"line_number":723,"context_line":""}],"source_content_type":"text/x-python","patch_set":8,"id":"AAAATn%2F8108%3D","line":720,"updated":"2013-12-19 17:02:55.000000000","message":"the locations of the image which under pending-delete status are also be marked to \"deleted\", their deleted field value is True also. so this filter will deduct those image\u0027s space size from usage and due to quota wrong.\n\nIf we really consider pending-deleted status images should consume storage quota than we need change this logic, otherwise we can rollback Line #715.\n\nI think it will be hard if we want to identify which deleted location entry whether is belongs to a pending-deleted image from db level currently, since under current code/design, each image can has some duplicated deleted locations, for the reason pls refer [1][2]. This is the partial reason also why I want to give image location a status field [3]. of cause I think it will be another change if we want to fix here via db approach.\n\nIMO another way can go is that we can query location from scrubber\u0027s queue, to make sure whether it is in the pending delete queue, if answer is yes, then we should calculate it. For this approach, we need enhance scrubber queue also, adding a query interface on location level [4].\n\nI hope other folks have other/better ways to go.\n\n[1] https://github.com/openstack/glance/blob/master/glance/db/sqlalchemy/api.py#L819\n\n[2] https://github.com/openstack/glance/blob/master/glance/db/sqlalchemy/api.py#L830\n\n[3] https://blueprints.launchpad.net/glance/+spec/image-location-status\n\n[4] https://github.com/openstack/glance/blob/master/glance/store/scrubber.py#L98","commit_id":"aad79f78719edaf4624d16108024808f9a0d82a4"}],"glance/tests/functional/db/base.py":[{"author":{"_account_id":6484,"name":"Feilong Wang","email":"hustemb@gmail.com","username":"flwang"},"change_message_id":"d4e8651cae7ba975b6758b2cbac87194f71bb083","unresolved":false,"context_lines":[{"line_number":1252,"context_line":"        self.db_api.image_destroy(self.context1, \u0027SOMEID\u0027)"},{"line_number":1253,"context_line":"        x \u003d self.db_api.user_get_storage_usage(self.context1, self.owner_id1)"},{"line_number":1254,"context_line":"        self.assertEqual(total, x)"},{"line_number":1255,"context_line":""},{"line_number":1256,"context_line":""},{"line_number":1257,"context_line":"class TaskTests(test_utils.BaseTestCase):"},{"line_number":1258,"context_line":""}],"source_content_type":"text/x-python","patch_set":2,"id":"AAAATn%2F88SA%3D","line":1255,"updated":"2013-12-18 15:00:48.000000000","message":"I think we need another test cases to test an active image with a deleted location.","commit_id":"99ea51bf8d2acf7ddafc9b31c727d495e9d1d8d3"}],"glance/tests/functional/db/test_sqlalchemy.py":[{"author":{"_account_id":9363,"name":"Konstantin Permyakov","email":"kpermyakov@griddynamics.com","username":"kpermyakov"},"change_message_id":"d14ba543f7029c5afe2d027a465f14f89b453137","unresolved":false,"context_lines":[{"line_number":108,"context_line":"        self.addCleanup(db_tests.reset)"},{"line_number":109,"context_line":""},{"line_number":110,"context_line":""},{"line_number":111,"context_line":"class TestSqlAlchemyQuota(base.DriverQuotaTests):"},{"line_number":112,"context_line":""},{"line_number":113,"context_line":"    def setUp(self):"},{"line_number":114,"context_line":"        db_tests.load(get_db, reset_db)"}],"source_content_type":"text/x-python","patch_set":7,"id":"AAAATn%2F8220%3D","line":111,"updated":"2013-12-19 14:31:54.000000000","message":"Where we do test quota in this test?","commit_id":"947a657d0b5226ce293cc3e32135ab909559a843"},{"author":{"_account_id":6159,"name":"Flavio Percoco Premoli","display_name":"flaper87","email":"flavio.percoco@flyrlabs.com","username":"flaper87"},"change_message_id":"f3e6032abb0542a3a4ed72fe6d7561317b4318cd","unresolved":false,"context_lines":[{"line_number":108,"context_line":"        self.addCleanup(db_tests.reset)"},{"line_number":109,"context_line":""},{"line_number":110,"context_line":""},{"line_number":111,"context_line":"class TestSqlAlchemyQuota(base.DriverQuotaTests):"},{"line_number":112,"context_line":""},{"line_number":113,"context_line":"    def setUp(self):"},{"line_number":114,"context_line":"        db_tests.load(get_db, reset_db)"}],"source_content_type":"text/x-python","patch_set":7,"id":"AAAATn%2F82nU%3D","line":111,"in_reply_to":"AAAATn%2F8220%3D","updated":"2013-12-19 15:14:47.000000000","message":"All the test methods are defined in `DriverQuotaTests`","commit_id":"947a657d0b5226ce293cc3e32135ab909559a843"}]}
