将设为首页浏览此站
开启辅助访问 天气与日历 收藏本站联系我们切换到窄版

易陆发现论坛

 找回密码
 开始注册
查看: 1346|回复: 1
收起左侧

image has snapshots - not removing 删除镜像出错该镜像包含snapshort解决过程

[复制链接]
发表于 2021-10-19 15:00:03 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有帐号?开始注册

x
删除时报错, ]  C/ C2 f  p5 m  M# ]. h
[root@compute01 ~]# rbd rm -p vms volume-b75a1ff5-606b-45ca-9a4a-b4327d6ff106
& S) B* R) W& P3 ^( \2021-10-19 14:20:49.287 7fe204b32b00 -1 librbd::image::PreRemoveRequest: 0x563793d78b50 check_image_snaps: image has snapshots - not removing, `* k' H, v$ u, W' A; B& ?
Removing image: 0% complete...failed.) m7 N. ?2 ^" q4 L$ R, A' d
rbd: image has snapshots - these must be deleted with 'rbd snap purge' before the image can be removed.7 ?# p* X) ^! B/ {1 Z

& p% a7 r! c% m6 F: |! o查看是否包含子镜像:& ^( a+ U: Z, M  Y
[root@compute01 ~]# rbd children vms/volume-b75a1ff5-606b-45ca-9a4a-b4327d6ff106  q7 y, _' f5 f: L

. t3 i) y8 U8 Y9 T( ]9 ]$ T5 ]" Y7 R' T) A" b$ b
查看snap信息:; z1 K$ P& i+ Y! B5 [8 r
[root@compute01 ~]# rbd snap ls vms/volume-b75a1ff5-606b-45ca-9a4a-b4327d6ff106/ d' s- a, A' [5 G5 ~# o. N& Q& P
SNAPID NAME                                          SIZE  PROTECTED TIMESTAMP               
' v/ ~* \0 m* }    36 snapshot-a5f9935c-338a-4b48-a535-3237dd741809 1 GiB yes       Mon Oct 18 17:12:22 2021
3 P+ n5 K+ U0 E$ p, r1 w5 ?    37 snapshot-59a87052-1b6c-469a-a989-8ffaa38cc862 1 GiB yes       Mon Oct 18 21:05:23 2021
2 R0 O2 V& J3 C  ]8 j
% S( o! N/ W. {2 O+ O% e分离flatten 镜像:
9 ?' q" w) o4 p% ^[root@compute01 ~]#  rbd flatten vms/volume-b75a1ff5-606b-45ca-9a4a-b4327d6ff106
  _( n5 n6 s6 rImage flatten: 0% complete...failed.
, b+ a: C( @, v! ~, X0 Rrbd: flatten error: (22) Invalid argument% f$ f( e5 g( ]: k
2021-10-19 14:22:11.267 7f51fde1bb00 -1 librbd::Operations: image has no parent
& v2 q5 w4 r0 A' l
8 D* j& j. @5 \失败了:郁闷了:% W$ {( K5 k" Z# I# L
[root@compute01 ~]#  rbd flatten vms/volume-b75a1ff5-606b-45ca-9a4a-b4327d6ff106 1 l0 T4 L: a$ B" T
Image flatten: 0% complete...failed.. C* R6 {, ], s' L. b# l. f
rbd: flatten error: 2021-10-19 14:22:17.346 7fcfb671bb00 -1 librbd::Operations: image has no parent(22) Invalid argument8 f; H' Q8 Y7 u' Z+ K. f/ N$ ~
; |9 t2 n  F: T" p$ Q" a/ @
查看其他的依然没有办法:, v) L! y" ^1 m4 |: ~1 V+ Y1 M
& s% }+ G, Y( c' t) t
[root@compute01 ~]#  rbd flatten vms/snapshot-59a87052-1b6c-469a-a989-8ffaa38cc8627 X5 i0 ?- I* ?% b' [2 `
rbd: error opening image snapshot-59a87052-1b6c-469a-a989-8ffaa38cc862: (2) No such file or directory
1 H. e5 H+ ]4 v6 }( U5 q/ _: U[root@compute01 ~]#  rbd children vms/volume-b75a1ff5-606b-45ca-9a4a-b4327d6ff106
3 l) Q7 z$ m1 F! g[root@compute01 ~]#  rbd flatten vms/snapshot-59a87052-1b6c-469a-a989-8ffaa38cc8620 d: I/ z' |( G( Q+ B: d
rbd: error opening image snapshot-59a87052-1b6c-469a-a989-8ffaa38cc862: (2) No such file or directory: f1 V1 [1 o! }3 `! t0 ^

+ O( c. w& G4 @' a再次查看snap信息:
, j5 G6 k4 h8 |2 O+ Q  k[root@compute01 ~]# rbd snap ls vms/volume-b75a1ff5-606b-45ca-9a4a-b4327d6ff106
7 k2 k4 M1 a6 X2 K* MSNAPID NAME                                          SIZE  PROTECTED TIMESTAMP                6 x. ^6 a* ]+ |2 ?
    36 snapshot-a5f9935c-338a-4b48-a535-3237dd741809 1 GiB yes       Mon Oct 18 17:12:22 2021
" {3 _! A' j: p! B5 j2 t    37 snapshot-59a87052-1b6c-469a-a989-8ffaa38cc862 1 GiB yes       Mon Oct 18 21:05:23 2021 # Y  M& `' V1 R. V
[root@compute01 ~]# rbd snap + s9 V4 X* V5 ?" Z; f8 h
add        create     limit      list       ls         protect    purge      remove     rename     revert     rm         rollback   unprotect  8 A  w- W$ D& a
[root@compute01 ~]# rbd snap
/ j3 f6 k/ C* d( E& i* @add        create     limit      list       ls         protect    purge      remove     rename     revert     rm         rollback   unprotect  
' ~! y; U' P3 C+ F. C
: H! p* X. L$ v+ X9 R9 t) ~
8 o" A* _6 r( M尝试删除snap:9 Q, {# U& t3 r  \
[root@compute01 ~]# rbd snap rm vms/volume-b75a1ff5-606b-45ca-9a4a-b4327d6ff106
9 z" Z5 s7 U: ?' q% l& }4 P4 Y& }rbd: snapshot name was not specified% W8 l. o. j. u& n0 o! Z% T$ h

. P1 b% ^! Z8 d检查snap ls状态:
5 Z3 l6 l# `& }. o! ~7 f' U% B[root@compute01 ~]# rbd snap ls vms/volume-b75a1ff5-606b-45ca-9a4a-b4327d6ff106@snapshot-59a87052-1b6c-469a-a989-8ffaa38cc8625 j5 E/ B& a9 B( |+ l
rbd: snapshot name specified for a command that doesn't use it0 j/ Y; ^  T& ]5 W# t$ z" ?1 U
- y9 G; |7 N+ K3 G( m1 F% g
[root@compute01 ~]# rbd snap ls vms/snapshot-59a87052-1b6c-469a-a989-8ffaa38cc862) ^* `7 J1 |9 D( _
rbd: error opening image snapshot-59a87052-1b6c-469a-a989-8ffaa38cc862: (2) No such file or directory/ X" I+ q/ C/ s$ o0 N
8 S5 O, V# ~* m" c% F: o5 J( b3 H
: K7 h+ S4 _4 r0 o
[root@compute01 ~]#  rbd flatten vms/snapshot-59a87052-1b6c-469a-a989-8ffaa38cc8621 f9 ~6 Q; d1 P8 Z7 [
rbd: error opening image snapshot-59a87052-1b6c-469a-a989-8ffaa38cc862: (2) No such file or directory
/ N! [) U+ U# I$ I5 p6 ]5 g  j5 l, U7 W2 h2 K! N
7 ]. J; g! i9 J5 h) F$ a
[root@compute01 ~]# rbd snap ls vms/volume-b75a1ff5-606b-45ca-9a4a-b4327d6ff106
3 S6 C* `4 J8 W% [  ~  T& S! b! sSNAPID NAME                                          SIZE  PROTECTED TIMESTAMP                : B( F, t* H3 j: L( j' m& j# e3 }$ W
    36 snapshot-a5f9935c-338a-4b48-a535-3237dd741809 1 GiB yes       Mon Oct 18 17:12:22 2021
$ Z3 G& h1 ^3 Y, L/ z    37 snapshot-59a87052-1b6c-469a-a989-8ffaa38cc862 1 GiB yes       Mon Oct 18 21:05:23 2021 - |+ U2 E% [) a: ^4 {: j' t
# w# _4 b1 I) r. @5 s# C$ z5 w
[root@compute01 ~]# rbd children vms/volume-b75a1ff5-606b-45ca-9a4a-b4327d6ff106@snapshot-a5f9935c-338a-4b48-a535-3237dd741809
4 m4 H" t+ m$ [- ?7 z& }- ?3 E[root@compute01 ~]# rbd children vms/volume-b75a1ff5-606b-45ca-9a4a-b4327d6ff106@snapshot-59a87052-1b6c-469a-a989-8ffaa38cc862  p) _# ?2 V  E8 H9 S
" u$ ]% E6 }# t$ V  S7 j4 n! N$ @
% C- ~6 V4 f$ V6 E$ L& F
通过snap删除:% \3 o6 E8 I5 m% e: U/ G# f4 N) m. x
[root@compute01 ~]# rbd snap rm snapshot-59a87052-1b6c-469a-a989-8ffaa38cc862
2 W, G) @5 F# S2 p1 Nrbd: snapshot name was not specified2 R9 M3 E% {) h) `0 u; c' o

5 M9 x, `1 }! b3 f4 v" f4 v
4 K* M; f' t6 s/ |9 W删除snap- g: x, @3 W! A: {
5 z" L) {/ v# h
[root@compute01 ~]# rbd snap rm vms/volume-b75a1ff5-606b-45ca-9a4a-b4327d6ff106@snapshot-59a87052-1b6c-469a-a989-8ffaa38cc8625 I! A3 b/ k: o! X% V$ P. |
Removing snap: 0% complete...failed.2 v5 m/ Z, E: |# Q6 L: N
rbd: snapshot 'snapshot-59a87052-1b6c-469a-a989-8ffaa38cc862' is protected from removal.; @& W# u' J3 J/ r6 ?1 U# C
2021-10-19 14:28:08.361 7f33d8a03b00 -1 librbd::Operations: snapshot is protected
: P$ D5 [, U$ O/ l4 \
: w, M4 A3 z% q, d/ G, T% f+ f8 ]3 ]% k" N0 M
取消snap 保护:, E- Q- b: I! B* k
[root@compute01 ~]# rbd snap unprotect vms/volume-b75a1ff5-606b-45ca-9a4a-b4327d6ff106@snapshot-59a87052-1b6c-469a-a989-8ffaa38cc862
/ N2 ?* M9 C3 x3 d* ~
# K5 @- c& l! _4 `
2 W+ m) r' H6 D% x$ ]$ r
9 i; x' D5 r8 F[root@compute01 ~]# rbd snap unprotect vms/volume-b75a1ff5-606b-45ca-9a4a-b4327d6ff106@snapshot-59a87052-1b6c-469a-a989-8ffaa38cc862@snap  K" Z$ l1 w! [0 O  O
rbd: unprotecting snap failed: (2) No such file or directory8 c" o4 j$ q% s1 j$ }

* q2 c! ^9 ?# K6 Q再次执行:6 [# o% B( U: Z
[root@compute01 ~]# rbd snap unprotect vms/volume-b75a1ff5-606b-45ca-9a4a-b4327d6ff106@snapshot-59a87052-1b6c-469a-a989-8ffaa38cc8629 ]* Q9 I- |6 F. d" e
rbd: snap is already unprotected& h. ^+ v4 b- [+ r. k: P* b1 ~
$ _$ J+ K2 Q$ J* h6 E
删除成功:1 P( O& k4 j" w8 b
[root@compute01 ~]# rbd snap rm vms/volume-b75a1ff5-606b-45ca-9a4a-b4327d6ff106@snapshot-59a87052-1b6c-469a-a989-8ffaa38cc862& s) @' k" h- ^" x5 @# m" X
Removing snap: 100% complete...done.
! n  j* w9 A+ M% L( M& e, _; s& V0 E/ E

( i, Q- ?" J5 |[root@compute01 ~]# rbd snap rm vms/volume-b75a1ff5-606b-45ca-9a4a-b4327d6ff106@snapshot-a5f9935c-338a-4b48-a535-3237dd741809
# F) X" j; H9 Z3 ~6 ]8 @Removing snap: 2021-10-19 14:29:05.450 7fe3d0f69b00 -1 librbd::Operations: snapshot is protected0% complete...failed.
3 s; i8 R/ I* ^* p7 Z$ @6 urbd: snapshot 'snapshot-a5f9935c-338a-4b48-a535-3237dd741809' is protected from removal.  {$ j. A9 Z! g( N( d
% _1 Y3 g; a  U) ]. U- K

' B* K* U( y. D& F: F! g0 ?4 l尝试第二个取消保护:
; R7 x' R, n9 g% K0 o& k[root@compute01 ~]# rbd snap unprotect vms/volume-b75a1ff5-606b-45ca-9a4a-b4327d6ff106@snapshot-a5f9935c-338a-4b48-a535-3237dd741809' u" m! e1 D( I0 s
[root@compute01 ~]# rbd snap unprotect vms/volume-b75a1ff5-606b-45ca-9a4a-b4327d6ff106@snapshot-a5f9935c-338a-4b48-a535-3237dd741809* u& i: j$ {2 j+ r3 t
rbd: snap is already unprotected' I$ C5 ^. d3 g9 o  e! u
删除snap,删除成功:
& F/ z2 `" `4 ~[root@compute01 ~]# rbd snap rm vms/volume-b75a1ff5-606b-45ca-9a4a-b4327d6ff106@snapshot-a5f9935c-338a-4b48-a535-3237dd741809, f. J# I$ N7 }& n. ?% ^# _1 S
Removing snap: 100% complete...done.
( R* T$ A2 g. n, M( r/ [) O/ b7 X+ S# O  z0 o+ G2 E  h
查看snap 列表:- A5 p) j1 X( _
[root@compute01 ~]# rbd snap ls vms/volume-b75a1ff5-606b-45ca-9a4a-b4327d6ff106- \2 L9 Y! p3 J. T2 V: s0 f

- ^& @1 d4 Z2 y0 y- f
2 U& D8 P+ C  j: X[root@compute01 ~]# rbd rm vms/volume-b75a1ff5-606b-45ca-9a4a-b4327d6ff106# u5 V/ N3 X6 {: o; U" ~) y
2021-10-19 14:29:44.232 7fbf6dffb700 -1 librbd::image::PreRemoveRequest: 0x558c03e97860 check_image_watchers: image has watchers - not removing2 h2 l& s7 i- j# n" V2 T1 J+ r
Removing image: 0% complete...failed.3 m8 A1 }1 t3 l- Q
rbd: error: image still has watchers
8 o! `4 |- ^$ J% r6 q% {. zThis means the image is still open or the client using it crashed. Try again after closing/unmapping it or waiting 30s for the crashed client to timeout.
4 Z" ~9 W& t2 ^. ^
8 A' ]7 [) ?; g7 e! _+ l8 v
# X2 @' y4 I/ U9 i# u查看运行状态:! S) |% h2 z- K
[root@compute01 ~]# rbd status  vms/volume-b75a1ff5-606b-45ca-9a4a-b4327d6ff106. V* ]% a2 ]! ^
Watchers:
6 w) A! z6 W: J, J! B, {: q( H0 l watcher=192.168.0.77:0/3193690701 client.125123467 cookie=94424575476608
1 |, u0 H# @: X+ {) A[root@compute01 ~]# ceph osd bl! k) V' A. f# _, Q
blacklist   blocked-by) d5 ~& l# w# {# o: r4 B) b

2 h5 X* L! D+ g" Z  ^$ ^4 B添加黑名单:0 K3 u/ q* o3 [9 }9 s' d
[root@compute01 ~]# ceph osd blacklist add 192.168.0.77:0/31936907013 {7 t" P" K! K. G3 w% ~  l
blacklisting 192.168.0.77:0/3193690701 until 2021-10-19 15:30:19.739160 (3600 sec)# _# l) R! w) Z! g0 J/ c/ E
4 a7 r9 a5 U0 W( ^
+ d: y5 j: O3 [) l. Q4 R
再次删除镜像:
+ q7 `( L4 V+ R4 c[root@compute01 ~]# rbd rm vms/volume-b75a1ff5-606b-45ca-9a4a-b4327d6ff106/ c( Q; x! V2 g& r
Removing image: 100% complete...done.0 J" e8 D! J- U8 ~
  Q1 }, T" [; u
7 T; l% D4 O0 U
成功删除镜像。; Z3 z$ S  L9 ]+ N5 n) N
. X5 {3 C, P" d7 V. T4 {

2 {: i4 b. H; m% N3 d9 x
: C. X) Q; ^+ P) T8 Z9 c  C
 楼主| 发表于 2021-10-19 15:00:04 | 显示全部楼层
[root@compute01 ~]# rbd rm -p volumes volume-d16830f8-278c-4c80-9077-69648a4aef39
; G4 n1 r! w1 }6 V1 u/ P* n. k2021-10-19 14:41:32.746 7f34fe96bb00 -1 librbd::image::PreRemoveRequest: 0x55c40db0a720 check_image_snaps: image has snapshots - not removing
# F$ ~6 l7 S( B! v2 n$ @7 v/ WRemoving image: 0% complete...failed.
5 O; i. G$ j. M' T, f! N. Wrbd: image has snapshots - these must be deleted with 'rbd snap purge' before the image can be removed.$ z6 C' X; [0 R* Q, l1 f) U4 b8 t) Y
[root@compute01 ~]# rbd snap ls -p volumes volume-d16830f8-278c-4c80-9077-69648a4aef391 B. o6 B# u' I
SNAPID NAME                                          SIZE   PROTECTED TIMESTAMP               
; V" f# ^9 v# f7 e0 P1 i2 p  P   114 snapshot-e4c6ed5f-1ced-4af8-96cc-42c25d01bacf 20 GiB yes       Mon Oct 18 17:33:26 2021
5 L* O$ X8 Y8 t3 d3 t% p/ m$ B
; M4 m! d3 d0 ~[root@compute01 ~]# rbd snap rm volumes/volume-d16830f8-278c-4c80-9077-69648a4aef39@snapshot-e4c6ed5f-1ced-4af8-96cc-42c25d01bacf: p. m. t1 f4 x' ~. t$ F9 T( `0 z. {
Removing snap: 2021-10-19 14:43:49.603 7f6d3ab14b00 -1 librbd::Operations: snapshot is protected0% complete...failed.
- A' I: ?4 C: mrbd: snapshot 'snapshot-e4c6ed5f-1ced-4af8-96cc-42c25d01bacf' is protected from removal.
# @& A8 h8 F9 p[root@compute01 ~]# rbd snap unprotect volumes/volume-d16830f8-278c-4c80-9077-69648a4aef39@snapshot-e4c6ed5f-1ced-4af8-96cc-42c25d01bacf( m, |) o+ |% ?$ H8 Q
[root@compute01 ~]# rbd snap rm volumes/volume-d16830f8-278c-4c80-9077-69648a4aef39@snapshot-e4c6ed5f-1ced-4af8-96cc-42c25d01bacf# Z3 i4 r. ^' D# i6 W* K
Removing snap: 100% complete...done.( L" s0 U" j+ r* V6 A2 {
[root@compute01 ~]# rbd rm -p volumes volume-d16830f8-278c-4c80-9077-69648a4aef398 X/ N/ i5 x3 n) t( q
Removing image: 100% complete...done.# H5 H0 R  `5 X8 C
您需要登录后才可以回帖 登录 | 开始注册

本版积分规则

关闭

站长推荐上一条 /4 下一条

如有购买积分卡请联系497906712

QQ|返回首页|Archiver|手机版|小黑屋|易陆发现 点击这里给我发消息

GMT+8, 2022-7-4 10:26 , Processed in 0.047701 second(s), 22 queries .

Powered by LR.LINUX.cloud bbs168x X3.2 Licensed

© 2012-2022 Comsenz Inc.

快速回复 返回顶部 返回列表