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

易陆发现论坛

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

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

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

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

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

x
删除时报错: C. e5 T) C5 O' v0 Z) Y
[root@compute01 ~]# rbd rm -p vms volume-b75a1ff5-606b-45ca-9a4a-b4327d6ff106
- z1 B; c: i% O) M, j( u) N2021-10-19 14:20:49.287 7fe204b32b00 -1 librbd::image::PreRemoveRequest: 0x563793d78b50 check_image_snaps: image has snapshots - not removing
# U2 N! G8 K# H! m" qRemoving image: 0% complete...failed.- C4 a% ?5 M# _* L% A0 l
rbd: image has snapshots - these must be deleted with 'rbd snap purge' before the image can be removed.; c. P# W3 l+ u* a4 K
% A0 X' i8 }! J/ C  ]- W6 \
查看是否包含子镜像:
' a0 i, G( {& T9 D0 Q[root@compute01 ~]# rbd children vms/volume-b75a1ff5-606b-45ca-9a4a-b4327d6ff106
& A7 D) G4 B/ J$ H1 l+ s+ Z
  |7 l% i( a5 o/ G! y8 V
+ z( ~% k/ y( D7 I) h( Q5 G$ u查看snap信息:
% o+ y& a- g2 Q9 k; p* v; H( S[root@compute01 ~]# rbd snap ls vms/volume-b75a1ff5-606b-45ca-9a4a-b4327d6ff106
7 R) v: d/ Y8 v! USNAPID NAME                                          SIZE  PROTECTED TIMESTAMP               
. G9 Z, M- x; Y/ e    36 snapshot-a5f9935c-338a-4b48-a535-3237dd741809 1 GiB yes       Mon Oct 18 17:12:22 2021
3 e# j0 Z! W) {$ t; E    37 snapshot-59a87052-1b6c-469a-a989-8ffaa38cc862 1 GiB yes       Mon Oct 18 21:05:23 2021 ; B4 {- {) h4 K- z

+ S  p$ X( L, h3 p& I分离flatten 镜像:, h6 v! i1 `$ K4 M
[root@compute01 ~]#  rbd flatten vms/volume-b75a1ff5-606b-45ca-9a4a-b4327d6ff106
5 C5 H5 C9 @, J) M8 ZImage flatten: 0% complete...failed.* p2 y+ Q3 P8 K! v# p
rbd: flatten error: (22) Invalid argument
0 h' D, L7 L/ F* e& y3 j( L: O2021-10-19 14:22:11.267 7f51fde1bb00 -1 librbd::Operations: image has no parent# ^. U6 ^7 N% ?7 P4 L* w  x/ |* r

; B: m4 ~% O# p6 q$ j7 N3 Q失败了:郁闷了:  c9 {7 C. z: \( d4 Q' X# N
[root@compute01 ~]#  rbd flatten vms/volume-b75a1ff5-606b-45ca-9a4a-b4327d6ff106
+ m; m0 q( ]2 p  |7 p; mImage flatten: 0% complete...failed.
; a6 k- ~& P+ N+ b0 lrbd: flatten error: 2021-10-19 14:22:17.346 7fcfb671bb00 -1 librbd::Operations: image has no parent(22) Invalid argument
7 A# N1 R/ K1 x4 n* e: _. `! B
# D/ E) G6 n; \% h4 P1 u- U查看其他的依然没有办法:) d6 i& D" M/ _" D& F8 }# x: W

0 Q9 j# c. p7 u7 o* m[root@compute01 ~]#  rbd flatten vms/snapshot-59a87052-1b6c-469a-a989-8ffaa38cc862
1 H; Q. |$ Y$ e0 W4 Orbd: error opening image snapshot-59a87052-1b6c-469a-a989-8ffaa38cc862: (2) No such file or directory
) X6 A! i* E7 j" h& L[root@compute01 ~]#  rbd children vms/volume-b75a1ff5-606b-45ca-9a4a-b4327d6ff1066 q' v9 `% p5 x+ j' y
[root@compute01 ~]#  rbd flatten vms/snapshot-59a87052-1b6c-469a-a989-8ffaa38cc862
  ^4 L- Y/ }# xrbd: error opening image snapshot-59a87052-1b6c-469a-a989-8ffaa38cc862: (2) No such file or directory3 @9 o/ L. r. x2 ^8 }* R  O

' Z7 \; ^& }: ^4 v8 [: U8 `再次查看snap信息:
: f, `) l% i  u8 W+ y[root@compute01 ~]# rbd snap ls vms/volume-b75a1ff5-606b-45ca-9a4a-b4327d6ff1064 H( a2 R) s/ O
SNAPID NAME                                          SIZE  PROTECTED TIMESTAMP                - ?- w+ F6 _4 T8 \3 c) ^& q
    36 snapshot-a5f9935c-338a-4b48-a535-3237dd741809 1 GiB yes       Mon Oct 18 17:12:22 2021 - P, e. b! V$ P' C( o3 o
    37 snapshot-59a87052-1b6c-469a-a989-8ffaa38cc862 1 GiB yes       Mon Oct 18 21:05:23 2021
& B' x/ R. x. m, \. [[root@compute01 ~]# rbd snap
; ]; y( h5 y8 E. ~0 i' \add        create     limit      list       ls         protect    purge      remove     rename     revert     rm         rollback   unprotect  
5 z5 l% y# A& S[root@compute01 ~]# rbd snap ' F  L: ?1 ~  H1 |7 C$ b, H
add        create     limit      list       ls         protect    purge      remove     rename     revert     rm         rollback   unprotect  
  J, \6 V' ~# d8 E# a; e6 D- S1 D5 o8 j: C, A

5 u' |1 q: S' s7 @2 }0 j尝试删除snap:. M$ F' U$ b% }8 D  t/ a0 K9 U# ~
[root@compute01 ~]# rbd snap rm vms/volume-b75a1ff5-606b-45ca-9a4a-b4327d6ff1066 E( m! s  w7 t7 c$ R
rbd: snapshot name was not specified2 N- T, h- b$ |% b0 q2 S5 |
4 @5 H' Y# _3 `
检查snap ls状态:
7 h3 o) a8 `$ [' p& d6 }! J( C" p& I[root@compute01 ~]# rbd snap ls vms/volume-b75a1ff5-606b-45ca-9a4a-b4327d6ff106@snapshot-59a87052-1b6c-469a-a989-8ffaa38cc8627 ^! B+ s4 |  c
rbd: snapshot name specified for a command that doesn't use it2 }3 |, D# d5 l2 y) K. x5 [

6 X, Y" X  d9 |- x$ [& I[root@compute01 ~]# rbd snap ls vms/snapshot-59a87052-1b6c-469a-a989-8ffaa38cc862
2 k, ^' `. i% X0 qrbd: error opening image snapshot-59a87052-1b6c-469a-a989-8ffaa38cc862: (2) No such file or directory
; x! z: i5 z( O! V
+ Q* \, c- F4 S7 Q( I  B+ S" K
/ H+ w4 X! b+ H3 {[root@compute01 ~]#  rbd flatten vms/snapshot-59a87052-1b6c-469a-a989-8ffaa38cc862* s, h8 [' z, w: Y5 l
rbd: error opening image snapshot-59a87052-1b6c-469a-a989-8ffaa38cc862: (2) No such file or directory+ ~9 X5 g; r" V4 s8 g9 m
& n; ]6 R* n! a0 q3 \

  ~+ H& F6 I& O[root@compute01 ~]# rbd snap ls vms/volume-b75a1ff5-606b-45ca-9a4a-b4327d6ff106+ x, Y- H- o) ?
SNAPID NAME                                          SIZE  PROTECTED TIMESTAMP                + z2 O; e# o3 Z- q+ D& r# C. N
    36 snapshot-a5f9935c-338a-4b48-a535-3237dd741809 1 GiB yes       Mon Oct 18 17:12:22 2021
( T9 o& `7 P8 e8 \1 c: }3 ~    37 snapshot-59a87052-1b6c-469a-a989-8ffaa38cc862 1 GiB yes       Mon Oct 18 21:05:23 2021
- k$ d! @; M$ \. ?1 b0 L8 L/ _3 b
. K2 p2 I3 ~) A# |; _, g" c/ }[root@compute01 ~]# rbd children vms/volume-b75a1ff5-606b-45ca-9a4a-b4327d6ff106@snapshot-a5f9935c-338a-4b48-a535-3237dd741809
9 T4 }+ H$ Y) [; y- U[root@compute01 ~]# rbd children vms/volume-b75a1ff5-606b-45ca-9a4a-b4327d6ff106@snapshot-59a87052-1b6c-469a-a989-8ffaa38cc862& r7 D  F0 `/ b& G
$ H+ b$ j1 Y# H( Y+ `! M7 S& \: j6 r- `
. P* w/ e+ G4 b$ o
通过snap删除:
% l5 V2 _5 F% Y  P- s) \6 A2 a[root@compute01 ~]# rbd snap rm snapshot-59a87052-1b6c-469a-a989-8ffaa38cc862" d- g) d3 y7 h
rbd: snapshot name was not specified
9 C1 s7 S' w+ O$ t
: H8 F& X+ b3 x
" H6 O% a# Y  l9 Q- V删除snap1 Q6 k# {, i# J6 e% c  D

3 ^" T2 a" U- L: ?! N. K4 U[root@compute01 ~]# rbd snap rm vms/volume-b75a1ff5-606b-45ca-9a4a-b4327d6ff106@snapshot-59a87052-1b6c-469a-a989-8ffaa38cc8629 N) X( I1 R8 x
Removing snap: 0% complete...failed.
, `) b- \5 z1 x3 y% A/ vrbd: snapshot 'snapshot-59a87052-1b6c-469a-a989-8ffaa38cc862' is protected from removal.
2 t8 v. T& P! \7 j  R2021-10-19 14:28:08.361 7f33d8a03b00 -1 librbd::Operations: snapshot is protected
" B7 ]6 p. G7 |+ C5 A5 G* ^  R: U9 m- e
& u, k# M: |1 m5 i" u1 Y  S6 L
取消snap 保护:+ A$ H% S1 R* s1 P* Z0 V
[root@compute01 ~]# rbd snap unprotect vms/volume-b75a1ff5-606b-45ca-9a4a-b4327d6ff106@snapshot-59a87052-1b6c-469a-a989-8ffaa38cc862
* }; j; Q4 r/ I6 ?" A6 z
" O: r* z/ X# G- _$ S6 [& u
  N- c- y# V  {6 s
" n8 h& {  g( p5 n) d. ~[root@compute01 ~]# rbd snap unprotect vms/volume-b75a1ff5-606b-45ca-9a4a-b4327d6ff106@snapshot-59a87052-1b6c-469a-a989-8ffaa38cc862@snap; q, `5 Y8 G' R6 M# ]0 s
rbd: unprotecting snap failed: (2) No such file or directory
3 ^: E" w: {0 x- z( U$ Q3 J
( J6 M3 l4 k. [( i7 N1 t( Y再次执行:
" _  Y8 _  N; s8 Q7 W2 G) `6 o[root@compute01 ~]# rbd snap unprotect vms/volume-b75a1ff5-606b-45ca-9a4a-b4327d6ff106@snapshot-59a87052-1b6c-469a-a989-8ffaa38cc862  i4 s, B. ~. o5 c+ `, v
rbd: snap is already unprotected) |9 r3 c  l" ?( n3 [# ?) F

4 j4 B" E, G" R  h* q$ Z& {  A! ~: N7 U删除成功:
$ r) q( v+ z8 o! ]4 f* ^[root@compute01 ~]# rbd snap rm vms/volume-b75a1ff5-606b-45ca-9a4a-b4327d6ff106@snapshot-59a87052-1b6c-469a-a989-8ffaa38cc862. p2 y- u$ A8 ]& `, ^2 Z6 ]
Removing snap: 100% complete...done.
' y$ y9 e- M# l. }, _9 N5 j9 k# d5 R* ], W. w& h6 j1 P) F  K

* t( ~  x: ~. }- L3 G* Q  Z[root@compute01 ~]# rbd snap rm vms/volume-b75a1ff5-606b-45ca-9a4a-b4327d6ff106@snapshot-a5f9935c-338a-4b48-a535-3237dd741809) a% p/ G  H% `
Removing snap: 2021-10-19 14:29:05.450 7fe3d0f69b00 -1 librbd::Operations: snapshot is protected0% complete...failed.
2 }6 v6 Y, s& j5 g( i- D5 yrbd: snapshot 'snapshot-a5f9935c-338a-4b48-a535-3237dd741809' is protected from removal.
* J9 K1 T" o: I% o7 k7 W
6 `4 U3 X9 n( g6 N% w6 a0 c; }  p) S
尝试第二个取消保护:
% x1 E8 f2 I, ^, q1 f; ][root@compute01 ~]# rbd snap unprotect vms/volume-b75a1ff5-606b-45ca-9a4a-b4327d6ff106@snapshot-a5f9935c-338a-4b48-a535-3237dd741809
5 e: E# \. j" l* [4 y0 I8 L/ x[root@compute01 ~]# rbd snap unprotect vms/volume-b75a1ff5-606b-45ca-9a4a-b4327d6ff106@snapshot-a5f9935c-338a-4b48-a535-3237dd741809
5 D' H" C5 b9 g3 O# Erbd: snap is already unprotected5 z+ w. [! A4 h; f! ^; V+ @( `
删除snap,删除成功:+ x1 |4 C8 i3 l
[root@compute01 ~]# rbd snap rm vms/volume-b75a1ff5-606b-45ca-9a4a-b4327d6ff106@snapshot-a5f9935c-338a-4b48-a535-3237dd741809$ `! K/ F; ~( ]
Removing snap: 100% complete...done.
; r) ^- h0 }, d
- W9 H; Z# m  M# j查看snap 列表:
' c! X" }) k! a$ a# d[root@compute01 ~]# rbd snap ls vms/volume-b75a1ff5-606b-45ca-9a4a-b4327d6ff106
* ^  Q, e1 R6 Z! O: {. ^7 \1 p/ y2 G5 B0 H2 x4 p0 `
) e6 ?( W# F- Q3 v
[root@compute01 ~]# rbd rm vms/volume-b75a1ff5-606b-45ca-9a4a-b4327d6ff106
7 g1 p& }! R# _8 S8 v2021-10-19 14:29:44.232 7fbf6dffb700 -1 librbd::image::PreRemoveRequest: 0x558c03e97860 check_image_watchers: image has watchers - not removing
0 @0 Y6 |3 w, A% |% jRemoving image: 0% complete...failed.( `6 V# @7 X) C+ c/ i, Z0 _
rbd: error: image still has watchers
% [" W- k) J. \( H  |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.
6 s8 q* ]# Z% [9 N4 q" ?
8 q. V, L$ g) x! {) _. c9 j" r' {3 x  M& f% |# Z
查看运行状态:, j: c3 _7 V) [7 r8 W9 U
[root@compute01 ~]# rbd status  vms/volume-b75a1ff5-606b-45ca-9a4a-b4327d6ff106- F( j9 H3 d- s' o% m! {7 g
Watchers:, \8 S& t6 L0 {: s9 ]5 [3 r7 g' v
watcher=192.168.0.77:0/3193690701 client.125123467 cookie=94424575476608& B( f' x# t% V2 l7 E2 I/ n
[root@compute01 ~]# ceph osd bl
: u, a6 I+ u* L" F$ {) h% vblacklist   blocked-by3 {5 T" v5 R: K# G  a$ O
2 W$ Z( \; E* ]; O6 o+ k# d
添加黑名单:
- w# Z& i2 X. C. [0 A, A, \! \7 c9 [[root@compute01 ~]# ceph osd blacklist add 192.168.0.77:0/3193690701* @5 i7 S( |& @* Z" K* d& F% s
blacklisting 192.168.0.77:0/3193690701 until 2021-10-19 15:30:19.739160 (3600 sec)4 s: W4 ?* X7 J
$ z) O3 T0 R8 o# I. O
) a; U1 G: Z2 u8 _" j4 }
再次删除镜像:; U3 X1 n# }: V3 b4 h
[root@compute01 ~]# rbd rm vms/volume-b75a1ff5-606b-45ca-9a4a-b4327d6ff106
. r# y* a: R5 M" l8 A4 VRemoving image: 100% complete...done.
0 X, Q) c' m( V& {3 R! M; L  s( d7 ]* \8 n7 V: u+ E+ W- [% @: z
" T  _+ H9 Y5 L8 w; D/ ^
成功删除镜像。% L. V+ F* m4 g5 d, k) w

; `3 G' _0 T& G5 L6 B+ [; p! ^& r$ y) Z  N, a+ X

, \' \0 V0 L6 T# L
 楼主| 发表于 2021-10-19 15:00:04 | 显示全部楼层
[root@compute01 ~]# rbd rm -p volumes volume-d16830f8-278c-4c80-9077-69648a4aef398 i, R0 |; G. W2 c
2021-10-19 14:41:32.746 7f34fe96bb00 -1 librbd::image::PreRemoveRequest: 0x55c40db0a720 check_image_snaps: image has snapshots - not removing% {% E8 b4 T/ q$ W4 t
Removing image: 0% complete...failed.
, t+ H- c! N7 m6 `# V* qrbd: image has snapshots - these must be deleted with 'rbd snap purge' before the image can be removed.
% ~' F7 i* s  Q4 b/ n5 r[root@compute01 ~]# rbd snap ls -p volumes volume-d16830f8-278c-4c80-9077-69648a4aef398 K: V$ E! v9 O
SNAPID NAME                                          SIZE   PROTECTED TIMESTAMP                $ ~% D/ o2 X9 i  Z1 Y+ X
   114 snapshot-e4c6ed5f-1ced-4af8-96cc-42c25d01bacf 20 GiB yes       Mon Oct 18 17:33:26 2021
9 L0 K, L2 B) ?9 r  A( E5 t% u* C' H; C9 I/ P
[root@compute01 ~]# rbd snap rm volumes/volume-d16830f8-278c-4c80-9077-69648a4aef39@snapshot-e4c6ed5f-1ced-4af8-96cc-42c25d01bacf
+ c- o. m$ i( ]( S9 |6 Z, K0 wRemoving snap: 2021-10-19 14:43:49.603 7f6d3ab14b00 -1 librbd::Operations: snapshot is protected0% complete...failed.' D' |; p1 u0 b2 a
rbd: snapshot 'snapshot-e4c6ed5f-1ced-4af8-96cc-42c25d01bacf' is protected from removal.1 W1 }  v# s5 |# B9 m8 s% s
[root@compute01 ~]# rbd snap unprotect volumes/volume-d16830f8-278c-4c80-9077-69648a4aef39@snapshot-e4c6ed5f-1ced-4af8-96cc-42c25d01bacf
2 i: B  O; {) b1 Y2 [  C/ o! F[root@compute01 ~]# rbd snap rm volumes/volume-d16830f8-278c-4c80-9077-69648a4aef39@snapshot-e4c6ed5f-1ced-4af8-96cc-42c25d01bacf
1 Y& P1 g' M% i5 X0 ]( GRemoving snap: 100% complete...done.
5 Q3 C1 h9 c# C) o; T* _& @) W" T% f[root@compute01 ~]# rbd rm -p volumes volume-d16830f8-278c-4c80-9077-69648a4aef39
8 }8 a/ A0 x! n/ SRemoving image: 100% complete...done.
& W0 Q: t9 N, K: E( z( D  \
您需要登录后才可以回帖 登录 | 开始注册

本版积分规则

关闭

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

如有购买积分卡请联系497906712

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

GMT+8, 2023-2-3 01:16 , Processed in 0.049138 second(s), 21 queries .

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

© 2012-2022 Comsenz Inc.

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