[root@controller ~]# cinder list
2 B b* r6 k2 c2 T0 N+--------------------------------------+-----------+------+------+-------------+----------+-------------+( R; K; u3 M {5 Z
| ID | Status | Name | Size | Volume Type | Bootable | Attached to |
; Z- c { C/ s* ]/ v/ ]$ R+--------------------------------------+-----------+------+------+-------------+----------+-------------+
2 @. s4 h& _& m$ N8 W# x" V3 q! r| 409f3a86-2bd6-413c-86f0-f41f59b8d840 | available | test | 1 | __DEFAULT__ | true | |4 }1 R2 F' j! U0 F" x9 e8 l; ]
+--------------------------------------+-----------+------+------+-------------+----------+-------------+5 j; w' X: H7 \1 t! l* h
4 T, a5 y# O( g5 y- j: H3 h还是删除失败:
% B. i% [% m$ |: g* Z& f/ L只能清理数据库了:9 J% x1 h' V5 k: i1 A! j
这就需要在控制节点在数据库删除了,因为此时虽然在物理机上已经删除了,但是数据库中还有该记录 ,不能直接删除记录,数据库有外键依赖,要把 cinder 卷的 deleted 改成 “1”5 x. ~5 J& I' p* M) O# T3 N' ~
z* G9 a$ i6 f: H4 Q4 h# i" d
' X- n: S# Y" o
在控制节点操作删除卷1) 进入数据库 mysql -u cinder -pxxxxxx -hIP cinder [root@controller ~]# mysql -u cinder -pxxxx cinder0 F: Y. R) c8 b- Y2 Y! Y2 a4 e
Reading table information for completion of table and column names
" E4 t, H: A( y2 F2 y( t4 hYou can turn off this feature to get a quicker startup with -A Welcome to the MariaDB monitor. Commands end with ; or \g.: n, ]5 m1 C: Z1 @
Your MariaDB connection id is 429
) k; x4 I9 i B. o' Y/ }" }- nServer 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';0 J/ X8 \4 y+ L0 Y( a& g* M
+--------------------------------------+-----------+--------------+
# U* A( j3 ^8 G! v7 @0 H \. _ P| id | status | display_name |
/ q% H) W8 i. w) s) T1 A3 e+--------------------------------------+-----------+--------------+
! a! n+ H2 K% ?7 }. E8 z| 409f3a86-2bd6-413c-86f0-f41f59b8d840 | available | test |* ~) _9 x. t, B/ [9 a ?2 Y5 }! v
+--------------------------------------+-----------+--------------+
/ U2 C) \5 r, h1 t0 }7 v1 row in set (0.000 sec) 4) 修改数据库 cinder 相关卷记录 MariaDB [cinder]> update volumes set deleted='1' where id='409f3a86-2bd6-413c-86f0-f41f59b8d840';; k, n7 k* K2 i) v7 R- u; D
Query OK, 1 row affected (0.001 sec)7 ~& c6 x6 S) t- P
Rows matched: 1 Changed: 1 Warnings: 0 到此问题解决 注意别忘了重新打开刚才 stop 的 cinder 相关服务 % F6 b9 O3 s# J- `! R, C& Q) |8 K7 y" V
" t. M0 [; ^/ B% s* i
) p2 l3 @0 W ^4 I( P) ?, p9 O
|