|
|
* W6 D# W' Y: k$ t$ J) t, m% s. o
查看有多少镜像:* V; G+ ]& U3 V
[root@ceph1 ~]# rbd ls -p images -l |grep d25d8b59-dfff-4f2b-b63e-aa22dc533778
( y. `& ^3 h* X9 z8 ?d25d8b59-dfff-4f2b-b63e-aa22dc533778 2 GiB 2 $ q5 ~; I. R3 }
d25d8b59-dfff-4f2b-b63e-aa22dc533778@snap 2 GiB 2 yes
: M9 N0 Q; Y# j, n
' g/ z) T" U L5 t解除父进程关系:( P; ^4 M# f8 m. d# ?. ]
[root@ceph1 ~]# rbd children images/d25d8b59-dfff-4f2b-b63e-aa22dc533778@snap
5 W* S! s0 L T6 M* _) B1 h% V$ Trbd: listing children failed: 2021-12-29 15:45:01.087 7f6ad90a1b00 -1 librbd::api::Image: list_descendants: error looking up name for image id 9753a327e2e1b4 in pool volumes-hdd(2) No such file or directory7 z" m( c7 x( V& a: i/ ?/ A
7 e9 N9 _3 `& g失败,再次尝试
! ~' q0 j2 V% M8 t- L$ r* Q7 Z[root@ceph1 ~]# rbd children images/d25d8b59-dfff-4f2b-b63e-aa22dc533778@snap2 [' S; y; J2 i# z
rbd: listing children failed: 2021-12-29 15:45:31.459 7fad7a5d1b00 -1 librbd::api::Image: list_descendants: error looking up name for image id 9753a327e2e1b4 in pool volumes-hdd(2) No such file or directory$ Z3 V' N+ ]1 w9 Q$ }) o
; i( g. p/ t m2 k# ^[root@ceph1 ~]# rbd children images/d25d8b59-dfff-4f2b-b63e-aa22dc533778
7 s# i9 I0 u( ]7 z' Z. g* Rrbd: listing children failed: 2021-12-29 15:45:59.067 7fbb3d475b00 -1 librbd::api::Image: list_descendants: error looking up name for image id 9753a327e2e1b4 in pool volumes-hdd(2) No such file or directory
8 Y9 Z. m/ a! j _8 @- l9 p+ B) E; I* g1 L/ Q3 n0 h8 G* ~
到报错的pool池中查找,也无相关的记录:6 Q* N) d" w. h% g, | o8 n
[root@ceph1 ~]# rbd ls -p volumes-hdd |grep 9753a327e2e1b4
+ d4 }, @: `# {. _6 m& h: _[root@ceph1 ~]# rbd ls -p volumes-hdd |grep 9753a327e2e1b4% K6 A! y& w9 @
[root@ceph1 ~]# rbd ls -p volumes-hdd |grep 9753a32" X) x. f4 j4 e# @9 Q$ Z* B
[root@ceph1 ~]# rbd ls -p volumes-hdd
6 n2 U* x' N5 \[root@ceph1 ~]# rbd ls -p volumes-hdd + C: @9 C1 ~5 q9 T
[root@ceph1 ~]# rbd ls -p volumes-hdd' M% m p* m: C9 V5 w4 Y1 b. N7 y% d
[root@ceph1 ~]# * A; P% D2 H. s5 Q
[root@ceph1 ~]#
* e% D* w' v7 P- K& r[root@ceph1 ~]# 5 ^* n9 n- {) D3 C @/ b( {
[root@ceph1 ~]#5 u$ W9 r4 x' d/ B5 H7 C; ^! Z
" _0 }( b, x( Y& O* B1 J
查看所有的镜像:1 j' [+ c2 z0 x: p
[root@ceph1 ~]# rbd ls -l images
6 R! {. D" w- J0 j( r( z* V9 \NAME SIZE PARENT FMT PROT LOCK 6 d& A$ x1 J# v1 p' g
33652a4d-3ff4-4b40-bada-6f7514f23345 12 GiB 2 , ?: w' N3 D2 M- O! l1 w
33652a4d-3ff4-4b40-bada-6f7514f23345@snap 12 GiB 2 yes 1 Y* _. S, y% N- f( ~& F# ^
46e08623-2616-429e-9b0c-008a1749d1a5 12 GiB 2
5 ^7 r# ^+ ?7 G4 I1 z9 T46e08623-2616-429e-9b0c-008a1749d1a5@snap 12 GiB 2 yes
% y! b# \( g" h: C. @ ebda91b25-d146-4084-923f-834019eae8db 3 GiB 2 ! c! e5 |# j6 _7 g3 T. U8 d. p c
bda91b25-d146-4084-923f-834019eae8db@snap 3 GiB 2 yes
: }7 E) }/ K( M# i# mc47afb15-a38a-46b6-8aa7-9dfba4243f5d 2 GiB 2
$ {7 I7 D( j$ j9 y+ Qc47afb15-a38a-46b6-8aa7-9dfba4243f5d@snap 2 GiB 2 yes
+ j w- t6 [# @& ^. hd25d8b59-dfff-4f2b-b63e-aa22dc533778 2 GiB 2
' J$ Q4 [& W G6 p3 `2 Kd25d8b59-dfff-4f2b-b63e-aa22dc533778@snap 2 GiB 2 yes
5 I; S. a9 O: X# sd6d6c4cd-00ad-44ce-994e-8a5fa8022139 3 GiB 2
6 _% A' P, u* r$ q8 k' j4 Cd6d6c4cd-00ad-44ce-994e-8a5fa8022139@snap 3 GiB 2 yes 7 z- v* `: ^* z! z7 V5 x
e6ec5576-03e3-425c-86bc-871acd6d13eb 12 GiB 2 - K- g2 B' [# S1 T: a- b
e6ec5576-03e3-425c-86bc-871acd6d13eb@snap 12 GiB 2 yes 4 x9 E; p, s5 l0 G6 k$ C
e828dc6f-b4ad-4ee0-b866-36b2df342553 3 GiB 2 - [( A2 `7 R" R1 N3 D
e828dc6f-b4ad-4ee0-b866-36b2df342553@snap 3 GiB 2 yes
: h6 X7 i9 n; _5 |$ C% y+ U2 h2 F+ ?, s
删除下镜像:
6 g1 e1 [- q a3 a[root@ceph1 ~]# rbd rm d25d8b59-dfff-4f2b-b63e-aa22dc533778 -p images/ ~4 C& E- j( x5 R: \% l
2021-12-29 15:51:50.536 7faff2c6ab00 -1 librbd::image::PreRemoveRequest: 0x558372b2d180 check_image_snaps: image has snapshots - not removing
1 e& W# o! k' S7 V" r, H- s- G0 bRemoving image: 0% complete...failed.8 e6 l7 B% T, \
rbd: image has snapshots - these must be deleted with 'rbd snap purge' before the image can be removed.
4 t* Q+ \8 j0 @, x4 P5 |/ v4 t
& ?1 S5 M0 u$ B删除失败,按提示执行rbd snap purge: S" Q4 w/ V( [0 i
: K' {; y9 R. X
[root@ceph1 ~]# rbd snap purge d25d8b59-dfff-4f2b-b63e-aa22dc533778 -p images
& {3 m; f/ \+ }) p7 c y& n/ |rbd: error removing snapshot(s) 'snap', which is protected - these must be unprotected with `rbd snap unprotect`.
- e. h: _. h7 P/ hRemoving all snapshots: 0% complete...failed.! x( \7 X$ r' R& n7 f0 t
: W T, @1 J% Q: p% W. W% _+ l还是报错:
/ Z t( |( T$ h0 j( A" b9 d: w% w[root@ceph1 ~]# rbd snap unprotect d25d8b59-dfff-4f2b-b63e-aa22dc533778 -p images9 N* T% O8 @ Q, ^8 W
rbd: snapshot name was not specified% }: k8 @: V0 z
[root@ceph1 ~]# rbd snap unprotect d25d8b59-dfff-4f2b-b63e-aa22dc533778@snap -p images
6 B( ]$ v9 E8 T+ Q4 d! q* d( W# `2021-12-29 15:52:30.984 7f4bdb7fe700 -1 librbd::SnapshotUnprotectRequest: cannot unprotect: at least 1 child(ren) [9753a327e2e1b4] in pool 'volumes-hdd'
' {9 w! o5 W& h$ B' g% ?0 o2021-12-29 15:52:30.985 7f4bdb7fe700 -1 librbd::SnapshotUnprotectRequest: encountered error: (16) Device or resource busy- }0 Z6 C( Y1 e+ C) x
2021-12-29 15:52:30.985 7f4bdb7fe700 -1 librbd::SnapshotUnprotectRequest: 0x55f981533360 should_complete_error: ret_val=-16
- }5 T. j1 A3 m8 q2021-12-29 15:52:30.987 7f4bdb7fe700 -1 librbd::SnapshotUnprotectRequest: 0x55f981533360 should_complete_error: ret_val=-163 ~/ [- ^ ?* ^- x7 M5 ]% g
rbd: unprotecting snap failed: (16) Device or resource busy; h; B1 y" H( q
删除失败:
/ G4 c# @# |0 x8 w; c& b: A, W& T- a[root@ceph1 ~]# rbd snap rm d25d8b59-dfff-4f2b-b63e-aa22dc533778@snap -p images1 _: A# ?( f: U7 S% d1 f! d! @ g
Removing snap: 0% complete...failed.
. y5 g6 D4 L& h2 prbd: snapshot 'snap' is protected from removal.! x8 Z, g* o$ Z. Z
2021-12-29 15:52:42.995 7f2908879b00 -1 librbd::Operations: snapshot is protected
3 v3 q5 P0 T. A; ?[root@ceph1 ~]# rbd snap protect d25d8b59-dfff-4f2b-b63e-aa22dc533778@snap -p images
% O: e# V/ |* }& V+ Prbd: snap is already protected
5 ]% @0 B$ I4 |$ G# V[root@ceph1 ~]# rbd snap unprotect d25d8b59-dfff-4f2b-b63e-aa22dc533778@snap -p images
U1 Y1 [% i$ ~; x/ r# Y2021-12-29 15:53:02.360 7ff8f6ffd700 -1 librbd::SnapshotUnprotectRequest: cannot unprotect: at least 1 child(ren) [9753a327e2e1b4] in pool 'volumes-hdd'% j, i+ g" A- ]5 ^6 }( l0 D; G
2021-12-29 15:53:02.361 7ff8f6ffd700 -1 librbd::SnapshotUnprotectRequest: encountered error: (16) Device or resource busy8 s6 @( I% j2 s7 s3 p8 E
2021-12-29 15:53:02.361 7ff8f6ffd700 -1 librbd::SnapshotUnprotectRequest: 0x5619a74f4230 should_complete_error: ret_val=-16
! P! J' o/ _! V5 ~ f2021-12-29 15:53:02.363 7ff8f6ffd700 -1 librbd::SnapshotUnprotectRequest: 0x5619a74f4230 should_complete_error: ret_val=-16rbd: unprotecting snap failed:
7 B* H1 T! p- T( G. F' d(16) Device or resource busy7 n9 p+ `0 s, y4 E2 R- }
[root@ceph1 ~]# rbd snap unprotect d25d8b59-dfff-4f2b-b63e-aa22dc533778@snap -p images
; Y" V. U! T/ S; s0 V/ c$ g# X5 s2 [% c2021-12-29 15:53:15.412 7fe7e3de8700 -1 librbd::SnapshotUnprotectRequest: cannot unprotect: at least 1 child(ren) [9753a327e2e1b4] in pool 'volumes-hdd'3 D8 F- ?" L/ G j- d
2021-12-29 15:53:15.413 7fe7e3de8700 -1 librbd::SnapshotUnprotectRequest: encountered error: (16) Device or resource busy' N1 y) t! Z1 k" z
2021-12-29 15:53:15.413 7fe7e3de8700 -1 librbd::SnapshotUnprotectRequest: 0x557a25e9b330 should_complete_error: ret_val=-16
! m2 Z: S$ r# l6 b2021-12-29 15:53:15.414 7fe7e3de8700 -1 librbd::SnapshotUnprotectRequest: 0x557a25e9b330 should_complete_error: ret_val=-16& r* @& N+ A& H: a$ W9 E
rbd: unprotecting snap failed: (16) Device or resource busy: t& \" u$ f- B' ^
% c8 I1 m# B, o1 [- w
/ |) b7 v( P9 b u' t
" j* I4 b1 f/ V( F: _1 j# Y+ ~8 m* f: ^+ u: Z' P
$ `5 z& o: R/ `+ a- T9 u: b/ _
实在无法删除,只好通过更新数据库信息来完成删除的任务:6 a4 ~* l5 q) L" C' j6 O
MariaDB [glance]> select id,name,deleted,protected,size from images ;
/ F: z8 t6 K1 _+ y& \+ x* L0 ~+--------------------------------------+----------------------+---------+-----------+-------------+
/ N" ]% N3 H% I3 p! Y" z- s+ {| id | name | deleted | protected | size |" A4 N0 Y1 v8 Q9 ~7 H; W1 q" x( `9 G
+--------------------------------------+----------------------+---------+-----------+-------------+
4 O, b( l" A" X. W j4 i0 p
D& _* p9 K# b5 a| c47afb15-a38a-46b6-8aa7-9dfba4243f5d | Centos7.9-origin-ssd | 0 | 0 | 2147483648 |
, z7 f; M& `+ }| d25d8b59-dfff-4f2b-b63e-aa22dc533778 | centos7.9-origin-hdd | 1 | 0 | 2147483648 |0 v- j# U+ N5 Z6 I7 u( |1 z% |2 M
|
# v, E2 n2 _* K- i+--------------------------------------+----------------------+---------+-----------+-------------+2 L% s; u; [* J- u* z4 e7 q
29 rows in set (0.00 sec)! }/ X+ `9 s- V3 q7 ]) p% k3 k
( T9 e. A; i6 h4 j6 X2 R
MariaDB [glance]> update glance.images set deleted='1' where id='c47afb15-a38a-46b6-8aa7-9dfba4243f5d';& v9 \7 @8 j; i! j3 w* b
Query OK, 1 row affected (0.00 sec)0 {- R+ \$ g( x' g. I/ |
Rows matched: 1 Changed: 1 Warnings: 0
: {5 i \) a) K: \; a/ M! e
, f2 C8 ^9 k' N: D( Q M" y# E. e, {1 n8 A) m. W* d0 X9 U+ Z" o
|
|