OpenStack错误:无法执行删除卷

查找无法删除的卷
openstack volume list --all-project |grep dffd4456-29b5-41e4-b3b7-7b00a1b3a313

改变状态
cinder reset-state dffd4456-29b5-41e4-b3b7-7b00a1b3a313 --state available

调取接口
cinder --debug show dffd4456-29b5-41e4-b3b7-7b00a1b3a313
#调取的接口为
http://172.28.8.20:8776/v3/5145855bb46c4f129073172fb982660e/volumes/dffd4456-29b5-41e4-b3b7-7b00a1b3a313

获取token认证
openstack token issue
#获取的token为
gAAAAABial5wnniQjH-iM8Y10H1li5r0GzyzEJXo4iSuDHYc4S82cuunjyKmFCZJZw3uLzEvtFGGMZ77QMkAZMKNWyq1NVFY3Lr9QgZXrh6PetBWAMCN4YMt7fLDt-IUXKx-1dWFvIZLwVvpC8Ky4S9vuMTMRT7NTM3WwkJtDE5bPLgaRixuZXc

数据库查询卷对应的挂载id
mysql -uroot -p
>use cinder
>select * from volume_attachment where volume_id='dffd4456-29b5-41e4-b3b7-7b00a1b3a313';
#获取的挂载id为
8edfc42e-eb4e-4405-b0c4-f35cf2c00bfe

拼接为请求接口
curl -g -i -X POST http://172.28.8.20:8776/v3/5145855bb46c4f129073172fb982660e/volumes/dffd4456-29b5-41e4-b3b7-7b00a1b3a313/action \
-H "User-Agent: python-cinderclient" -H "Content-Type: application/json" -H "Accept: application/json" \
-H "X-Auth-Token: gAAAAABial5wnniQjH-iM8Y10H1li5r0GzyzEJXo4iSuDHYc4S82cuunjyKmFCZJZw3uLzEvtFGGMZ77QMkAZMKNWyq1NVFY3Lr9QgZXrh6PetBWAMCN4YMt7fLDt-IUXKx-1dWFvIZLwVvpC8Ky4S9vuMTMRT7NTM3WwkJtDE5bPLgaRixuZXc" \
-d '{"os-detach": {"attachment_id": "8edfc42e-eb4e-4405-b0c4-f35cf2c00bfe"}}'

删除卷
openstack volume delete dffd4456-29b5-41e4-b3b7-7b00a1b3a313

参考链接:https://www.freesion.com/article/3345773571/

posted @ 2022-04-28 16:03  wang-hongwei  阅读(572)  评论(0编辑  收藏  举报