Remove support for "lvm_share_export_ip"

The LVM driver accepts a "lvm_share_export_ips"
option instead of "lvm_share_export_ip" since
the Pike release [1]. Let's drop support for this
option and cleanup compatibility code.

[1] Ib3594aa5d7751c829820fce830d87f6ceea6b049

Change-Id: Ifdeb470438c204cc6cc370517833cb2cab5b7822
This commit is contained in:
Goutham Pacha Ravi 2019-07-30 14:23:30 -07:00
parent 8d03a2a46e
commit 8e1343c9cd
7 changed files with 41 additions and 77 deletions

View File

@ -40,11 +40,12 @@ below:
[LVM_sample_backend]
driver_handles_share_servers = False
share_driver = manila.share.drivers.lvm.LVMShareDriver
lvm_share_export_ip = 1.2.3.4
lvm_share_export_ips = 1.2.3.4
In the example above, ``lvm_share_export_ip`` is the address to be used by
In the example above, ``lvm_share_export_ips`` is the address to be used by
clients for accessing shares. In the simplest case, it should be the same
as host's address.
as host's address. The option allows configuring more than one IP address as
a comma separated string.
Supported shared file systems and operations
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

View File

@ -18,8 +18,8 @@
- Description
* - **[DEFAULT]**
-
* - ``lvm_share_export_ip`` = ``None``
- (String) IP to be added to export string.
* - ``lvm_share_export_ips`` = ``None``
- (String) List of IPs to export shares belonging to the LVM storage driver.
* - ``lvm_share_export_root`` = ``$state_path/mnt``
- (String) Base folder where exported shares are located.
* - ``lvm_share_helpers`` = ``CIFS=manila.share.drivers.helpers.CIFSHelperUserAccess, NFS=manila.share.drivers.helpers.NFSHelper``

View File

@ -85,12 +85,12 @@ Configure components
share_driver = manila.share.drivers.lvm.LVMShareDriver
driver_handles_share_servers = False
lvm_share_volume_group = manila-volumes
lvm_share_export_ip = MANAGEMENT_INTERFACE_IP_ADDRESS
lvm_share_export_ips = MANAGEMENT_INTERFACE_IP_ADDRESS
Replace ``MANAGEMENT_INTERFACE_IP_ADDRESS`` with the IP address
of the management network interface on your storage node,
typically 10.0.0.41 for the first node in the example architecture
shown below:
of the management network interface on your storage node. The value of
this option can be a comma separated string of one or more IP addresses.
In the example architecture shown below, the address would be 10.0.0.41:
.. figure:: figures/hwreqs.png
:alt: Hardware requirements

View File

@ -41,12 +41,9 @@ share_opts = [
cfg.StrOpt('lvm_share_export_root',
default='$state_path/mnt',
help='Base folder where exported shares are located.'),
cfg.StrOpt('lvm_share_export_ip',
deprecated_for_removal=True,
deprecated_reason='Use lvm_share_export_ips instead.',
help='IP to be added to export string.'),
cfg.ListOpt('lvm_share_export_ips',
help='List of IPs to export shares.'),
help='List of IPs to export shares belonging to the LVM '
'storage driver.'),
cfg.IntOpt('lvm_share_mirrors',
default=0,
help='If set, create LVMs with multiple mirrors. Note that '
@ -78,15 +75,8 @@ class LVMMixin(driver.ExecuteMixin):
% self.configuration.lvm_share_volume_group)
raise exception.InvalidParameterValue(err=msg)
if (self.configuration.lvm_share_export_ip and
self.configuration.lvm_share_export_ips):
msg = (_("Only one of lvm_share_export_ip or lvm_share_export_ips"
" may be specified."))
raise exception.InvalidParameterValue(err=msg)
if not (self.configuration.lvm_share_export_ip or
self.configuration.lvm_share_export_ips):
msg = (_("Neither lvm_share_export_ip nor lvm_share_export_ips is"
" specified."))
if not self.configuration.lvm_share_export_ips:
msg = _("The option lvm_share_export_ips must be specified.")
raise exception.InvalidParameterValue(err=msg)
def _allocate_container(self, share):
@ -176,12 +166,9 @@ class LVMShareDriver(LVMMixin, driver.ShareDriver):
'instance_id': self.backend_name,
'lock_name': 'manila_lvm',
}
if self.configuration.lvm_share_export_ip:
self.share_server['public_addresses'] = [
self.configuration.lvm_share_export_ip]
else:
self.share_server['public_addresses'] = (
self.configuration.lvm_share_export_ips)
self.share_server['public_addresses'] = (
self.configuration.lvm_share_export_ips
)
self.ipv6_implemented = True
def _ssh_exec_as_root(self, server, command, check_exit_code=True):
@ -452,23 +439,12 @@ class LVMShareDriver(LVMMixin, driver.ShareDriver):
if self.configured_ip_version is None:
try:
self.configured_ip_version = []
if self.configuration.lvm_share_export_ip:
self.configured_ip_version.append(ipaddress.ip_address(
six.text_type(
self.configuration.lvm_share_export_ip)).version)
else:
for ip in self.configuration.lvm_share_export_ips:
self.configured_ip_version.append(
ipaddress.ip_address(six.text_type(ip)).version)
for ip in self.configuration.lvm_share_export_ips:
self.configured_ip_version.append(
ipaddress.ip_address(six.text_type(ip)).version)
except Exception:
if self.configuration.lvm_share_export_ip:
message = (_("Invalid 'lvm_share_export_ip' option "
"supplied %s.") %
self.configuration.lvm_share_export_ip)
else:
message = (_("Invalid 'lvm_share_export_ips' option "
"supplied %s.") %
self.configuration.lvm_share_export_ips)
message = (_("Invalid 'lvm_share_export_ips' option supplied "
"%s.") % self.configuration.lvm_share_export_ips)
raise exception.InvalidInput(reason=message)
return self.configured_ip_version

View File

@ -31,7 +31,7 @@ from manila.tests.share.drivers.container import fakes as cont_fakes
CONF = cfg.CONF
CONF.import_opt('lvm_share_export_ip', 'manila.share.drivers.lvm')
CONF.import_opt('lvm_share_export_ips', 'manila.share.drivers.lvm')
@ddt.ddt
@ -53,7 +53,7 @@ class ContainerShareDriverTestCase(test.TestCase):
self.share = cont_fakes.fake_share()
self.access = cont_fakes.fake_access()
self.server = {
'public_address': self.fake_conf.lvm_share_export_ip,
'public_address': self.fake_conf.lvm_share_export_ips,
'instance_id': 'LVM',
}

View File

@ -150,16 +150,6 @@ class LVMShareDriverTestCase(test.TestCase):
self.assertRaises(exception.InvalidParameterValue,
self._driver.check_for_setup_error)
def test_check_for_setup_error_deprecated_export_ip(self):
def exec_runner(*ignore_args, **ignore_kwargs):
return '\n fake1\n fakevg\n fake2\n', ''
fake_utils.fake_execute_set_repliers([('vgs --noheadings -o name',
exec_runner)])
CONF.set_default('lvm_share_export_ip', CONF.lvm_share_export_ips[0])
CONF.set_default('lvm_share_export_ips', None)
self.assertIsNone(self._driver.check_for_setup_error())
def test_check_for_setup_error_no_export_ips(self):
def exec_runner(*ignore_args, **ignore_kwargs):
return '\n fake1\n fakevg\n fake2\n', ''
@ -170,16 +160,6 @@ class LVMShareDriverTestCase(test.TestCase):
self.assertRaises(exception.InvalidParameterValue,
self._driver.check_for_setup_error)
def test_check_for_setup_error_both_export_ip_and_ips(self):
def exec_runner(*ignore_args, **ignore_kwargs):
return '\n fake1\n fakevg\n fake2\n', ''
fake_utils.fake_execute_set_repliers([('vgs --noheadings -o name',
exec_runner)])
CONF.set_default('lvm_share_export_ip', CONF.lvm_share_export_ips[0])
self.assertRaises(exception.InvalidParameterValue,
self._driver.check_for_setup_error)
def test_local_path_normal(self):
share = fake_share(name='fake_sharename')
CONF.set_default('lvm_share_volume_group', 'fake_vg')
@ -403,15 +383,15 @@ class LVMShareDriverTestCase(test.TestCase):
self.server, self.share['name'],
access_rules, add_rules=add_rules, delete_rules=delete_rules))
@ddt.data(('1001::1001/129', None, False), ('1.1.1.256', None, False),
('1001::1001', None, [6]), ('1.1.1.0', None, [4]),
(None, ['1001::1001', '1.1.1.0'], [6, 4]),
(None, ['1001::1001'], [6]), (None, ['1.1.1.0'], [4]),
(None, ['1001::1001/129', '1.1.1.0'], False))
@ddt.data((['1001::1001/129'], False),
(['1.1.1.256'], False),
(['1001::1001'], [6]),
('1.1.1.0', [4]),
(['1001::1001', '1.1.1.0'], [6, 4]),
(['1001::1001/129', '1.1.1.0'], False))
@ddt.unpack
def test_get_configured_ip_versions(
self, configured_ip, configured_ips, configured_ip_version):
CONF.set_default('lvm_share_export_ip', configured_ip)
def test_get_configured_ip_versions(self, configured_ips,
configured_ip_version):
CONF.set_default('lvm_share_export_ips', configured_ips)
if configured_ip_version:
self.assertEqual(configured_ip_version,
@ -547,10 +527,10 @@ class LVMShareDriverTestCase(test.TestCase):
'count=1024', 'bs=1M',
run_as_root=True)
@ddt.data(('1.1.1.1', 4), ('1001::1001', 6))
@ddt.data((['1.1.1.1'], 4), (['1001::1001'], 6))
@ddt.unpack
def test_update_share_stats(self, configured_ip, version):
CONF.set_default('lvm_share_export_ip', configured_ip)
CONF.set_default('lvm_share_export_ips', configured_ip)
self.mock_object(self._driver, 'get_share_server_pools',
mock.Mock(return_value='test-pool'))

View File

@ -0,0 +1,7 @@
---
upgrade:
- |
The LVM driver configuration option ``lvm_share_export_ip`` is no longer
supported. This option has been replaced by ``lvm_share_export_ips``
which accepts a comma-separated string of IP addresses of the host
exporting the LVM shares (NFS/CIFS share server).