)]}'
{"glance/api/v1/images.py":[{"author":{"_account_id":616,"name":"Mark Washenberger","email":"mark.washenberger@markwash.net","username":"markwash"},"change_message_id":"77fc7db5f41000592f1583191eca51e5c35de7bd","unresolved":false,"context_lines":[{"line_number":505,"context_line":"        return image_meta.get(\u0027size\u0027, 0) or get_size_from_backend(context,"},{"line_number":506,"context_line":"                                                                  location)"},{"line_number":507,"context_line":""},{"line_number":508,"context_line":"    def _handle_source(self, req, image_id, image_meta, image_data):"},{"line_number":509,"context_line":"        if image_data:"},{"line_number":510,"context_line":"            image_meta \u003d self._validate_image_for_activation(req,"},{"line_number":511,"context_line":"                                                             image_id,"}],"source_content_type":"text/x-python","patch_set":6,"id":"AAAAPn%2F%2Fvt4%3D","line":508,"updated":"2013-06-23 01:52:27.000000000","message":"How about:\n\n  copy_from \u003d self._copy_from(req)\n  if image_data:\n      if copy_from:\n          msg \u003d _(\"It is invalid to provide a copy_from header \"\n                       \"in a request with image data in the request body.\")\n          LOG.debug(msg)\n          raise HTTPBadRequest(explanation\u003dmsg,\n                                             request\u003dreq,\n                                             content_type\u003d\"text/plain\")\n      ...\n  elif copy_from:\n      ...","commit_id":"c0df5d42372d23c4d9745fb0bb0d292825943521"},{"author":{"_account_id":6484,"name":"Feilong Wang","email":"hustemb@gmail.com","username":"flwang"},"change_message_id":"93bb94a5679d723c2c86580981639c6bf1cddc77","unresolved":false,"context_lines":[{"line_number":505,"context_line":"        return image_meta.get(\u0027size\u0027, 0) or get_size_from_backend(context,"},{"line_number":506,"context_line":"                                                                  location)"},{"line_number":507,"context_line":""},{"line_number":508,"context_line":"    def _handle_source(self, req, image_id, image_meta, image_data):"},{"line_number":509,"context_line":"        if image_data:"},{"line_number":510,"context_line":"            image_meta \u003d self._validate_image_for_activation(req,"},{"line_number":511,"context_line":"                                                             image_id,"}],"source_content_type":"text/x-python","patch_set":6,"id":"AAAAPn%2F%2FvF0%3D","line":508,"in_reply_to":"AAAAPn%2F%2Fvt4%3D","updated":"2013-06-24 03:11:25.000000000","message":"Thank you for the suggestions, Mark. I think I was confused by this test case: https://github.com/openstack/glance/blob/master/glance/tests/unit/v1/test_api.py#L532. Since it\u0027s using both copy-from and body. So we also need to update the test case, agree?\n\nBesides, I found the create image HTTP request will be synchronous by specifying the body. So is there any other way to make the create image HTTP request as synchronous call without specifying HTTP body?\n\nBased on all the discussion, I think we may need to handle below 4 scenarios for this kind of issue by checking the headers and body explicitly. \n1. x-image-meta-location and x-glance-api-copy-from\n2. x-image-meta-location and body\n3. body and x-glance-api-copy-from\n4. x-image-meta-location and x-glance-api-copy-from and body\n\nPlease correct me if there is anything wrong. Thanks.","commit_id":"c0df5d42372d23c4d9745fb0bb0d292825943521"}],"glance/tests/unit/v1/test_api.py":[{"author":{"_account_id":616,"name":"Mark Washenberger","email":"mark.washenberger@markwash.net","username":"markwash"},"change_message_id":"3a27e54948319262fc050172f98e9db1067e56a9","unresolved":false,"context_lines":[{"line_number":304,"context_line":"        for k, v in fixture_headers.iteritems():"},{"line_number":305,"context_line":"            req.headers[k] \u003d v"},{"line_number":306,"context_line":"        res \u003d req.get_response(self.api)"},{"line_number":307,"context_line":"        self.assertEquals(res.status_int, 500)"},{"line_number":308,"context_line":""},{"line_number":309,"context_line":"    def test_add_image_size_header_too_big(self):"},{"line_number":310,"context_line":"        \"\"\"Tests raises BadRequest for supplied image size that is too big\"\"\""}],"source_content_type":"text/x-python","patch_set":4,"id":"AAAAPX%2F%2Fz%2BA%3D","line":307,"updated":"2013-06-09 18:43:41.000000000","message":"This should definitely not be a 500 error. If the user uploads both data and a copy-from header, we should be returning a 400 error because it is invalid to specify both sources of data.","commit_id":"f2e3c7a0bef220e9a7f6380460150613d37cc7fc"},{"author":{"_account_id":6484,"name":"Feilong Wang","email":"hustemb@gmail.com","username":"flwang"},"change_message_id":"f843de7f8bd68ae7421900475ecef741e93ec96d","unresolved":false,"context_lines":[{"line_number":304,"context_line":"        for k, v in fixture_headers.iteritems():"},{"line_number":305,"context_line":"            req.headers[k] \u003d v"},{"line_number":306,"context_line":"        res \u003d req.get_response(self.api)"},{"line_number":307,"context_line":"        self.assertEquals(res.status_int, 500)"},{"line_number":308,"context_line":""},{"line_number":309,"context_line":"    def test_add_image_size_header_too_big(self):"},{"line_number":310,"context_line":"        \"\"\"Tests raises BadRequest for supplied image size that is too big\"\"\""}],"source_content_type":"text/x-python","patch_set":4,"id":"AAAAPn%2F%2F%2BFY%3D","line":307,"in_reply_to":"AAAAPX%2F%2Fz%2BA%3D","updated":"2013-06-17 03:07:25.000000000","message":"Mark, thanks for the comments. Did you mean we should return 400 (HttpBadRequest) no matter if the copy-from is available?","commit_id":"f2e3c7a0bef220e9a7f6380460150613d37cc7fc"},{"author":{"_account_id":616,"name":"Mark Washenberger","email":"mark.washenberger@markwash.net","username":"markwash"},"change_message_id":"ef5ee2b534cb4715d5500910dfa4ceef6144952d","unresolved":false,"context_lines":[{"line_number":304,"context_line":"        for k, v in fixture_headers.iteritems():"},{"line_number":305,"context_line":"            req.headers[k] \u003d v"},{"line_number":306,"context_line":"        res \u003d req.get_response(self.api)"},{"line_number":307,"context_line":"        self.assertEquals(res.status_int, 500)"},{"line_number":308,"context_line":""},{"line_number":309,"context_line":"    def test_add_image_size_header_too_big(self):"},{"line_number":310,"context_line":"        \"\"\"Tests raises BadRequest for supplied image size that is too big\"\"\""}],"source_content_type":"text/x-python","patch_set":4,"id":"AAAAPn%2F%2F8b0%3D","line":307,"in_reply_to":"AAAAPn%2F%2F%2BFY%3D","updated":"2013-06-17 18:07:35.000000000","message":"I\u0027m saying return a 400 if both copy-from *and* request.body data are available.","commit_id":"f2e3c7a0bef220e9a7f6380460150613d37cc7fc"},{"author":{"_account_id":4463,"name":"iccha-sethi","email":"iccha.sethi@rackspace.com","username":"iccha-sethi"},"change_message_id":"eb2e41424ada0d505eab304870de1695037cd549","unresolved":false,"context_lines":[{"line_number":547,"context_line":"        res \u003d req.get_response(self.api)"},{"line_number":548,"context_line":"        self.assertEquals(res.status_int, 201)"},{"line_number":549,"context_line":""},{"line_number":550,"context_line":"    def test_add_copy_from_bad_location_with_nonempty_body(self):"},{"line_number":551,"context_line":"        \"\"\"Tests creates an image from a bad location of copy-from\"\"\""},{"line_number":552,"context_line":"        fixture_headers \u003d {\u0027x-image-meta-store\u0027: \u0027file\u0027,"},{"line_number":553,"context_line":"                           \u0027x-image-meta-disk-format\u0027: \u0027vhd\u0027,"}],"source_content_type":"text/x-python","patch_set":7,"id":"AAAAPn%2F%2FoWM%3D","line":550,"updated":"2013-06-26 12:30:33.000000000","message":"Hey Fei, could we not combine the bad copy from location with the body. could we independently test: good copy from loc+body, loc+body, copy_from_loc+loc in separate tests since they are unit tests?","commit_id":"bdde7d8e46cadf54f6ae5569f076611c4ac9db66"},{"author":{"_account_id":6484,"name":"Feilong Wang","email":"hustemb@gmail.com","username":"flwang"},"change_message_id":"a4e132e1cad7f947b877dc99d34e829c63ec0a91","unresolved":false,"context_lines":[{"line_number":547,"context_line":"        res \u003d req.get_response(self.api)"},{"line_number":548,"context_line":"        self.assertEquals(res.status_int, 201)"},{"line_number":549,"context_line":""},{"line_number":550,"context_line":"    def test_add_copy_from_bad_location_with_nonempty_body(self):"},{"line_number":551,"context_line":"        \"\"\"Tests creates an image from a bad location of copy-from\"\"\""},{"line_number":552,"context_line":"        fixture_headers \u003d {\u0027x-image-meta-store\u0027: \u0027file\u0027,"},{"line_number":553,"context_line":"                           \u0027x-image-meta-disk-format\u0027: \u0027vhd\u0027,"}],"source_content_type":"text/x-python","patch_set":7,"id":"AAAAPn%2F%2Fnn0%3D","line":550,"in_reply_to":"AAAAPn%2F%2FoWM%3D","updated":"2013-06-26 16:16:30.000000000","message":"Done","commit_id":"bdde7d8e46cadf54f6ae5569f076611c4ac9db66"}]}
