Cinder volume showing status as "in-use" but shows no attachment.

Solution Verified - Updated -

Environment

  • Red Hat OpenStack Platform 13.0

Issue

  • Unable to attach a volume to a server as it's status shows in-use although there is no server attached to it. While attaching the volume to a server it fails with below error.

    $ openstack server add volume a494a8de-1a7e-4a24-a3f2-a07e6c944987 6780193d-ba26-495b-9643-cf0fe98949d4
    Invalid input received: Invalid volume: Volume 6780193d-ba26-495b-9643-cf0fe98949d4 status must be available or downloading (HTTP 400) (Request-ID: req-88c73bce-d44b-4536-8f5c-8c695472ea27) (HTTP 400) (Request-ID: req-c949c5a7-e7b5-4721-ae8e-0d0bd060edbc)
    
    $ openstack volume list
    +--------------------------------------+----------+-----------+------+-------------+
    | ID                                   | Name     | Status    | Size | Attached to |
    +--------------------------------------+----------+-----------+------+-------------+
    | 6f52cf36-24b7-49e8-818e-8b1404a82563 | testvol2 | available |    1 |             |
    | 6780193d-ba26-495b-9643-cf0fe98949d4 | testvol1 | in-use    |    1 |             |
    +--------------------------------------+----------+-----------+------+-------------+
    

Resolution

  • Reset the volume state to available.

    $ openstack volume set --state available <Volume_UUID>
    

Diagnostic Steps

  • Check the output of the command openstack volume show <Volume_UUID>. The attachments field should be empty.

    $ openstack volume show 5c4bd497-7ff2-4d85-9abc-17225f355690
    +--------------------------------+--------------------------------------------------+
    | Field                          | Value                                            |
    +--------------------------------+--------------------------------------------------+
    | attachments                    | []                                               |
    | availability_zone              | nova                                             |
    | bootable                       | false                                            |
    | consistencygroup_id            | None                                             |
    | created_at                     | 2019-11-14T07:00:57.000000                       |
    | description                    | WBPDS_DB_Data_Volume_Extend 500 GB               |
    | encrypted                      | False                                            |
    | id                             | 5c4bd497-7ff2-4d85-9abc-17225f355690             |
    | migration_status               | None                                             |
    | multiattach                    | False                                            |
    | name                           | WBPDS_DB_Data_Volume_Extend                      |
    | os-vol-host-attr:host          | hostgroup@wbsdc-OSP-Cinder#wbsdc_OSP_Prod_vol004 |
    | os-vol-mig-status-attr:migstat | None                                             |
    | os-vol-mig-status-attr:name_id | None                                             |
    | os-vol-tenant-attr:tenant_id   | f21ec0d2fe9b46a29b9de993cdc9bb9e                 |
    | properties                     |                                                  |
    | replication_status             | None                                             |
    | size                           | 500                                              |
    | snapshot_id                    | None                                             |
    | source_volid                   | None                                             |
    | status                         | in-use                                           |
    | type                           | netapp                                           |
    | updated_at                     | 2019-11-18T06:28:43.000000                       |
    | user_id                        | a41e1908cbf441f6947153a98713d396                 |
    +--------------------------------+--------------------------------------------------+
    
  • Check the status of cinder service. cinder-volume service must be up and running.

    $ openstack volume service list
    +------------------+-------------------------+------+---------+-------+----------------------------+
    | Binary           | Host                    | Zone | Status  | State | Updated At                 |
    +------------------+-------------------------+------+---------+-------+----------------------------+
    | cinder-scheduler | controller-2            | nova | enabled | up    | 2020-02-07T06:55:02.000000 |
    | cinder-scheduler | controller-1            | nova | enabled | up    | 2020-02-07T06:54:57.000000 |
    | cinder-scheduler | controller-0            | nova | enabled | up    | 2020-02-07T06:55:03.000000 |
    | cinder-volume    | hostgroup@tripleo_iscsi | nova | enabled | up    | 2020-02-07T06:54:58.000000 |
    +------------------+-------------------------+------+---------+-------+----------------------------+
    
  • Collect the output of below command from any one controller. It should not return anything which means the volume is not attached to any server although it shows in-use state. Therefore, it's safe to proceed with resetting the volume state to available.

    $ docker exec -it galera-bundle-docker-0 mysql cinder -e "select * from volume_attachment where volume_id='<Volume_UUID>'  \G;"
    

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.