Make dd block size user configurable

This patch introduces a new configuration option volume_dd_blocksize
to change the bs parameter passed to the dd command when creating or
deleting volumes. In certain scenarios changing the block size might
result in better performance.

The default value is still 1M, which was used before.

Change-Id: I0398436ab3ecca51f6121e8f521af8b2dc60acd3
Fixes: bug #1157417
This commit is contained in:
Christoph Kassen 2013-03-19 21:50:51 +01:00
parent 34a8c8e51a
commit 8e8f200d90
1 changed files with 5 additions and 1 deletions

View File

@ -47,6 +47,9 @@ volume_opts = [
cfg.IntOpt('volume_clear_size',
default=0,
help='Size in MiB to wipe at start of old volumes. 0 => all'),
cfg.StrOpt('volume_dd_blocksize',
default='1M',
help='The default block size used when clearing volumes'),
cfg.StrOpt('pool_size',
default=None,
help='Size of thin provisioning pool '
@ -110,7 +113,8 @@ class LVMVolumeDriver(driver.VolumeDriver):
# Perform the copy
self._execute('dd', 'if=%s' % srcstr, 'of=%s' % deststr,
'count=%d' % (size_in_g * 1024), 'bs=1M',
'count=%d' % (size_in_g * 1024),
'bs=%s' % self.configuration.volume_dd_blocksize,
*extra_flags, run_as_root=True)
def _volume_not_present(self, volume_name):