)]}'
{"/COMMIT_MSG":[{"author":{"_account_id":11536,"name":"hongbin","email":"hongbin034@gmail.com","username":"hongbin"},"change_message_id":"a670efb1592c750dc176b4680519cfdaa5657f4b","unresolved":false,"context_lines":[{"line_number":16,"context_line":"the image must be named in the way of \u0027image:tag\u0027,"},{"line_number":17,"context_line":"that means, the \u0027image:tag\u0027 is a image name."},{"line_number":18,"context_line":""},{"line_number":19,"context_line":"2/ When the user uploads docker image to glance,"},{"line_number":20,"context_line":"the image needs to set the tags parameter."},{"line_number":21,"context_line":"eg. \u0027glance image-create --tags tag:test --file ubuntu.tar"},{"line_number":22,"context_line":"--name ubuntu --disk-format qcow2 --container-format docker --progress\u0027"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":3,"id":"df7087c5_9a2085ae","line":19,"range":{"start_line":19,"start_character":0,"end_line":19,"end_character":1},"updated":"2018-03-14 03:22:56.000000000","message":"Personally, I like this option better.","commit_id":"b97999a32953bdff44deb9e358c1f7b7cc117160"},{"author":{"_account_id":11536,"name":"hongbin","email":"hongbin034@gmail.com","username":"hongbin"},"change_message_id":"a670efb1592c750dc176b4680519cfdaa5657f4b","unresolved":false,"context_lines":[{"line_number":17,"context_line":"that means, the \u0027image:tag\u0027 is a image name."},{"line_number":18,"context_line":""},{"line_number":19,"context_line":"2/ When the user uploads docker image to glance,"},{"line_number":20,"context_line":"the image needs to set the tags parameter."},{"line_number":21,"context_line":"eg. \u0027glance image-create --tags tag:test --file ubuntu.tar"},{"line_number":22,"context_line":"--name ubuntu --disk-format qcow2 --container-format docker --progress\u0027"},{"line_number":23,"context_line":"   Disadvantages: If there are two images with the same name,"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":3,"id":"df7087c5_5a166d57","line":20,"range":{"start_line":20,"start_character":10,"end_line":20,"end_character":18},"updated":"2018-03-14 03:22:56.000000000","message":"I think we can relax this requirement. The user experience is better if we let users to decide if they want to tag the image. Basically, users have two choice:\n\n1. Upload an image without tag.\n2. Upload an image with a tag.\n\nIf users upload a untagged image, they are supposed to run a container with image name only (i.e. zun run \u003cimage_name\u003e). If users upload a tagged image, they are supposed to run a container with image name and tag (i.e. zun run \u003cimage_name\u003e:\u003ctag\u003e).\n\nWhat do you think?","commit_id":"b97999a32953bdff44deb9e358c1f7b7cc117160"},{"author":{"_account_id":11536,"name":"hongbin","email":"hongbin034@gmail.com","username":"hongbin"},"change_message_id":"a670efb1592c750dc176b4680519cfdaa5657f4b","unresolved":false,"context_lines":[{"line_number":20,"context_line":"the image needs to set the tags parameter."},{"line_number":21,"context_line":"eg. \u0027glance image-create --tags tag:test --file ubuntu.tar"},{"line_number":22,"context_line":"--name ubuntu --disk-format qcow2 --container-format docker --progress\u0027"},{"line_number":23,"context_line":"   Disadvantages: If there are two images with the same name,"},{"line_number":24,"context_line":"   the user cannot see the image tag information intuitively."},{"line_number":25,"context_line":"   Must use the \u0027glance image-show\u0027 command to view the image tag"},{"line_number":26,"context_line":"   information."}],"source_content_type":"text/x-gerrit-commit-message","patch_set":3,"id":"df7087c5_ce415e3b","line":23,"range":{"start_line":23,"start_character":47,"end_line":23,"end_character":61},"updated":"2018-03-14 03:22:56.000000000","message":"Keep in mind that users can specify the image ID if name is ambiguous.","commit_id":"b97999a32953bdff44deb9e358c1f7b7cc117160"},{"author":{"_account_id":11536,"name":"hongbin","email":"hongbin034@gmail.com","username":"hongbin"},"change_message_id":"a670efb1592c750dc176b4680519cfdaa5657f4b","unresolved":false,"context_lines":[{"line_number":21,"context_line":"eg. \u0027glance image-create --tags tag:test --file ubuntu.tar"},{"line_number":22,"context_line":"--name ubuntu --disk-format qcow2 --container-format docker --progress\u0027"},{"line_number":23,"context_line":"   Disadvantages: If there are two images with the same name,"},{"line_number":24,"context_line":"   the user cannot see the image tag information intuitively."},{"line_number":25,"context_line":"   Must use the \u0027glance image-show\u0027 command to view the image tag"},{"line_number":26,"context_line":"   information."},{"line_number":27,"context_line":""}],"source_content_type":"text/x-gerrit-commit-message","patch_set":3,"id":"df7087c5_ee10e250","line":24,"range":{"start_line":24,"start_character":3,"end_line":24,"end_character":60},"updated":"2018-03-14 03:22:56.000000000","message":"The user can see the tag with the --long option:\n\n  $ openstack image list --long","commit_id":"b97999a32953bdff44deb9e358c1f7b7cc117160"}],"zun/compute/manager.py":[{"author":{"_account_id":11536,"name":"hongbin","email":"hongbin034@gmail.com","username":"hongbin"},"change_message_id":"2e380dafaae37a61ee40b0d202fb92c2ef679b5e","unresolved":false,"context_lines":[{"line_number":265,"context_line":"            if image[\u0027driver\u0027] \u003d\u003d \u0027glance\u0027:"},{"line_number":266,"context_line":"                self.driver.read_tar_image(image)"},{"line_number":267,"context_line":"            if image[\u0027tag\u0027] !\u003d tag:"},{"line_number":268,"context_line":"                LOG.error(\"The input tag is different from the tag in tar\")"},{"line_number":269,"context_line":"            container \u003d self.driver.create(context, container, image,"},{"line_number":270,"context_line":"                                           requested_networks,"},{"line_number":271,"context_line":"                                           requested_volumes)"}],"source_content_type":"text/x-python","patch_set":5,"id":"df7087c5_a77836f8","line":268,"range":{"start_line":268,"start_character":20,"end_line":268,"end_character":25},"updated":"2018-03-20 14:51:41.000000000","message":"Do we allow the \u0027tag\u0027 in the tarball to be different from the glance image? If we allow it, in here, we should use LOG.warning instead. If we don\u0027t allow it, we should raise an exception after the logging.","commit_id":"35fee7201c19b285709ae0ec8f305a121eefa9fa"},{"author":{"_account_id":21428,"name":"JiWei","email":"17366060309@163.com","username":"WeiJi"},"change_message_id":"f6bc525120cdeb3a4c6903bb87f32335de99a0cb","unresolved":false,"context_lines":[{"line_number":265,"context_line":"            if image[\u0027driver\u0027] \u003d\u003d \u0027glance\u0027:"},{"line_number":266,"context_line":"                self.driver.read_tar_image(image)"},{"line_number":267,"context_line":"            if image[\u0027tag\u0027] !\u003d tag:"},{"line_number":268,"context_line":"                LOG.error(\"The input tag is different from the tag in tar\")"},{"line_number":269,"context_line":"            container \u003d self.driver.create(context, container, image,"},{"line_number":270,"context_line":"                                           requested_networks,"},{"line_number":271,"context_line":"                                           requested_volumes)"}],"source_content_type":"text/x-python","patch_set":5,"id":"df7087c5_9b9a18c3","line":268,"range":{"start_line":268,"start_character":20,"end_line":268,"end_character":25},"in_reply_to":"df7087c5_a77836f8","updated":"2018-03-21 08:23:58.000000000","message":"Done","commit_id":"35fee7201c19b285709ae0ec8f305a121eefa9fa"}],"zun/image/glance/utils.py":[{"author":{"_account_id":11536,"name":"hongbin","email":"hongbin034@gmail.com","username":"hongbin"},"change_message_id":"2e380dafaae37a61ee40b0d202fb92c2ef679b5e","unresolved":false,"context_lines":[{"line_number":34,"context_line":"    return osc.glance()"},{"line_number":35,"context_line":""},{"line_number":36,"context_line":""},{"line_number":37,"context_line":"def get_latest_image(images):"},{"line_number":38,"context_line":"    def dic_key(dic):"},{"line_number":39,"context_line":"        return dic[\u0027updated_at\u0027]"},{"line_number":40,"context_line":"    return max(images, key\u003ddic_key)"}],"source_content_type":"text/x-python","patch_set":5,"id":"df7087c5_67b1bee1","line":37,"range":{"start_line":37,"start_character":4,"end_line":37,"end_character":20},"updated":"2018-03-20 14:51:41.000000000","message":"It looks this can be achieved by using \u0027sort_key\u0027 and \u0027sort_dir\u0027 on listing images. See my comment at line #75","commit_id":"35fee7201c19b285709ae0ec8f305a121eefa9fa"},{"author":{"_account_id":21428,"name":"JiWei","email":"17366060309@163.com","username":"WeiJi"},"change_message_id":"f6bc525120cdeb3a4c6903bb87f32335de99a0cb","unresolved":false,"context_lines":[{"line_number":34,"context_line":"    return osc.glance()"},{"line_number":35,"context_line":""},{"line_number":36,"context_line":""},{"line_number":37,"context_line":"def get_latest_image(images):"},{"line_number":38,"context_line":"    def dic_key(dic):"},{"line_number":39,"context_line":"        return dic[\u0027updated_at\u0027]"},{"line_number":40,"context_line":"    return max(images, key\u003ddic_key)"}],"source_content_type":"text/x-python","patch_set":5,"id":"df7087c5_1bdcc872","line":37,"range":{"start_line":37,"start_character":4,"end_line":37,"end_character":20},"in_reply_to":"df7087c5_67b1bee1","updated":"2018-03-21 08:23:58.000000000","message":"A better way to achieve , the code has been modified, thank you","commit_id":"35fee7201c19b285709ae0ec8f305a121eefa9fa"},{"author":{"_account_id":11536,"name":"hongbin","email":"hongbin034@gmail.com","username":"hongbin"},"change_message_id":"2e380dafaae37a61ee40b0d202fb92c2ef679b5e","unresolved":false,"context_lines":[{"line_number":43,"context_line":"def find_image(context, image_ident, tag):"},{"line_number":44,"context_line":"    matches \u003d find_images(context, image_ident, exact_match\u003dTrue)"},{"line_number":45,"context_line":"    LOG.debug(\u0027Found matches %s \u0027, matches)"},{"line_number":46,"context_line":"    if tag !\u003d \u0027latest\u0027:"},{"line_number":47,"context_line":"        for image in matches:"},{"line_number":48,"context_line":"            if tag not in image.tags:"},{"line_number":49,"context_line":"                matches.remove(image)"},{"line_number":50,"context_line":"    if len(matches) \u003d\u003d 0:"},{"line_number":51,"context_line":"        raise exception.ImageNotFound(image\u003dimage_ident)"},{"line_number":52,"context_line":"    if tag \u003d\u003d \u0027latest\u0027:"}],"source_content_type":"text/x-python","patch_set":5,"id":"df7087c5_c7df6a0a","line":49,"range":{"start_line":46,"start_character":0,"end_line":49,"end_character":37},"updated":"2018-03-20 14:51:41.000000000","message":"It looks this can be achieved by using \u0027tag\u0027 on listing images. See my comments at line #75","commit_id":"35fee7201c19b285709ae0ec8f305a121eefa9fa"},{"author":{"_account_id":21428,"name":"JiWei","email":"17366060309@163.com","username":"WeiJi"},"change_message_id":"f6bc525120cdeb3a4c6903bb87f32335de99a0cb","unresolved":false,"context_lines":[{"line_number":43,"context_line":"def find_image(context, image_ident, tag):"},{"line_number":44,"context_line":"    matches \u003d find_images(context, image_ident, exact_match\u003dTrue)"},{"line_number":45,"context_line":"    LOG.debug(\u0027Found matches %s \u0027, matches)"},{"line_number":46,"context_line":"    if tag !\u003d \u0027latest\u0027:"},{"line_number":47,"context_line":"        for image in matches:"},{"line_number":48,"context_line":"            if tag not in image.tags:"},{"line_number":49,"context_line":"                matches.remove(image)"},{"line_number":50,"context_line":"    if len(matches) \u003d\u003d 0:"},{"line_number":51,"context_line":"        raise exception.ImageNotFound(image\u003dimage_ident)"},{"line_number":52,"context_line":"    if tag \u003d\u003d \u0027latest\u0027:"}],"source_content_type":"text/x-python","patch_set":5,"id":"df7087c5_3bd74c52","line":49,"range":{"start_line":46,"start_character":0,"end_line":49,"end_character":37},"in_reply_to":"df7087c5_c7df6a0a","updated":"2018-03-21 08:23:58.000000000","message":"Done","commit_id":"35fee7201c19b285709ae0ec8f305a121eefa9fa"},{"author":{"_account_id":11536,"name":"hongbin","email":"hongbin034@gmail.com","username":"hongbin"},"change_message_id":"2e380dafaae37a61ee40b0d202fb92c2ef679b5e","unresolved":false,"context_lines":[{"line_number":72,"context_line":"            pass"},{"line_number":73,"context_line":"    else:"},{"line_number":74,"context_line":"        filters \u003d {\u0027container_format\u0027: \u0027docker\u0027}"},{"line_number":75,"context_line":"        images \u003d list(glance.images.list(filters\u003dfilters))"},{"line_number":76,"context_line":"        if exact_match:"},{"line_number":77,"context_line":"            images \u003d [i for i in images if i.name \u003d\u003d image_ident]"},{"line_number":78,"context_line":"        else:"}],"source_content_type":"text/x-python","patch_set":5,"id":"df7087c5_47e11afc","line":75,"range":{"start_line":75,"start_character":36,"end_line":75,"end_character":40},"updated":"2018-03-20 14:51:41.000000000","message":"Several observations:\n\n* It looks images.list supports parameters \u0027sort_key\u0027 and \u0027sort_dir\u0027 [1]. Perhaps, you can use these two parameters to sort the list of images by \u0027updated_at\u0027? Then, line 37 - 41 can be removed.\n* It looks images.list supports parameters \u0027tag\u0027. Perhaps, you can use this parameter to list the images with specific tag? If yes, line 46 - 49 can be removed.\n\n[1] https://developer.openstack.org/api-ref/image/v2/index.html#show-images","commit_id":"35fee7201c19b285709ae0ec8f305a121eefa9fa"},{"author":{"_account_id":21428,"name":"JiWei","email":"17366060309@163.com","username":"WeiJi"},"change_message_id":"f6bc525120cdeb3a4c6903bb87f32335de99a0cb","unresolved":false,"context_lines":[{"line_number":72,"context_line":"            pass"},{"line_number":73,"context_line":"    else:"},{"line_number":74,"context_line":"        filters \u003d {\u0027container_format\u0027: \u0027docker\u0027}"},{"line_number":75,"context_line":"        images \u003d list(glance.images.list(filters\u003dfilters))"},{"line_number":76,"context_line":"        if exact_match:"},{"line_number":77,"context_line":"            images \u003d [i for i in images if i.name \u003d\u003d image_ident]"},{"line_number":78,"context_line":"        else:"}],"source_content_type":"text/x-python","patch_set":5,"id":"df7087c5_fbe0f428","line":75,"range":{"start_line":75,"start_character":36,"end_line":75,"end_character":40},"in_reply_to":"df7087c5_47e11afc","updated":"2018-03-21 08:23:58.000000000","message":"Done","commit_id":"35fee7201c19b285709ae0ec8f305a121eefa9fa"},{"author":{"_account_id":11536,"name":"hongbin","email":"hongbin034@gmail.com","username":"hongbin"},"change_message_id":"2a4d80bb6ef7ba461dcdf35eed7a83b67abcd840","unresolved":false,"context_lines":[{"line_number":39,"context_line":"    LOG.debug(\u0027Found matches %s \u0027, matches)"},{"line_number":40,"context_line":"    if len(matches) \u003d\u003d 0:"},{"line_number":41,"context_line":"        raise exception.ImageNotFound(image\u003dimage_ident)"},{"line_number":42,"context_line":"    if len(matches) \u003e 1 and tag !\u003d \u0027latest\u0027:"},{"line_number":43,"context_line":"        msg \u003d (\"Multiple images exist with same name \""},{"line_number":44,"context_line":"               \"%(image_ident)s. Please use the image id \""},{"line_number":45,"context_line":"               \"instead.\") % {\u0027image_ident\u0027: image_ident}"}],"source_content_type":"text/x-python","patch_set":6,"id":"df7087c5_ffbd2568","line":42,"range":{"start_line":42,"start_character":28,"end_line":42,"end_character":43},"updated":"2018-03-22 02:46:13.000000000","message":"I have been thinking about this approach. My understanding is that you want to pick the newest image if there are multiple image with the same name. A down side of this approach is that you are not able to pick the image with the \u0027latest\u0027 tag (because you choose to pick by \u0027updated_at\u0027 instead of the tag itself).\n\nI am fine with either approach. Just want to point out the side effect of implementing this.","commit_id":"d5853dd9eefe23ff6c3ccb4b7bf46ec1c1a9a649"},{"author":{"_account_id":21428,"name":"JiWei","email":"17366060309@163.com","username":"WeiJi"},"change_message_id":"626772328804a20b22d173c0e968eb205752650b","unresolved":false,"context_lines":[{"line_number":39,"context_line":"    LOG.debug(\u0027Found matches %s \u0027, matches)"},{"line_number":40,"context_line":"    if len(matches) \u003d\u003d 0:"},{"line_number":41,"context_line":"        raise exception.ImageNotFound(image\u003dimage_ident)"},{"line_number":42,"context_line":"    if len(matches) \u003e 1 and tag !\u003d \u0027latest\u0027:"},{"line_number":43,"context_line":"        msg \u003d (\"Multiple images exist with same name \""},{"line_number":44,"context_line":"               \"%(image_ident)s. Please use the image id \""},{"line_number":45,"context_line":"               \"instead.\") % {\u0027image_ident\u0027: image_ident}"}],"source_content_type":"text/x-python","patch_set":6,"id":"df7087c5_596688c3","line":42,"range":{"start_line":42,"start_character":28,"end_line":42,"end_character":43},"in_reply_to":"df7087c5_ffbd2568","updated":"2018-03-23 07:40:40.000000000","message":"Yes, this is a risk, it has been modified : https://review.openstack.org/#/c/555650/","commit_id":"d5853dd9eefe23ff6c3ccb4b7bf46ec1c1a9a649"}]}
