SMBFS: remove deprecated config options

Some driver specific config options have been marked as deprecated
in Pike and are now being removed. The equivalent generic options
are available.

Note that the 'smbfs_sparsed_volumes' config option was only used
by the Linux SMB driver, which was removed in Pike. By mistake,
it was copied over to the Windows SMB driver, which was inheriting
it.

Change-Id: I23def8b2095dcf3945d2e0e1b4e5efe178cef9be
This commit is contained in:
Lucian Petrut 2017-11-15 13:03:39 +02:00
parent 4f649809a4
commit d618c66c60
3 changed files with 9 additions and 75 deletions

View File

@ -61,11 +61,8 @@ class WindowsSmbFsTestCase(test.TestCase):
self.context = context.get_admin_context()
self._FAKE_SMBFS_CONFIG = mock.MagicMock(
smbfs_oversub_ratio = 2,
smbfs_used_ratio = 0.5,
smbfs_shares_config = mock.sentinel.share_config_file,
smbfs_default_volume_format = 'vhdx',
smbfs_sparsed_volumes = False)
smbfs_default_volume_format = 'vhdx')
self._smbfs_driver = smbfs.WindowsSmbfsDriver(
configuration=mock.Mock())
@ -115,9 +112,7 @@ class WindowsSmbFsTestCase(test.TestCase):
self._smbfs_driver._setup_pool_mappings = mock.Mock()
self._smbfs_driver.configuration = config
if not (config.smbfs_shares_config and share_config_exists and
config.smbfs_oversub_ratio > 0 and
0 <= config.smbfs_used_ratio <= 1):
if not (config.smbfs_shares_config and share_config_exists):
self.assertRaises(exception.SmbfsException,
self._smbfs_driver.do_setup,
mock.sentinel.context)
@ -196,21 +191,6 @@ class WindowsSmbFsTestCase(test.TestCase):
self._test_setup(config=self._FAKE_SMBFS_CONFIG,
share_config_exists=False)
def test_setup_invlid_oversub_ratio(self):
fake_config = copy.copy(self._FAKE_SMBFS_CONFIG)
fake_config.smbfs_oversub_ratio = -1
self._test_setup(config=fake_config)
def test_setup_invalid_used_ratio(self):
fake_config = copy.copy(self._FAKE_SMBFS_CONFIG)
fake_config.smbfs_used_ratio = -1
self._test_setup(config=fake_config)
def test_setup_invalid_used_ratio2(self):
fake_config = copy.copy(self._FAKE_SMBFS_CONFIG)
fake_config.smbfs_used_ratio = 1.1
self._test_setup(config=fake_config)
@mock.patch.object(smbfs, 'context')
@mock.patch.object(smbfs.WindowsSmbfsDriver,
'_get_pool_name_from_share')

View File

@ -42,35 +42,11 @@ volume_opts = [
cfg.StrOpt('smbfs_shares_config',
default=r'C:\OpenStack\smbfs_shares.txt',
help='File with the list of available smbfs shares.'),
cfg.StrOpt('smbfs_allocation_info_file_path',
default=r'C:\OpenStack\allocation_data.txt',
help=('The path of the automatically generated file containing '
'information about volume disk space allocation.'),
deprecated_for_removal=True,
deprecated_since="11.0.0",
deprecated_reason="This allocation file is no longer used."),
cfg.StrOpt('smbfs_default_volume_format',
default='vhd',
choices=['vhd', 'vhdx'],
help=('Default format that will be used when creating volumes '
'if no volume format is specified.')),
cfg.BoolOpt('smbfs_sparsed_volumes',
default=True,
help=('Create volumes as sparsed files which take no space '
'rather than regular files when using raw format, '
'in which case volume creation takes lot of time.')),
cfg.FloatOpt('smbfs_used_ratio',
default=None,
help=('Percent of ACTUAL usage of the underlying volume '
'before no new volumes can be allocated to the volume '
'destination.'),
deprecated_for_removal=True),
cfg.FloatOpt('smbfs_oversub_ratio',
default=None,
help=('This will compare the allocated to available space on '
'the volume destination. If the ratio exceeds this '
'number, the destination will no longer be valid.'),
deprecated_for_removal=True),
cfg.StrOpt('smbfs_mount_point_base',
default=r'C:\OpenStack\_mnt',
help=('Base dir containing mount points for smbfs shares.')),
@ -85,12 +61,6 @@ volume_opts = [
CONF = cfg.CONF
CONF.register_opts(volume_opts, group=configuration.SHARED_CONF_GROUP)
# TODO(lpetrut): drop the following default values. The according
# smbfs driver opts are getting deprecated but we want to preserve
# their defaults until we completely remove them.
CONF.set_default('max_over_subscription_ratio', 1)
CONF.set_default('reserved_percentage', 5)
@interface.volumedriver
class WindowsSmbfsDriver(remotefs_drv.RevertToSnapshotMixin,
@ -150,13 +120,6 @@ class WindowsSmbfsDriver(remotefs_drv.RevertToSnapshotMixin,
def do_setup(self, context):
self._check_os_platform()
if self.configuration.smbfs_oversub_ratio is not None:
self.configuration.max_over_subscription_ratio = (
self.configuration.smbfs_oversub_ratio)
if self.configuration.smbfs_used_ratio is not None:
self.configuration.reserved_percentage = (
1 - self.configuration.smbfs_used_ratio) * 100
super(WindowsSmbfsDriver, self).do_setup(context)
image_utils.check_qemu_img_version(self._MINIMUM_QEMU_IMG_VERSION)
@ -175,22 +138,6 @@ class WindowsSmbfsDriver(remotefs_drv.RevertToSnapshotMixin,
msg = _("Invalid mount point base: %s") % self.base
LOG.error(msg)
raise exception.SmbfsException(msg)
if not self.configuration.max_over_subscription_ratio > 0:
msg = _(
"SMBFS config 'max_over_subscription_ratio' invalid. "
"Must be > 0: %s"
) % self.configuration.max_over_subscription_ratio
LOG.error(msg)
raise exception.SmbfsException(msg)
if not 0 <= self.configuration.reserved_percentage <= 100:
msg = _(
"SMBFS config 'reserved_percentage' invalid. "
"Must be > 0 and <= 100: %s"
) % self.configuration.reserved_percentage
LOG.error(msg)
raise exception.SmbfsException(msg)
self.shares = {} # address : options
self._ensure_shares_mounted()

View File

@ -0,0 +1,7 @@
---
upgrades:
- |
The following config SMBFS volume driver options have been deprecated
and are now being removed: ``smbfs_allocation_info_file_path``,
``smbfs_sparsed_volumes``, ``smbfs_used_ratio``, ``smbfs_oversub_ratio``.
Note that the equivalent generic options are available.