Fix size exceed of dd action when clearing a volume

This patch closes a bug that may result in "No space left" error
of dd command.

If user set the config item volume_clear_size to larger value than
a size of a volume, the "dd" command will get "No space left"
error when deleting the volume.
This change rejects volume_clear_size settings that are larger
than 1GiB, because there isn't really a reason to set that.
That would be safer all-around.

DocImpact

Closes-Bug: #1588310
Change-Id: I690d62bc728c85c9795a87f84b52f1a14474933d
This commit is contained in:
Cao ShuFeng 2016-06-04 07:57:49 -04:00 committed by Zhang Danyang
parent fa8201b7ce
commit 50e1f161fb
2 changed files with 7 additions and 1 deletions

View File

@ -83,7 +83,9 @@ volume_opts = [
help='Method used to wipe old volumes'),
cfg.IntOpt('volume_clear_size',
default=0,
help='Size in MiB to wipe at start of old volumes. 0 => all'),
max=1024,
help='Size in MiB to wipe at start of old volumes. 1024 MiB'
'at max. 0 => all'),
cfg.StrOpt('volume_clear_ionice',
help='The flag to pass to ionice to alter the i/o priority '
'of the process used to zero a volume after deletion, '

View File

@ -0,0 +1,4 @@
---
fixes:
- Fix 'No Space left' of dd command when users set the config item
volume_clear_size to larger value than a size of a volume.