From 8e8f200d909ff62c9286d585e658dab93bdfea67 Mon Sep 17 00:00:00 2001 From: Christoph Kassen Date: Tue, 19 Mar 2013 21:50:51 +0100 Subject: [PATCH] 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 --- cinder/volume/drivers/lvm.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cinder/volume/drivers/lvm.py b/cinder/volume/drivers/lvm.py index 3ab5ec38e..30c23abee 100644 --- a/cinder/volume/drivers/lvm.py +++ b/cinder/volume/drivers/lvm.py @@ -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): -- 2.45.2