)]}'
{"glance/api/middleware/cache.py":[{"author":{"_account_id":2537,"name":"Nikhil Komawar","email":"nik.komawar@gmail.com","username":"nikhil-komawar"},"change_message_id":"07b26717a036533bab26410db024edc93d33738a","unresolved":false,"context_lines":[{"line_number":153,"context_line":"        # Bug: 1664709"},{"line_number":154,"context_line":"        # TODO(dharinic): If an image is already cached, add support to serve"},{"line_number":155,"context_line":"        # only the requested bytes (partial image download) from the cache."},{"line_number":156,"context_line":"        if request.headers.get(\u0027Content-Range\u0027):"},{"line_number":157,"context_line":"            return None"},{"line_number":158,"context_line":""},{"line_number":159,"context_line":"        if request.method !\u003d \u0027GET\u0027 or not self.cache.is_cached(image_id):"}],"source_content_type":"text/x-python","patch_set":3,"id":"da36d5c6_c6e7ca44","line":156,"range":{"start_line":156,"start_character":8,"end_line":156,"end_character":10},"updated":"2017-02-27 21:58:08.000000000","message":"this should be after the policy check (on line 170) and before the log line for cache hit (line 173).","commit_id":"886a78f0702a73e55d25b226ff48b549fbd84398"},{"author":{"_account_id":21722,"name":"Dharini Chandrasekar","email":"dharini.chandrasekar@intel.com","username":"dharinic"},"change_message_id":"ea9f4e49aeeaa8e5d55e2ea2671319e12b14d045","unresolved":false,"context_lines":[{"line_number":153,"context_line":"        # Bug: 1664709"},{"line_number":154,"context_line":"        # TODO(dharinic): If an image is already cached, add support to serve"},{"line_number":155,"context_line":"        # only the requested bytes (partial image download) from the cache."},{"line_number":156,"context_line":"        if request.headers.get(\u0027Content-Range\u0027):"},{"line_number":157,"context_line":"            return None"},{"line_number":158,"context_line":""},{"line_number":159,"context_line":"        if request.method !\u003d \u0027GET\u0027 or not self.cache.is_cached(image_id):"}],"source_content_type":"text/x-python","patch_set":3,"id":"ba2be162_54e4690c","line":156,"range":{"start_line":156,"start_character":8,"end_line":156,"end_character":10},"in_reply_to":"da36d5c6_6669be25","updated":"2017-02-28 19:54:17.000000000","message":"I prefer keeping this conditional check here for now as I feel there is no need to do a policy check as we wont serve from cache anyway.\nWhen we implement the TODO, will move this to after L171.\nPlease let me know if I am missing something.","commit_id":"886a78f0702a73e55d25b226ff48b549fbd84398"},{"author":{"_account_id":21722,"name":"Dharini Chandrasekar","email":"dharini.chandrasekar@intel.com","username":"dharinic"},"change_message_id":"8086713c718c1ce3c7a4d5c22734b663482a0972","unresolved":false,"context_lines":[{"line_number":153,"context_line":"        # Bug: 1664709"},{"line_number":154,"context_line":"        # TODO(dharinic): If an image is already cached, add support to serve"},{"line_number":155,"context_line":"        # only the requested bytes (partial image download) from the cache."},{"line_number":156,"context_line":"        if request.headers.get(\u0027Content-Range\u0027):"},{"line_number":157,"context_line":"            return None"},{"line_number":158,"context_line":""},{"line_number":159,"context_line":"        if request.method !\u003d \u0027GET\u0027 or not self.cache.is_cached(image_id):"}],"source_content_type":"text/x-python","patch_set":3,"id":"da36d5c6_6669be25","line":156,"range":{"start_line":156,"start_character":8,"end_line":156,"end_character":10},"in_reply_to":"da36d5c6_c6e7ca44","updated":"2017-02-27 22:10:14.000000000","message":"Nikhil, currently with the scope of this PS, if we do not want to serve the partial image from cache, why should we wait till the policy check? Why not return faster?","commit_id":"886a78f0702a73e55d25b226ff48b549fbd84398"},{"author":{"_account_id":2537,"name":"Nikhil Komawar","email":"nik.komawar@gmail.com","username":"nikhil-komawar"},"change_message_id":"07b26717a036533bab26410db024edc93d33738a","unresolved":false,"context_lines":[{"line_number":263,"context_line":"            return resp"},{"line_number":264,"context_line":""},{"line_number":265,"context_line":"        # Note(dharinic): Bug: 1664709: Do not cache partial images."},{"line_number":266,"context_line":"        if status_code \u003d\u003d 206:"},{"line_number":267,"context_line":"            return resp"},{"line_number":268,"context_line":""},{"line_number":269,"context_line":"        try:"}],"source_content_type":"text/x-python","patch_set":3,"id":"da36d5c6_0625625b","line":266,"range":{"start_line":266,"start_character":8,"end_line":266,"end_character":29},"updated":"2017-02-27 21:58:08.000000000","message":"for consistency and to respect the prior cleanup, I think this should be http.PARTIAL_CONTENT (see \"below\" https://docs.python.org/2/library/httplib.html#httplib.HTTPS_PORT )\n\nI think this should just work for py35 but couldn\u0027t find doc to indicate that it would. six \u0026 tests will ideally take care of things.","commit_id":"886a78f0702a73e55d25b226ff48b549fbd84398"},{"author":{"_account_id":21722,"name":"Dharini Chandrasekar","email":"dharini.chandrasekar@intel.com","username":"dharinic"},"change_message_id":"8086713c718c1ce3c7a4d5c22734b663482a0972","unresolved":false,"context_lines":[{"line_number":263,"context_line":"            return resp"},{"line_number":264,"context_line":""},{"line_number":265,"context_line":"        # Note(dharinic): Bug: 1664709: Do not cache partial images."},{"line_number":266,"context_line":"        if status_code \u003d\u003d 206:"},{"line_number":267,"context_line":"            return resp"},{"line_number":268,"context_line":""},{"line_number":269,"context_line":"        try:"}],"source_content_type":"text/x-python","patch_set":3,"id":"da36d5c6_6621beb4","line":266,"range":{"start_line":266,"start_character":8,"end_line":266,"end_character":29},"in_reply_to":"da36d5c6_0625625b","updated":"2017-02-27 22:10:14.000000000","message":"Sure.","commit_id":"886a78f0702a73e55d25b226ff48b549fbd84398"}],"glance/tests/functional/test_cache_middleware.py":[{"author":{"_account_id":21722,"name":"Dharini Chandrasekar","email":"dharini.chandrasekar@intel.com","username":"dharinic"},"change_message_id":"c85a324fa6ff6c9c6d71a2a5754229c288e16e2b","unresolved":false,"context_lines":[{"line_number":242,"context_line":"    @skip_if_disabled"},{"line_number":243,"context_line":"    def test_partial_download_of_cached_images_v2_api(self):"},{"line_number":244,"context_line":"        \"\"\""},{"line_number":245,"context_line":"        Verify that partial download requests for cached images proeeds to"},{"line_number":246,"context_line":"        root app and is not served from cache"},{"line_number":247,"context_line":"        \"\"\""},{"line_number":248,"context_line":"        self.cleanup()"}],"source_content_type":"text/x-python","patch_set":3,"id":"da36d5c6_80f4da87","line":245,"range":{"start_line":245,"start_character":64,"end_line":245,"end_character":71},"updated":"2017-02-27 21:03:09.000000000","message":"s/proeeds/proceeds\nwill correct this in upcoming PS if any.","commit_id":"886a78f0702a73e55d25b226ff48b549fbd84398"},{"author":{"_account_id":5314,"name":"Brian Rosmaita","email":"rosmaita.fossdev@gmail.com","username":"brian-rosmaita"},"change_message_id":"c157af012eb5d8f64edbc5bcb75f8ceb68acd5f4","unresolved":false,"context_lines":[{"line_number":227,"context_line":"            \u0027X-User-Id\u0027: \u0027f9a41d13-0c13-47e9-bee2-ce4e8bfe958e\u0027,"},{"line_number":228,"context_line":"            \u0027X-Tenant-Id\u0027: str(uuid.uuid4()),"},{"line_number":229,"context_line":"            \u0027X-Roles\u0027: \u0027member\u0027,"},{"line_number":230,"context_line":"            \u0027Content-Range\u0027: content_range"},{"line_number":231,"context_line":"        }"},{"line_number":232,"context_line":"        response, content \u003d http.request(path, \u0027GET\u0027, headers\u003dheaders)"},{"line_number":233,"context_line":"        self.assertEqual(http_client.PARTIAL_CONTENT, response.status)"}],"source_content_type":"text/x-python","patch_set":4,"id":"ffe62b97_62013daf","line":230,"range":{"start_line":230,"start_character":13,"end_line":230,"end_character":26},"updated":"2017-03-29 14:24:59.000000000","message":"Shouldn\u0027t this be \u0027Range\u0027 on a request?\n\n(I think I just answered my own question, your patch fixing this hasn\u0027t been merged yet.)","commit_id":"febe08db4b8af5c42d545f378773e2a4c7aa2604"},{"author":{"_account_id":5314,"name":"Brian Rosmaita","email":"rosmaita.fossdev@gmail.com","username":"brian-rosmaita"},"change_message_id":"c157af012eb5d8f64edbc5bcb75f8ceb68acd5f4","unresolved":false,"context_lines":[{"line_number":299,"context_line":"            \u0027X-User-Id\u0027: \u0027f9a41d13-0c13-47e9-bee2-ce4e8bfe958e\u0027,"},{"line_number":300,"context_line":"            \u0027X-Tenant-Id\u0027: str(uuid.uuid4()),"},{"line_number":301,"context_line":"            \u0027X-Roles\u0027: \u0027member\u0027,"},{"line_number":302,"context_line":"            \u0027Content-Range\u0027: content_range,"},{"line_number":303,"context_line":"            \u0027content-type\u0027: \u0027application/json\u0027"},{"line_number":304,"context_line":"        }"},{"line_number":305,"context_line":"        response, content \u003d http.request(path, \u0027GET\u0027, headers\u003dheaders)"}],"source_content_type":"text/x-python","patch_set":4,"id":"ffe62b97_626c9d9b","line":302,"range":{"start_line":302,"start_character":13,"end_line":302,"end_character":26},"updated":"2017-03-29 14:24:59.000000000","message":"Isn\u0027t this supposed to be \u0027Range\u0027 on a request?  (After your other patch is merged, anyway)","commit_id":"febe08db4b8af5c42d545f378773e2a4c7aa2604"},{"author":{"_account_id":5314,"name":"Brian Rosmaita","email":"rosmaita.fossdev@gmail.com","username":"brian-rosmaita"},"change_message_id":"c157af012eb5d8f64edbc5bcb75f8ceb68acd5f4","unresolved":false,"context_lines":[{"line_number":303,"context_line":"            \u0027content-type\u0027: \u0027application/json\u0027"},{"line_number":304,"context_line":"        }"},{"line_number":305,"context_line":"        response, content \u003d http.request(path, \u0027GET\u0027, headers\u003dheaders)"},{"line_number":306,"context_line":"        self.assertEqual(http_client.PARTIAL_CONTENT, response.status)"},{"line_number":307,"context_line":""},{"line_number":308,"context_line":"        self.stop_servers()"},{"line_number":309,"context_line":""}],"source_content_type":"text/x-python","patch_set":4,"id":"ffe62b97_3fed92b6","line":306,"updated":"2017-03-29 14:24:59.000000000","message":"This test has a funny smell, but I can\u0027t clearly articulate the problem.  Basically, you have introduced code into the cache middleware so that when the response coming back from the backend is 206, it will just return the response.  This test is taking the fact that we\u0027re getting a 206 as proof that the partial request was not served from the cache.  So I don\u0027t think this test really tests that the cache is bypassed.  I think what it\u0027s testing is that partial download works when the cache is enabled, which is fine, we need to test that.  So the name of this test is fine, my quibble is with the docstring.\n\nSince it\u0027s testing partial download when the cache is enabled, I think you need to make sure that we received the correct content in the response.","commit_id":"febe08db4b8af5c42d545f378773e2a4c7aa2604"},{"author":{"_account_id":21722,"name":"Dharini Chandrasekar","email":"dharini.chandrasekar@intel.com","username":"dharinic"},"change_message_id":"6dd9c5ffe984d89a486964d7818867ac08043ea6","unresolved":false,"context_lines":[{"line_number":303,"context_line":"            \u0027content-type\u0027: \u0027application/json\u0027"},{"line_number":304,"context_line":"        }"},{"line_number":305,"context_line":"        response, content \u003d http.request(path, \u0027GET\u0027, headers\u003dheaders)"},{"line_number":306,"context_line":"        self.assertEqual(http_client.PARTIAL_CONTENT, response.status)"},{"line_number":307,"context_line":""},{"line_number":308,"context_line":"        self.stop_servers()"},{"line_number":309,"context_line":""}],"source_content_type":"text/x-python","patch_set":4,"id":"ffe62b97_a82eed88","line":306,"in_reply_to":"ffe62b97_3fed92b6","updated":"2017-03-30 00:05:36.000000000","message":"Brian, I agree. I am not sure we have a definite way of checking that the cache was not touched and that the image was served from root app.\nOne way I was testing it was to cache the full image (L288, 289) and attempt its download. Clearly, if a partial download succeeds, it is served from store.\nI will add the content verification as you suggest.","commit_id":"febe08db4b8af5c42d545f378773e2a4c7aa2604"},{"author":{"_account_id":8158,"name":"Hemanth Makkapati","email":"makstacker+osgerrit@gmail.com","username":"hemanth.makkapati"},"change_message_id":"f8654d476969caef15d802cc7a57516e06810725","unresolved":false,"context_lines":[{"line_number":285,"context_line":"        path \u003d \"http://%s:%d/v2/images/%s/file\" % (\"0.0.0.0\", self.api_port,"},{"line_number":286,"context_line":"                                                   image_id)"},{"line_number":287,"context_line":"        headers \u003d {\u0027content-type\u0027: \u0027application/octet-stream\u0027}"},{"line_number":288,"context_line":"        image_data \u003d \"*\" * FIVE_KB"},{"line_number":289,"context_line":"        response, content \u003d http.request(path, \u0027PUT\u0027,"},{"line_number":290,"context_line":"                                         headers\u003dheaders,"},{"line_number":291,"context_line":"                                         body\u003dimage_data)"}],"source_content_type":"text/x-python","patch_set":7,"id":"dfeb2761_3bd63b51","line":288,"range":{"start_line":288,"start_character":7,"end_line":288,"end_character":34},"updated":"2017-04-03 16:45:23.000000000","message":"As in the other patch, this isn\u0027t a good test data. I suggest using A-Z like we did on the other patch.","commit_id":"7908e0d227429a80cd21cc116460b3600619b180"},{"author":{"_account_id":21722,"name":"Dharini Chandrasekar","email":"dharini.chandrasekar@intel.com","username":"dharinic"},"change_message_id":"2d9c4b218a52f7d0fe8bb9e40d123bb2ad5ec9f5","unresolved":false,"context_lines":[{"line_number":285,"context_line":"        path \u003d \"http://%s:%d/v2/images/%s/file\" % (\"0.0.0.0\", self.api_port,"},{"line_number":286,"context_line":"                                                   image_id)"},{"line_number":287,"context_line":"        headers \u003d {\u0027content-type\u0027: \u0027application/octet-stream\u0027}"},{"line_number":288,"context_line":"        image_data \u003d \"*\" * FIVE_KB"},{"line_number":289,"context_line":"        response, content \u003d http.request(path, \u0027PUT\u0027,"},{"line_number":290,"context_line":"                                         headers\u003dheaders,"},{"line_number":291,"context_line":"                                         body\u003dimage_data)"}],"source_content_type":"text/x-python","patch_set":7,"id":"dfeb2761_6aeaa70f","line":288,"range":{"start_line":288,"start_character":7,"end_line":288,"end_character":34},"in_reply_to":"dfeb2761_3bd63b51","updated":"2017-04-03 19:15:36.000000000","message":"Done","commit_id":"7908e0d227429a80cd21cc116460b3600619b180"},{"author":{"_account_id":12807,"name":"Steve Lewis (stevelle)","email":"stevelle@gmail.com","username":"stevelle"},"change_message_id":"3f4886d034612a1769bda96b9ab88fb67ce53333","unresolved":false,"context_lines":[{"line_number":305,"context_line":"        image_cached_path \u003d os.path.join(self.api_server.image_cache_dir,"},{"line_number":306,"context_line":"                                         image_id)"},{"line_number":307,"context_line":"        self.assertTrue(os.path.exists(image_cached_path))"},{"line_number":308,"context_line":""},{"line_number":309,"context_line":"        # Partially attempt a download of this image"},{"line_number":310,"context_line":"        expected_content \u003d 3 * b\u0027*\u0027"},{"line_number":311,"context_line":"        # range download request"}],"source_content_type":"text/x-python","patch_set":7,"id":"dfeb2761_550f91e0","line":308,"updated":"2017-04-03 15:36:47.000000000","message":"modifying the cached data file to contain different content here would be a stronger test.","commit_id":"7908e0d227429a80cd21cc116460b3600619b180"},{"author":{"_account_id":21722,"name":"Dharini Chandrasekar","email":"dharini.chandrasekar@intel.com","username":"dharinic"},"change_message_id":"2d9c4b218a52f7d0fe8bb9e40d123bb2ad5ec9f5","unresolved":false,"context_lines":[{"line_number":305,"context_line":"        image_cached_path \u003d os.path.join(self.api_server.image_cache_dir,"},{"line_number":306,"context_line":"                                         image_id)"},{"line_number":307,"context_line":"        self.assertTrue(os.path.exists(image_cached_path))"},{"line_number":308,"context_line":""},{"line_number":309,"context_line":"        # Partially attempt a download of this image"},{"line_number":310,"context_line":"        expected_content \u003d 3 * b\u0027*\u0027"},{"line_number":311,"context_line":"        # range download request"}],"source_content_type":"text/x-python","patch_set":7,"id":"dfeb2761_8a8deb7c","line":308,"in_reply_to":"dfeb2761_550f91e0","updated":"2017-04-03 19:15:36.000000000","message":"Done","commit_id":"7908e0d227429a80cd21cc116460b3600619b180"},{"author":{"_account_id":8158,"name":"Hemanth Makkapati","email":"makstacker+osgerrit@gmail.com","username":"hemanth.makkapati"},"change_message_id":"f8654d476969caef15d802cc7a57516e06810725","unresolved":false,"context_lines":[{"line_number":307,"context_line":"        self.assertTrue(os.path.exists(image_cached_path))"},{"line_number":308,"context_line":""},{"line_number":309,"context_line":"        # Partially attempt a download of this image"},{"line_number":310,"context_line":"        expected_content \u003d 3 * b\u0027*\u0027"},{"line_number":311,"context_line":"        # range download request"},{"line_number":312,"context_line":"        range_ \u003d \u0027bytes\u003d3-5\u0027"},{"line_number":313,"context_line":"        headers \u003d {"}],"source_content_type":"text/x-python","patch_set":7,"id":"dfeb2761_5b38df9e","line":310,"range":{"start_line":310,"start_character":8,"end_line":310,"end_character":35},"updated":"2017-04-03 16:45:23.000000000","message":"We should change this if we change the test data above.","commit_id":"7908e0d227429a80cd21cc116460b3600619b180"},{"author":{"_account_id":21722,"name":"Dharini Chandrasekar","email":"dharini.chandrasekar@intel.com","username":"dharinic"},"change_message_id":"2d9c4b218a52f7d0fe8bb9e40d123bb2ad5ec9f5","unresolved":false,"context_lines":[{"line_number":307,"context_line":"        self.assertTrue(os.path.exists(image_cached_path))"},{"line_number":308,"context_line":""},{"line_number":309,"context_line":"        # Partially attempt a download of this image"},{"line_number":310,"context_line":"        expected_content \u003d 3 * b\u0027*\u0027"},{"line_number":311,"context_line":"        # range download request"},{"line_number":312,"context_line":"        range_ \u003d \u0027bytes\u003d3-5\u0027"},{"line_number":313,"context_line":"        headers \u003d {"}],"source_content_type":"text/x-python","patch_set":7,"id":"dfeb2761_aa92ef9c","line":310,"range":{"start_line":310,"start_character":8,"end_line":310,"end_character":35},"in_reply_to":"dfeb2761_5b38df9e","updated":"2017-04-03 19:15:36.000000000","message":"Done","commit_id":"7908e0d227429a80cd21cc116460b3600619b180"}]}
