zoukankan      html  css  js  c++  java
  • rbd的删除回收站功能

    前言

    rbd 提供了一个回收站功能,这个是属于防呆设计,防止误操作删除rbd引起无法恢复的情况,rbd正常情况下的删除是马上会在后台回收空间的,这个也听说过有人做过误删除的操作,那么这个设计就是从操作逻辑上来尽量避免这个失误的

    相关操作

    命令比较简单就几条命令,luminous版本就支持了,提供几个命令

    • trash list (trash ls) 列出回收站的rbd
    • trash move (trash mv)通过回收接口删除rbd
    • trash remove (trash rm)删除回收站里面的rbd
    • trash restore 还原回收站的rbd

    其中move操作里面是支持delay的

    [root@lab201 ~]# rbd  help  trash move |grep delay
    usage: rbd trash move [--pool <pool>] [--image <image>] [--delay <delay>] 
      --delay arg          time delay in seconds until effectively remove the image
    

    这个delay不是说delay多久后会删除,而是设置进入回收站以后,在多长时间之后是可以去删除回收站的rbd的,如果没到这个delay的时间是不能直接删除的,需要加上force强制命令的,这个地方也就是可以设置一个时间,比如一天,今天删除的,今天不能正常清理回收站,明天再清理,也提供了强制命令,但是操作逻辑上面是默认有个宽限期的

    相关的测试

    创建rbd

    rbd create test --size 8G
    

    删除到回收站并设置延时时间

    rbd    trash move test --delay  7200
    

    查看回收站列表

    [root@lab201 ~]# rbd trash list
    166a16b8b4567 test
    

    删除回收站的rbd

    [root@lab201 ~]# rbd    trash remove 166a16b8b4567
    Deferment time has not expired, please use --force if you really want to remove the image
    Removing image: 0% complete...failed.
    2020-09-09 11:40:15.571122 7f51d7677d40 -1 librbd: error: deferment time has not expired.
    

    强制删除回收站的rbd

    [root@lab201 ~]# rbd    trash remove 166a16b8b4567 --force
    Removing image: 100% complete...done.
    

    还原操作

    [root@lab201 ~]# rbd    trash restore 166a76b8b4567
    

    总结

    回收站的功能能够比较好的去避免误操作,这样即使误删除了,也留了一定的时间可以去处理,从而从逻辑上更安全了一些

    变更记录

    Why Who When
    创建 武汉-运维-磨渣 2020-09-09
  • 相关阅读:
    ant-design-vue a-tree默认展开所有父节点不生效
    CSS模型简介
    一点BFC的看法
    css提高开发效率的必备代码
    CSS模型简介-逆战班
    CSS 样式:常用居中方法
    rem 自适应布局 js 代码
    CSS 样式 :position-absolute 绝对定位属性
    CSS 样式
    CSS样式字体初解
  • 原文地址:https://www.cnblogs.com/zphj1987/p/13637896.html
Copyright © 2011-2022 走看看