[root@controller ~]# cinder list 4 V! [' Z" ?! k# Q1 G! v
+--------------------------------------+-----------+------+------+-------------+----------+-------------+6 s, ^1 W5 @: G. Y( A+ N
| ID | Status | Name | Size | Volume Type | Bootable | Attached to |$ i( S) M/ V( o0 q" p4 X6 y
+--------------------------------------+-----------+------+------+-------------+----------+-------------+
, ?2 i, u: m" J% D| 409f3a86-2bd6-413c-86f0-f41f59b8d840 | available | test | 1 | __DEFAULT__ | true | |$ l0 \3 U, i# i
+--------------------------------------+-----------+------+------+-------------+----------+-------------+
. V7 X) X' V* n4 z
7 w8 D* p: j+ q% x- B; Q: V还是删除失败:
. S7 Q0 i4 |. t7 ]; H4 {7 D( s只能清理数据库了:
# Y! L1 x' S% y8 v这就需要在控制节点在数据库删除了,因为此时虽然在物理机上已经删除了,但是数据库中还有该记录 ,不能直接删除记录,数据库有外键依赖,要把 cinder 卷的 deleted 改成 “1”6 k/ a& ]9 P8 E
3 M$ Q1 Y5 x& D7 V8 [# o+ `+ ]- \7 U1 E9 q
在控制节点操作删除卷1) 进入数据库 mysql -u cinder -pxxxxxx -hIP cinder [root@controller ~]# mysql -u cinder -pxxxx cinder
* X4 H# b. u3 S x1 W9 sReading table information for completion of table and column names
6 F! L& i/ h2 i+ H2 `: eYou can turn off this feature to get a quicker startup with -A Welcome to the MariaDB monitor. Commands end with ; or \g.
7 F) @0 Z: H5 V. ? r) Z3 qYour MariaDB connection id is 429. L. }% \1 [; R2 W4 P7 G/ c
Server version: 10.3.28-MariaDB MariaDB Server Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. MariaDB [cinder]> 2) 进入 cinder 数据库表 或者使用 mysql -u cinder -pxxxx use cinder; 3) selete 找到出错的表 MariaDB [cinder]> select id,status,display_name from volumes where id='409f3a86-2bd6-413c-86f0-f41f59b8d840';( O4 O( _$ C3 @
+--------------------------------------+-----------+--------------+
# a4 i" u0 T8 J9 ?7 G8 g| id | status | display_name |( W" U/ S. c8 ?; r( g9 p1 a" L! a
+--------------------------------------+-----------+--------------+& `& A$ c5 W, Q9 K. J" B n
| 409f3a86-2bd6-413c-86f0-f41f59b8d840 | available | test |
8 k3 D- t1 y4 P3 Y! A$ ^+--------------------------------------+-----------+--------------+$ ~9 V" @- c) T4 J
1 row in set (0.000 sec) 4) 修改数据库 cinder 相关卷记录 MariaDB [cinder]> update volumes set deleted='1' where id='409f3a86-2bd6-413c-86f0-f41f59b8d840';
# }' d# A, V/ {) `- EQuery OK, 1 row affected (0.001 sec)
3 \% L% P7 n2 p" _Rows matched: 1 Changed: 1 Warnings: 0 到此问题解决 注意别忘了重新打开刚才 stop 的 cinder 相关服务 ) A; Y) C8 Z/ x
% g( l" q% }5 g0 S4 `% u& }
) ^- g: p; G! {3 i
|