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

易陆发现论坛

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

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

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

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

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

x
删除时报错- c; }$ b: n( n% q# ~  h* V
[root@compute01 ~]# rbd rm -p vms volume-b75a1ff5-606b-45ca-9a4a-b4327d6ff106
& i1 {. W* E0 L% E! |; X2021-10-19 14:20:49.287 7fe204b32b00 -1 librbd::image::PreRemoveRequest: 0x563793d78b50 check_image_snaps: image has snapshots - not removing( r, a7 \0 }# y) i6 C
Removing image: 0% complete...failed.9 E0 p7 _' l) z; G1 q' d0 s2 h
rbd: image has snapshots - these must be deleted with 'rbd snap purge' before the image can be removed.: A, @9 m! t* g! i$ Z& f
' F4 T# b" @/ p
查看是否包含子镜像:; N8 b# ~3 }5 E
[root@compute01 ~]# rbd children vms/volume-b75a1ff5-606b-45ca-9a4a-b4327d6ff1069 p' y8 r$ z3 z2 s, Q9 A: X6 U' j
  x: d" Z: W9 @0 p

) p% {* D6 g' r) C' Q查看snap信息:
/ |9 f7 W3 z) s/ L4 L2 J* j[root@compute01 ~]# rbd snap ls vms/volume-b75a1ff5-606b-45ca-9a4a-b4327d6ff106
5 t8 R$ j( @* {- `SNAPID NAME                                          SIZE  PROTECTED TIMESTAMP               
+ O; e0 F# I* D. h    36 snapshot-a5f9935c-338a-4b48-a535-3237dd741809 1 GiB yes       Mon Oct 18 17:12:22 2021 / z/ M9 r; x0 @0 m# ?" ]
    37 snapshot-59a87052-1b6c-469a-a989-8ffaa38cc862 1 GiB yes       Mon Oct 18 21:05:23 2021 . Y1 }$ x% {+ ^
" Q6 Z5 U6 T5 T$ i
分离flatten 镜像:
9 F! c6 ]6 p6 c& Q[root@compute01 ~]#  rbd flatten vms/volume-b75a1ff5-606b-45ca-9a4a-b4327d6ff106
6 @1 }9 E7 h# b. [  H* m1 ?3 V1 LImage flatten: 0% complete...failed.. e! W# j( z, G" C& J
rbd: flatten error: (22) Invalid argument3 P( ?* f7 X! `3 n) f% H
2021-10-19 14:22:11.267 7f51fde1bb00 -1 librbd::Operations: image has no parent
, @% [5 a( W- O# `( x
0 ?6 `$ B% s5 [" W& B# G失败了:郁闷了:
9 A) d9 D& c8 ?' ]6 e[root@compute01 ~]#  rbd flatten vms/volume-b75a1ff5-606b-45ca-9a4a-b4327d6ff106
: o; s9 z# [+ f+ P. L6 E7 BImage flatten: 0% complete...failed.; H" P( s, _- |' _. w* S4 B
rbd: flatten error: 2021-10-19 14:22:17.346 7fcfb671bb00 -1 librbd::Operations: image has no parent(22) Invalid argument
3 R0 E0 O# f8 t9 b/ H8 ?' K8 W& X+ \4 Z' q
查看其他的依然没有办法:3 k; f- ^0 X1 X
: w' k; C: b& {, H8 b6 e  }4 L
[root@compute01 ~]#  rbd flatten vms/snapshot-59a87052-1b6c-469a-a989-8ffaa38cc862+ d) s. i  x0 o% A1 \4 z+ N) v
rbd: error opening image snapshot-59a87052-1b6c-469a-a989-8ffaa38cc862: (2) No such file or directory4 U4 T3 X/ E. t7 e
[root@compute01 ~]#  rbd children vms/volume-b75a1ff5-606b-45ca-9a4a-b4327d6ff106
3 u$ H# H& {0 Q2 V[root@compute01 ~]#  rbd flatten vms/snapshot-59a87052-1b6c-469a-a989-8ffaa38cc862
: B0 \# s* h& [( H4 nrbd: error opening image snapshot-59a87052-1b6c-469a-a989-8ffaa38cc862: (2) No such file or directory9 |8 }" i0 A1 a0 K" P
( F& T7 t' d  |
再次查看snap信息:3 Q* J1 ~  m; g3 m' ~, a  e
[root@compute01 ~]# rbd snap ls vms/volume-b75a1ff5-606b-45ca-9a4a-b4327d6ff1064 l$ `2 s+ g* Y( y; e
SNAPID NAME                                          SIZE  PROTECTED TIMESTAMP                # @3 D* F9 C2 L! x- _1 \9 l
    36 snapshot-a5f9935c-338a-4b48-a535-3237dd741809 1 GiB yes       Mon Oct 18 17:12:22 2021
4 |( ]+ Y% B3 t* v3 X6 q4 m    37 snapshot-59a87052-1b6c-469a-a989-8ffaa38cc862 1 GiB yes       Mon Oct 18 21:05:23 2021
: w9 }! r/ P0 F8 y& D[root@compute01 ~]# rbd snap & s- a! ~' d8 ~/ [; F: w% ^+ d
add        create     limit      list       ls         protect    purge      remove     rename     revert     rm         rollback   unprotect  
- g5 D/ c2 B1 d6 D2 a+ r: U0 b) }[root@compute01 ~]# rbd snap
, d2 N0 `! p* m7 q: madd        create     limit      list       ls         protect    purge      remove     rename     revert     rm         rollback   unprotect  
% [3 }9 l" L8 d, K+ j6 @
. x* A$ P8 ?9 p( K) I
( Y' v- \3 h6 C- `$ w  R尝试删除snap:
0 A! [! z* q0 G& _$ B[root@compute01 ~]# rbd snap rm vms/volume-b75a1ff5-606b-45ca-9a4a-b4327d6ff106& B9 _! j6 G7 M( ]  j- B$ y( Q
rbd: snapshot name was not specified4 G/ {3 ^5 G9 l  ~7 c
1 i1 L% D5 g6 r* ^: ^4 O$ X
检查snap ls状态:
! d& H; u! A7 m( }7 _1 ]! t+ g3 z[root@compute01 ~]# rbd snap ls vms/volume-b75a1ff5-606b-45ca-9a4a-b4327d6ff106@snapshot-59a87052-1b6c-469a-a989-8ffaa38cc862
. `# D% [; S" J, E6 Y/ Y3 _rbd: snapshot name specified for a command that doesn't use it
3 q0 |0 f7 v7 x7 D+ k" \
4 I1 F7 P& j1 I  B* k, ?[root@compute01 ~]# rbd snap ls vms/snapshot-59a87052-1b6c-469a-a989-8ffaa38cc862$ G) Q3 ~6 f: w3 r
rbd: error opening image snapshot-59a87052-1b6c-469a-a989-8ffaa38cc862: (2) No such file or directory
6 \6 `7 n0 ]% s7 _( m5 Y5 C% y) @0 d) ], l6 p% V! a" V
" c, M- x  T: I& l/ F* V. M
[root@compute01 ~]#  rbd flatten vms/snapshot-59a87052-1b6c-469a-a989-8ffaa38cc862: G$ q# o  x) }' W
rbd: error opening image snapshot-59a87052-1b6c-469a-a989-8ffaa38cc862: (2) No such file or directory0 }) `4 `  v5 m) n; d' M1 d
; _: z3 T1 \  E! J

6 }& d* ?2 g7 B- s$ w[root@compute01 ~]# rbd snap ls vms/volume-b75a1ff5-606b-45ca-9a4a-b4327d6ff106
0 a, t3 O. h' H# Q( u* P# d3 _SNAPID NAME                                          SIZE  PROTECTED TIMESTAMP               
5 k8 q+ x! Y0 I7 S    36 snapshot-a5f9935c-338a-4b48-a535-3237dd741809 1 GiB yes       Mon Oct 18 17:12:22 2021 : e! Q1 ], B9 @3 G# i" I
    37 snapshot-59a87052-1b6c-469a-a989-8ffaa38cc862 1 GiB yes       Mon Oct 18 21:05:23 2021 & W# I# Z+ R7 b( h5 ^9 P/ ^4 v
7 d5 J9 ]5 h% `# r
[root@compute01 ~]# rbd children vms/volume-b75a1ff5-606b-45ca-9a4a-b4327d6ff106@snapshot-a5f9935c-338a-4b48-a535-3237dd741809+ Y9 S2 c& ]/ X: L* u
[root@compute01 ~]# rbd children vms/volume-b75a1ff5-606b-45ca-9a4a-b4327d6ff106@snapshot-59a87052-1b6c-469a-a989-8ffaa38cc862
# w) ^' t5 ~  w9 g, U' c  T, x6 s; m; q- q

1 A$ V1 Y$ d& |通过snap删除:
" Q0 K6 H% L) p+ v[root@compute01 ~]# rbd snap rm snapshot-59a87052-1b6c-469a-a989-8ffaa38cc862* a, N$ [( n3 I: Q$ a5 G# W& w
rbd: snapshot name was not specified
% l% ~- R4 Q& M
( h& e8 G3 _& l2 q+ ]7 Y
6 a$ X/ |2 W! e5 M/ j删除snap
) e7 G% A' J) ^1 i1 g* W! U" ~0 ^) j. e# U
[root@compute01 ~]# rbd snap rm vms/volume-b75a1ff5-606b-45ca-9a4a-b4327d6ff106@snapshot-59a87052-1b6c-469a-a989-8ffaa38cc862" n* d7 A  H# y7 R: t: s( v
Removing snap: 0% complete...failed.
2 X) G8 N5 Q! F1 irbd: snapshot 'snapshot-59a87052-1b6c-469a-a989-8ffaa38cc862' is protected from removal.
! }6 c3 Z- c/ R& M! o, `; d2021-10-19 14:28:08.361 7f33d8a03b00 -1 librbd::Operations: snapshot is protected! R$ M+ j- A& [/ D2 |! Y
  @, r4 Q0 R8 U
0 n" G6 N1 x+ G8 u1 e: s
取消snap 保护:
3 a$ @7 o' g1 L4 V6 Z( ~# u: U6 j[root@compute01 ~]# rbd snap unprotect vms/volume-b75a1ff5-606b-45ca-9a4a-b4327d6ff106@snapshot-59a87052-1b6c-469a-a989-8ffaa38cc862
4 z: E% ]8 B. h5 Y1 J) r: t4 Z; I
* v4 ^$ q& A! l, D9 D$ F
' X* J) t. O3 e9 {/ P5 b
[root@compute01 ~]# rbd snap unprotect vms/volume-b75a1ff5-606b-45ca-9a4a-b4327d6ff106@snapshot-59a87052-1b6c-469a-a989-8ffaa38cc862@snap" G: p# f# F  t% M6 X
rbd: unprotecting snap failed: (2) No such file or directory
4 @% r9 ^9 P& L6 f$ V; ]4 T8 V' h% f% P. H. K+ A
再次执行:
6 F+ t0 d, [8 O% X[root@compute01 ~]# rbd snap unprotect vms/volume-b75a1ff5-606b-45ca-9a4a-b4327d6ff106@snapshot-59a87052-1b6c-469a-a989-8ffaa38cc862
. @' t! J2 j2 F2 J: k6 Wrbd: snap is already unprotected
: n" q0 n! g  ?' O! L
$ r/ W0 S/ I! N8 T5 ~删除成功:6 a4 f. Y! J6 d1 r7 D" ]# G
[root@compute01 ~]# rbd snap rm vms/volume-b75a1ff5-606b-45ca-9a4a-b4327d6ff106@snapshot-59a87052-1b6c-469a-a989-8ffaa38cc862
% o. ~9 _5 U  i- S. mRemoving snap: 100% complete...done.
( M% o6 ?( ?+ V8 Q; ^2 D& U  Q  U! V: Z! k  g0 ^: G; F; v! [
! s- u7 M& m) v4 l
[root@compute01 ~]# rbd snap rm vms/volume-b75a1ff5-606b-45ca-9a4a-b4327d6ff106@snapshot-a5f9935c-338a-4b48-a535-3237dd741809# k( C& D5 G" I2 [
Removing snap: 2021-10-19 14:29:05.450 7fe3d0f69b00 -1 librbd::Operations: snapshot is protected0% complete...failed.
; ~3 b* }# E" H2 t& Z2 ]7 j3 w" p) srbd: snapshot 'snapshot-a5f9935c-338a-4b48-a535-3237dd741809' is protected from removal.1 H1 J& e- L! b) D% D
* ?* b' b7 n/ M! v) r

+ M1 x) G- P2 O尝试第二个取消保护:
3 o9 d7 @/ |) V, l4 M[root@compute01 ~]# rbd snap unprotect vms/volume-b75a1ff5-606b-45ca-9a4a-b4327d6ff106@snapshot-a5f9935c-338a-4b48-a535-3237dd741809+ c& p  Y/ h3 k* n8 i' G
[root@compute01 ~]# rbd snap unprotect vms/volume-b75a1ff5-606b-45ca-9a4a-b4327d6ff106@snapshot-a5f9935c-338a-4b48-a535-3237dd741809! k& s' s: z* i4 M% M  D# a) f+ Q6 V
rbd: snap is already unprotected' e5 D* O4 q# x0 s$ _5 x: {. M/ D: W! Q8 `
删除snap,删除成功:* X) V: z) s8 [8 o0 J9 y
[root@compute01 ~]# rbd snap rm vms/volume-b75a1ff5-606b-45ca-9a4a-b4327d6ff106@snapshot-a5f9935c-338a-4b48-a535-3237dd7418095 `! m; a6 C9 \" v
Removing snap: 100% complete...done.
: l7 V, B- V4 x& g6 j- `+ o7 R6 }" `' p/ y! Z
查看snap 列表:; r7 g$ i$ f+ F# ?/ n, N; k. [
[root@compute01 ~]# rbd snap ls vms/volume-b75a1ff5-606b-45ca-9a4a-b4327d6ff106
  {$ \3 Q# r3 K
5 H; ?8 W8 _) i) H9 Y9 ^3 y( S0 D- c
[root@compute01 ~]# rbd rm vms/volume-b75a1ff5-606b-45ca-9a4a-b4327d6ff106  [" Z) m! ~+ i( J
2021-10-19 14:29:44.232 7fbf6dffb700 -1 librbd::image::PreRemoveRequest: 0x558c03e97860 check_image_watchers: image has watchers - not removing, ~% A7 B4 [4 s6 {
Removing image: 0% complete...failed." N) a' m  |$ B$ |% T2 v
rbd: error: image still has watchers8 n5 v( o/ U7 I
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.0 B4 L1 M. [  W- {7 b1 E; f! L

& ?1 U& s: Q. u' O, ]
2 Y) i9 U/ @- ]  S5 k# n$ S# f查看运行状态:- n- q$ E' p' S2 u& q& t- b+ `
[root@compute01 ~]# rbd status  vms/volume-b75a1ff5-606b-45ca-9a4a-b4327d6ff106
4 a( @7 g5 D9 F2 \$ e+ sWatchers:+ u% N, T# l) N
watcher=192.168.0.77:0/3193690701 client.125123467 cookie=94424575476608
5 N% Z; i  J( h[root@compute01 ~]# ceph osd bl0 ^% f3 }) ~+ E4 E; Z
blacklist   blocked-by# F" X; E6 ?) G! c, q

: T+ ?1 G, J) c6 ?  x添加黑名单:4 {* }- L$ |$ A* B: }' N, x+ R! Q5 ]
[root@compute01 ~]# ceph osd blacklist add 192.168.0.77:0/31936907017 G, ^3 @" Y; {$ c4 ]
blacklisting 192.168.0.77:0/3193690701 until 2021-10-19 15:30:19.739160 (3600 sec)
3 n- S% o/ w. ]# T
# g' C2 f0 P" s# G
3 L1 G% Q. `8 D1 k5 A再次删除镜像:# x' {) V% B( q" }
[root@compute01 ~]# rbd rm vms/volume-b75a1ff5-606b-45ca-9a4a-b4327d6ff106- u/ w1 Q3 n. A  Z# k$ L  A1 N7 e8 D! R
Removing image: 100% complete...done.1 b2 _! F0 K* n3 u: U

5 a) W4 ^1 W0 z1 J8 f. y! n& }1 w' p4 l- j' |+ J  ?
成功删除镜像。, [6 `% c5 x2 ~4 Q

; B9 Q  y( y& Z( N# V; t, N+ }1 {8 {, f
: f6 v! \3 G2 j& k+ Q0 i1 w7 g( j
 楼主| 发表于 2021-10-19 15:00:04 | 显示全部楼层
[root@compute01 ~]# rbd rm -p volumes volume-d16830f8-278c-4c80-9077-69648a4aef39
7 ?# v1 l/ |  U) V( B* f$ Q" e2021-10-19 14:41:32.746 7f34fe96bb00 -1 librbd::image::PreRemoveRequest: 0x55c40db0a720 check_image_snaps: image has snapshots - not removing3 i5 f0 a$ R) U! x2 f) R, ?# M$ U4 e
Removing image: 0% complete...failed.- m, U7 _- z- F6 k. J$ O! F
rbd: image has snapshots - these must be deleted with 'rbd snap purge' before the image can be removed.. J/ ]) @2 K& W  e& s9 I7 j$ Q% b
[root@compute01 ~]# rbd snap ls -p volumes volume-d16830f8-278c-4c80-9077-69648a4aef39
, D5 p( K% `- D5 [. i0 mSNAPID NAME                                          SIZE   PROTECTED TIMESTAMP                  g, L, T9 `4 V/ h6 `
   114 snapshot-e4c6ed5f-1ced-4af8-96cc-42c25d01bacf 20 GiB yes       Mon Oct 18 17:33:26 2021
  O: d  y: G9 u8 z; w2 ^/ L; E  L: V
2 Q2 p/ R) M- H$ |3 w6 B2 F% p% G[root@compute01 ~]# rbd snap rm volumes/volume-d16830f8-278c-4c80-9077-69648a4aef39@snapshot-e4c6ed5f-1ced-4af8-96cc-42c25d01bacf
% `3 `6 r& u; u9 C5 f6 y! H" ~Removing snap: 2021-10-19 14:43:49.603 7f6d3ab14b00 -1 librbd::Operations: snapshot is protected0% complete...failed." q# |. N3 T8 o: `% F2 a9 K: z
rbd: snapshot 'snapshot-e4c6ed5f-1ced-4af8-96cc-42c25d01bacf' is protected from removal.
% [4 }: f+ ~; I. x% }: L& W[root@compute01 ~]# rbd snap unprotect volumes/volume-d16830f8-278c-4c80-9077-69648a4aef39@snapshot-e4c6ed5f-1ced-4af8-96cc-42c25d01bacf
* P$ I& l- T' {8 H) w% [2 M" E# x" w3 i[root@compute01 ~]# rbd snap rm volumes/volume-d16830f8-278c-4c80-9077-69648a4aef39@snapshot-e4c6ed5f-1ced-4af8-96cc-42c25d01bacf
& ~2 D* u5 j  [* R; IRemoving snap: 100% complete...done.7 F* z4 V! B$ e+ P4 c- ^- k( G0 ?
[root@compute01 ~]# rbd rm -p volumes volume-d16830f8-278c-4c80-9077-69648a4aef39
# V3 k' a, {4 q1 o3 n! xRemoving image: 100% complete...done.
3 V+ n$ h) A) _. `0 L: K% k
您需要登录后才可以回帖 登录 | 开始注册

本版积分规则

关闭

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

如有购买积分卡请联系497906712

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

GMT+8, 2023-2-1 01:32 , Processed in 0.046572 second(s), 21 queries .

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

© 2012-2022 Comsenz Inc.

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