)]}'
{"glance/api/v1/images.py":[{"author":{"_account_id":6493,"name":"John Bresnahan","email":"john@bresnahan.me","username":"jbresnah"},"change_message_id":"68a878f6a666b03ff33120ca0a551a1b1de14508","unresolved":false,"context_lines":[{"line_number":526,"context_line":"        else:"},{"line_number":527,"context_line":"            if location:"},{"line_number":528,"context_line":"                self._validate_image_for_activation(req, image_id, image_meta)"},{"line_number":529,"context_line":"                location_data \u003d {\u0027url\u0027: location, \u0027metadata\u0027: None,"},{"line_number":530,"context_line":"                                 \u0027status\u0027: \u0027active\u0027}"},{"line_number":531,"context_line":"                image_meta \u003d self._activate(req, image_id, location_data)"},{"line_number":532,"context_line":"        return image_meta"}],"source_content_type":"text/x-python","patch_set":3,"id":"AAAASX%2F%2F040%3D","line":529,"updated":"2013-08-26 17:54:50.000000000","message":"In other places we are using \u0027metadata\u0027: {} instead of \u0027metadata\u0027: None.  Do both have the same end results?  When querying an image will the user see the same thing?","commit_id":"3f3a18beb9af31126afcc3b57abe2dca025a6e3d"},{"author":{"_account_id":6549,"name":"Zhi Yan Liu","email":"lzy.dev@gmail.com","username":"lzy-dev"},"change_message_id":"de79a57fc8feb4e17c57a20778ee0cc7c015dacd","unresolved":false,"context_lines":[{"line_number":526,"context_line":"        else:"},{"line_number":527,"context_line":"            if location:"},{"line_number":528,"context_line":"                self._validate_image_for_activation(req, image_id, image_meta)"},{"line_number":529,"context_line":"                location_data \u003d {\u0027url\u0027: location, \u0027metadata\u0027: None,"},{"line_number":530,"context_line":"                                 \u0027status\u0027: \u0027active\u0027}"},{"line_number":531,"context_line":"                image_meta \u003d self._activate(req, image_id, location_data)"},{"line_number":532,"context_line":"        return image_meta"}],"source_content_type":"text/x-python","patch_set":3,"id":"AAAASn%2F%2F%2Fmk%3D","line":529,"in_reply_to":"AAAASX%2F%2F040%3D","updated":"2013-08-27 06:41:18.000000000","message":"Good catch, will fix in next PS.","commit_id":"3f3a18beb9af31126afcc3b57abe2dca025a6e3d"},{"author":{"_account_id":6493,"name":"John Bresnahan","email":"john@bresnahan.me","username":"jbresnah"},"change_message_id":"68a878f6a666b03ff33120ca0a551a1b1de14508","unresolved":false,"context_lines":[{"line_number":768,"context_line":"            if image[\u0027location\u0027]:"},{"line_number":769,"context_line":"                for loc in image[\u0027location_data\u0027]:"},{"line_number":770,"context_line":"                    if loc[\u0027status\u0027] \u003d\u003d \u0027active\u0027:"},{"line_number":771,"context_line":"                        upload_utils.initiate_deletion(req, loc, id)"},{"line_number":772,"context_line":"        except exception.NotFound as e:"},{"line_number":773,"context_line":"            msg \u003d (_(\"Failed to find image to delete: %(e)s\") % locals())"},{"line_number":774,"context_line":"            for line in msg.split(\u0027\\n\u0027):"}],"source_content_type":"text/x-python","patch_set":3,"id":"AAAASX%2F%2F04M%3D","line":771,"updated":"2013-08-26 17:54:50.000000000","message":"Are we sure that we only want to delete active images?  What if someone calls delete while uploading?\n\nIn situations like this where en event occurs on a statefull object it is very nice to see the logic go through a single place that evaluates the event based on the current state and thus has a nice mapping for every state.  Without such a thing we end up with a lot of if statements like this one and often can miss cases.  This isn\u0027t a show stopper for me on this patch submission, however not having it does make it harder to review.","commit_id":"3f3a18beb9af31126afcc3b57abe2dca025a6e3d"},{"author":{"_account_id":6549,"name":"Zhi Yan Liu","email":"lzy.dev@gmail.com","username":"lzy-dev"},"change_message_id":"de79a57fc8feb4e17c57a20778ee0cc7c015dacd","unresolved":false,"context_lines":[{"line_number":768,"context_line":"            if image[\u0027location\u0027]:"},{"line_number":769,"context_line":"                for loc in image[\u0027location_data\u0027]:"},{"line_number":770,"context_line":"                    if loc[\u0027status\u0027] \u003d\u003d \u0027active\u0027:"},{"line_number":771,"context_line":"                        upload_utils.initiate_deletion(req, loc, id)"},{"line_number":772,"context_line":"        except exception.NotFound as e:"},{"line_number":773,"context_line":"            msg \u003d (_(\"Failed to find image to delete: %(e)s\") % locals())"},{"line_number":774,"context_line":"            for line in msg.split(\u0027\\n\u0027):"}],"source_content_type":"text/x-python","patch_set":3,"id":"AAAASn%2F%2F%2Flc%3D","line":771,"in_reply_to":"AAAASX%2F%2F04M%3D","updated":"2013-08-27 06:41:18.000000000","message":"As above comments said (L764-766), I think this will be ok.\n\nFor you second question, shall we talk that more in IRC?","commit_id":"3f3a18beb9af31126afcc3b57abe2dca025a6e3d"}],"glance/api/v2/__init__.py":[{"author":{"_account_id":6159,"name":"Flavio Percoco Premoli","display_name":"flaper87","email":"flavio.percoco@flyrlabs.com","username":"flaper87"},"change_message_id":"a797d0e528b2cfdb63c02fdb0f0800b038d1d9fc","unresolved":false,"context_lines":[{"line_number":15,"context_line":"#    under the License."},{"line_number":16,"context_line":""},{"line_number":17,"context_line":""},{"line_number":18,"context_line":"def get_image_active_locations(image):"},{"line_number":19,"context_line":"    ret \u003d []"},{"line_number":20,"context_line":"    if image and image.locations:"},{"line_number":21,"context_line":"        for loc in image.locations:"}],"source_content_type":"text/x-python","patch_set":18,"id":"AAAAUH%2F%2FnX4%3D","line":18,"updated":"2014-01-10 13:52:08.000000000","message":"Could this be moved somewhere else? Not sure __init__ is the best place to have this function. What about `location_utils`?\n\n   from glance.api.v2 import location_utils\n   location_utils.get_active_locations(image)","commit_id":"919a2d97478d699465604af5789f6086e08ba8ac"},{"author":{"_account_id":6549,"name":"Zhi Yan Liu","email":"lzy.dev@gmail.com","username":"lzy-dev"},"change_message_id":"6c1d5ba1218a6816dda51c63b9dc0005eea2b483","unresolved":false,"context_lines":[{"line_number":15,"context_line":"#    under the License."},{"line_number":16,"context_line":""},{"line_number":17,"context_line":""},{"line_number":18,"context_line":"def get_image_active_locations(image):"},{"line_number":19,"context_line":"    ret \u003d []"},{"line_number":20,"context_line":"    if image and image.locations:"},{"line_number":21,"context_line":"        for loc in image.locations:"}],"source_content_type":"text/x-python","patch_set":18,"id":"AAAAUH%2F%2FgNI%3D","line":18,"in_reply_to":"AAAAUH%2F%2FnX4%3D","updated":"2014-01-13 11:52:30.000000000","message":"Done","commit_id":"919a2d97478d699465604af5789f6086e08ba8ac"},{"author":{"_account_id":6159,"name":"Flavio Percoco Premoli","display_name":"flaper87","email":"flavio.percoco@flyrlabs.com","username":"flaper87"},"change_message_id":"a797d0e528b2cfdb63c02fdb0f0800b038d1d9fc","unresolved":false,"context_lines":[{"line_number":19,"context_line":"    ret \u003d []"},{"line_number":20,"context_line":"    if image and image.locations:"},{"line_number":21,"context_line":"        for loc in image.locations:"},{"line_number":22,"context_line":"            if loc.get(\u0027status\u0027) \u003d\u003d \u0027active\u0027:"},{"line_number":23,"context_line":"                ret.append(loc)"},{"line_number":24,"context_line":"    return ret"}],"source_content_type":"text/x-python","patch_set":18,"id":"AAAAUH%2F%2FnXA%3D","line":22,"updated":"2014-01-10 13:52:08.000000000","message":"Is there a case where the `status` is not present? If so, what are those cases?\n\nCan we have a fallback value for status instead of None?","commit_id":"919a2d97478d699465604af5789f6086e08ba8ac"},{"author":{"_account_id":6549,"name":"Zhi Yan Liu","email":"lzy.dev@gmail.com","username":"lzy-dev"},"change_message_id":"6c1d5ba1218a6816dda51c63b9dc0005eea2b483","unresolved":false,"context_lines":[{"line_number":19,"context_line":"    ret \u003d []"},{"line_number":20,"context_line":"    if image and image.locations:"},{"line_number":21,"context_line":"        for loc in image.locations:"},{"line_number":22,"context_line":"            if loc.get(\u0027status\u0027) \u003d\u003d \u0027active\u0027:"},{"line_number":23,"context_line":"                ret.append(loc)"},{"line_number":24,"context_line":"    return ret"}],"source_content_type":"text/x-python","patch_set":18,"id":"AAAAUH%2F%2FgM0%3D","line":22,"in_reply_to":"AAAAUH%2F%2FnXA%3D","updated":"2014-01-13 11:52:30.000000000","message":"Done. Change to \"if loc[\u0027status\u0027] \u003d\u003d \u0027active\u0027:\" since status field will always present.","commit_id":"919a2d97478d699465604af5789f6086e08ba8ac"}],"glance/api/v2/image_data.py":[{"author":{"_account_id":6493,"name":"John Bresnahan","email":"john@bresnahan.me","username":"jbresnah"},"change_message_id":"68a878f6a666b03ff33120ca0a551a1b1de14508","unresolved":false,"context_lines":[{"line_number":100,"context_line":""},{"line_number":101,"context_line":"        if (not image.locations or"},{"line_number":102,"context_line":"                not filter(lambda loc: loc[\u0027status\u0027] \u003d\u003d \u0027active\u0027,"},{"line_number":103,"context_line":"                           image.locations)):"},{"line_number":104,"context_line":"            reason \u003d _(\"No image data could be found\")"},{"line_number":105,"context_line":"            raise webob.exc.HTTPNotFound(reason)"},{"line_number":106,"context_line":"        return image"}],"source_content_type":"text/x-python","patch_set":3,"id":"AAAASX%2F%2F05k%3D","line":103,"updated":"2013-08-26 17:54:50.000000000","message":"Could this also be put into a utility function that determines if a location/image is ready?  Similar reasons to the comments on glance/api/v2/images.py","commit_id":"3f3a18beb9af31126afcc3b57abe2dca025a6e3d"},{"author":{"_account_id":6549,"name":"Zhi Yan Liu","email":"lzy.dev@gmail.com","username":"lzy-dev"},"change_message_id":"de79a57fc8feb4e17c57a20778ee0cc7c015dacd","unresolved":false,"context_lines":[{"line_number":100,"context_line":""},{"line_number":101,"context_line":"        if (not image.locations or"},{"line_number":102,"context_line":"                not filter(lambda loc: loc[\u0027status\u0027] \u003d\u003d \u0027active\u0027,"},{"line_number":103,"context_line":"                           image.locations)):"},{"line_number":104,"context_line":"            reason \u003d _(\"No image data could be found\")"},{"line_number":105,"context_line":"            raise webob.exc.HTTPNotFound(reason)"},{"line_number":106,"context_line":"        return image"}],"source_content_type":"text/x-python","patch_set":3,"id":"AAAASn%2F%2F%2FhY%3D","line":103,"in_reply_to":"AAAASX%2F%2F05k%3D","updated":"2013-08-27 06:41:18.000000000","message":"Done","commit_id":"3f3a18beb9af31126afcc3b57abe2dca025a6e3d"}],"glance/api/v2/images.py":[{"author":{"_account_id":6493,"name":"John Bresnahan","email":"john@bresnahan.me","username":"jbresnah"},"change_message_id":"68a878f6a666b03ff33120ca0a551a1b1de14508","unresolved":false,"context_lines":[{"line_number":545,"context_line":"            if CONF.show_multiple_locations:"},{"line_number":546,"context_line":"                image_view[\u0027locations\u0027] \u003d [loc for loc in list(image.locations)"},{"line_number":547,"context_line":"                                           if (loc.pop(\u0027id\u0027) is not None and"},{"line_number":548,"context_line":"                                               loc.pop(\u0027status\u0027) is not None)]"},{"line_number":549,"context_line":"            if CONF.show_image_direct_url:"},{"line_number":550,"context_line":"                image_view[\u0027direct_url\u0027] \u003d None"},{"line_number":551,"context_line":"                for loc in image.locations:"}],"source_content_type":"text/x-python","patch_set":3,"id":"AAAASX%2F%2F06I%3D","line":548,"updated":"2013-08-26 17:54:50.000000000","message":"Why would status ever be None?","commit_id":"3f3a18beb9af31126afcc3b57abe2dca025a6e3d"},{"author":{"_account_id":6549,"name":"Zhi Yan Liu","email":"lzy.dev@gmail.com","username":"lzy-dev"},"change_message_id":"de79a57fc8feb4e17c57a20778ee0cc7c015dacd","unresolved":false,"context_lines":[{"line_number":545,"context_line":"            if CONF.show_multiple_locations:"},{"line_number":546,"context_line":"                image_view[\u0027locations\u0027] \u003d [loc for loc in list(image.locations)"},{"line_number":547,"context_line":"                                           if (loc.pop(\u0027id\u0027) is not None and"},{"line_number":548,"context_line":"                                               loc.pop(\u0027status\u0027) is not None)]"},{"line_number":549,"context_line":"            if CONF.show_image_direct_url:"},{"line_number":550,"context_line":"                image_view[\u0027direct_url\u0027] \u003d None"},{"line_number":551,"context_line":"                for loc in image.locations:"}],"source_content_type":"text/x-python","patch_set":3,"id":"AAAASn%2F%2F%2FlI%3D","line":548,"in_reply_to":"AAAASX%2F%2F06I%3D","updated":"2013-08-27 06:41:18.000000000","message":"I just want to pop \u0027id\u0027 and \u0027status\u0027 field out from location dict object, seems this pop-out approach confuse you sorry. I will fix this in next PS, but it will use more code lines :).","commit_id":"3f3a18beb9af31126afcc3b57abe2dca025a6e3d"},{"author":{"_account_id":6493,"name":"John Bresnahan","email":"john@bresnahan.me","username":"jbresnah"},"change_message_id":"68a878f6a666b03ff33120ca0a551a1b1de14508","unresolved":false,"context_lines":[{"line_number":552,"context_line":"                    if loc[\u0027status\u0027] \u003d\u003d \u0027active\u0027:"},{"line_number":553,"context_line":"                        image_view[\u0027direct_url\u0027] \u003d loc[\u0027url\u0027]"},{"line_number":554,"context_line":"                        break"},{"line_number":555,"context_line":"        image_view[\u0027tags\u0027] \u003d list(image.tags)"},{"line_number":556,"context_line":"        image_view[\u0027self\u0027] \u003d self._get_image_href(image)"},{"line_number":557,"context_line":"        image_view[\u0027file\u0027] \u003d self._get_image_href(image, \u0027file\u0027)"},{"line_number":558,"context_line":"        image_view[\u0027schema\u0027] \u003d \u0027/v2/schemas/image\u0027"}],"source_content_type":"text/x-python","patch_set":3,"id":"AAAASX%2F%2F050%3D","line":555,"updated":"2013-08-26 17:54:50.000000000","message":"Instead of having the logic for whether or not an image is ready to be present to a user inline here, could you abstract it out into a utility function?  My hope is that it would help limit the number of places that the status field is checked and make it more clear how you are deciding if the location is ready.","commit_id":"3f3a18beb9af31126afcc3b57abe2dca025a6e3d"},{"author":{"_account_id":6549,"name":"Zhi Yan Liu","email":"lzy.dev@gmail.com","username":"lzy-dev"},"change_message_id":"de79a57fc8feb4e17c57a20778ee0cc7c015dacd","unresolved":false,"context_lines":[{"line_number":552,"context_line":"                    if loc[\u0027status\u0027] \u003d\u003d \u0027active\u0027:"},{"line_number":553,"context_line":"                        image_view[\u0027direct_url\u0027] \u003d loc[\u0027url\u0027]"},{"line_number":554,"context_line":"                        break"},{"line_number":555,"context_line":"        image_view[\u0027tags\u0027] \u003d list(image.tags)"},{"line_number":556,"context_line":"        image_view[\u0027self\u0027] \u003d self._get_image_href(image)"},{"line_number":557,"context_line":"        image_view[\u0027file\u0027] \u003d self._get_image_href(image, \u0027file\u0027)"},{"line_number":558,"context_line":"        image_view[\u0027schema\u0027] \u003d \u0027/v2/schemas/image\u0027"}],"source_content_type":"text/x-python","patch_set":3,"id":"AAAASn%2F%2F%2FhU%3D","line":555,"in_reply_to":"AAAASX%2F%2F050%3D","updated":"2013-08-27 06:41:18.000000000","message":"Done","commit_id":"3f3a18beb9af31126afcc3b57abe2dca025a6e3d"},{"author":{"_account_id":6159,"name":"Flavio Percoco Premoli","display_name":"flaper87","email":"flavio.percoco@flyrlabs.com","username":"flaper87"},"change_message_id":"a797d0e528b2cfdb63c02fdb0f0800b038d1d9fc","unresolved":false,"context_lines":[{"line_number":577,"context_line":"                active_locations \u003d ("},{"line_number":578,"context_line":"                    glance.api.v2.get_image_active_locations(image))"},{"line_number":579,"context_line":"                if active_locations:"},{"line_number":580,"context_line":"                    for loc in active_locations:"},{"line_number":581,"context_line":"                        loc.pop(\u0027id\u0027)"},{"line_number":582,"context_line":"                        loc.pop(\u0027status\u0027)"},{"line_number":583,"context_line":"                    image_view[\u0027locations\u0027] \u003d active_locations"}],"source_content_type":"text/x-python","patch_set":18,"id":"AAAAUH%2F%2FnVM%3D","line":580,"updated":"2014-01-10 13:52:08.000000000","message":"Can we make this a generator?","commit_id":"919a2d97478d699465604af5789f6086e08ba8ac"},{"author":{"_account_id":6549,"name":"Zhi Yan Liu","email":"lzy.dev@gmail.com","username":"lzy-dev"},"change_message_id":"6c1d5ba1218a6816dda51c63b9dc0005eea2b483","unresolved":false,"context_lines":[{"line_number":577,"context_line":"                active_locations \u003d ("},{"line_number":578,"context_line":"                    glance.api.v2.get_image_active_locations(image))"},{"line_number":579,"context_line":"                if active_locations:"},{"line_number":580,"context_line":"                    for loc in active_locations:"},{"line_number":581,"context_line":"                        loc.pop(\u0027id\u0027)"},{"line_number":582,"context_line":"                        loc.pop(\u0027status\u0027)"},{"line_number":583,"context_line":"                    image_view[\u0027locations\u0027] \u003d active_locations"}],"source_content_type":"text/x-python","patch_set":18,"id":"AAAAUH%2F%2FgL0%3D","line":580,"in_reply_to":"AAAAUH%2F%2FnVM%3D","updated":"2014-01-13 11:52:30.000000000","message":"I think make get_image_active_locations() return a list is more common, since I also use it at https://review.openstack.org/#/c/41311/18/glance/api/v2/image_data.py Line #126 .","commit_id":"919a2d97478d699465604af5789f6086e08ba8ac"},{"author":{"_account_id":6159,"name":"Flavio Percoco Premoli","display_name":"flaper87","email":"flavio.percoco@flyrlabs.com","username":"flaper87"},"change_message_id":"a797d0e528b2cfdb63c02fdb0f0800b038d1d9fc","unresolved":false,"context_lines":[{"line_number":578,"context_line":"                    glance.api.v2.get_image_active_locations(image))"},{"line_number":579,"context_line":"                if active_locations:"},{"line_number":580,"context_line":"                    for loc in active_locations:"},{"line_number":581,"context_line":"                        loc.pop(\u0027id\u0027)"},{"line_number":582,"context_line":"                        loc.pop(\u0027status\u0027)"},{"line_number":583,"context_line":"                    image_view[\u0027locations\u0027] \u003d active_locations"},{"line_number":584,"context_line":"                else:"}],"source_content_type":"text/x-python","patch_set":18,"id":"AAAAUH%2F%2FnVE%3D","line":581,"updated":"2014-01-10 13:52:08.000000000","message":"del loc[\u0027id\u0027] is a faster.","commit_id":"919a2d97478d699465604af5789f6086e08ba8ac"},{"author":{"_account_id":6549,"name":"Zhi Yan Liu","email":"lzy.dev@gmail.com","username":"lzy-dev"},"change_message_id":"6c1d5ba1218a6816dda51c63b9dc0005eea2b483","unresolved":false,"context_lines":[{"line_number":578,"context_line":"                    glance.api.v2.get_image_active_locations(image))"},{"line_number":579,"context_line":"                if active_locations:"},{"line_number":580,"context_line":"                    for loc in active_locations:"},{"line_number":581,"context_line":"                        loc.pop(\u0027id\u0027)"},{"line_number":582,"context_line":"                        loc.pop(\u0027status\u0027)"},{"line_number":583,"context_line":"                    image_view[\u0027locations\u0027] \u003d active_locations"},{"line_number":584,"context_line":"                else:"}],"source_content_type":"text/x-python","patch_set":18,"id":"AAAAUH%2F%2FgL8%3D","line":581,"in_reply_to":"AAAAUH%2F%2FnVE%3D","updated":"2014-01-13 11:52:30.000000000","message":"Done","commit_id":"919a2d97478d699465604af5789f6086e08ba8ac"}],"glance/common/store_utils.py":[{"author":{"_account_id":6159,"name":"Flavio Percoco Premoli","display_name":"flaper87","email":"flavio.percoco@flyrlabs.com","username":"flaper87"},"change_message_id":"a797d0e528b2cfdb63c02fdb0f0800b038d1d9fc","unresolved":false,"context_lines":[{"line_number":1,"context_line":"# vim: tabstop\u003d4 shiftwidth\u003d4 softtabstop\u003d4"},{"line_number":2,"context_line":""},{"line_number":3,"context_line":"#    # Copyright 2013 IBM Corp."},{"line_number":4,"context_line":"#"}],"source_content_type":"text/x-python","patch_set":18,"id":"AAAAUH%2F%2FnUk%3D","line":1,"updated":"2014-01-10 13:52:08.000000000","message":"Could you get rid of this mod line?","commit_id":"919a2d97478d699465604af5789f6086e08ba8ac"},{"author":{"_account_id":6549,"name":"Zhi Yan Liu","email":"lzy.dev@gmail.com","username":"lzy-dev"},"change_message_id":"6c1d5ba1218a6816dda51c63b9dc0005eea2b483","unresolved":false,"context_lines":[{"line_number":1,"context_line":"# vim: tabstop\u003d4 shiftwidth\u003d4 softtabstop\u003d4"},{"line_number":2,"context_line":""},{"line_number":3,"context_line":"#    # Copyright 2013 IBM Corp."},{"line_number":4,"context_line":"#"}],"source_content_type":"text/x-python","patch_set":18,"id":"AAAAUH%2F%2FgLA%3D","line":1,"in_reply_to":"AAAAUH%2F%2FnUk%3D","updated":"2014-01-13 11:52:30.000000000","message":"Done","commit_id":"919a2d97478d699465604af5789f6086e08ba8ac"},{"author":{"_account_id":6159,"name":"Flavio Percoco Premoli","display_name":"flaper87","email":"flavio.percoco@flyrlabs.com","username":"flaper87"},"change_message_id":"a797d0e528b2cfdb63c02fdb0f0800b038d1d9fc","unresolved":false,"context_lines":[{"line_number":1,"context_line":"# vim: tabstop\u003d4 shiftwidth\u003d4 softtabstop\u003d4"},{"line_number":2,"context_line":""},{"line_number":3,"context_line":"#    # Copyright 2013 IBM Corp."},{"line_number":4,"context_line":"#"},{"line_number":5,"context_line":"#    Licensed under the Apache License, Version 2.0 (the \"License\"); you may"},{"line_number":6,"context_line":"#    not use this file except in compliance with the License. You may obtain"}],"source_content_type":"text/x-python","patch_set":18,"id":"AAAAUH%2F%2FnUg%3D","line":3,"updated":"2014-01-10 13:52:08.000000000","message":"2014* here and all other files :)","commit_id":"919a2d97478d699465604af5789f6086e08ba8ac"},{"author":{"_account_id":6549,"name":"Zhi Yan Liu","email":"lzy.dev@gmail.com","username":"lzy-dev"},"change_message_id":"6c1d5ba1218a6816dda51c63b9dc0005eea2b483","unresolved":false,"context_lines":[{"line_number":1,"context_line":"# vim: tabstop\u003d4 shiftwidth\u003d4 softtabstop\u003d4"},{"line_number":2,"context_line":""},{"line_number":3,"context_line":"#    # Copyright 2013 IBM Corp."},{"line_number":4,"context_line":"#"},{"line_number":5,"context_line":"#    Licensed under the Apache License, Version 2.0 (the \"License\"); you may"},{"line_number":6,"context_line":"#    not use this file except in compliance with the License. You may obtain"}],"source_content_type":"text/x-python","patch_set":18,"id":"AAAAUH%2F%2FgK0%3D","line":3,"in_reply_to":"AAAAUH%2F%2FnUg%3D","updated":"2014-01-13 11:52:30.000000000","message":"Np, done.","commit_id":"919a2d97478d699465604af5789f6086e08ba8ac"},{"author":{"_account_id":8759,"name":"Arnaud Legendre","email":"arnaudleg@gmail.com","username":"arnaud"},"change_message_id":"78c6d3b5d7eab0c9f33d9195962a975b5ecf9919","unresolved":false,"context_lines":[{"line_number":70,"context_line":"    return ret"},{"line_number":71,"context_line":""},{"line_number":72,"context_line":""},{"line_number":73,"context_line":"def delete_image_from_backend(context, store_utils, image_id, location):"},{"line_number":74,"context_line":"    deleted \u003d False"},{"line_number":75,"context_line":"    if CONF.delayed_delete:"},{"line_number":76,"context_line":"        deleted \u003d store_utils.schedule_delayed_delete_from_backend(context,"}],"source_content_type":"text/x-python","patch_set":18,"id":"AAAAUH%2F%2Fld4%3D","line":73,"updated":"2014-01-10 19:18:27.000000000","message":"why do you need store_utils as a param?","commit_id":"919a2d97478d699465604af5789f6086e08ba8ac"},{"author":{"_account_id":6549,"name":"Zhi Yan Liu","email":"lzy.dev@gmail.com","username":"lzy-dev"},"change_message_id":"6c1d5ba1218a6816dda51c63b9dc0005eea2b483","unresolved":false,"context_lines":[{"line_number":70,"context_line":"    return ret"},{"line_number":71,"context_line":""},{"line_number":72,"context_line":""},{"line_number":73,"context_line":"def delete_image_from_backend(context, store_utils, image_id, location):"},{"line_number":74,"context_line":"    deleted \u003d False"},{"line_number":75,"context_line":"    if CONF.delayed_delete:"},{"line_number":76,"context_line":"        deleted \u003d store_utils.schedule_delayed_delete_from_backend(context,"}],"source_content_type":"text/x-python","patch_set":18,"id":"AAAAUH%2F%2FfS8%3D","line":73,"in_reply_to":"AAAAUH%2F%2Fld4%3D","updated":"2014-01-13 11:52:30.000000000","message":"In original design, ImageProxy domain object within image store has own store api object, and it provide that object when it call this function, for reference [1] [2]. In this change I remained this design [3].\n\n[1] https://github.com/openstack/glance/blob/master/glance/store/__init__.py#L508\n\n[2] https://github.com/openstack/glance/blob/master/glance/store/__init__.py#L302\n\n[3] https://review.openstack.org/#/c/41311/18/glance/store/__init__.py Line 471","commit_id":"919a2d97478d699465604af5789f6086e08ba8ac"},{"author":{"_account_id":8759,"name":"Arnaud Legendre","email":"arnaudleg@gmail.com","username":"arnaud"},"change_message_id":"78c6d3b5d7eab0c9f33d9195962a975b5ecf9919","unresolved":false,"context_lines":[{"line_number":76,"context_line":"        deleted \u003d store_utils.schedule_delayed_delete_from_backend(context,"},{"line_number":77,"context_line":"                                                                   image_id,"},{"line_number":78,"context_line":"                                                                   location)"},{"line_number":79,"context_line":"    if not deleted:"},{"line_number":80,"context_line":"        # NOTE(zhiyan) If image metadata has not be saved to DB"},{"line_number":81,"context_line":"        # such as uploading process failure then we can\u0027t using"},{"line_number":82,"context_line":"        # location status mechanism to support image pending delete."}],"source_content_type":"text/x-python","patch_set":18,"id":"AAAAUH%2F%2Fldc%3D","line":79,"updated":"2014-01-10 19:18:27.000000000","message":"typo: has not been saved to the DB","commit_id":"919a2d97478d699465604af5789f6086e08ba8ac"},{"author":{"_account_id":6549,"name":"Zhi Yan Liu","email":"lzy.dev@gmail.com","username":"lzy-dev"},"change_message_id":"6c1d5ba1218a6816dda51c63b9dc0005eea2b483","unresolved":false,"context_lines":[{"line_number":76,"context_line":"        deleted \u003d store_utils.schedule_delayed_delete_from_backend(context,"},{"line_number":77,"context_line":"                                                                   image_id,"},{"line_number":78,"context_line":"                                                                   location)"},{"line_number":79,"context_line":"    if not deleted:"},{"line_number":80,"context_line":"        # NOTE(zhiyan) If image metadata has not be saved to DB"},{"line_number":81,"context_line":"        # such as uploading process failure then we can\u0027t using"},{"line_number":82,"context_line":"        # location status mechanism to support image pending delete."}],"source_content_type":"text/x-python","patch_set":18,"id":"AAAAUH%2F%2FfWM%3D","line":79,"in_reply_to":"AAAAUH%2F%2Fldc%3D","updated":"2014-01-13 11:52:30.000000000","message":"Done","commit_id":"919a2d97478d699465604af5789f6086e08ba8ac"}],"glance/db/__init__.py":[{"author":{"_account_id":6159,"name":"Flavio Percoco Premoli","display_name":"flaper87","email":"flavio.percoco@flyrlabs.com","username":"flaper87"},"change_message_id":"a797d0e528b2cfdb63c02fdb0f0800b038d1d9fc","unresolved":false,"context_lines":[{"line_number":128,"context_line":"                ld.append({\u0027url\u0027: url, \u0027metadata\u0027: l[\u0027metadata\u0027],"},{"line_number":129,"context_line":"                           \u0027status\u0027: l[\u0027status\u0027],"},{"line_number":130,"context_line":"                           # Note(zhiyan): New location has no ID field."},{"line_number":131,"context_line":"                           \u0027id\u0027: l[\u0027id\u0027] if \u0027id\u0027 in l else None})"},{"line_number":132,"context_line":"            locations \u003d ld"},{"line_number":133,"context_line":"        return {"},{"line_number":134,"context_line":"            \u0027id\u0027: image.image_id,"}],"source_content_type":"text/x-python","patch_set":18,"id":"AAAAUH%2F%2FnUU%3D","line":131,"updated":"2014-01-10 13:52:08.000000000","message":"l.get(\u0027id\u0027) ?","commit_id":"919a2d97478d699465604af5789f6086e08ba8ac"},{"author":{"_account_id":6549,"name":"Zhi Yan Liu","email":"lzy.dev@gmail.com","username":"lzy-dev"},"change_message_id":"6c1d5ba1218a6816dda51c63b9dc0005eea2b483","unresolved":false,"context_lines":[{"line_number":128,"context_line":"                ld.append({\u0027url\u0027: url, \u0027metadata\u0027: l[\u0027metadata\u0027],"},{"line_number":129,"context_line":"                           \u0027status\u0027: l[\u0027status\u0027],"},{"line_number":130,"context_line":"                           # Note(zhiyan): New location has no ID field."},{"line_number":131,"context_line":"                           \u0027id\u0027: l[\u0027id\u0027] if \u0027id\u0027 in l else None})"},{"line_number":132,"context_line":"            locations \u003d ld"},{"line_number":133,"context_line":"        return {"},{"line_number":134,"context_line":"            \u0027id\u0027: image.image_id,"}],"source_content_type":"text/x-python","patch_set":18,"id":"AAAAUH%2F%2FgKI%3D","line":131,"in_reply_to":"AAAAUH%2F%2FnUU%3D","updated":"2014-01-13 11:52:30.000000000","message":":-)","commit_id":"919a2d97478d699465604af5789f6086e08ba8ac"}],"glance/db/simple/api.py":[{"author":{"_account_id":6159,"name":"Flavio Percoco Premoli","display_name":"flaper87","email":"flavio.percoco@flyrlabs.com","username":"flaper87"},"change_message_id":"a797d0e528b2cfdb63c02fdb0f0800b038d1d9fc","unresolved":false,"context_lines":[{"line_number":82,"context_line":"        \u0027image_id\u0027: image_id,"},{"line_number":83,"context_line":"        \u0027created_at\u0027: dt,"},{"line_number":84,"context_line":"        \u0027updated_at\u0027: dt,"},{"line_number":85,"context_line":"        \u0027deleted_at\u0027: deleted if dt else None,"},{"line_number":86,"context_line":"        \u0027deleted\u0027: deleted,"},{"line_number":87,"context_line":"        \u0027url\u0027: value,"},{"line_number":88,"context_line":"        \u0027metadata\u0027: meta_data,"}],"source_content_type":"text/x-python","patch_set":18,"id":"AAAAUH%2F%2FnT8%3D","line":85,"updated":"2014-01-10 13:52:08.000000000","message":"dt if deleted else None*","commit_id":"919a2d97478d699465604af5789f6086e08ba8ac"},{"author":{"_account_id":6549,"name":"Zhi Yan Liu","email":"lzy.dev@gmail.com","username":"lzy-dev"},"change_message_id":"6c1d5ba1218a6816dda51c63b9dc0005eea2b483","unresolved":false,"context_lines":[{"line_number":82,"context_line":"        \u0027image_id\u0027: image_id,"},{"line_number":83,"context_line":"        \u0027created_at\u0027: dt,"},{"line_number":84,"context_line":"        \u0027updated_at\u0027: dt,"},{"line_number":85,"context_line":"        \u0027deleted_at\u0027: deleted if dt else None,"},{"line_number":86,"context_line":"        \u0027deleted\u0027: deleted,"},{"line_number":87,"context_line":"        \u0027url\u0027: value,"},{"line_number":88,"context_line":"        \u0027metadata\u0027: meta_data,"}],"source_content_type":"text/x-python","patch_set":18,"id":"AAAAUH%2F%2FgJ0%3D","line":85,"in_reply_to":"AAAAUH%2F%2FnT8%3D","updated":"2014-01-13 11:52:30.000000000","message":"oops, done.","commit_id":"919a2d97478d699465604af5789f6086e08ba8ac"},{"author":{"_account_id":6159,"name":"Flavio Percoco Premoli","display_name":"flaper87","email":"flavio.percoco@flyrlabs.com","username":"flaper87"},"change_message_id":"a797d0e528b2cfdb63c02fdb0f0800b038d1d9fc","unresolved":false,"context_lines":[{"line_number":466,"context_line":""},{"line_number":467,"context_line":""},{"line_number":468,"context_line":"def _image_locations_update(image_id, locations):"},{"line_number":469,"context_line":"    _image_locations_delete_all(image_id)"},{"line_number":470,"context_line":"    global DATA"},{"line_number":471,"context_line":"    image \u003d DATA[\u0027images\u0027][image_id]"},{"line_number":472,"context_line":"    for loc in locations:"}],"source_content_type":"text/x-python","patch_set":18,"id":"AAAAUH%2F%2FnRw%3D","line":469,"updated":"2014-01-10 13:52:08.000000000","message":"Why deleting them all? What if `locations` has an URL that was previously set as location? We would end up duplicating that record, 1 marked as deleted.","commit_id":"919a2d97478d699465604af5789f6086e08ba8ac"},{"author":{"_account_id":6549,"name":"Zhi Yan Liu","email":"lzy.dev@gmail.com","username":"lzy-dev"},"change_message_id":"6c1d5ba1218a6816dda51c63b9dc0005eea2b483","unresolved":false,"context_lines":[{"line_number":466,"context_line":""},{"line_number":467,"context_line":""},{"line_number":468,"context_line":"def _image_locations_update(image_id, locations):"},{"line_number":469,"context_line":"    _image_locations_delete_all(image_id)"},{"line_number":470,"context_line":"    global DATA"},{"line_number":471,"context_line":"    image \u003d DATA[\u0027images\u0027][image_id]"},{"line_number":472,"context_line":"    for loc in locations:"}],"source_content_type":"text/x-python","patch_set":18,"id":"AAAAUH%2F%2FfYk%3D","line":469,"in_reply_to":"AAAAUH%2F%2Flcg%3D","updated":"2014-01-13 11:52:30.000000000","message":"Done, thank you all.","commit_id":"919a2d97478d699465604af5789f6086e08ba8ac"},{"author":{"_account_id":8759,"name":"Arnaud Legendre","email":"arnaudleg@gmail.com","username":"arnaud"},"change_message_id":"78c6d3b5d7eab0c9f33d9195962a975b5ecf9919","unresolved":false,"context_lines":[{"line_number":466,"context_line":""},{"line_number":467,"context_line":""},{"line_number":468,"context_line":"def _image_locations_update(image_id, locations):"},{"line_number":469,"context_line":"    _image_locations_delete_all(image_id)"},{"line_number":470,"context_line":"    global DATA"},{"line_number":471,"context_line":"    image \u003d DATA[\u0027images\u0027][image_id]"},{"line_number":472,"context_line":"    for loc in locations:"}],"source_content_type":"text/x-python","patch_set":18,"id":"AAAAUH%2F%2Flcg%3D","line":469,"in_reply_to":"AAAAUH%2F%2FnRw%3D","updated":"2014-01-10 19:18:27.000000000","message":"+1","commit_id":"919a2d97478d699465604af5789f6086e08ba8ac"},{"author":{"_account_id":6159,"name":"Flavio Percoco Premoli","display_name":"flaper87","email":"flavio.percoco@flyrlabs.com","username":"flaper87"},"change_message_id":"a797d0e528b2cfdb63c02fdb0f0800b038d1d9fc","unresolved":false,"context_lines":[{"line_number":517,"context_line":"def _image_locations_delete_all(image_id):"},{"line_number":518,"context_line":"    global DATA"},{"line_number":519,"context_line":"    image \u003d DATA[\u0027images\u0027][image_id]"},{"line_number":520,"context_line":"    for location in image[\u0027locations\u0027]:"},{"line_number":521,"context_line":"        location[\u0027deleted\u0027] \u003d True"},{"line_number":522,"context_line":"        location[\u0027deleted_at\u0027] \u003d timeutils.utcnow()"},{"line_number":523,"context_line":"        if location[\u0027status\u0027] \u003d\u003d \u0027active\u0027:"}],"source_content_type":"text/x-python","patch_set":18,"id":"AAAAUH%2F%2FnRQ%3D","line":520,"updated":"2014-01-10 13:52:08.000000000","message":"Can we have an `_image_location_delete` that is called by both `image_location_delete` and `_image_location_delete_all` in order to avoid duplicating the code in this loop?","commit_id":"919a2d97478d699465604af5789f6086e08ba8ac"},{"author":{"_account_id":6549,"name":"Zhi Yan Liu","email":"lzy.dev@gmail.com","username":"lzy-dev"},"change_message_id":"6c1d5ba1218a6816dda51c63b9dc0005eea2b483","unresolved":false,"context_lines":[{"line_number":517,"context_line":"def _image_locations_delete_all(image_id):"},{"line_number":518,"context_line":"    global DATA"},{"line_number":519,"context_line":"    image \u003d DATA[\u0027images\u0027][image_id]"},{"line_number":520,"context_line":"    for location in image[\u0027locations\u0027]:"},{"line_number":521,"context_line":"        location[\u0027deleted\u0027] \u003d True"},{"line_number":522,"context_line":"        location[\u0027deleted_at\u0027] \u003d timeutils.utcnow()"},{"line_number":523,"context_line":"        if location[\u0027status\u0027] \u003d\u003d \u0027active\u0027:"}],"source_content_type":"text/x-python","patch_set":18,"id":"AAAAUH%2F%2Ff6k%3D","line":520,"in_reply_to":"AAAAUH%2F%2FnRQ%3D","updated":"2014-01-13 11:52:30.000000000","message":"Done","commit_id":"919a2d97478d699465604af5789f6086e08ba8ac"},{"author":{"_account_id":6159,"name":"Flavio Percoco Premoli","display_name":"flaper87","email":"flavio.percoco@flyrlabs.com","username":"flaper87"},"change_message_id":"a797d0e528b2cfdb63c02fdb0f0800b038d1d9fc","unresolved":false,"context_lines":[{"line_number":521,"context_line":"        location[\u0027deleted\u0027] \u003d True"},{"line_number":522,"context_line":"        location[\u0027deleted_at\u0027] \u003d timeutils.utcnow()"},{"line_number":523,"context_line":"        if location[\u0027status\u0027] \u003d\u003d \u0027active\u0027:"},{"line_number":524,"context_line":"            location[\u0027status\u0027] \u003d \u0027deleted\u0027"},{"line_number":525,"context_line":""},{"line_number":526,"context_line":"    for i, location in enumerate(DATA[\u0027locations\u0027]):"},{"line_number":527,"context_line":"        if image_id \u003d\u003d location[\u0027image_id\u0027] and location[\u0027deleted\u0027] is False:"}],"source_content_type":"text/x-python","patch_set":18,"id":"AAAAUH%2F%2FnSs%3D","line":524,"updated":"2014-01-10 13:52:08.000000000","message":"Something to think about is that this could end up in a huge location dict full of deleted images. Should we remove some records at some point? \n\nWhat about getting rid of the location on delete and just having \u0027pending_delete\u0027? it wouldn\u0027t be consistent with iamge\u0027s delete status, though.","commit_id":"919a2d97478d699465604af5789f6086e08ba8ac"},{"author":{"_account_id":6549,"name":"Zhi Yan Liu","email":"lzy.dev@gmail.com","username":"lzy-dev"},"change_message_id":"6c1d5ba1218a6816dda51c63b9dc0005eea2b483","unresolved":false,"context_lines":[{"line_number":521,"context_line":"        location[\u0027deleted\u0027] \u003d True"},{"line_number":522,"context_line":"        location[\u0027deleted_at\u0027] \u003d timeutils.utcnow()"},{"line_number":523,"context_line":"        if location[\u0027status\u0027] \u003d\u003d \u0027active\u0027:"},{"line_number":524,"context_line":"            location[\u0027status\u0027] \u003d \u0027deleted\u0027"},{"line_number":525,"context_line":""},{"line_number":526,"context_line":"    for i, location in enumerate(DATA[\u0027locations\u0027]):"},{"line_number":527,"context_line":"        if image_id \u003d\u003d location[\u0027image_id\u0027] and location[\u0027deleted\u0027] is False:"}],"source_content_type":"text/x-python","patch_set":18,"id":"AAAAUH%2F%2Ff0k%3D","line":524,"in_reply_to":"AAAAUH%2F%2FnSs%3D","updated":"2014-01-13 11:52:30.000000000","message":"@flaper87, your concerns is reasonable but just like you said it can break data/image-status consistentcy, so I prefer to keep those record here to keep data/status be consistent.\n\nAnd TBH I think there should only has a few people need to use this backend as \"database\" in the real Cloud deployment, so huge location dict should be very rare in the real world, so I think to keep data consistent is more important here.","commit_id":"919a2d97478d699465604af5789f6086e08ba8ac"}],"glance/db/sqlalchemy/api.py":[{"author":{"_account_id":6159,"name":"Flavio Percoco Premoli","display_name":"flaper87","email":"flavio.percoco@flyrlabs.com","username":"flaper87"},"change_message_id":"a797d0e528b2cfdb63c02fdb0f0800b038d1d9fc","unresolved":false,"context_lines":[{"line_number":682,"context_line":""},{"line_number":683,"context_line":""},{"line_number":684,"context_line":"def _image_locations_update(context, image_id, locations, session):"},{"line_number":685,"context_line":"    _image_locations_delete_all(context, image_id, session\u003dsession)"},{"line_number":686,"context_line":"    for loc in locations:"},{"line_number":687,"context_line":"        loc_id \u003d loc.get(\u0027id\u0027)"},{"line_number":688,"context_line":"        if loc_id is None:"}],"source_content_type":"text/x-python","patch_set":18,"id":"AAAAUH%2F%2FnQM%3D","line":685,"updated":"2014-01-10 13:52:08.000000000","message":"Can we first verify whether there are duplicated locations here? Instead of deleting them all, we would delete those that are not in `locations`","commit_id":"919a2d97478d699465604af5789f6086e08ba8ac"},{"author":{"_account_id":6549,"name":"Zhi Yan Liu","email":"lzy.dev@gmail.com","username":"lzy-dev"},"change_message_id":"6c1d5ba1218a6816dda51c63b9dc0005eea2b483","unresolved":false,"context_lines":[{"line_number":682,"context_line":""},{"line_number":683,"context_line":""},{"line_number":684,"context_line":"def _image_locations_update(context, image_id, locations, session):"},{"line_number":685,"context_line":"    _image_locations_delete_all(context, image_id, session\u003dsession)"},{"line_number":686,"context_line":"    for loc in locations:"},{"line_number":687,"context_line":"        loc_id \u003d loc.get(\u0027id\u0027)"},{"line_number":688,"context_line":"        if loc_id is None:"}],"source_content_type":"text/x-python","patch_set":18,"id":"AAAAUH%2F%2FgBw%3D","line":685,"in_reply_to":"AAAAUH%2F%2FnQM%3D","updated":"2014-01-13 11:52:30.000000000","message":"@flaper87 yes your suggestion is make sense, but TBH I think current approach is clearer and easier to be implemented, and I think this implementation is enough to us.","commit_id":"919a2d97478d699465604af5789f6086e08ba8ac"},{"author":{"_account_id":8759,"name":"Arnaud Legendre","email":"arnaudleg@gmail.com","username":"arnaud"},"change_message_id":"78c6d3b5d7eab0c9f33d9195962a975b5ecf9919","unresolved":false,"context_lines":[{"line_number":696,"context_line":"            location_ref.save(session\u003dsession)"},{"line_number":697,"context_line":"        else:"},{"line_number":698,"context_line":"            # Updating an existing image location"},{"line_number":699,"context_line":"            location_ref \u003d session.query(models.ImageLocation)\\"},{"line_number":700,"context_line":"                .filter_by(id\u003dloc_id)\\"},{"line_number":701,"context_line":"                .filter_by(image_id\u003dimage_id)\\"},{"line_number":702,"context_line":"                .one()"}],"source_content_type":"text/x-python","patch_set":18,"id":"AAAAUH%2F%2Flbg%3D","line":699,"updated":"2014-01-10 19:18:27.000000000","message":"since same logic as in simple/api.py: is it possible to have it only in one place somewhere else?","commit_id":"919a2d97478d699465604af5789f6086e08ba8ac"},{"author":{"_account_id":6549,"name":"Zhi Yan Liu","email":"lzy.dev@gmail.com","username":"lzy-dev"},"change_message_id":"6c1d5ba1218a6816dda51c63b9dc0005eea2b483","unresolved":false,"context_lines":[{"line_number":696,"context_line":"            location_ref.save(session\u003dsession)"},{"line_number":697,"context_line":"        else:"},{"line_number":698,"context_line":"            # Updating an existing image location"},{"line_number":699,"context_line":"            location_ref \u003d session.query(models.ImageLocation)\\"},{"line_number":700,"context_line":"                .filter_by(id\u003dloc_id)\\"},{"line_number":701,"context_line":"                .filter_by(image_id\u003dimage_id)\\"},{"line_number":702,"context_line":"                .one()"}],"source_content_type":"text/x-python","patch_set":18,"id":"AAAAUH%2F%2FgDo%3D","line":699,"in_reply_to":"AAAAUH%2F%2Flbg%3D","updated":"2014-01-13 11:52:30.000000000","message":"Yes the logic is similar with simple api implementation, but the details is different since sqlalchemy api access data via ORM models but simple api use local container variable.","commit_id":"919a2d97478d699465604af5789f6086e08ba8ac"},{"author":{"_account_id":616,"name":"Mark Washenberger","email":"mark.washenberger@markwash.net","username":"markwash"},"change_message_id":"a4e75d7be54df97a8269fb1e173445e0cabed30f","unresolved":false,"context_lines":[{"line_number":682,"context_line":""},{"line_number":683,"context_line":""},{"line_number":684,"context_line":"def _image_locations_update(context, image_id, locations, session):"},{"line_number":685,"context_line":"    _image_locations_delete_all(context, image_id, session\u003dsession)"},{"line_number":686,"context_line":"    for loc in locations:"},{"line_number":687,"context_line":"        loc_id \u003d loc.get(\u0027id\u0027)"},{"line_number":688,"context_line":"        if loc_id is None:"}],"source_content_type":"text/x-python","patch_set":20,"id":"AAAAUH%2F%2FP3w%3D","line":685,"updated":"2014-01-15 22:38:07.000000000","message":"This is starting to get really strained.\n\nI think its time we go ahead with image locations as a repo so that we actually know the users intentions about adding a new vs modifying an existing location.","commit_id":"f2b6765bf3be71081192d48fc1265d01d0d7bd1d"},{"author":{"_account_id":6549,"name":"Zhi Yan Liu","email":"lzy.dev@gmail.com","username":"lzy-dev"},"change_message_id":"e8b7a3daf54dc3f68dfac8f263ebbbb5fd43ac6a","unresolved":false,"context_lines":[{"line_number":682,"context_line":""},{"line_number":683,"context_line":""},{"line_number":684,"context_line":"def _image_locations_update(context, image_id, locations, session):"},{"line_number":685,"context_line":"    _image_locations_delete_all(context, image_id, session\u003dsession)"},{"line_number":686,"context_line":"    for loc in locations:"},{"line_number":687,"context_line":"        loc_id \u003d loc.get(\u0027id\u0027)"},{"line_number":688,"context_line":"        if loc_id is None:"}],"source_content_type":"text/x-python","patch_set":20,"id":"AAAAUH%2F%2FODA%3D","line":685,"in_reply_to":"AAAAUH%2F%2FP3w%3D","updated":"2014-01-16 08:56:50.000000000","message":"location_repo sounds good","commit_id":"f2b6765bf3be71081192d48fc1265d01d0d7bd1d"}],"glance/db/sqlalchemy/migrate_repo/versions/033_add_location_status.py":[{"author":{"_account_id":616,"name":"Mark Washenberger","email":"mark.washenberger@markwash.net","username":"markwash"},"change_message_id":"a4e75d7be54df97a8269fb1e173445e0cabed30f","unresolved":false,"context_lines":[{"line_number":26,"context_line":"                                             autoload\u003dTrue)"},{"line_number":27,"context_line":""},{"line_number":28,"context_line":"    # Create \u0027status\u0027 column for image_locations table"},{"line_number":29,"context_line":"    status \u003d sqlalchemy.Column(\u0027status\u0027, schema.String(30), default\u003dNone)"},{"line_number":30,"context_line":"    status.create(image_locations_table)"},{"line_number":31,"context_line":""},{"line_number":32,"context_line":"    # Set \u0027status\u0027 column initial value for image_locations table"}],"source_content_type":"text/x-python","patch_set":20,"id":"AAAAUH%2F%2FP64%3D","line":29,"updated":"2014-01-15 22:38:07.000000000","message":"I think this status column should not be Nullable, but maybe that creates some difficulty in the migration?","commit_id":"f2b6765bf3be71081192d48fc1265d01d0d7bd1d"},{"author":{"_account_id":6549,"name":"Zhi Yan Liu","email":"lzy.dev@gmail.com","username":"lzy-dev"},"change_message_id":"e8b7a3daf54dc3f68dfac8f263ebbbb5fd43ac6a","unresolved":false,"context_lines":[{"line_number":26,"context_line":"                                             autoload\u003dTrue)"},{"line_number":27,"context_line":""},{"line_number":28,"context_line":"    # Create \u0027status\u0027 column for image_locations table"},{"line_number":29,"context_line":"    status \u003d sqlalchemy.Column(\u0027status\u0027, schema.String(30), default\u003dNone)"},{"line_number":30,"context_line":"    status.create(image_locations_table)"},{"line_number":31,"context_line":""},{"line_number":32,"context_line":"    # Set \u0027status\u0027 column initial value for image_locations table"}],"source_content_type":"text/x-python","patch_set":20,"id":"AAAAUH%2F%2FODg%3D","line":29,"in_reply_to":"AAAAUH%2F%2FP64%3D","updated":"2014-01-16 08:56:50.000000000","message":"yes I think this can prevent some potential migration issue, since there has not a complete status translation mappings: as we talked, there only has three available status for location \"active\", \"pending_delete\" and \"deleted\".","commit_id":"f2b6765bf3be71081192d48fc1265d01d0d7bd1d"}],"glance/db/sqlalchemy/models.py":[{"author":{"_account_id":616,"name":"Mark Washenberger","email":"mark.washenberger@markwash.net","username":"markwash"},"change_message_id":"a4e75d7be54df97a8269fb1e173445e0cabed30f","unresolved":false,"context_lines":[{"line_number":180,"context_line":"    image \u003d relationship(Image, backref\u003dbackref(\u0027locations\u0027))"},{"line_number":181,"context_line":"    value \u003d Column(Text(), nullable\u003dFalse)"},{"line_number":182,"context_line":"    meta_data \u003d Column(JSONEncodedDict(), default\u003d{})"},{"line_number":183,"context_line":"    status \u003d Column(String(30), nullable\u003dTrue)"},{"line_number":184,"context_line":""},{"line_number":185,"context_line":""},{"line_number":186,"context_line":"class ImageMember(BASE, GlanceBase):"}],"source_content_type":"text/x-python","patch_set":20,"id":"AAAAUH%2F%2FP6c%3D","line":183,"updated":"2014-01-15 22:38:07.000000000","message":"I\u0027m curious about why column should be nullable.","commit_id":"f2b6765bf3be71081192d48fc1265d01d0d7bd1d"},{"author":{"_account_id":6549,"name":"Zhi Yan Liu","email":"lzy.dev@gmail.com","username":"lzy-dev"},"change_message_id":"e8b7a3daf54dc3f68dfac8f263ebbbb5fd43ac6a","unresolved":false,"context_lines":[{"line_number":180,"context_line":"    image \u003d relationship(Image, backref\u003dbackref(\u0027locations\u0027))"},{"line_number":181,"context_line":"    value \u003d Column(Text(), nullable\u003dFalse)"},{"line_number":182,"context_line":"    meta_data \u003d Column(JSONEncodedDict(), default\u003d{})"},{"line_number":183,"context_line":"    status \u003d Column(String(30), nullable\u003dTrue)"},{"line_number":184,"context_line":""},{"line_number":185,"context_line":""},{"line_number":186,"context_line":"class ImageMember(BASE, GlanceBase):"}],"source_content_type":"text/x-python","patch_set":20,"id":"AAAAUH%2F%2FODU%3D","line":183,"in_reply_to":"AAAAUH%2F%2FP6c%3D","updated":"2014-01-16 08:56:50.000000000","message":"Respond in https://review.openstack.org/#/c/41311/20/glance/db/sqlalchemy/migrate_repo/versions/033_add_location_status.py .","commit_id":"f2b6765bf3be71081192d48fc1265d01d0d7bd1d"}],"glance/registry/client/v1/client.py":[{"author":{"_account_id":6159,"name":"Flavio Percoco Premoli","display_name":"flaper87","email":"flavio.percoco@flyrlabs.com","username":"flaper87"},"change_message_id":"a797d0e528b2cfdb63c02fdb0f0800b038d1d9fc","unresolved":false,"context_lines":[{"line_number":84,"context_line":"                    ld.append({\u0027url\u0027: url, \u0027metadata\u0027: loc[\u0027metadata\u0027],"},{"line_number":85,"context_line":"                               \u0027status\u0027: loc[\u0027status\u0027],"},{"line_number":86,"context_line":"                               # Note(zhiyan): New location has no ID field."},{"line_number":87,"context_line":"                               \u0027id\u0027: loc[\u0027id\u0027] if \u0027id\u0027 in loc else None})"},{"line_number":88,"context_line":"                image_metadata[\u0027location_data\u0027] \u003d ld"},{"line_number":89,"context_line":"        return image_metadata"},{"line_number":90,"context_line":""}],"source_content_type":"text/x-python","patch_set":18,"id":"AAAAUH%2F%2FnPo%3D","line":87,"updated":"2014-01-10 13:52:08.000000000","message":"loc.get(\u0027id\u0027)","commit_id":"919a2d97478d699465604af5789f6086e08ba8ac"},{"author":{"_account_id":6549,"name":"Zhi Yan Liu","email":"lzy.dev@gmail.com","username":"lzy-dev"},"change_message_id":"6c1d5ba1218a6816dda51c63b9dc0005eea2b483","unresolved":false,"context_lines":[{"line_number":84,"context_line":"                    ld.append({\u0027url\u0027: url, \u0027metadata\u0027: loc[\u0027metadata\u0027],"},{"line_number":85,"context_line":"                               \u0027status\u0027: loc[\u0027status\u0027],"},{"line_number":86,"context_line":"                               # Note(zhiyan): New location has no ID field."},{"line_number":87,"context_line":"                               \u0027id\u0027: loc[\u0027id\u0027] if \u0027id\u0027 in loc else None})"},{"line_number":88,"context_line":"                image_metadata[\u0027location_data\u0027] \u003d ld"},{"line_number":89,"context_line":"        return image_metadata"},{"line_number":90,"context_line":""}],"source_content_type":"text/x-python","patch_set":18,"id":"AAAAUH%2F%2FgIw%3D","line":87,"in_reply_to":"AAAAUH%2F%2FnPo%3D","updated":"2014-01-13 11:52:30.000000000","message":"Done","commit_id":"919a2d97478d699465604af5789f6086e08ba8ac"}],"glance/store/__init__.py":[{"author":{"_account_id":6493,"name":"John Bresnahan","email":"john@bresnahan.me","username":"jbresnah"},"change_message_id":"68a878f6a666b03ff33120ca0a551a1b1de14508","unresolved":false,"context_lines":[{"line_number":421,"context_line":"        for location in image.locations:"},{"line_number":422,"context_line":"            if location[\u0027status\u0027] \u003d\u003d \u0027active\u0027:"},{"line_number":423,"context_line":"                self.store_api.set_acls(self.context, location[\u0027url\u0027], public,"},{"line_number":424,"context_line":"                                        read_tenants\u003dmember_ids)"},{"line_number":425,"context_line":""},{"line_number":426,"context_line":"    def add(self, image):"},{"line_number":427,"context_line":"        result \u003d super(ImageRepoProxy, self).add(image)"}],"source_content_type":"text/x-python","patch_set":3,"id":"AAAASX%2F%2F03c%3D","line":424,"updated":"2013-08-26 17:54:50.000000000","message":"What if an image is pending (in upload) but a parallel call wants to change the ACL?","commit_id":"3f3a18beb9af31126afcc3b57abe2dca025a6e3d"},{"author":{"_account_id":6549,"name":"Zhi Yan Liu","email":"lzy.dev@gmail.com","username":"lzy-dev"},"change_message_id":"de79a57fc8feb4e17c57a20778ee0cc7c015dacd","unresolved":false,"context_lines":[{"line_number":421,"context_line":"        for location in image.locations:"},{"line_number":422,"context_line":"            if location[\u0027status\u0027] \u003d\u003d \u0027active\u0027:"},{"line_number":423,"context_line":"                self.store_api.set_acls(self.context, location[\u0027url\u0027], public,"},{"line_number":424,"context_line":"                                        read_tenants\u003dmember_ids)"},{"line_number":425,"context_line":""},{"line_number":426,"context_line":"    def add(self, image):"},{"line_number":427,"context_line":"        result \u003d super(ImageRepoProxy, self).add(image)"}],"source_content_type":"text/x-python","patch_set":3,"id":"AAAASn%2F%2F%2FKw%3D","line":424,"in_reply_to":"AAAASX%2F%2F03c%3D","updated":"2013-08-27 06:41:18.000000000","message":"IMO user can not change ACL to a image\u0027s location which under uploading, that means if image under saving status then its location should have not be wrote to DB yet, so image.locations will not include that location, the old code logic just like this.","commit_id":"3f3a18beb9af31126afcc3b57abe2dca025a6e3d"},{"author":{"_account_id":6159,"name":"Flavio Percoco Premoli","display_name":"flaper87","email":"flavio.percoco@flyrlabs.com","username":"flaper87"},"change_message_id":"a797d0e528b2cfdb63c02fdb0f0800b038d1d9fc","unresolved":false,"context_lines":[{"line_number":647,"context_line":""},{"line_number":648,"context_line":"    def get_data(self):"},{"line_number":649,"context_line":"        if (not self.image.locations or"},{"line_number":650,"context_line":"                not filter(lambda loc: loc[\u0027status\u0027] \u003d\u003d \u0027active\u0027,"},{"line_number":651,"context_line":"                           self.image.locations)):"},{"line_number":652,"context_line":"            raise exception.NotFound(_(\"No image data could be found\"))"},{"line_number":653,"context_line":"        err \u003d None"}],"source_content_type":"text/x-python","patch_set":18,"id":"AAAAUH%2F%2FnOE%3D","line":650,"updated":"2014-01-10 13:52:08.000000000","message":"in Py3K filter returns an object. Could you wrap it in a list? \n\n  list(filter(...))\n\nAlso, What about using \u0027get_active_locations\u0027 here?","commit_id":"919a2d97478d699465604af5789f6086e08ba8ac"},{"author":{"_account_id":6549,"name":"Zhi Yan Liu","email":"lzy.dev@gmail.com","username":"lzy-dev"},"change_message_id":"6c1d5ba1218a6816dda51c63b9dc0005eea2b483","unresolved":false,"context_lines":[{"line_number":647,"context_line":""},{"line_number":648,"context_line":"    def get_data(self):"},{"line_number":649,"context_line":"        if (not self.image.locations or"},{"line_number":650,"context_line":"                not filter(lambda loc: loc[\u0027status\u0027] \u003d\u003d \u0027active\u0027,"},{"line_number":651,"context_line":"                           self.image.locations)):"},{"line_number":652,"context_line":"            raise exception.NotFound(_(\"No image data could be found\"))"},{"line_number":653,"context_line":"        err \u003d None"}],"source_content_type":"text/x-python","patch_set":18,"id":"AAAAUH%2F%2FgIU%3D","line":650,"in_reply_to":"AAAAUH%2F%2FnOE%3D","updated":"2014-01-13 11:52:30.000000000","message":"Done","commit_id":"919a2d97478d699465604af5789f6086e08ba8ac"}],"glance/tests/unit/v1/test_registry_api.py":[{"author":{"_account_id":616,"name":"Mark Washenberger","email":"mark.washenberger@markwash.net","username":"markwash"},"change_message_id":"a4e75d7be54df97a8269fb1e173445e0cabed30f","unresolved":false,"context_lines":[{"line_number":1788,"context_line":"        self.assertEqual(res.status_int, 200)"},{"line_number":1789,"context_line":"        res_dict \u003d jsonutils.loads(res.body)"},{"line_number":1790,"context_line":"        image \u003d res_dict[\u0027image\u0027]"},{"line_number":1791,"context_line":"        self.assertTrue(\u0027id\u0027 in image[\u0027location_data\u0027][0])"},{"line_number":1792,"context_line":"        image[\u0027location_data\u0027][0].pop(\u0027id\u0027)"},{"line_number":1793,"context_line":"        self.assertEqual(self.FIXTURES[1][\u0027locations\u0027][0],"},{"line_number":1794,"context_line":"                         image[\u0027location_data\u0027][0])"}],"source_content_type":"text/x-python","patch_set":20,"id":"AAAAUH%2F%2FP2Q%3D","line":1791,"updated":"2014-01-15 22:38:07.000000000","message":"This tests indicates to me that we are adding more information to the v1 api. Is that true?","commit_id":"f2b6765bf3be71081192d48fc1265d01d0d7bd1d"},{"author":{"_account_id":6549,"name":"Zhi Yan Liu","email":"lzy.dev@gmail.com","username":"lzy-dev"},"change_message_id":"e8b7a3daf54dc3f68dfac8f263ebbbb5fd43ac6a","unresolved":false,"context_lines":[{"line_number":1788,"context_line":"        self.assertEqual(res.status_int, 200)"},{"line_number":1789,"context_line":"        res_dict \u003d jsonutils.loads(res.body)"},{"line_number":1790,"context_line":"        image \u003d res_dict[\u0027image\u0027]"},{"line_number":1791,"context_line":"        self.assertTrue(\u0027id\u0027 in image[\u0027location_data\u0027][0])"},{"line_number":1792,"context_line":"        image[\u0027location_data\u0027][0].pop(\u0027id\u0027)"},{"line_number":1793,"context_line":"        self.assertEqual(self.FIXTURES[1][\u0027locations\u0027][0],"},{"line_number":1794,"context_line":"                         image[\u0027location_data\u0027][0])"}],"source_content_type":"text/x-python","patch_set":20,"id":"AAAAUH%2F%2FOEU%3D","line":1791,"in_reply_to":"AAAAUH%2F%2FP2Q%3D","updated":"2014-01-16 08:56:50.000000000","message":"Yes I have changed registry v1 API to allow it expose \u0027id\u0027 field of image location entry, since glance.store.scrubber.ScrubDBQueue use it.","commit_id":"f2b6765bf3be71081192d48fc1265d01d0d7bd1d"}]}
