Merge "Remove deprecated volume_clear shred option"
This commit is contained in:
commit
703211fe22
@ -531,7 +531,7 @@ class ClearVolumeTestCase(test.TestCase):
|
|||||||
@mock.patch('cinder.volume.utils.copy_volume', return_value=None)
|
@mock.patch('cinder.volume.utils.copy_volume', return_value=None)
|
||||||
@mock.patch('cinder.volume.utils.CONF')
|
@mock.patch('cinder.volume.utils.CONF')
|
||||||
def test_clear_volume_args(self, mock_conf, mock_copy):
|
def test_clear_volume_args(self, mock_conf, mock_copy):
|
||||||
mock_conf.volume_clear = 'shred'
|
mock_conf.volume_clear = 'should_override_with_arg'
|
||||||
mock_conf.volume_clear_size = 0
|
mock_conf.volume_clear_size = 0
|
||||||
mock_conf.volume_dd_blocksize = '1M'
|
mock_conf.volume_dd_blocksize = '1M'
|
||||||
mock_conf.volume_clear_ionice = '-c3'
|
mock_conf.volume_clear_ionice = '-c3'
|
||||||
@ -543,37 +543,6 @@ class ClearVolumeTestCase(test.TestCase):
|
|||||||
execute=utils.execute, ionice='-c0',
|
execute=utils.execute, ionice='-c0',
|
||||||
throttle=None, sparse=False)
|
throttle=None, sparse=False)
|
||||||
|
|
||||||
@mock.patch('cinder.utils.execute')
|
|
||||||
@mock.patch('cinder.volume.utils.CONF')
|
|
||||||
def test_clear_volume_shred(self, mock_conf, mock_exec):
|
|
||||||
# 'shred' now uses 'dd'. Remove this test when
|
|
||||||
# support for 'volume_clear=shred' is removed.
|
|
||||||
mock_conf.volume_clear = 'shred'
|
|
||||||
mock_conf.volume_clear_size = 1
|
|
||||||
mock_conf.volume_clear_ionice = None
|
|
||||||
mock_conf.volume_dd_blocksize = '1M'
|
|
||||||
output = volume_utils.clear_volume(1024, 'volume_path')
|
|
||||||
self.assertIsNone(output)
|
|
||||||
mock_exec.assert_called_with(
|
|
||||||
'dd', 'if=/dev/zero', 'of=volume_path', 'count=1048576', 'bs=1M',
|
|
||||||
'iflag=count_bytes', 'oflag=direct', run_as_root=True)
|
|
||||||
|
|
||||||
@mock.patch('cinder.utils.execute')
|
|
||||||
@mock.patch('cinder.volume.utils.CONF')
|
|
||||||
def test_clear_volume_shred_not_clear_size(self, mock_conf, mock_exec):
|
|
||||||
# 'shred' now uses 'dd'. Remove this test when
|
|
||||||
# support for 'volume_clear=shred' is removed.
|
|
||||||
mock_conf.volume_clear = 'shred'
|
|
||||||
mock_conf.volume_clear_size = None
|
|
||||||
mock_conf.volume_clear_ionice = None
|
|
||||||
mock_conf.volume_dd_blocksize = '1M'
|
|
||||||
mock_conf.volume_clear_size = 1
|
|
||||||
output = volume_utils.clear_volume(1024, 'volume_path')
|
|
||||||
self.assertIsNone(output)
|
|
||||||
mock_exec.assert_called_with(
|
|
||||||
'dd', 'if=/dev/zero', 'of=volume_path', 'count=1048576', 'bs=1M',
|
|
||||||
'iflag=count_bytes', 'oflag=direct', run_as_root=True)
|
|
||||||
|
|
||||||
@mock.patch('cinder.volume.utils.CONF')
|
@mock.patch('cinder.volume.utils.CONF')
|
||||||
def test_clear_volume_invalid_opt(self, mock_conf):
|
def test_clear_volume_invalid_opt(self, mock_conf):
|
||||||
mock_conf.volume_clear = 'non_existent_volume_clearer'
|
mock_conf.volume_clear = 'non_existent_volume_clearer'
|
||||||
|
@ -75,7 +75,7 @@ volume_opts = [
|
|||||||
'running. Otherwise, it will fallback to single path.'),
|
'running. Otherwise, it will fallback to single path.'),
|
||||||
cfg.StrOpt('volume_clear',
|
cfg.StrOpt('volume_clear',
|
||||||
default='zero',
|
default='zero',
|
||||||
choices=['none', 'zero', 'shred'],
|
choices=['none', 'zero'],
|
||||||
help='Method used to wipe old volumes'),
|
help='Method used to wipe old volumes'),
|
||||||
cfg.IntOpt('volume_clear_size',
|
cfg.IntOpt('volume_clear_size',
|
||||||
default=0,
|
default=0,
|
||||||
|
@ -598,11 +598,6 @@ def clear_volume(volume_size, volume_path, volume_clear=None,
|
|||||||
|
|
||||||
LOG.info(_LI("Performing secure delete on volume: %s"), volume_path)
|
LOG.info(_LI("Performing secure delete on volume: %s"), volume_path)
|
||||||
|
|
||||||
if volume_clear == 'shred':
|
|
||||||
LOG.warning(_LW("volume_clear=shred has been deprecated and will "
|
|
||||||
"be removed in the next release. Clearing with dd."))
|
|
||||||
volume_clear = 'zero'
|
|
||||||
|
|
||||||
# We pass sparse=False explicitly here so that zero blocks are not
|
# We pass sparse=False explicitly here so that zero blocks are not
|
||||||
# skipped in order to clear the volume.
|
# skipped in order to clear the volume.
|
||||||
if volume_clear == 'zero':
|
if volume_clear == 'zero':
|
||||||
|
@ -0,0 +1,7 @@
|
|||||||
|
---
|
||||||
|
upgrade:
|
||||||
|
- The volume_clear option to use `shred` was deprecated
|
||||||
|
in the Newton release and has now been removed. Since
|
||||||
|
deprecation, this option has performed the same action
|
||||||
|
as the `zero` option. Config settings for `shred` should
|
||||||
|
be updated to be set to `zero` for continued operation.
|
Loading…
Reference in New Issue
Block a user