From 5f5eedec0ff253c92d80515e751b1c8640863222 Mon Sep 17 00:00:00 2001 From: Yuriy Nesenenko Date: Wed, 6 Apr 2016 15:14:17 +0300 Subject: [PATCH] Deprecate nas_ip and change this to nas_host This patch fixes a usability/discoverability problem since the option is named "nas_ip" but isn't just for IPs. Change-Id: I3383e586219b7f831194805d2d4230ee620c7c14 --- cinder/tests/unit/test_coho.py | 2 +- cinder/tests/unit/test_glusterfs.py | 2 +- cinder/tests/unit/test_hitachi_hnas_nfs.py | 2 +- cinder/tests/unit/test_nexenta5_nfs.py | 2 +- cinder/tests/unit/test_nfs.py | 4 ++-- cinder/volume/drivers/ibm/gpfs.py | 2 +- cinder/volume/drivers/nexenta/ns5/nfs.py | 2 +- cinder/volume/drivers/remotefs.py | 17 +++++++++-------- .../deprecated-nas-ip-fd86a734c92f6fae.yaml | 7 +++++++ 9 files changed, 24 insertions(+), 16 deletions(-) create mode 100644 releasenotes/notes/deprecated-nas-ip-fd86a734c92f6fae.yaml diff --git a/cinder/tests/unit/test_coho.py b/cinder/tests/unit/test_coho.py index 6b78171af21..e2d1b0dbbd1 100644 --- a/cinder/tests/unit/test_coho.py +++ b/cinder/tests/unit/test_coho.py @@ -97,7 +97,7 @@ class CohoDriverTest(test.TestCase): self.configuration.nfs_sparsed_volumes = True self.configuration.nfs_mount_point_base = '/opt/stack/cinder/mnt' self.configuration.nfs_mount_options = None - self.configuration.nas_ip = None + self.configuration.nas_host = None self.configuration.nas_share_path = None self.configuration.nas_mount_options = None diff --git a/cinder/tests/unit/test_glusterfs.py b/cinder/tests/unit/test_glusterfs.py index 8f11757f6d6..cf17cc89f25 100644 --- a/cinder/tests/unit/test_glusterfs.py +++ b/cinder/tests/unit/test_glusterfs.py @@ -92,7 +92,7 @@ class GlusterFsDriverTestCase(test.TestCase): self.TEST_MNT_POINT_BASE self._configuration.nas_secure_file_permissions = 'false' self._configuration.nas_secure_file_operations = 'false' - self._configuration.nas_ip = None + self._configuration.nas_host = None self._configuration.nas_share_path = None self._configuration.nas_mount_options = None diff --git a/cinder/tests/unit/test_hitachi_hnas_nfs.py b/cinder/tests/unit/test_hitachi_hnas_nfs.py index d67e2849a5c..c18a51fadb0 100644 --- a/cinder/tests/unit/test_hitachi_hnas_nfs.py +++ b/cinder/tests/unit/test_hitachi_hnas_nfs.py @@ -253,7 +253,7 @@ class HDSNFSDriverTest(test.TestCase): self.configuration.nfs_shares_config = self.shares_file.name self.configuration.nfs_mount_point_base = '/opt/stack/cinder/mnt' self.configuration.nfs_mount_options = None - self.configuration.nas_ip = None + self.configuration.nas_host = None self.configuration.nas_share_path = None self.configuration.nas_mount_options = None diff --git a/cinder/tests/unit/test_nexenta5_nfs.py b/cinder/tests/unit/test_nexenta5_nfs.py index 8e935c944d9..c7efcc6ad8f 100644 --- a/cinder/tests/unit/test_nexenta5_nfs.py +++ b/cinder/tests/unit/test_nexenta5_nfs.py @@ -76,7 +76,7 @@ class TestNexentaNfsDriver(test.TestCase): self.cfg.nexenta_user = 'user' self.cfg.nexenta_password = 'pass' self.cfg.max_over_subscription_ratio = 20.0 - self.cfg.nas_ip = '1.1.1.1' + self.cfg.nas_host = '1.1.1.1' self.cfg.nas_share_path = 'pool/share' self.nef_mock = mock.Mock() self.stubs.Set(jsonrpc, 'NexentaJSONProxy', diff --git a/cinder/tests/unit/test_nfs.py b/cinder/tests/unit/test_nfs.py index 7dcc1fc66ee..82b10fcc810 100644 --- a/cinder/tests/unit/test_nfs.py +++ b/cinder/tests/unit/test_nfs.py @@ -337,7 +337,7 @@ class NfsDriverTestCase(test.TestCase): self.configuration.nfs_qcow2_volumes = False self.configuration.nas_secure_file_permissions = 'false' self.configuration.nas_secure_file_operations = 'false' - self.configuration.nas_ip = None + self.configuration.nas_host = None self.configuration.nas_share_path = None self.configuration.nas_mount_options = None self.configuration.volume_dd_blocksize = '1M' @@ -495,7 +495,7 @@ class NfsDriverTestCase(test.TestCase): def test_load_shares_config_nas_opts(self): drv = self._driver - drv.configuration.nas_ip = self.TEST_NFS_HOST + drv.configuration.nas_host = self.TEST_NFS_HOST drv.configuration.nas_share_path = self.TEST_NFS_SHARE_PATH drv.configuration.nfs_shares_config = self.TEST_SHARES_CONFIG_FILE diff --git a/cinder/volume/drivers/ibm/gpfs.py b/cinder/volume/drivers/ibm/gpfs.py index 8e79c77a457..38a63d93009 100644 --- a/cinder/volume/drivers/ibm/gpfs.py +++ b/cinder/volume/drivers/ibm/gpfs.py @@ -1244,7 +1244,7 @@ class GPFSNFSDriver(GPFSDriver, nfs.NfsDriver, san.SanDriver): super(GPFSNFSDriver, self).__init__(*args, **kwargs) self.gpfs_execute = self._gpfs_remote_execute self.configuration.append_config_values(remotefs.nas_opts) - self.configuration.san_ip = self.configuration.nas_ip + self.configuration.san_ip = self.configuration.nas_host self.configuration.san_login = self.configuration.nas_login self.configuration.san_password = self.configuration.nas_password self.configuration.san_private_key = ( diff --git a/cinder/volume/drivers/nexenta/ns5/nfs.py b/cinder/volume/drivers/nexenta/ns5/nfs.py index 3726f13cf70..e759a852f0e 100644 --- a/cinder/volume/drivers/nexenta/ns5/nfs.py +++ b/cinder/volume/drivers/nexenta/ns5/nfs.py @@ -67,7 +67,7 @@ class NexentaNfsDriver(nfs.NfsDriver): # pylint: disable=R0921 self.sparsed_volumes = self.configuration.nexenta_sparsed_volumes self.nef = None self.nef_protocol = self.configuration.nexenta_rest_protocol - self.nef_host = self.configuration.nas_ip + self.nef_host = self.configuration.nas_host self.share = self.configuration.nas_share_path self.nef_port = self.configuration.nexenta_rest_port self.nef_user = self.configuration.nexenta_user diff --git a/cinder/volume/drivers/remotefs.py b/cinder/volume/drivers/remotefs.py index f8b4870fed3..87d3127057d 100644 --- a/cinder/volume/drivers/remotefs.py +++ b/cinder/volume/drivers/remotefs.py @@ -37,11 +37,12 @@ from cinder.volume import driver LOG = logging.getLogger(__name__) + nas_opts = [ - # TODO(eharney): deprecate nas_ip and change this to nas_host - cfg.StrOpt('nas_ip', + cfg.StrOpt('nas_host', default='', - help='IP address or Hostname of NAS system.'), + help='IP address or Hostname of NAS system.', + deprecated_name='nas_ip'), cfg.StrOpt('nas_login', default='admin', help='User name to connect to NAS system.'), @@ -435,19 +436,19 @@ class RemoteFSDriver(driver.LocalVD, driver.TransferVD, driver.BaseVD): def _load_shares_config(self, share_file=None): self.shares = {} - if all((self.configuration.nas_ip, + if all((self.configuration.nas_host, self.configuration.nas_share_path)): - LOG.debug('Using nas_ip and nas_share_path configuration.') + LOG.debug('Using nas_host and nas_share_path configuration.') - nas_ip = self.configuration.nas_ip + nas_host = self.configuration.nas_host nas_share_path = self.configuration.nas_share_path - share_address = '%s:%s' % (nas_ip, nas_share_path) + share_address = '%s:%s' % (nas_host, nas_share_path) if not re.match(self.SHARE_FORMAT_REGEX, share_address): msg = (_("Share %s ignored due to invalid format. Must " "be of form address:/export. Please check the " - "nas_ip and nas_share_path settings."), + "nas_host and nas_share_path settings."), share_address) raise exception.InvalidConfigurationValue(msg) diff --git a/releasenotes/notes/deprecated-nas-ip-fd86a734c92f6fae.yaml b/releasenotes/notes/deprecated-nas-ip-fd86a734c92f6fae.yaml new file mode 100644 index 00000000000..138766c2022 --- /dev/null +++ b/releasenotes/notes/deprecated-nas-ip-fd86a734c92f6fae.yaml @@ -0,0 +1,7 @@ +--- +deprecations: + - Deprecate the nas_ip configuration option + and change it to nas_host. It will be more + clear to use the nas_host configuration + option instead of the nas_ip as IP address + or Hostname of NAS system.