Reviewed: https://review.openstack.org/624959 Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=41b982c9feec3105247bc72d23d1470bcabc3a0f Submitter: Zuul Branch: master
commit 41b982c9feec3105247bc72d23d1470bcabc3a0f Author: Kevin_Zheng <zhengzhe...@huawei.com> Date: Thu Dec 13 19:31:13 2018 +0800 Don't call begin_detaching when detaching volume from shelved vm When shelve an instance, if the instance has volume attached, with new attach/detach flow, we will delete the old attachment and create a new attachment, the volume status will be ``reserved``. If the user tries to detach these volumes, it fails due to that Cinder does not allow a begin_detaching() call on a `reserved` volume. Actually for shelved instances, we can just skip this step and directly detach it. Change-Id: Ib1799feebbd8f4b0f389168939df7e5e90c8add1 closes-bug: #1808089 ** Changed in: nova Status: In Progress => Fix Released -- You received this bug notification because you are a member of Yahoo! Engineering Team, which is subscribed to OpenStack Compute (nova). https://bugs.launchpad.net/bugs/1808089 Title: Feature to detach volume from a shelved(_offloaded) instance is broken Status in OpenStack Compute (nova): Fix Released Status in OpenStack Compute (nova) queens series: Confirmed Status in OpenStack Compute (nova) rocky series: Confirmed Bug description: In microversion 2.20 we added the ablility to detach/attach volumes from a shelved(_offloaded) instance: http://git.openstack.org/cgit/openstack/nova/tree/nova/api/openstack/compute/rest_api_version_history.rst?h=stable/rocky#n177 But after we uses the cinder new attach workflow, this feature is broken, as when we delete the attachment the volume status changed to "reserved" and we cannot detach the volume with this status. http://git.openstack.org/cgit/openstack/nova/tree/nova/compute/manager.py?h=stable/rocky#n4469 Dec 11 22:20:41 ubuntu devstack@c-api.service[2919]: INFO cinder.api.openstack.wsgi [req-7f18da0d-44db-4445-92df-0abc790dede9 req-3f6b8e1e-4072-400f-aa47-fcbffef3fe55 admin admin] DELETE http://10.76.150.197/volume/v3/5f8092daf17b4b6a83472595eacaa219/attachments/60d6c3e1-9ced-4e64-a2aa-c5dae2248f5b Dec 11 22:20:41 ubuntu devstack@c-api.service[2919]: DEBUG cinder.api.openstack.wsgi [req-7f18da0d-44db-4445-92df-0abc790dede9 req-3f6b8e1e-4072-400f-aa47-fcbffef3fe55 admin admin] Empty body provided in request {{(pid=2922) get_body /opt/stack/cinder/cinder/api/openstack/wsgi.py:719}} Dec 11 22:20:41 ubuntu devstack@c-api.service[2919]: DEBUG cinder.api.openstack.wsgi [req-7f18da0d-44db-4445-92df-0abc790dede9 req-3f6b8e1e-4072-400f-aa47-fcbffef3fe55 admin admin] Calling method 'version_select' {{(pid=2922) _process_stack /opt/stack/cinder/cinder/api/openstack/wsgi.py:873}} Dec 11 22:20:41 ubuntu devstack@c-api.service[2919]: DEBUG cinder.volume.api [req-7f18da0d-44db-4445-92df-0abc790dede9 req-3f6b8e1e-4072-400f-aa47-fcbffef3fe55 admin admin] Remaining volume attachments: VolumeAttachmentList(objects=[VolumeAttachment(cb3a2f68-fc14-4a2e-9b2a-78e049a1b23c)]) {{(pid=2922) attachment_delete /opt/stack/cinder/cinder/volume/api.py:2186}} Dec 11 22:20:41 ubuntu devstack@c-api.service[2919]: DEBUG cinder.volume.api [req-7f18da0d-44db-4445-92df-0abc790dede9 req-3f6b8e1e-4072-400f-aa47-fcbffef3fe55 admin admin] Adding status of: reserved to pending status list for volume. {{(pid=2922) attachment_delete /opt/stack/cinder/cinder/volume/api.py:2195}} Dec 11 22:20:41 ubuntu devstack@c-api.service[2919]: DEBUG cinder.volume.api [req-7f18da0d-44db-4445-92df-0abc790dede9 req-3f6b8e1e-4072-400f-aa47-fcbffef3fe55 admin admin] Pending status list for volume during attachment-delete: [u'reserved'] {{(pid=2922) attachment_delete /opt/stack/cinder/cinder/volume/api.py:2199}} Dec 11 22:20:42 ubuntu devstack@c-api.service[2919]: INFO cinder.api.openstack.wsgi [req-7f18da0d-44db-4445-92df-0abc790dede9 req-3f6b8e1e-4072-400f-aa47-fcbffef3fe55 admin admin] http://10.76.150.197/volume/v3/5f8092daf17b4b6a83472595eacaa219/attachments/60d6c3e1-9ced-4e64-a2aa-c5dae2248f5b returned with HTTP 200 And when I call detach volume on this, I got: { "badRequest": { "message": "Invalid volume: Invalid input received: Invalid volume: Unable to detach volume. Volume status must be 'in-use' and attach_status must be 'attached' to detach. (HTTP 400) (Request-ID: req-70a9bdb8-d4a5-432c-b11b-d3ce6cf179c7)", "code": 400 } } To manage notifications about this bug go to: https://bugs.launchpad.net/nova/+bug/1808089/+subscriptions -- Mailing list: https://launchpad.net/~yahoo-eng-team Post to : yahoo-eng-team@lists.launchpad.net Unsubscribe : https://launchpad.net/~yahoo-eng-team More help : https://help.launchpad.net/ListHelp