cinder卷刪除不掉解決辦法


現象:P版環境創建的卷虛機 人為或代碼干預導致虛機刪除掉但是卷還在in-use的狀態,此種情況想要detach卷報錯虛機不存在,

想刪除卷也刪不掉

Delete for volume b80074d1-b9fa-4833-98d7-e19dfeec00b0 failed: Invalid volume: Volume status must be available or error or error_restoring or error_extending or error_managing and must not be migrating, attached, belong to a group, have snapshots or be disassociated from snapshots after volume transfer. (HTTP 400) (Request-ID: req-744fc7a7-1920-48d3-91b4-b3348962f602)

ERROR: Unable to delete any of the specified volumes. 

原因為 nova刪除虛機時自動detach卷,但由於rabbitmq或者其他原因導致卸載卷不成功,但nova未能對此結果處理,還是將虛機刪除掉了,就會導致這種情況

解決方法如下:

在控制節點先show一下問題卷 加上debug 調取接口

# cinder --debug show d6c76247-ad3b-442e-ae97-98a2ccd74362 

# openstack token issue

獲取token認證

最后還要去數據庫查詢

volume_attachment表格中這個卷對應的掛載的id

 select * from volume_attachment where volume_id='d6c76247-ad3b-442e-ae97-98a2ccd74362'; 

以上查詢到的信息集成修復接口

curl -g -i -X POST  http://10.76.188.29:8776/v3/81e5890a537a4e70ba4038c15ca55bc4/volumes/d6c76247-ad3b-442e-ae97-98a2ccd74362/action -H "User-Agent: python-cinderclient" -H "Content-Type: application/json" -H "Accept: application/json" -H "X-Auth-Token: gAAAAABc51ltN2C5nhoDAigmpisBL2HnlL9osbTMFOjSnHWnkUK_LqHWi81Jx2r_Iq7XB9p967HnzxOARB3S0b_R4XfvzAA_3KsYdyufvTXjKQS2Lk6Kb3VR8d92SgBb9CB0DL3SbGTjUuj4ZvppTa-dYDLgiO2R6n29BJeJtGyp93GQ73bJE9k" -d '{"os-detach": {"attachment_id": "ef3a3d58-b6b3-47bf-98f4-2f6b587eb61c"}}'

控制節點執行完此命令 重新查詢該卷 已經變為了available狀態 重新執行cinder delete id 刪除掉就可以了;

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM