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

易陆发现论坛

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

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

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

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

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

x
删除时报错8 o, B& c1 L1 b* m* f) ^
[root@compute01 ~]# rbd rm -p vms volume-b75a1ff5-606b-45ca-9a4a-b4327d6ff106
* |/ h3 M8 H: i$ B6 s+ ]* Q2021-10-19 14:20:49.287 7fe204b32b00 -1 librbd::image::PreRemoveRequest: 0x563793d78b50 check_image_snaps: image has snapshots - not removing
9 a3 \. o# P5 _. f* A& qRemoving image: 0% complete...failed.
- {' s. k) `/ D; e4 Drbd: image has snapshots - these must be deleted with 'rbd snap purge' before the image can be removed.
+ T- @8 R; o. W2 A
( a# P2 m  a5 u3 h* K( }, {查看是否包含子镜像:: M% D/ U/ G4 ~5 J; |% v" M+ F
[root@compute01 ~]# rbd children vms/volume-b75a1ff5-606b-45ca-9a4a-b4327d6ff106
3 Z0 x4 G  l) T$ [  P: t) K1 J: ^" e: X# i( a
: I& C$ {0 D7 w  d0 N
查看snap信息:8 w- S  }5 _$ ]+ V' X
[root@compute01 ~]# rbd snap ls vms/volume-b75a1ff5-606b-45ca-9a4a-b4327d6ff106
# E2 s1 O+ @  W6 J3 `' h: lSNAPID NAME                                          SIZE  PROTECTED TIMESTAMP                # `# {: ]1 b8 P7 [2 J
    36 snapshot-a5f9935c-338a-4b48-a535-3237dd741809 1 GiB yes       Mon Oct 18 17:12:22 2021
- P6 A5 H+ m0 [- h# q6 C9 a    37 snapshot-59a87052-1b6c-469a-a989-8ffaa38cc862 1 GiB yes       Mon Oct 18 21:05:23 2021 ! H. g! D& ?2 ]4 K

: |, Q1 I' f& a* V5 |. p8 n分离flatten 镜像:) K0 T7 f5 A- \3 _% Q
[root@compute01 ~]#  rbd flatten vms/volume-b75a1ff5-606b-45ca-9a4a-b4327d6ff106
" @! \$ n( F" Q3 H4 N7 q9 A4 S, W3 HImage flatten: 0% complete...failed.! v. n1 @, y) H2 |  \' A) x3 q6 h& q
rbd: flatten error: (22) Invalid argument- z- K4 i. u9 g0 e* F; D" g5 x
2021-10-19 14:22:11.267 7f51fde1bb00 -1 librbd::Operations: image has no parent
' B6 ^. e. E3 ?$ g9 u, O7 a# X% b$ L4 p9 P4 r8 a
失败了:郁闷了:
* c% a, H7 P( T/ D( d# `  B& N/ @[root@compute01 ~]#  rbd flatten vms/volume-b75a1ff5-606b-45ca-9a4a-b4327d6ff106
# ]* `- q' j3 d/ s- L; B- p$ mImage flatten: 0% complete...failed.
4 T9 Q% i; h/ y2 j, O2 yrbd: flatten error: 2021-10-19 14:22:17.346 7fcfb671bb00 -1 librbd::Operations: image has no parent(22) Invalid argument
7 t( r  r6 `9 \/ d5 Z( e7 H* H( C3 f4 H. z, q" C
查看其他的依然没有办法:: P- c' }! X. e

! h2 f, p! v, F& l[root@compute01 ~]#  rbd flatten vms/snapshot-59a87052-1b6c-469a-a989-8ffaa38cc8623 _5 Z3 ^# ~  W9 H3 \6 A$ k
rbd: error opening image snapshot-59a87052-1b6c-469a-a989-8ffaa38cc862: (2) No such file or directory3 ]9 u" q# _; L. p
[root@compute01 ~]#  rbd children vms/volume-b75a1ff5-606b-45ca-9a4a-b4327d6ff106
) K. O' A8 v/ Z; @% H- \, G[root@compute01 ~]#  rbd flatten vms/snapshot-59a87052-1b6c-469a-a989-8ffaa38cc862
/ l5 N- m# c/ v, @" e  w) ^+ ]. urbd: error opening image snapshot-59a87052-1b6c-469a-a989-8ffaa38cc862: (2) No such file or directory
6 V# g$ n' e" n3 C$ l& H( \2 j$ |0 i: E
8 F" I  y' }! r6 m再次查看snap信息:
' a  `: T* C- j[root@compute01 ~]# rbd snap ls vms/volume-b75a1ff5-606b-45ca-9a4a-b4327d6ff106
! n  V7 L. {" H2 O* PSNAPID NAME                                          SIZE  PROTECTED TIMESTAMP               
  }$ W7 `' |8 v. c    36 snapshot-a5f9935c-338a-4b48-a535-3237dd741809 1 GiB yes       Mon Oct 18 17:12:22 2021 7 c! _5 E4 D6 H, @' w( J
    37 snapshot-59a87052-1b6c-469a-a989-8ffaa38cc862 1 GiB yes       Mon Oct 18 21:05:23 2021 " r( t6 e1 T7 U: L- \
[root@compute01 ~]# rbd snap
% J- ?8 {9 W( R8 aadd        create     limit      list       ls         protect    purge      remove     rename     revert     rm         rollback   unprotect  
& |9 H, i; X7 h5 B% i; i$ Y8 ^  \[root@compute01 ~]# rbd snap
' ?+ p2 I4 x7 p$ s0 G% Kadd        create     limit      list       ls         protect    purge      remove     rename     revert     rm         rollback   unprotect  + d" w' h% t2 p' I5 ]4 ^3 D
4 d. ^2 _" n" C3 E
8 }: n# F- ^# A7 ?% }6 l! z/ R9 N
尝试删除snap:
0 v9 o1 w3 x, U. c8 H0 B[root@compute01 ~]# rbd snap rm vms/volume-b75a1ff5-606b-45ca-9a4a-b4327d6ff106; `( a0 _3 g+ |1 ~. J$ U
rbd: snapshot name was not specified
, S) X/ \) f" V% ^" c+ C" m1 _8 V1 v: B" F+ Q! N6 a
检查snap ls状态:
# f4 T9 `+ B$ L8 E& D/ i/ q- Y7 L9 B[root@compute01 ~]# rbd snap ls vms/volume-b75a1ff5-606b-45ca-9a4a-b4327d6ff106@snapshot-59a87052-1b6c-469a-a989-8ffaa38cc862" P* s6 O) R2 p& ?. V
rbd: snapshot name specified for a command that doesn't use it
# W4 _: T  G1 E5 F4 K; R! ~
, @3 a: I( }2 d# V[root@compute01 ~]# rbd snap ls vms/snapshot-59a87052-1b6c-469a-a989-8ffaa38cc862
: o( Y# W5 d, M/ y2 w# w/ jrbd: error opening image snapshot-59a87052-1b6c-469a-a989-8ffaa38cc862: (2) No such file or directory
3 R3 K$ D- S6 ~* I
' \# r! @2 _  y1 {9 d9 v; Q$ L. b+ \/ j! y2 A" X" l
[root@compute01 ~]#  rbd flatten vms/snapshot-59a87052-1b6c-469a-a989-8ffaa38cc862
; H: I1 U3 I# u$ {$ J6 f9 trbd: error opening image snapshot-59a87052-1b6c-469a-a989-8ffaa38cc862: (2) No such file or directory+ x/ r" h. G0 L9 d4 o/ J3 |

# m# \& {7 v, Z0 U: m
% x2 g! L& ~# d% B) i[root@compute01 ~]# rbd snap ls vms/volume-b75a1ff5-606b-45ca-9a4a-b4327d6ff106
1 c) m5 a) G! c5 x# |6 r( lSNAPID NAME                                          SIZE  PROTECTED TIMESTAMP                ! y& A) w4 _) q. `, Y
    36 snapshot-a5f9935c-338a-4b48-a535-3237dd741809 1 GiB yes       Mon Oct 18 17:12:22 2021
1 L6 W2 g- L1 G! i3 S    37 snapshot-59a87052-1b6c-469a-a989-8ffaa38cc862 1 GiB yes       Mon Oct 18 21:05:23 2021
8 l! i5 `5 ]/ j( a1 _: y, X4 g+ i
( W$ l' W2 u0 F$ C: J[root@compute01 ~]# rbd children vms/volume-b75a1ff5-606b-45ca-9a4a-b4327d6ff106@snapshot-a5f9935c-338a-4b48-a535-3237dd741809' G( m% N; [* F, r& m# r3 x
[root@compute01 ~]# rbd children vms/volume-b75a1ff5-606b-45ca-9a4a-b4327d6ff106@snapshot-59a87052-1b6c-469a-a989-8ffaa38cc862
7 P- Q2 C! Y; a2 q& b3 c
$ r; t) u7 H' O( B' J& E# l
7 O6 o7 |+ z2 Q" l1 e  ]; l; C4 v1 t通过snap删除:7 X7 V% ^$ F. \
[root@compute01 ~]# rbd snap rm snapshot-59a87052-1b6c-469a-a989-8ffaa38cc862' B; \7 [) e. N
rbd: snapshot name was not specified
  @' b+ t# x- j: {+ j' {4 |! `( A% F0 B9 i0 [

6 f! |- V/ I; D: y- G删除snap
$ @- e7 ?+ U7 @8 b5 L) m" q
4 W; L# f8 h0 N+ g1 m! M! I, @- ^[root@compute01 ~]# rbd snap rm vms/volume-b75a1ff5-606b-45ca-9a4a-b4327d6ff106@snapshot-59a87052-1b6c-469a-a989-8ffaa38cc862! o. g6 k  R6 b# J
Removing snap: 0% complete...failed.
( v, T. a9 {' s: M2 O8 s" krbd: snapshot 'snapshot-59a87052-1b6c-469a-a989-8ffaa38cc862' is protected from removal.
9 S; z3 h4 A( r1 f2021-10-19 14:28:08.361 7f33d8a03b00 -1 librbd::Operations: snapshot is protected
9 ?! A/ E0 ]$ W: U, W6 P. J/ X9 `& S% s7 H& J

- Z% G( ^0 Y% ]( I5 a5 S& @& [% B取消snap 保护:1 h3 {2 @& I1 G% b% l
[root@compute01 ~]# rbd snap unprotect vms/volume-b75a1ff5-606b-45ca-9a4a-b4327d6ff106@snapshot-59a87052-1b6c-469a-a989-8ffaa38cc862( p: q9 S6 N4 l

2 \- n$ |& t1 M5 _7 }2 s
. ^7 W- x2 A' d4 w, t! j! q# e2 P0 B6 A( u4 g4 g
[root@compute01 ~]# rbd snap unprotect vms/volume-b75a1ff5-606b-45ca-9a4a-b4327d6ff106@snapshot-59a87052-1b6c-469a-a989-8ffaa38cc862@snap
8 c9 c9 i$ h" Y2 V" F* Srbd: unprotecting snap failed: (2) No such file or directory% Q% s2 a2 `: ]8 O+ T

2 Q9 F/ W* |5 F$ F/ d再次执行:; Y2 H  W2 U! g2 ]) |6 k5 @$ U3 H
[root@compute01 ~]# rbd snap unprotect vms/volume-b75a1ff5-606b-45ca-9a4a-b4327d6ff106@snapshot-59a87052-1b6c-469a-a989-8ffaa38cc8624 Y: y9 y3 D. j  q. N
rbd: snap is already unprotected3 s- I/ c  T; f8 ^
7 d0 Q$ Z  a$ ~+ r
删除成功:" @6 Y; W* h; e- z8 `
[root@compute01 ~]# rbd snap rm vms/volume-b75a1ff5-606b-45ca-9a4a-b4327d6ff106@snapshot-59a87052-1b6c-469a-a989-8ffaa38cc862& }5 R4 P; n" h$ @/ S+ c/ f# f5 U6 U% _
Removing snap: 100% complete...done.9 K9 ?) z* Z; W8 a2 k+ n. j
) G3 [- Z% g! j; N( O/ n; Q; d
. |0 A5 r2 G5 N: k- z# K. O
[root@compute01 ~]# rbd snap rm vms/volume-b75a1ff5-606b-45ca-9a4a-b4327d6ff106@snapshot-a5f9935c-338a-4b48-a535-3237dd741809
- m7 @( r$ }) F) N/ C7 {8 k, ~7 ^Removing snap: 2021-10-19 14:29:05.450 7fe3d0f69b00 -1 librbd::Operations: snapshot is protected0% complete...failed.$ G* V0 {" G% H9 s/ p; u9 Z* C
rbd: snapshot 'snapshot-a5f9935c-338a-4b48-a535-3237dd741809' is protected from removal." A" b- }  K- R. e  s# k/ r
; G2 W5 u0 I$ c

+ c2 }0 @: ^3 l尝试第二个取消保护:
' s; `' p$ f; k  r$ E[root@compute01 ~]# rbd snap unprotect vms/volume-b75a1ff5-606b-45ca-9a4a-b4327d6ff106@snapshot-a5f9935c-338a-4b48-a535-3237dd7418092 w0 U' {4 s6 ^6 @+ H+ I- k8 p
[root@compute01 ~]# rbd snap unprotect vms/volume-b75a1ff5-606b-45ca-9a4a-b4327d6ff106@snapshot-a5f9935c-338a-4b48-a535-3237dd741809; C( \- @3 P9 s% H( f. K" z& M+ u7 r% h
rbd: snap is already unprotected- V. @, W& c- h! _5 h! _
删除snap,删除成功:
# O3 r, z. D4 {0 K( B[root@compute01 ~]# rbd snap rm vms/volume-b75a1ff5-606b-45ca-9a4a-b4327d6ff106@snapshot-a5f9935c-338a-4b48-a535-3237dd741809
5 s7 f" g# {& CRemoving snap: 100% complete...done.
+ }, R% M* _3 N
4 [  @+ ^, u+ I( ^查看snap 列表:
$ v2 L! o& P# z8 f4 ^& ^[root@compute01 ~]# rbd snap ls vms/volume-b75a1ff5-606b-45ca-9a4a-b4327d6ff106
" o$ N6 l" e! p/ F  L: g; w4 A0 }/ a9 Z& M, y" z
3 H% v  B; `4 y* P
[root@compute01 ~]# rbd rm vms/volume-b75a1ff5-606b-45ca-9a4a-b4327d6ff106
# j3 m. b2 T% {* L6 z3 @9 u2021-10-19 14:29:44.232 7fbf6dffb700 -1 librbd::image::PreRemoveRequest: 0x558c03e97860 check_image_watchers: image has watchers - not removing
# ~  O2 o3 E5 ]Removing image: 0% complete...failed.& g2 H: n. n" {7 C
rbd: error: image still has watchers, h4 {, S) Q) k5 ]
This 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.# ?3 q6 S7 @7 u+ j) z9 U' S8 |. z
2 L" E7 Y3 d7 w- j5 p* G" c8 r* x
& P9 I# z6 x3 K
查看运行状态:  Q! m2 t* s! y& n! Y2 i! U. p
[root@compute01 ~]# rbd status  vms/volume-b75a1ff5-606b-45ca-9a4a-b4327d6ff1065 f7 f5 p) ]  Y: V/ `& w' ?
Watchers:. Q: r* z5 M- L. U  W4 j
watcher=192.168.0.77:0/3193690701 client.125123467 cookie=944245754766084 @  y5 P+ Q4 N2 S2 P
[root@compute01 ~]# ceph osd bl
* y% o9 |: e9 W6 }# `5 \' A3 s9 ablacklist   blocked-by. T5 ]% V8 J- B6 }; E+ r' }! O# j
3 w# O0 ~5 @9 j, L
添加黑名单:, o& l% @8 t, c1 i: V( l* b, ~
[root@compute01 ~]# ceph osd blacklist add 192.168.0.77:0/3193690701
5 s, B! y$ O7 g8 f) Jblacklisting 192.168.0.77:0/3193690701 until 2021-10-19 15:30:19.739160 (3600 sec). _) ^5 K$ a) Z9 i' N, S
3 J/ r+ I5 p( q+ x6 p: |# N

  ]0 G  {; I# A' H- a再次删除镜像:+ ?& h* ?9 |) c: s% a
[root@compute01 ~]# rbd rm vms/volume-b75a1ff5-606b-45ca-9a4a-b4327d6ff1066 Z$ i1 r" Y+ d# k
Removing image: 100% complete...done.
3 G* B& `: w7 G2 m+ F% T8 }
- ~9 t9 {" l5 e) Y5 K% p4 L% o5 n$ `  ^7 Y2 M7 z7 d2 T
成功删除镜像。% D3 Y  Y2 `# Z5 V7 p, m) i

- s) \- ~8 h' C" x7 H6 C
# B! @9 a/ K& c+ ]) `0 Y2 d
. t& p# T. w0 d2 B* M8 t% B" V, J$ d
 楼主| 发表于 2021-10-19 15:00:04 | 显示全部楼层
[root@compute01 ~]# rbd rm -p volumes volume-d16830f8-278c-4c80-9077-69648a4aef39
8 Q7 h! T9 Y  G2021-10-19 14:41:32.746 7f34fe96bb00 -1 librbd::image::PreRemoveRequest: 0x55c40db0a720 check_image_snaps: image has snapshots - not removing. D- c0 @3 m* n; g" l
Removing image: 0% complete...failed.0 y- ^- h5 `! F  U
rbd: image has snapshots - these must be deleted with 'rbd snap purge' before the image can be removed.6 d; U$ |- c7 B
[root@compute01 ~]# rbd snap ls -p volumes volume-d16830f8-278c-4c80-9077-69648a4aef39
) c  B2 r8 T" S5 x( C8 wSNAPID NAME                                          SIZE   PROTECTED TIMESTAMP               
4 Y1 l0 w# b3 B   114 snapshot-e4c6ed5f-1ced-4af8-96cc-42c25d01bacf 20 GiB yes       Mon Oct 18 17:33:26 2021
* s. L8 O/ y2 N- c
. B  \% ]; T( O1 A[root@compute01 ~]# rbd snap rm volumes/volume-d16830f8-278c-4c80-9077-69648a4aef39@snapshot-e4c6ed5f-1ced-4af8-96cc-42c25d01bacf: X( e# x) ^" v" }( D5 n2 r; m" i
Removing snap: 2021-10-19 14:43:49.603 7f6d3ab14b00 -1 librbd::Operations: snapshot is protected0% complete...failed.. ~% ~: H* R6 S9 Z& O' x
rbd: snapshot 'snapshot-e4c6ed5f-1ced-4af8-96cc-42c25d01bacf' is protected from removal.
  U0 a  L7 Z0 ^0 d! z[root@compute01 ~]# rbd snap unprotect volumes/volume-d16830f8-278c-4c80-9077-69648a4aef39@snapshot-e4c6ed5f-1ced-4af8-96cc-42c25d01bacf
+ [' @- F. W$ c1 M$ M2 q! }[root@compute01 ~]# rbd snap rm volumes/volume-d16830f8-278c-4c80-9077-69648a4aef39@snapshot-e4c6ed5f-1ced-4af8-96cc-42c25d01bacf
2 c6 P3 P0 J8 m0 O# h8 d' QRemoving snap: 100% complete...done.
0 L) n: _; S, n[root@compute01 ~]# rbd rm -p volumes volume-d16830f8-278c-4c80-9077-69648a4aef39
, k$ p4 E6 Q9 k2 n! p4 W% ]Removing image: 100% complete...done.$ M# G( T: o( y5 l" X' T: n
您需要登录后才可以回帖 登录 | 开始注册

本版积分规则

关闭

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

如有购买积分卡请联系497906712

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

GMT+8, 2021-11-28 19:39 , Processed in 0.046697 second(s), 22 queries .

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

© 2012-2022 Comsenz Inc.

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