]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
NetApp 7mode NFS driver doesn't honor netapp_vfiler option
authorAndrew Kerr <andrew.kerr@netapp.com>
Mon, 1 Dec 2014 21:32:02 +0000 (16:32 -0500)
committerAndrew Kerr <andrew.kerr@netapp.com>
Tue, 2 Dec 2014 20:58:49 +0000 (20:58 +0000)
This patch fixes the NetApp 7mode NFS driver to register and use
the netapp_vfiler option if it is configured in cinder.conf.

DocImpact
Change-Id: I4db42d2521d7e6018f4f7ad0c4ab13441871675e
Closes-Bug: 1381716

cinder/tests/test_netapp_nfs.py
cinder/tests/volume/drivers/netapp/dataontap/client/test_client_7mode.py
cinder/volume/drivers/netapp/dataontap/client/client_7mode.py
cinder/volume/drivers/netapp/dataontap/nfs_7mode.py
cinder/volume/drivers/netapp/dataontap/nfs_base.py
cinder/volume/drivers/netapp/dataontap/nfs_cmode.py
cinder/volume/drivers/netapp/options.py
etc/cinder/cinder.conf.sample

index 9c75e5b8ed82b150a1144473fc97be307fc24794..63ff706073786f0bc435c8676e2692337d673717 100644 (file)
@@ -14,6 +14,7 @@
 #    under the License.
 """Unit tests for the NetApp-specific NFS driver module."""
 
+from itertools import chain
 import os
 
 from lxml import etree
@@ -53,6 +54,8 @@ CONNECTION_INFO = {'hostname': 'fake_host',
                    'port': 443,
                    'username': 'admin',
                    'password': 'passw0rd'}
+SEVEN_MODE_CONNECTION_INFO = dict(chain(CONNECTION_INFO.items(),
+                                        {'vfiler': 'test_vfiler'}.items()))
 FAKE_VSERVER = 'fake_vserver'
 
 
@@ -66,6 +69,7 @@ def create_configuration():
     configuration.netapp_server_port = CONNECTION_INFO['port']
     configuration.netapp_login = CONNECTION_INFO['username']
     configuration.netapp_password = CONNECTION_INFO['password']
+    configuration.netapp_vfiler = SEVEN_MODE_CONNECTION_INFO['vfiler']
     return configuration
 
 
@@ -1219,7 +1223,7 @@ class NetApp7modeNfsDriverTestCase(NetAppCmodeNfsDriverTestCase):
     def test_do_setup(self, mock_client_init, mock_super_do_setup):
         context = mock.Mock()
         self._driver.do_setup(context)
-        mock_client_init.assert_called_once_with(**CONNECTION_INFO)
+        mock_client_init.assert_called_once_with(**SEVEN_MODE_CONNECTION_INFO)
         mock_super_do_setup.assert_called_once_with(context)
 
     @mock.patch.object(nfs_base.NetAppNfsDriver, 'check_for_setup_error')
index 452f413f772d77acff420c920098ac3a2f129779..bb1791be3eaf0cecef4d5ebd0d7394934055c162 100644 (file)
@@ -401,7 +401,11 @@ class NetApp7modeClientTestCase(test.TestCase):
         actual_pathname = self.client.get_actual_path_for_export(
             fake_export_path)
 
+        __, __, _kwargs = self.connection.invoke_successfully.mock_calls[0]
+        enable_tunneling = _kwargs['enable_tunneling']
+
         self.assertEqual(expected_actual_pathname, actual_pathname)
+        self.assertTrue(enable_tunneling)
 
     def test_clone_file(self):
         expected_src_path = "fake_src_path"
@@ -439,8 +443,9 @@ class NetApp7modeClientTestCase(test.TestCase):
 
         self.client.clone_file(expected_src_path, expected_dest_path)
 
-        __, _args, __ = self.connection.invoke_successfully.mock_calls[0]
+        __, _args, _kwargs = self.connection.invoke_successfully.mock_calls[0]
         actual_request = _args[0]
+        enable_tunneling = _kwargs['enable_tunneling']
         actual_src_path = actual_request \
             .get_child_by_name('source-path').get_content()
         actual_dest_path = actual_request.get_child_by_name(
@@ -450,6 +455,7 @@ class NetApp7modeClientTestCase(test.TestCase):
         self.assertEqual(expected_dest_path, actual_dest_path)
         self.assertEqual(actual_request.get_child_by_name(
             'destination-exists'), None)
+        self.assertTrue(enable_tunneling)
 
     def test_clone_file_when_clone_fails(self):
         """Ensure clone is cleaned up on failure."""
@@ -493,8 +499,9 @@ class NetApp7modeClientTestCase(test.TestCase):
                           expected_src_path,
                           expected_dest_path)
 
-        __, _args, __ = self.connection.invoke_successfully.mock_calls[0]
+        __, _args, _kwargs = self.connection.invoke_successfully.mock_calls[0]
         actual_request = _args[0]
+        enable_tunneling = _kwargs['enable_tunneling']
         actual_src_path = actual_request \
             .get_child_by_name('source-path').get_content()
         actual_dest_path = actual_request.get_child_by_name(
@@ -504,9 +511,11 @@ class NetApp7modeClientTestCase(test.TestCase):
         self.assertEqual(expected_dest_path, actual_dest_path)
         self.assertEqual(actual_request.get_child_by_name(
             'destination-exists'), None)
+        self.assertTrue(enable_tunneling)
 
-        __, _args, __ = self.connection.invoke_successfully.mock_calls[1]
+        __, _args, _kwargs = self.connection.invoke_successfully.mock_calls[1]
         actual_request = _args[0]
+        enable_tunneling = _kwargs['enable_tunneling']
         actual_clone_id = actual_request.get_child_by_name('clone-id')
         actual_clone_id_info = actual_clone_id.get_child_by_name(
             'clone-id-info')
@@ -517,14 +526,17 @@ class NetApp7modeClientTestCase(test.TestCase):
 
         self.assertEqual(fake_clone_op_id, actual_clone_op_id)
         self.assertEqual(fake_volume_id, actual_volume_uuid)
+        self.assertTrue(enable_tunneling)
 
         # Ensure that the clone-clear call is made upon error
-        __, _args, __ = self.connection.invoke_successfully.mock_calls[2]
+        __, _args, _kwargs = self.connection.invoke_successfully.mock_calls[2]
         actual_request = _args[0]
+        enable_tunneling = _kwargs['enable_tunneling']
         actual_clone_id = actual_request \
             .get_child_by_name('clone-id').get_content()
 
         self.assertEqual(fake_clone_op_id, actual_clone_id)
+        self.assertTrue(enable_tunneling)
 
     def test_get_file_usage(self):
         expected_bytes = "2048"
index 17c14b44a3c16584d83bd8adcea7bda689048c3c..6cbcd391959f05a04806b6a8dc5f13218ec8f1cf 100644 (file)
@@ -252,7 +252,8 @@ class Client(client_base.Client):
         """Gets the actual path on the filer for export path."""
         storage_path = netapp_api.NaElement.create_node_with_children(
             'nfs-exportfs-storage-path', **{'pathname': export_path})
-        result = self.connection.invoke_successfully(storage_path)
+        result = self.connection.invoke_successfully(storage_path,
+                                                     enable_tunneling=True)
         if result.get_child_content('actual-pathname'):
             return result.get_child_content('actual-pathname')
         raise exception.NotFound(_('No storage path found for export path %s')
@@ -267,7 +268,8 @@ class Client(client_base.Client):
             **{'source-path': src_path,
                'destination-path': dest_path,
                'no-snap': 'true'})
-        result = self.connection.invoke_successfully(clone_start)
+        result = self.connection.invoke_successfully(clone_start,
+                                                     enable_tunneling=True)
         clone_id_el = result.get_child_by_name('clone-id')
         cl_id_info = clone_id_el.get_child_by_name('clone-id-info')
         vol_uuid = cl_id_info.get_child_content('volume-uuid')
@@ -291,7 +293,8 @@ class Client(client_base.Client):
                                            'volume-uuid': vol_uuid})
         task_running = True
         while task_running:
-            result = self.connection.invoke_successfully(clone_ls_st)
+            result = self.connection.invoke_successfully(clone_ls_st,
+                                                         enable_tunneling=True)
             status = result.get_child_by_name('status')
             ops_info = status.get_children()
             if ops_info:
@@ -322,7 +325,8 @@ class Client(client_base.Client):
         retry = 3
         while retry:
             try:
-                self.connection.invoke_successfully(clone_clear)
+                self.connection.invoke_successfully(clone_clear,
+                                                    enable_tunneling=True)
                 break
             except netapp_api.NaApiError:
                 # Filer might be rebooting
index 0f4740d5607f16c74c3ddc6e2ad2d9ace26337fa..eb686b0cf55f68d6cb7245540867b813f50ad02a 100644 (file)
@@ -28,6 +28,7 @@ from cinder.i18n import _, _LE, _LI
 from cinder.openstack.common import log as logging
 from cinder.volume.drivers.netapp.dataontap.client import client_7mode
 from cinder.volume.drivers.netapp.dataontap import nfs_base
+from cinder.volume.drivers.netapp import options as na_opts
 from cinder.volume.drivers.netapp import utils as na_utils
 from cinder.volume import utils as volume_utils
 
@@ -40,6 +41,7 @@ class NetApp7modeNfsDriver(nfs_base.NetAppNfsDriver):
 
     def __init__(self, *args, **kwargs):
         super(NetApp7modeNfsDriver, self).__init__(*args, **kwargs)
+        self.configuration.append_config_values(na_opts.netapp_7mode_opts)
 
     def do_setup(self, context):
         """Do the customized set up on client if any for 7 mode."""
@@ -50,7 +52,8 @@ class NetApp7modeNfsDriver(nfs_base.NetAppNfsDriver):
             username=self.configuration.netapp_login,
             password=self.configuration.netapp_password,
             hostname=self.configuration.netapp_server_hostname,
-            port=self.configuration.netapp_server_port)
+            port=self.configuration.netapp_server_port,
+            vfiler=self.configuration.netapp_vfiler)
 
     def check_for_setup_error(self):
         """Checks if setup occurred properly."""
index 6a334f2704120bacac475bc3a6f98f924e569f53..42cbc9267a84f764532ec5630f71603de58e9133 100644 (file)
@@ -61,6 +61,7 @@ class NetAppNfsDriver(nfs.NfsDriver):
         self.configuration.append_config_values(na_opts.netapp_basicauth_opts)
         self.configuration.append_config_values(na_opts.netapp_transport_opts)
         self.configuration.append_config_values(na_opts.netapp_img_cache_opts)
+        self.configuration.append_config_values(na_opts.netapp_nfs_extra_opts)
 
     def set_execute(self, execute):
         self._execute = execute
index db267c29fe180b6b6baf48a5fb7ebc82e6b64ad6..a11d9c02be497f05e68a374be6cbe7c29320edd6 100644 (file)
@@ -51,7 +51,6 @@ class NetAppCmodeNfsDriver(nfs_base.NetAppNfsDriver):
     def __init__(self, *args, **kwargs):
         super(NetAppCmodeNfsDriver, self).__init__(*args, **kwargs)
         self.configuration.append_config_values(na_opts.netapp_cluster_opts)
-        self.configuration.append_config_values(na_opts.netapp_nfs_extra_opts)
 
     def do_setup(self, context):
         """Do the customized set up on client for cluster mode."""
index 9e979d2b656ed58320b1616cd7530da985eefe48..8a701616f60529955bd96da10620f84677fc0730 100644 (file)
@@ -105,8 +105,7 @@ netapp_7mode_opts = [
                help=('The vFiler unit on which provisioning of block storage '
                      'volumes will be done. This option is only used by the '
                      'driver when connecting to an instance with a storage '
-                     'family of Data ONTAP operating in 7-Mode and the '
-                     'storage protocol selected is iSCSI. Only use this '
+                     'family of Data ONTAP operating in 7-Mode. Only use this '
                      'option when utilizing the MultiStore feature on the '
                      'NetApp storage system.')), ]
 
index 5889decee4bc34e73726baebf293dd85a51c5e35..e5027cd3b765d229dadc3ffd11e751b172187475 100644 (file)
 # The vFiler unit on which provisioning of block storage
 # volumes will be done. This option is only used by the driver
 # when connecting to an instance with a storage family of Data
-# ONTAP operating in 7-Mode and the storage protocol selected
-# is iSCSI. Only use this option when utilizing the MultiStore
-# feature on the NetApp storage system. (string value)
+# ONTAP operating in 7-Mode. Only use this option when
+# utilizing the MultiStore feature on the NetApp storage
+# system. (string value)
 #netapp_vfiler=<None>
 
 # Administrative user account name used to access the storage