From 1ce9384b652fdc55a35a6d8999d54e04a715fd68 Mon Sep 17 00:00:00 2001 From: Clinton Knight Date: Mon, 20 Apr 2015 16:10:14 -0400 Subject: [PATCH] NetApp cDOT driver clones NFS export policy When clustered Data ONTAP clones a flexvol, the clone gets the NFS export policy of its parent. Manila expects the clone to be independent of its parent, so it should be given its own export policy. This isn't happening in the Kilo cDOT driver. Change-Id: I5067fc5729bec62de19d1aeaed7ed60d2224e498 Closes-Bug: #1446369 (cherry picked from commit b907ca09f13389f8ac3fa059785c1d1e644f85bf) --- .../share/drivers/netapp/dataontap/protocols/nfs_cmode.py | 1 + .../drivers/netapp/dataontap/protocols/test_nfs_cmode.py | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/manila/share/drivers/netapp/dataontap/protocols/nfs_cmode.py b/manila/share/drivers/netapp/dataontap/protocols/nfs_cmode.py index 2f02ff961a..55464ae04b 100644 --- a/manila/share/drivers/netapp/dataontap/protocols/nfs_cmode.py +++ b/manila/share/drivers/netapp/dataontap/protocols/nfs_cmode.py @@ -33,6 +33,7 @@ class NetAppCmodeNFSHelper(base.NetAppBaseHelper): @na_utils.trace def create_share(self, share, share_name, export_addresses): """Creates NFS share.""" + self._client.clear_nfs_export_policy_for_volume(share_name) self._ensure_export_policy(share, share_name) export_path = self._client.get_volume_junction_path(share_name) return [':'.join([export_address, export_path]) diff --git a/manila/tests/share/drivers/netapp/dataontap/protocols/test_nfs_cmode.py b/manila/tests/share/drivers/netapp/dataontap/protocols/test_nfs_cmode.py index 94b28ea4d1..66459776de 100644 --- a/manila/tests/share/drivers/netapp/dataontap/protocols/test_nfs_cmode.py +++ b/manila/tests/share/drivers/netapp/dataontap/protocols/test_nfs_cmode.py @@ -50,6 +50,8 @@ class NetAppClusteredNFSHelperTestCase(test.TestCase): expected = [':'.join([fake.SHARE_ADDRESS_1, fake.NFS_SHARE_PATH])] self.assertEqual(expected, result) + self.mock_client.clear_nfs_export_policy_for_volume.\ + assert_called_once_with(fake.SHARE_NAME) self.assertTrue(mock_ensure_export_policy.called) def test_create_share_multiple(self): @@ -67,6 +69,8 @@ class NetAppClusteredNFSHelperTestCase(test.TestCase): expected = [':'.join([fake.SHARE_ADDRESS_1, fake.NFS_SHARE_PATH]), ':'.join([fake.SHARE_ADDRESS_2, fake.NFS_SHARE_PATH])] self.assertEqual(expected, result) + self.mock_client.clear_nfs_export_policy_for_volume.\ + assert_called_once_with(fake.SHARE_NAME) self.assertTrue(mock_ensure_export_policy.called) def test_delete_share(self): @@ -226,4 +230,4 @@ class NetAppClusteredNFSHelperTestCase(test.TestCase): self.assertFalse(self.mock_client.create_nfs_export_policy.called) self.mock_client.rename_nfs_export_policy.assert_called_once_with( - 'fake', fake.EXPORT_POLICY_NAME) \ No newline at end of file + 'fake', fake.EXPORT_POLICY_NAME)