diff --git a/cinder/tests/unit/test_volume_utils.py b/cinder/tests/unit/test_volume_utils.py index 915f1ee45e5..946ae2fd896 100644 --- a/cinder/tests/unit/test_volume_utils.py +++ b/cinder/tests/unit/test_volume_utils.py @@ -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' diff --git a/cinder/volume/driver.py b/cinder/volume/driver.py index abe04b49413..a7379e4be31 100644 --- a/cinder/volume/driver.py +++ b/cinder/volume/driver.py @@ -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, diff --git a/cinder/volume/utils.py b/cinder/volume/utils.py index 324efc920e0..4f43a75f1a2 100644 --- a/cinder/volume/utils.py +++ b/cinder/volume/utils.py @@ -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': diff --git a/releasenotes/notes/remove-volume-clear-shred-bde9f7f9ff430feb.yaml b/releasenotes/notes/remove-volume-clear-shred-bde9f7f9ff430feb.yaml new file mode 100644 index 00000000000..a83a9943627 --- /dev/null +++ b/releasenotes/notes/remove-volume-clear-shred-bde9f7f9ff430feb.yaml @@ -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.