]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Make dd block size user configurable
authorChristoph Kassen <c.kassen@telekom.de>
Tue, 19 Mar 2013 20:50:51 +0000 (21:50 +0100)
committerChristoph Kassen <c.kassen@telekom.de>
Tue, 19 Mar 2013 20:52:09 +0000 (21:52 +0100)
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

index 3ab5ec38efda658f195ee5e0fa57cb6dbefc50f3..30c23abeef525bc41e91c998b7765eb99bfdd987 100644 (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):