Remove deprecated volume_clear shred option

This option was deprecated in the Newton release and has
performed the same action as the zero option.

Change-Id: I473636595fb6696f426565a2f14ebe7070afa560
Closes-bug: #1477805
This commit is contained in:
Sean McGinnis 2016-11-11 13:49:24 -06:00
parent 0e47f3ce3a
commit f90c49e006
4 changed files with 9 additions and 38 deletions

View File

@ -531,7 +531,7 @@ class ClearVolumeTestCase(test.TestCase):
@mock.patch('cinder.volume.utils.copy_volume', return_value=None)
@mock.patch('cinder.volume.utils.CONF')
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_dd_blocksize = '1M'
mock_conf.volume_clear_ionice = '-c3'
@ -543,37 +543,6 @@ class ClearVolumeTestCase(test.TestCase):
execute=utils.execute, ionice='-c0',
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')
def test_clear_volume_invalid_opt(self, mock_conf):
mock_conf.volume_clear = 'non_existent_volume_clearer'

View File

@ -75,7 +75,7 @@ volume_opts = [
'running. Otherwise, it will fallback to single path.'),
cfg.StrOpt('volume_clear',
default='zero',
choices=['none', 'zero', 'shred'],
choices=['none', 'zero'],
help='Method used to wipe old volumes'),
cfg.IntOpt('volume_clear_size',
default=0,

View File

@ -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)
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
# skipped in order to clear the volume.
if volume_clear == 'zero':

View File

@ -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.