)]}'
{"tempest/api/compute/base.py":[{"author":{"_account_id":20190,"name":"zhufl","email":"zhu.fanglei@zte.com.cn","username":"zhufl"},"change_message_id":"c36146642c07db8f41a6472024d71df447d22d88","unresolved":false,"context_lines":[{"line_number":428,"context_line":"        Ignores 404 responses if the volume or server do not exist, or the"},{"line_number":429,"context_line":"        volume is already detached from the server."},{"line_number":430,"context_line":"        \"\"\""},{"line_number":431,"context_line":"        try:"},{"line_number":432,"context_line":"            volume \u003d self.volumes_client.show_volume(volume[\u0027id\u0027])[\u0027volume\u0027]"},{"line_number":433,"context_line":"        except exceptions.NotFound:"},{"line_number":434,"context_line":"            # If the volume was deleted we can just ignore."},{"line_number":435,"context_line":"            return"},{"line_number":436,"context_line":""},{"line_number":437,"context_line":"        # Check the status. You can only detach an in-use volume, otherwise"},{"line_number":438,"context_line":"        # the compute API will return a 400 response."},{"line_number":439,"context_line":"        if volume[\u0027status\u0027] \u003d\u003d \u0027in-use\u0027:"},{"line_number":440,"context_line":"            # Ignore 404s on detach in case the server is deleted or the volume"},{"line_number":441,"context_line":"            # is already detached."},{"line_number":442,"context_line":"            try:"},{"line_number":443,"context_line":"                self.servers_client.detach_volume(server[\u0027id\u0027], volume[\u0027id\u0027])"},{"line_number":444,"context_line":"            except exceptions.NotFound:"},{"line_number":445,"context_line":"                pass"},{"line_number":446,"context_line":""},{"line_number":447,"context_line":"    def attach_volume(self, server, volume, device\u003dNone, check_reserved\u003dFalse):"},{"line_number":448,"context_line":"        \"\"\"Attaches volume to server and waits for \u0027in-use\u0027 volume status."}],"source_content_type":"text/x-python","patch_set":1,"id":"5f4e5783_3777b73d","line":445,"range":{"start_line":431,"start_character":0,"end_line":445,"end_character":20},"updated":"2017-10-11 06:09:14.000000000","message":"the code logic can be merged? i.e.,\n        try:\n            volume \u003d self.volumes_client.show_volume(volume[\u0027id\u0027])[\u0027volume\u0027]\n            if volume[\u0027status\u0027] \u003d\u003d \u0027in-use\u0027:\n                self.servers_client.detach_volume(server[\u0027id\u0027], volume[\u0027id\u0027])\n        except exceptions.NotFound:\n            # some comments here\n            pass","commit_id":"311b140378a773c575755acb597381ed19622fc5"},{"author":{"_account_id":8556,"name":"Ghanshyam Maan","display_name":"Ghanshyam Maan","email":"gmaan.os14@gmail.com","username":"ghanshyam"},"change_message_id":"96f558648683565d7b6b7727e3e28e463594f58a","unresolved":false,"context_lines":[{"line_number":428,"context_line":"        Ignores 404 responses if the volume or server do not exist, or the"},{"line_number":429,"context_line":"        volume is already detached from the server."},{"line_number":430,"context_line":"        \"\"\""},{"line_number":431,"context_line":"        try:"},{"line_number":432,"context_line":"            volume \u003d self.volumes_client.show_volume(volume[\u0027id\u0027])[\u0027volume\u0027]"},{"line_number":433,"context_line":"        except exceptions.NotFound:"},{"line_number":434,"context_line":"            # If the volume was deleted we can just ignore."},{"line_number":435,"context_line":"            return"},{"line_number":436,"context_line":""},{"line_number":437,"context_line":"        # Check the status. You can only detach an in-use volume, otherwise"},{"line_number":438,"context_line":"        # the compute API will return a 400 response."},{"line_number":439,"context_line":"        if volume[\u0027status\u0027] \u003d\u003d \u0027in-use\u0027:"},{"line_number":440,"context_line":"            # Ignore 404s on detach in case the server is deleted or the volume"},{"line_number":441,"context_line":"            # is already detached."},{"line_number":442,"context_line":"            try:"},{"line_number":443,"context_line":"                self.servers_client.detach_volume(server[\u0027id\u0027], volume[\u0027id\u0027])"},{"line_number":444,"context_line":"            except exceptions.NotFound:"},{"line_number":445,"context_line":"                pass"},{"line_number":446,"context_line":""},{"line_number":447,"context_line":"    def attach_volume(self, server, volume, device\u003dNone, check_reserved\u003dFalse):"},{"line_number":448,"context_line":"        \"\"\"Attaches volume to server and waits for \u0027in-use\u0027 volume status."}],"source_content_type":"text/x-python","patch_set":1,"id":"5f4e5783_a7ffcbff","line":445,"range":{"start_line":431,"start_character":0,"end_line":445,"end_character":20},"in_reply_to":"5f4e5783_3777b73d","updated":"2017-10-12 09:41:06.000000000","message":"yea, done","commit_id":"311b140378a773c575755acb597381ed19622fc5"},{"author":{"_account_id":5803,"name":"Attila Fazekas","email":"afazekas@redhat.com","username":"afazekas"},"change_message_id":"4e5957b493732ee4d77cc30c689a158b81bb57fd","unresolved":false,"context_lines":[{"line_number":432,"context_line":"            volume \u003d self.volumes_client.show_volume(volume[\u0027id\u0027])[\u0027volume\u0027]"},{"line_number":433,"context_line":"            # Check the status. You can only detach an in-use volume, otherwise"},{"line_number":434,"context_line":"            # the compute API will return a 400 response."},{"line_number":435,"context_line":"            if volume[\u0027status\u0027] \u003d\u003d \u0027in-use\u0027:"},{"line_number":436,"context_line":"                self.servers_client.detach_volume(server[\u0027id\u0027], volume[\u0027id\u0027])"},{"line_number":437,"context_line":"        except exceptions.NotFound:"},{"line_number":438,"context_line":"            # Ignore 404s on detach in case the server is deleted or the volume"}],"source_content_type":"text/x-python","patch_set":2,"id":"5f4e5783_cefd3c3b","line":435,"updated":"2017-10-12 13:23:26.000000000","message":"If I remember correctly and we have an `attaching` state,\nwhen the volume in `attaching` state (or something similarly named), we should wait for `in-use` with a reasonable timeout.","commit_id":"0d4551b367c9d3f37117a5426a9ca500d791ac25"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"c6d5b2f528756c4bc4346c6295562503273b66ab","unresolved":false,"context_lines":[{"line_number":432,"context_line":"            volume \u003d self.volumes_client.show_volume(volume[\u0027id\u0027])[\u0027volume\u0027]"},{"line_number":433,"context_line":"            # Check the status. You can only detach an in-use volume, otherwise"},{"line_number":434,"context_line":"            # the compute API will return a 400 response."},{"line_number":435,"context_line":"            if volume[\u0027status\u0027] \u003d\u003d \u0027in-use\u0027:"},{"line_number":436,"context_line":"                self.servers_client.detach_volume(server[\u0027id\u0027], volume[\u0027id\u0027])"},{"line_number":437,"context_line":"        except exceptions.NotFound:"},{"line_number":438,"context_line":"            # Ignore 404s on detach in case the server is deleted or the volume"}],"source_content_type":"text/x-python","patch_set":2,"id":"5f4e5783_a178a9c3","line":435,"in_reply_to":"5f4e5783_45bb580d","updated":"2017-10-13 18:17:42.000000000","message":"I think the only way to get the \u0027attaching\u0027 status is you have to get the volume and then check the attachments on the volume, but with cinder \u003c v3.27 you don\u0027t get the detailed attach status in the response to even tell.\n\nhttps://github.com/openstack/cinder/blob/master/cinder/api/v2/views/volumes.py#L115\n\nSo you can only see \u0027attached\u0027 attachments on the volume, not any that are \u0027attaching\u0027 while the volume is \u0027reserved\u0027 as gmann pointed out.","commit_id":"0d4551b367c9d3f37117a5426a9ca500d791ac25"},{"author":{"_account_id":8556,"name":"Ghanshyam Maan","display_name":"Ghanshyam Maan","email":"gmaan.os14@gmail.com","username":"ghanshyam"},"change_message_id":"4d461b1336954d6589d8b68a7a1131f6d921f724","unresolved":false,"context_lines":[{"line_number":432,"context_line":"            volume \u003d self.volumes_client.show_volume(volume[\u0027id\u0027])[\u0027volume\u0027]"},{"line_number":433,"context_line":"            # Check the status. You can only detach an in-use volume, otherwise"},{"line_number":434,"context_line":"            # the compute API will return a 400 response."},{"line_number":435,"context_line":"            if volume[\u0027status\u0027] \u003d\u003d \u0027in-use\u0027:"},{"line_number":436,"context_line":"                self.servers_client.detach_volume(server[\u0027id\u0027], volume[\u0027id\u0027])"},{"line_number":437,"context_line":"        except exceptions.NotFound:"},{"line_number":438,"context_line":"            # Ignore 404s on detach in case the server is deleted or the volume"}],"source_content_type":"text/x-python","patch_set":2,"id":"5f4e5783_45bb580d","line":435,"in_reply_to":"5f4e5783_cefd3c3b","updated":"2017-10-13 03:23:26.000000000","message":"yea there is \u0027attaching\u0027 state in volume but that is not going to visible when attaching volume via nova API.\n \nCinder update the volume state to \u0027attaching\u0027 when volume is reserved. Volume reserve is pre step of volume attach.\n\n- https://github.com/openstack/cinder/blob/31938d6dc63793fe104ffbc16a3cf08804b50037/cinder/volume/api.py#L672\n\nNova Attach volume API workflow is - \n\n- First nova reserve the volume in cinder [1]\n- attach the volume [2]\n\nSo when attaching volume via nova API, \u0027attaching\u0027 state is never going to visible to user as reserve and attach is happening in same call. it is \u0027available\u0027 -\u003e \u0027in-use\u0027\n \n..1 https://github.com/openstack/nova/blob/d054abd8fa861a78780b83f1b7787d417b3979ea/nova/compute/api.py#L3544\n..2 https://github.com/openstack/nova/blob/d054abd8fa861a78780b83f1b7787d417b3979ea/nova/compute/api.py#L3545","commit_id":"0d4551b367c9d3f37117a5426a9ca500d791ac25"}]}
