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

易陆发现论坛

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

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

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

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

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

x
删除时报错
) Y- p, T- |2 o# l  c# D* o[root@compute01 ~]# rbd rm -p vms volume-b75a1ff5-606b-45ca-9a4a-b4327d6ff106  g; x- i5 ?7 w" G+ b! z- |; ?' y
2021-10-19 14:20:49.287 7fe204b32b00 -1 librbd::image::PreRemoveRequest: 0x563793d78b50 check_image_snaps: image has snapshots - not removing
, [1 s8 W$ n5 }1 ~/ y4 v: }( Q+ SRemoving image: 0% complete...failed.
+ d7 {" y3 ?4 L8 rrbd: image has snapshots - these must be deleted with 'rbd snap purge' before the image can be removed.
4 t+ \. Z7 O; \" h* g" l! y& B) a1 E) [/ @3 g
查看是否包含子镜像:3 z9 x/ L  B2 ]. v6 C
[root@compute01 ~]# rbd children vms/volume-b75a1ff5-606b-45ca-9a4a-b4327d6ff106' X2 q* t1 r6 V

3 x% k7 ?3 c+ u1 b( ^* F* E& w! I6 F2 X$ w: b5 `! [
查看snap信息:
6 `0 r7 R  S  O6 m% z. w3 x- F  ][root@compute01 ~]# rbd snap ls vms/volume-b75a1ff5-606b-45ca-9a4a-b4327d6ff106! y4 O8 b# {; P" x% b  ]
SNAPID NAME                                          SIZE  PROTECTED TIMESTAMP                + E0 l. C8 F& w5 a( [1 ~
    36 snapshot-a5f9935c-338a-4b48-a535-3237dd741809 1 GiB yes       Mon Oct 18 17:12:22 2021
' p2 L1 V5 G2 g% P2 ^% P6 u    37 snapshot-59a87052-1b6c-469a-a989-8ffaa38cc862 1 GiB yes       Mon Oct 18 21:05:23 2021
* f1 M8 j# `. X  _7 Z$ x; Z' H% _% K  {1 E: f
分离flatten 镜像:
' r* G3 `  A7 f# ~' x1 S. m' m/ z- Y2 C[root@compute01 ~]#  rbd flatten vms/volume-b75a1ff5-606b-45ca-9a4a-b4327d6ff106
9 U. G) N& H0 t) UImage flatten: 0% complete...failed.4 b: W% l' Z$ S: i: D% \+ E
rbd: flatten error: (22) Invalid argument; g. U" `* S) p* R6 l. ~8 K6 |
2021-10-19 14:22:11.267 7f51fde1bb00 -1 librbd::Operations: image has no parent4 q! ~' i' \9 C) ?

  ^5 p7 Y! w7 g; Q9 ^- ]失败了:郁闷了:
) S% l1 X- ^& Y" }, Z. }. u' D  L! Q[root@compute01 ~]#  rbd flatten vms/volume-b75a1ff5-606b-45ca-9a4a-b4327d6ff106 % K1 i0 A- K! r% @5 J* l; P
Image flatten: 0% complete...failed.
* u' e- g# i8 Q) k/ P' urbd: flatten error: 2021-10-19 14:22:17.346 7fcfb671bb00 -1 librbd::Operations: image has no parent(22) Invalid argument) G- r5 k1 r* J+ i9 {7 f

3 a8 B3 E8 a9 D" R查看其他的依然没有办法:/ _7 ]( r0 F' ^7 I

9 P: d. b8 @  c' N" H# @[root@compute01 ~]#  rbd flatten vms/snapshot-59a87052-1b6c-469a-a989-8ffaa38cc862' N* P: l8 u+ f) k* l
rbd: error opening image snapshot-59a87052-1b6c-469a-a989-8ffaa38cc862: (2) No such file or directory, x0 r! Q* p9 X; F% _
[root@compute01 ~]#  rbd children vms/volume-b75a1ff5-606b-45ca-9a4a-b4327d6ff106
( P6 v. d9 k$ M[root@compute01 ~]#  rbd flatten vms/snapshot-59a87052-1b6c-469a-a989-8ffaa38cc862$ p! z! K% o1 O2 b2 h4 t* b
rbd: error opening image snapshot-59a87052-1b6c-469a-a989-8ffaa38cc862: (2) No such file or directory
! Q3 n1 [) M" [" e
' o$ Q2 V* O4 p* i0 Z7 M再次查看snap信息:& q- S# K0 ~9 e1 J! n# o. J: E
[root@compute01 ~]# rbd snap ls vms/volume-b75a1ff5-606b-45ca-9a4a-b4327d6ff106
+ S4 O% q1 N$ N) CSNAPID NAME                                          SIZE  PROTECTED TIMESTAMP                : Y$ q8 q; a" e! a' ?
    36 snapshot-a5f9935c-338a-4b48-a535-3237dd741809 1 GiB yes       Mon Oct 18 17:12:22 2021
/ {( _: \' L4 O- |4 S: D    37 snapshot-59a87052-1b6c-469a-a989-8ffaa38cc862 1 GiB yes       Mon Oct 18 21:05:23 2021 ( F# t: {4 c, a+ r' q, T, `8 u
[root@compute01 ~]# rbd snap 2 ?2 h* V9 |" h: U0 e3 l1 n
add        create     limit      list       ls         protect    purge      remove     rename     revert     rm         rollback   unprotect  3 m3 P8 k) m! T4 Z. k$ P: D, N- I
[root@compute01 ~]# rbd snap 0 h1 X3 c, v3 N
add        create     limit      list       ls         protect    purge      remove     rename     revert     rm         rollback   unprotect  0 t6 B) }4 ?4 y. E# h' ]5 t
% \1 f3 `( T" T& V6 p$ c

8 W$ Z6 b6 J4 y1 u* r尝试删除snap:6 Y; g4 m. j8 o
[root@compute01 ~]# rbd snap rm vms/volume-b75a1ff5-606b-45ca-9a4a-b4327d6ff106& T/ G) I  `& s' a3 b) H
rbd: snapshot name was not specified
' W& U/ a1 y8 g; o. m/ C8 p# H% e
检查snap ls状态:) r- n8 e; W7 U! R& K
[root@compute01 ~]# rbd snap ls vms/volume-b75a1ff5-606b-45ca-9a4a-b4327d6ff106@snapshot-59a87052-1b6c-469a-a989-8ffaa38cc862
7 m5 T3 e# c+ X4 g( irbd: snapshot name specified for a command that doesn't use it
$ D/ Y8 v9 u/ u. w, i
$ N: t3 H# ^. W/ D7 J[root@compute01 ~]# rbd snap ls vms/snapshot-59a87052-1b6c-469a-a989-8ffaa38cc862
/ T/ x/ f! f% R' _rbd: error opening image snapshot-59a87052-1b6c-469a-a989-8ffaa38cc862: (2) No such file or directory
9 A1 _4 G, K  A0 S) d0 h- L' o, D
( U3 {- m" g' ]
[root@compute01 ~]#  rbd flatten vms/snapshot-59a87052-1b6c-469a-a989-8ffaa38cc862
, \' A" C9 U& C' J- Mrbd: error opening image snapshot-59a87052-1b6c-469a-a989-8ffaa38cc862: (2) No such file or directory0 ^$ O6 R/ M8 y  d; x
/ L: f; i; f0 D( c5 K2 f

9 @% Y  Z; ~( W- u7 o; u$ ?[root@compute01 ~]# rbd snap ls vms/volume-b75a1ff5-606b-45ca-9a4a-b4327d6ff106/ o; k. x5 C* }  m% I. K! {, Z
SNAPID NAME                                          SIZE  PROTECTED TIMESTAMP                0 s: N. q: t, K$ C6 v& p
    36 snapshot-a5f9935c-338a-4b48-a535-3237dd741809 1 GiB yes       Mon Oct 18 17:12:22 2021 * n7 [# a, e3 }% G
    37 snapshot-59a87052-1b6c-469a-a989-8ffaa38cc862 1 GiB yes       Mon Oct 18 21:05:23 2021
& B2 I& P0 l- b. Z. L; S+ z) \* r& Q0 Q4 }9 Z
[root@compute01 ~]# rbd children vms/volume-b75a1ff5-606b-45ca-9a4a-b4327d6ff106@snapshot-a5f9935c-338a-4b48-a535-3237dd741809
( e3 O, c! j) ^1 }* [- a4 i4 N6 z[root@compute01 ~]# rbd children vms/volume-b75a1ff5-606b-45ca-9a4a-b4327d6ff106@snapshot-59a87052-1b6c-469a-a989-8ffaa38cc862
' q+ N3 d8 e4 k/ \; l- u2 d
! l9 R; G7 S& R2 |. z
" c7 }. e5 v6 F2 \7 z$ L通过snap删除:
1 j! P$ y4 r; B[root@compute01 ~]# rbd snap rm snapshot-59a87052-1b6c-469a-a989-8ffaa38cc8626 a: j1 O8 k9 X/ F
rbd: snapshot name was not specified
) D8 P1 P2 \2 J. q6 C! w1 y: e

3 n- f2 `& M# Q1 ^- C删除snap
2 ]  N! G( h7 R$ `& o
7 \; `( m: y3 ^[root@compute01 ~]# rbd snap rm vms/volume-b75a1ff5-606b-45ca-9a4a-b4327d6ff106@snapshot-59a87052-1b6c-469a-a989-8ffaa38cc862
% T  r' Z: @& U& aRemoving snap: 0% complete...failed.
! L) Z8 }! Y: N; k+ r+ b6 drbd: snapshot 'snapshot-59a87052-1b6c-469a-a989-8ffaa38cc862' is protected from removal.
1 G6 \  v# F9 ~8 K, M' @8 \0 o2021-10-19 14:28:08.361 7f33d8a03b00 -1 librbd::Operations: snapshot is protected4 U3 n% K6 ~9 \1 b5 y
2 C" O, e. t% B+ j3 j! v

" I# W1 A5 N' N; S+ G/ t" F5 Y4 k取消snap 保护:
( P$ [1 {0 ?0 G, e& m9 S[root@compute01 ~]# rbd snap unprotect vms/volume-b75a1ff5-606b-45ca-9a4a-b4327d6ff106@snapshot-59a87052-1b6c-469a-a989-8ffaa38cc862
. V3 {% ^, K' t8 R( s3 o. V" d4 @$ A0 w2 T& l0 w

; b+ F; y% \- w, {
3 ?6 D  [( u) M/ b0 m# q[root@compute01 ~]# rbd snap unprotect vms/volume-b75a1ff5-606b-45ca-9a4a-b4327d6ff106@snapshot-59a87052-1b6c-469a-a989-8ffaa38cc862@snap
5 i5 q9 k- |; w  w4 n: K, A1 Y! ]rbd: unprotecting snap failed: (2) No such file or directory  z# O  W! `' k2 q6 n# h% |
6 d  X: {, L1 h4 Y  T
再次执行:
+ t* @' d4 y/ h1 p8 G- m( |[root@compute01 ~]# rbd snap unprotect vms/volume-b75a1ff5-606b-45ca-9a4a-b4327d6ff106@snapshot-59a87052-1b6c-469a-a989-8ffaa38cc862% G7 i& B, B0 Z6 y
rbd: snap is already unprotected
: V9 B7 b# Y! b
: L3 v: }: Q( O! W9 ^% E- ?: E( ~+ a删除成功:" T2 [" A1 H; g1 Z: Q
[root@compute01 ~]# rbd snap rm vms/volume-b75a1ff5-606b-45ca-9a4a-b4327d6ff106@snapshot-59a87052-1b6c-469a-a989-8ffaa38cc8626 ^3 {3 t9 V/ B3 R! X7 ~5 O
Removing snap: 100% complete...done." E, ~$ I6 A" h
# o0 ~2 z; B0 r8 X) `% U
' u' g1 m/ }# O
[root@compute01 ~]# rbd snap rm vms/volume-b75a1ff5-606b-45ca-9a4a-b4327d6ff106@snapshot-a5f9935c-338a-4b48-a535-3237dd741809) K- {$ |% ]/ M4 t5 ~* J
Removing snap: 2021-10-19 14:29:05.450 7fe3d0f69b00 -1 librbd::Operations: snapshot is protected0% complete...failed.
; D- p# S' P6 W9 M/ Q& hrbd: snapshot 'snapshot-a5f9935c-338a-4b48-a535-3237dd741809' is protected from removal.
* z8 \# ]' S" R! M! I% ^) ?7 C  e$ S9 M# Y

! ~8 D, n+ h6 Q尝试第二个取消保护:; O# U" X- c3 }! a4 D9 Q% E2 T
[root@compute01 ~]# rbd snap unprotect vms/volume-b75a1ff5-606b-45ca-9a4a-b4327d6ff106@snapshot-a5f9935c-338a-4b48-a535-3237dd7418099 `8 ~+ _& T2 M4 k9 }
[root@compute01 ~]# rbd snap unprotect vms/volume-b75a1ff5-606b-45ca-9a4a-b4327d6ff106@snapshot-a5f9935c-338a-4b48-a535-3237dd741809
* ]0 x# h3 Y, Krbd: snap is already unprotected
5 o) w' B8 Y4 w( W% N删除snap,删除成功:
7 R" Z/ W, G3 q- [9 z[root@compute01 ~]# rbd snap rm vms/volume-b75a1ff5-606b-45ca-9a4a-b4327d6ff106@snapshot-a5f9935c-338a-4b48-a535-3237dd741809
9 f% n  u5 D) {5 gRemoving snap: 100% complete...done.3 s- o0 Q$ k1 J' S( `9 m2 s
% o. _  J0 u% U7 ]6 `) t$ l
查看snap 列表:
1 j) a7 {5 x6 q  i/ u" X6 i) p[root@compute01 ~]# rbd snap ls vms/volume-b75a1ff5-606b-45ca-9a4a-b4327d6ff106
) D2 x3 B5 f% w. K% k3 u
: p7 Q( ]% P/ Z9 \+ P3 L- R6 Z" q0 a9 U7 o3 Y  V) s
[root@compute01 ~]# rbd rm vms/volume-b75a1ff5-606b-45ca-9a4a-b4327d6ff106
4 b, J* ?% L' G. A( t2021-10-19 14:29:44.232 7fbf6dffb700 -1 librbd::image::PreRemoveRequest: 0x558c03e97860 check_image_watchers: image has watchers - not removing; S# b% }( }) H" W6 `4 [6 g/ K8 _
Removing image: 0% complete...failed.
4 `5 Q6 s5 e5 ?0 `  Z% {% irbd: error: image still has watchers
+ t9 M( y+ c8 _& G. D: u/ }& iThis 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.: p6 A/ _3 z9 B5 ?& t( z

8 R5 [3 P% \, d) J8 T4 A9 D6 @4 Y! }% Z0 C& e; Y3 U
查看运行状态:) E1 e( @4 e* c& B" Z
[root@compute01 ~]# rbd status  vms/volume-b75a1ff5-606b-45ca-9a4a-b4327d6ff106% |9 X' ]! X- t& A% {
Watchers:
' P# z% E% ?1 |* u; k0 C" R: \ watcher=192.168.0.77:0/3193690701 client.125123467 cookie=944245754766086 ?- r; V+ z$ E7 ?/ Z
[root@compute01 ~]# ceph osd bl
/ S+ t0 v$ b( j- p# h3 zblacklist   blocked-by
( p7 Y( `' }& d* j# T, }9 l" x& l7 ]6 r9 Q" V6 m# k$ g
添加黑名单:9 X. |1 a& ]6 H6 q) l
[root@compute01 ~]# ceph osd blacklist add 192.168.0.77:0/3193690701, N/ M3 f, N+ m. c3 {
blacklisting 192.168.0.77:0/3193690701 until 2021-10-19 15:30:19.739160 (3600 sec)
5 E8 H, A; ~8 \8 b9 Y! s" b/ H7 ]4 Q: g5 z" U3 O

8 E1 h5 k* }* Z, O再次删除镜像:
- N6 k' F. q: n) K+ W5 }[root@compute01 ~]# rbd rm vms/volume-b75a1ff5-606b-45ca-9a4a-b4327d6ff106; T1 H# L2 @' p/ h' v- K5 c
Removing image: 100% complete...done.
7 K* S2 q: H+ [/ z: _" b
, z+ x" c' x7 Y! h' T+ ?0 g" w  d# c; ~- b2 I4 P0 G" h+ [
成功删除镜像。! D5 p6 i4 B3 z0 M
8 X2 D; d* }8 o9 v3 t5 N: U# G3 U

# [) M. V4 H1 ?; j( R# I) U# e5 j, }3 B2 v. k; ?0 H5 @
 楼主| 发表于 2021-10-19 15:00:04 | 显示全部楼层
[root@compute01 ~]# rbd rm -p volumes volume-d16830f8-278c-4c80-9077-69648a4aef390 `+ D; j$ t" ~# H( ^+ Z# O1 ]
2021-10-19 14:41:32.746 7f34fe96bb00 -1 librbd::image::PreRemoveRequest: 0x55c40db0a720 check_image_snaps: image has snapshots - not removing
1 E, D# z; s9 i% {9 d% ERemoving image: 0% complete...failed.% L8 h" O& ?5 H& l
rbd: image has snapshots - these must be deleted with 'rbd snap purge' before the image can be removed.
% ]5 k# ?/ s  o: `+ p. ]0 O  |[root@compute01 ~]# rbd snap ls -p volumes volume-d16830f8-278c-4c80-9077-69648a4aef39' X( Z/ {3 T* x1 m* K3 v
SNAPID NAME                                          SIZE   PROTECTED TIMESTAMP               
6 Y/ h* [3 e; x; X( L   114 snapshot-e4c6ed5f-1ced-4af8-96cc-42c25d01bacf 20 GiB yes       Mon Oct 18 17:33:26 2021
( [# `! _4 S& x- k8 L. l' B$ B3 @) d; K4 X
[root@compute01 ~]# rbd snap rm volumes/volume-d16830f8-278c-4c80-9077-69648a4aef39@snapshot-e4c6ed5f-1ced-4af8-96cc-42c25d01bacf- K' [  p5 f& k# ]. W2 o% U
Removing snap: 2021-10-19 14:43:49.603 7f6d3ab14b00 -1 librbd::Operations: snapshot is protected0% complete...failed.# m4 D; x2 z. @6 i
rbd: snapshot 'snapshot-e4c6ed5f-1ced-4af8-96cc-42c25d01bacf' is protected from removal.- F: j5 I% Y1 M: C9 P& J0 Q! D+ Z
[root@compute01 ~]# rbd snap unprotect volumes/volume-d16830f8-278c-4c80-9077-69648a4aef39@snapshot-e4c6ed5f-1ced-4af8-96cc-42c25d01bacf6 W& \, M4 T8 O( ^+ B' A5 g
[root@compute01 ~]# rbd snap rm volumes/volume-d16830f8-278c-4c80-9077-69648a4aef39@snapshot-e4c6ed5f-1ced-4af8-96cc-42c25d01bacf8 N" r" P# J. u5 @4 O1 o
Removing snap: 100% complete...done.
% H+ e* e$ a; A) |! G[root@compute01 ~]# rbd rm -p volumes volume-d16830f8-278c-4c80-9077-69648a4aef39
3 c/ I. [! h& T+ U6 V  ]Removing image: 100% complete...done.; d! T! T- [( [$ J1 z6 H) u
您需要登录后才可以回帖 登录 | 开始注册

本版积分规则

关闭

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

如有购买积分卡请联系497906712

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

GMT+8, 2022-10-4 05:49 , Processed in 0.044923 second(s), 22 queries .

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

© 2012-2022 Comsenz Inc.

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