码迷,mamicode.com
首页 > 其他好文 > 详细

OpenStack Cinder删除卷太慢的解决方法

时间:2017-10-13 12:38:55      阅读:360      评论:0      收藏:0      [点我收藏+]

标签:数据   mib   lock   pat   none   copy   填充   image   安全   

1.让OpenStack删除卷更快
为什么速度这么慢?

当我们执行删除卷命令以后,openstack会尝试去清除卷上的数据,他是如何清除的呢?
其实他是通过dd命令填充空白数据上去(dd if=/dev/zero)。这样子的清理方式目的是
为了彻底的清除数据,保证数据安全。但是对于ceph作为后端存储的情况而言,我们把image删
除了,数据也就相当安全了。这样子的操作并没有太多用处。特别是存储空间大于50GB的情况下,会操作很久。

我们可以做那些什么?
直接修改/etc/cinder/cinder.conf 配置文件:

# Method used to wipe old volumes (string value)
# Allowed values: none, zero, shred
volume_clear = none

openstack-config --set /etc/cinder/cinder.conf DEFAULT volume_clear none

默认值是zero,我们配置成none,就跳过清理这步。如果我们想只清理前100MB呢?

# Method used to wipe old volumes (string value)
# Allowed values: none, zero, shred
volume_clear = zero
 
# Size in MiB to wipe at start of old volumes. 0 => all (integer value)
volume_clear_size = 100

cinder 中clear_volume段代码
    
def clear_volume(volume_size, volume_path, volume_clear=None,
                 volume_clear_size=None, volume_clear_ionice=None,
                 throttle=None):
    """Unprovision old volumes to prevent data leaking between users."""
    if volume_clear is None:
        volume_clear = CONF.volume_clear
 
    if volume_clear_size is None:
        volume_clear_size = CONF.volume_clear_size
 
    if volume_clear_size == 0:
        volume_clear_size = volume_size
 
    if volume_clear_ionice is None:
        volume_clear_ionice = CONF.volume_clear_ionice
 
    LOG.info(_LI("Performing secure delete on volume: %s"), volume_path)
 
    # We pass sparse=False explicitly here so that zero blocks are not
    # skipped in order to clear the volume.
    if volume_clear == zero:
        return copy_volume(/dev/zero, volume_path, volume_clear_size,
                           CONF.volume_dd_blocksize,
                           sync=True, execute=utils.execute,
                           ionice=volume_clear_ionice,
                           throttle=throttle, sparse=False)
    else:
        raise exception.InvalidConfigurationValue(
            option=volume_clear,
            value=volume_clear)

OpenStack Cinder删除卷太慢的解决方法

标签:数据   mib   lock   pat   none   copy   填充   image   安全   

原文地址:http://www.cnblogs.com/wangyifu/p/7660309.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!