From 8aac388cc091b6c79c2d0650810acf72a1097446 Mon Sep 17 00:00:00 2001 From: John Griffith Date: Tue, 6 Aug 2013 14:58:02 -0600 Subject: [PATCH] Move volume_clear and clear_size opts up to driver The block_device driver pulled in the clear and clear_size options for it's own use and broke the inheritance model needed for multiple backend configs. This change moves the two configs up higher in the heirarchy to driver.py so that it can be shared/used by all drivers if they desire. This means that they are now set properly in volume_opts. At some point we shoudl restructure this a bit to allow multi-backends to specify independent settings for these configs. Fixes bug: 1208964 Change-Id: I6afbdecea637f7e7d3417be537ab71fe97bffda3 --- cinder/volume/driver.py | 11 +++++++++-- cinder/volume/drivers/block_device.py | 7 ------- cinder/volume/drivers/lvm.py | 2 -- 3 files changed, 9 insertions(+), 11 deletions(-) diff --git a/cinder/volume/driver.py b/cinder/volume/driver.py index 086725f89e..ec72808792 100644 --- a/cinder/volume/driver.py +++ b/cinder/volume/driver.py @@ -21,7 +21,6 @@ """ import os -import socket import time from oslo.config import cfg @@ -82,7 +81,15 @@ cfg.BoolOpt('use_multipath_for_image_xfer', default=False, help='Do we attach/detach volumes in cinder using multipath ' - 'for volume to image and image to volume transfers?'), ] + 'for volume to image and image to volume transfers?'), + cfg.StrOpt('volume_clear', + default='zero', + help='Method used to wipe old voumes (valid options are: ' + 'none, zero, shred)'), + cfg.IntOpt('volume_clear_size', + default=0, + help='Size in MiB to wipe at start of old volumes. 0 => all'), ] + CONF = cfg.CONF CONF.register_opts(volume_opts) diff --git a/cinder/volume/drivers/block_device.py b/cinder/volume/drivers/block_device.py index f4edbaa947..4b1ad2fdd4 100644 --- a/cinder/volume/drivers/block_device.py +++ b/cinder/volume/drivers/block_device.py @@ -34,13 +34,6 @@ cfg.ListOpt('available_devices', default=[], help='List of all available devices'), - cfg.IntOpt('volume_clear_size', - default=0, - help='Size in MiB to wipe at start of old volumes. 0 => all'), - cfg.StrOpt('volume_clear', - default='zero', - help='Method used to wipe old volumes (valid options are: ' - 'none, zero, shred)'), ] CONF = cfg.CONF diff --git a/cinder/volume/drivers/lvm.py b/cinder/volume/drivers/lvm.py index 0847e9c169..6b54142978 100644 --- a/cinder/volume/drivers/lvm.py +++ b/cinder/volume/drivers/lvm.py @@ -55,8 +55,6 @@ CONF = cfg.CONF CONF.register_opts(volume_opts) -CONF.import_opt('volume_clear', 'cinder.volume.drivers.block_device') -CONF.import_opt('volume_clear_size', 'cinder.volume.drivers.block_device') class LVMVolumeDriver(driver.VolumeDriver):