After attachment-delete nova still sees volume as attached

Bug #1914273 reported by Facundo Ciccioli
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Cinder
Invalid
Medium
Unassigned

Bug Description

Using cinder attachment-delete command to detach a volume from a stopped instance seems to be affecting only what cinder sees but not what nova sees.

Here are rough steps to reproduce:

1. Create a volume from an image, say the volume's UUID is $VOL

2. Create an instance using that volume as storage:

    $ openstack server create --volume $VOL --flavor some_flavor test-instance

3. Verify the volume is attached to the instance:

    $ openstack server show test-instance -fvalue -cvolumes_attached
    id='$VOL'

4. Get the attachment id using, suppose it's $ATT:

    $ os volume show $VOL -fvalue -c attachments | python -c 'import sys,pprint;pprint.pprint(eval(sys.stdin.read()))'
    [{'attached_at': '2021-02-02T09:38:02.000000',
      'attachment_id': '$ATT',
      'device': '/dev/vda',
      'host_name': 'some-hostname',
      'id': '$VOL',
      'server_id': '...',
      'volume_id': '$VOL'}]

5. Stop the instance

6. Detach the volume:

    $ cinder --os-volume-api-version 3.50 attachment-delete $ATT

Now the volume will show as not being attached according to openstack volume show:

    $ os volume show $VOL -fvalue -c attachments | python -c 'import sys,pprint;pprint.pprint(eval(sys.stdin.read()))'
    []

But it will still be listed as volumes_attached by server show:

    $ openstack server show test-instance -fvalue -cvolumes_attached
    id='$VOL'

I believe this to be related with the fact that the volume being a boot device, it cannot actually be detached. This indeed happens is I try to remove the volume by means of the openstack CLI:

    $ os server remove volume test-instance $VOL
    Cannot detach a root device volume (HTTP 403) (Request-ID: req-...)

I think cinder should error in the same way.

Changed in cinder:
importance: Undecided → High
Changed in cinder:
importance: High → Medium
tags: added: attachment-delete nova volume
Revision history for this message
Sofia Enriquez (lsofia-enriquez) wrote :

This looks like the right behaviour.
If you delete the attachment from Cinder and don't detach from Nova, this is what you would expect to happen.

Changed in cinder:
status: New → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.