progetti:cloud-areapd:ced-c:operations:recover_a_stuck_volume
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
progetti:cloud-areapd:ced-c:operations:recover_a_stuck_volume [2015/12/16 14:14] – [Delete the original volume / rename the copy] mazzon@infn.it | progetti:cloud-areapd:ced-c:operations:recover_a_stuck_volume [2016/08/25 07:14] (current) – mengumat@infn.it | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== Recover a stuck cinder Volume ====== | ||
+ | Adapted from [[https:// | ||
+ | |||
+ | |||
+ | |||
+ | ==== List the volumes ==== | ||
+ | |||
+ | < | ||
+ | $ . ~/ | ||
+ | $ nova volume-list --all-tenants | ||
+ | +--------------------------------------+-----------+--------------+------+--------------+--------------------------------------+ | ||
+ | | ID | Status | ||
+ | +--------------------------------------+-----------+--------------+------+--------------+--------------------------------------+ | ||
+ | | f480ca6a-0b52-499c-94ab-461be861c7fa | available | Biocomp2 | ||
+ | | 7d95cdc2-69fd-4b39-ae89-2abbfdf9bb7f | available | test | 20 | bulk_storage | | | ||
+ | | 24aa5fc3-0f08-4910-a354-6ed4d1fe8ea1 | in-use | ||
+ | | 86a39713-50ba-4885-8fdc-9d7cdf3d16a8 | in-use | ||
+ | | 1fb65656-f358-4ab8-8baa-fb0c48a0e18d | in-use | ||
+ | | 6feb1a3b-2257-4c3d-84f9-24a476ea64c6 | available | test | 1 | bulk_storage | | | ||
+ | +--------------------------------------+-----------+--------------+------+--------------+--------------------------------------+ | ||
+ | </ | ||
+ | |||
+ | * Try to detach it the ' | ||
+ | < | ||
+ | $ nova volume-detach 002dc79b-9050-459c-9ec3-f3a53b4bb1fb 24aa5fc3-0f08-4910-a354-6ed4d1fe8ea1 | ||
+ | ERROR: The resource could not be found. (HTTP 404) (Request-ID: | ||
+ | </ | ||
+ | NOTE: the operation failed maybe because the VM '' | ||
+ | |||
+ | ==== Find the volume on the iscsi storage using Volume-Display-Name ==== | ||
+ | ==== KILO release cinderDB ==== | ||
+ | |||
+ | * Connect to the mysql db | ||
+ | < | ||
+ | mysql -u root -p | ||
+ | mysql> use cinder; | ||
+ | | ||
+ | Database changed | ||
+ | mysql> SELECT * from volumes where display_name = ' | ||
+ | mysql> SELECT id, | ||
+ | +--------------------------------------+------+-----------+---------------+--------------+ | ||
+ | | id | size | status | ||
+ | +--------------------------------------+------+-----------+---------------+--------------+ | ||
+ | | f4f7de64-7323-43ac-93f6-48d2314cfa6e | 3000 | in-use | ||
+ | +--------------------------------------+------+-----------+---------------+--------------+ | ||
+ | 1 row in set (0.00 sec) | ||
+ | |||
+ | mysql> update volumes SET status=" | ||
+ | mysql> SELECT id, | ||
+ | +--------------------------------------+------+-----------+---------------+--------------+ | ||
+ | | id | size | status | ||
+ | +--------------------------------------+------+-----------+---------------+--------------+ | ||
+ | | f4f7de64-7323-43ac-93f6-48d2314cfa6e | 3000 | available | detached | ||
+ | +--------------------------------------+------+-----------+---------------+--------------+ | ||
+ | 1 row in set (0.00 sec) | ||
+ | |||
+ | mysql> quit; | ||
+ | </ | ||
+ | |||
+ | ==== Find the volume on the iscsi storage ==== | ||
+ | |||
+ | * Connect to the mysql db | ||
+ | < | ||
+ | mysql -u root -p | ||
+ | mysql> use cinder; | ||
+ | | ||
+ | Database changed | ||
+ | mysql> set @volid=' | ||
+ | mysql> select project_id, | ||
+ | +----------------------------------+------+--------------------------------------+------------+ | ||
+ | | project_id | ||
+ | +----------------------------------+------+--------------------------------------+------------+ | ||
+ | | cc6353c145fd49adb7564e2ebe4f3f91 | 200 | 002dc79b-9050-459c-9ec3-f3a53b4bb1fb | / | ||
+ | +----------------------------------+------+--------------------------------------+------------+ | ||
+ | 1 row in set (0.00 sec) | ||
+ | |||
+ | mysql> select display_name, | ||
+ | +--------------+---------------------+------------------------------------------------------------------------------------------------------------------------------------+ | ||
+ | | display_name | display_description | provider_location | ||
+ | +--------------+---------------------+------------------------------------------------------------------------------------------------------------------------------------+ | ||
+ | | Biocomp | ||
+ | +--------------+---------------------+------------------------------------------------------------------------------------------------------------------------------------+ | ||
+ | 1 row in set (0.00 sec) | ||
+ | </ | ||
+ | **volume-24aa5fc3-0f08-4910-a354-6ed4d1fe8ea1** | ||
+ | |||
+ | * Connect to the iscsi storage from cld-blu-01 or cld-blu-02 | ||
+ | < | ||
+ | $ ssh grpadmin@172.16.36.13 | ||
+ | grpadmin@172.16.36.13' | ||
+ | Last login: Mon Dec 14 09:55:50 2015 from 192.168.40.120 on tty?? | ||
+ | |||
+ | |||
+ | | ||
+ | |||
+ | Copyright 2001-2014 Dell Inc. | ||
+ | |||
+ | |||
+ | |||
+ | CloudUnipdVeneto> | ||
+ | </ | ||
+ | * create a copy of the volume (just for security) | ||
+ | < | ||
+ | CloudUnipdVeneto> | ||
+ | Name Size | ||
+ | --------------- ---------- --------- ------- ---------- ----------- - | ||
+ | volume-6feb1a3b 1GB 0 | ||
+ | -2257-4c3d-84 | ||
+ | f9-24a476ea64 | ||
+ | c6 | ||
+ | volume-1fb65656 500GB 0 | ||
+ | -f358-4ab8-8b | ||
+ | aa-fb0c48a0e1 | ||
+ | 8d | ||
+ | volume-86a39713 16GB | ||
+ | -50ba-4885-8f | ||
+ | dc-9d7cdf3d16 | ||
+ | a8 | ||
+ | volume-24aa5fc3 200GB 1 | ||
+ | -0f08-4910-a3 | ||
+ | 54-6ed4d1fe8e | ||
+ | a1 | ||
+ | ... | ||
+ | ... | ||
+ | CloudUnipdVeneto> | ||
+ | CloudUnipdVeneto(volume_volume-24aa5fc3-0f08-4910-a354-6ed4d1fe8ea1)> | ||
+ | Volume creation succeeded. | ||
+ | iSCSI target name is iqn.2001-05.com.equallogic: | ||
+ | CloudUnipdVeneto(volume_volume-24aa5fc3-0f08-4910-a354-6ed4d1fe8ea1)> | ||
+ | CloudUnipdVeneto> | ||
+ | </ | ||
+ | ==== Make a copy of the volume from the dashboard ==== | ||
+ | |||
+ | Access the Project' | ||
+ | |||
+ | {{: | ||
+ | |||
+ | |||
+ | |||
+ | ==== Try to use the copy the normal way ==== | ||
+ | |||
+ | * Attach the volume to a working VM | ||
+ | * Check the contents are fine | ||
+ | * Detach the volume | ||
+ | |||
+ | ==== Manually detach the stuck volume via DB ==== | ||
+ | |||
+ | < | ||
+ | $ mysql -u root -p | ||
+ | mysql> set @volid=' | ||
+ | Query OK, 0 rows affected (0.01 sec) | ||
+ | |||
+ | mysql> set @instance=' | ||
+ | Query OK, 0 rows affected (0.01 sec) | ||
+ | |||
+ | mysql> use nova; | ||
+ | Database changed | ||
+ | mysql> delete from block_device_mapping where not deleted and volume_id=@volid and instance_uuid=@instance; | ||
+ | Query OK, 1 rows affected (0.01 sec) | ||
+ | |||
+ | mysql> use cinder; | ||
+ | Database changed | ||
+ | mysql> select instance_uuid, | ||
+ | +--------------------------------------+----------------------------+--------+---------------+------------+ | ||
+ | | instance_uuid | ||
+ | +--------------------------------------+----------------------------+--------+---------------+------------+ | ||
+ | | 002dc79b-9050-459c-9ec3-f3a53b4bb1fb | 2015-12-10T09: | ||
+ | +--------------------------------------+----------------------------+--------+---------------+------------+ | ||
+ | mysql> update volumes set instance_uuid=NULL, | ||
+ | Query OK, 1 rows affected (0.01 sec) | ||
+ | </ | ||
+ | |||
+ | |||
+ | ==== Check the volume is again available ==== | ||
+ | |||
+ | < | ||
+ | $ nova volume-list --all-tenants | ||
+ | +--------------------------------------+-----------+--------------+------+--------------+--------------------------------------+ | ||
+ | | ID | Status | ||
+ | +--------------------------------------+-----------+--------------+------+--------------+--------------------------------------+ | ||
+ | | f480ca6a-0b52-499c-94ab-461be861c7fa | available | Biocomp2 | ||
+ | | 7d95cdc2-69fd-4b39-ae89-2abbfdf9bb7f | available | test | 20 | bulk_storage | | | ||
+ | | 24aa5fc3-0f08-4910-a354-6ed4d1fe8ea1 | available | Biocomp | ||
+ | | 86a39713-50ba-4885-8fdc-9d7cdf3d16a8 | in-use | ||
+ | | 1fb65656-f358-4ab8-8baa-fb0c48a0e18d | in-use | ||
+ | | 6feb1a3b-2257-4c3d-84f9-24a476ea64c6 | available | test | 1 | bulk_storage | | | ||
+ | +--------------------------------------+-----------+--------------+------+--------------+--------------------------------------+ | ||
+ | </ | ||
+ | |||
+ | ==== Delete the original volume / rename the copy ==== | ||
+ | |||
+ | It should be now possible to delete the volume from the dashboard. This is **necessary** because the volume has somewhat become //toxic//, e.g. if you try to use it again it will again become stuck. Since you made a copy (actually two of them...) it should be safely deleted. | ||
+ | |||
+ | After that you can use the dashboard to rename the volume copy after the original one. | ||
+ | |||
+ | ==== Transfer ownership of the volume! ==== | ||
+ | |||
+ | Since you created the volume as the admin the ownership of the volume is ' | ||
+ | |||
+ | You must transfer the ownership to the user which created the original one. To perform such task: | ||
+ | |||
+ | * As the admin user: | ||
+ | - **Modify the ' | ||
+ | - Download the rc file of the project and the {{: | ||
+ | - Modify the rc file: put the chain.pem file in the same directory and add '' | ||
+ | - Source the rc file and list the project volume: < | ||
+ | $ . testing-openrc-admin.sh | ||
+ | Please enter your OpenStack Password: | ||
+ | |||
+ | $ cinder list | ||
+ | +--------------------------------------+-----------+--------------+------+-------------+----------+-------------+ | ||
+ | | ID | | ||
+ | +--------------------------------------+-----------+--------------+------+-------------+----------+-------------+ | ||
+ | | a79bbf87-112b-471b-bd0c-6d938da57b4c | available | | ||
+ | +--------------------------------------+-----------+--------------+------+-------------+----------+-------------+ | ||
+ | </ | ||
+ | - Create a transfer request for the volume< | ||
+ | $ cinder transfer-create a79bbf87-112b-471b-bd0c-6d938da57b4c | ||
+ | +------------+--------------------------------------+ | ||
+ | | Property | ||
+ | +------------+--------------------------------------+ | ||
+ | | auth_key | ||
+ | | created_at | 2015-12-16T14: | ||
+ | | | ||
+ | | name | | ||
+ | | volume_id | ||
+ | +------------+--------------------------------------+ | ||
+ | </ | ||
+ | - Mail the **id** and **auth_key** to the new owner ('' | ||
+ | *As the new user | ||
+ | - Set a password for your user. The rc file doesn' | ||
+ | - Download the rc file and the {{: | ||
+ | - Modify the rc file: put the chain.pem file in the same directory and add export '' | ||
+ | - Source the rc file and accept the transfer:< | ||
+ | $ . testing-openrc-admin.sh | ||
+ | Please enter your OpenStack Password: | ||
+ | |||
+ | $ cinder transfer-accept d01cf5a1-5e3d-466a-9f4e-0efcca8e818c a182392984ce82b7 | ||
+ | +-----------+--------------------------------------+ | ||
+ | | Property | Value | | ||
+ | +-----------+--------------------------------------+ | ||
+ | | | ||
+ | | name | ||
+ | | volume_id | a79bbf87-112b-471b-bd0c-6d938da57b4c | | ||
+ | +-----------+--------------------------------------+ | ||
+ | </ |