Browse Source

Merge "VNX: share server cannot be deleted" into stable/ocata

tags/4.0.1
Jenkins 1 year ago
parent
commit
36495bb8f7

+ 2
- 1
manila/share/drivers/dell_emc/plugins/vnx/object_manager.py View File

@@ -1015,7 +1015,8 @@ class VDM(StorageObject):
1015 1015
                     if_name = m_if.group('if').strip()
1016 1016
                     if 'cifs' == m_if.group('type') and if_name != '':
1017 1017
                         interfaces['cifs'].append(if_name)
1018
-                    elif 'vdm' == m_if.group('type') and if_name != '':
1018
+                    elif (m_if.group('type') in ('vdm', 'nfs')
1019
+                          and if_name != ''):
1019 1020
                         interfaces['nfs'].append(if_name)
1020 1021
 
1021 1022
         return interfaces

+ 28
- 2
manila/tests/share/drivers/dell_emc/plugins/vnx/fakes.py View File

@@ -758,8 +758,9 @@ class VDMTestData(StorageObjectTestData):
758 758
             '-vdm', self.vdm_name,
759 759
         ]
760 760
 
761
-    def output_get_interfaces(self, cifs_interface=FakeData.interface_name1,
762
-                              nfs_interface=FakeData.interface_name2):
761
+    def output_get_interfaces_vdm(self,
762
+                                  cifs_interface=FakeData.interface_name1,
763
+                                  nfs_interface=FakeData.interface_name2):
763 764
         return (
764 765
             """id        = %(vdmid)s
765 766
             name      = %(name)s
@@ -782,6 +783,31 @@ class VDMTestData(StorageObjectTestData):
782 783
              'cifs_if_name': cifs_interface}
783 784
         )
784 785
 
786
+    def output_get_interfaces_nfs(self,
787
+                                  cifs_interface=FakeData.interface_name1,
788
+                                  nfs_interface=FakeData.interface_name2):
789
+        return (
790
+            """id        = %(vdmid)s
791
+            name      = %(name)s
792
+            acl       = 0
793
+            type      = vdm
794
+            server    = server_2
795
+            rootfs    = root_fs_vdm_vdm-fakeid
796
+            I18N mode = UNICODE
797
+            mountedfs =
798
+            member_of =
799
+            status    :
800
+              defined = enabled
801
+               actual = loaded, active
802
+            Interfaces to services mapping:
803
+             interface=%(nfs_if_name)s :nfs
804
+             interface=%(cifs_if_name)s :cifs""" %
805
+            {'vdmid': self.vdm_id,
806
+             'name': self.vdm_name,
807
+             'nfs_if_name': nfs_interface,
808
+             'cifs_if_name': cifs_interface}
809
+        )
810
+
785 811
 
786 812
 class PoolTestData(StorageObjectTestData):
787 813
     def __init__(self):

+ 6
- 6
manila/tests/share/drivers/dell_emc/plugins/vnx/test_connection.py View File

@@ -716,7 +716,7 @@ class StorageConnectionTestCase(test.TestCase):
716 716
         xml_req_mock = utils.EMCMock(side_effect=hook)
717 717
         self.connection.manager.connectors['XML'].request = xml_req_mock
718 718
         ssh_hook = utils.SSHSideEffect()
719
-        ssh_hook.append(self.vdm.output_get_interfaces(nfs_interface=''))
719
+        ssh_hook.append(self.vdm.output_get_interfaces_vdm(nfs_interface=''))
720 720
         ssh_cmd_mock = mock.Mock(side_effect=ssh_hook)
721 721
         self.connection.manager.connectors['SSH'].run_ssh = ssh_cmd_mock
722 722
 
@@ -755,7 +755,7 @@ class StorageConnectionTestCase(test.TestCase):
755 755
         self.connection.manager.connectors['XML'].request = xml_req_mock
756 756
 
757 757
         ssh_hook = utils.SSHSideEffect()
758
-        ssh_hook.append(self.vdm.output_get_interfaces(nfs_interface=''))
758
+        ssh_hook.append(self.vdm.output_get_interfaces_vdm(nfs_interface=''))
759 759
         ssh_cmd_mock = mock.Mock(side_effect=ssh_hook)
760 760
         self.connection.manager.connectors['SSH'].run_ssh = ssh_cmd_mock
761 761
 
@@ -805,7 +805,7 @@ class StorageConnectionTestCase(test.TestCase):
805 805
         self.connection.manager.connectors['XML'].request = xml_req_mock
806 806
 
807 807
         ssh_hook = utils.SSHSideEffect()
808
-        ssh_hook.append(self.vdm.output_get_interfaces())
808
+        ssh_hook.append(self.vdm.output_get_interfaces_vdm())
809 809
         ssh_hook.append()
810 810
         ssh_cmd_mock = mock.Mock(side_effect=ssh_hook)
811 811
         self.connection.manager.connectors['SSH'].run_ssh = ssh_cmd_mock
@@ -848,7 +848,7 @@ class StorageConnectionTestCase(test.TestCase):
848 848
         self.connection.manager.connectors['XML'].request = xml_req_mock
849 849
 
850 850
         ssh_hook = utils.SSHSideEffect()
851
-        ssh_hook.append(self.vdm.output_get_interfaces())
851
+        ssh_hook.append(self.vdm.output_get_interfaces_vdm())
852 852
         ssh_hook.append()
853 853
         ssh_cmd_mock = mock.Mock(side_effect=ssh_hook)
854 854
         self.connection.manager.connectors['SSH'].run_ssh = ssh_cmd_mock
@@ -906,7 +906,7 @@ class StorageConnectionTestCase(test.TestCase):
906 906
         self.connection.manager.connectors['XML'].request = xml_req_mock
907 907
 
908 908
         ssh_hook = utils.SSHSideEffect()
909
-        ssh_hook.append(self.vdm.output_get_interfaces())
909
+        ssh_hook.append(self.vdm.output_get_interfaces_vdm())
910 910
         ssh_hook.append()
911 911
         ssh_cmd_mock = mock.Mock(side_effect=ssh_hook)
912 912
         self.connection.manager.connectors['SSH'].run_ssh = ssh_cmd_mock
@@ -947,7 +947,7 @@ class StorageConnectionTestCase(test.TestCase):
947 947
         self.connection.manager.connectors['XML'].request = xml_req_mock
948 948
 
949 949
         ssh_hook = utils.SSHSideEffect()
950
-        ssh_hook.append(self.vdm.output_get_interfaces())
950
+        ssh_hook.append(self.vdm.output_get_interfaces_vdm())
951 951
         ssh_hook.append()
952 952
         ssh_cmd_mock = mock.Mock(side_effect=ssh_hook)
953 953
         self.connection.manager.connectors['SSH'].run_ssh = ssh_cmd_mock

+ 7
- 4
manila/tests/share/drivers/dell_emc/plugins/vnx/test_object_manager.py View File

@@ -851,6 +851,7 @@ class MountPointTestCase(StorageObjectTestCaseBase):
851 851
         context.conn['XML'].request.assert_has_calls(expected_calls)
852 852
 
853 853
 
854
+@ddt.ddt
854 855
 class VDMTestCase(StorageObjectTestCaseBase):
855 856
     def setUp(self):
856 857
         super(self.__class__, self).setUp()
@@ -1075,11 +1076,11 @@ class VDMTestCase(StorageObjectTestCaseBase):
1075 1076
     def test_detach_nfs_interface_with_error(self):
1076 1077
         self.ssh_hook.append(ex=processutils.ProcessExecutionError(
1077 1078
             stdout=self.vdm.fake_output))
1078
-        self.ssh_hook.append(self.vdm.output_get_interfaces(
1079
+        self.ssh_hook.append(self.vdm.output_get_interfaces_vdm(
1079 1080
             self.mover.interface_name2))
1080 1081
         self.ssh_hook.append(ex=processutils.ProcessExecutionError(
1081 1082
             stdout=self.vdm.fake_output))
1082
-        self.ssh_hook.append(self.vdm.output_get_interfaces(
1083
+        self.ssh_hook.append(self.vdm.output_get_interfaces_vdm(
1083 1084
             nfs_interface=fakes.FakeData.interface_name1))
1084 1085
 
1085 1086
         context = self.manager.getStorageContext('VDM')
@@ -1101,8 +1102,10 @@ class VDMTestCase(StorageObjectTestCaseBase):
1101 1102
         ]
1102 1103
         context.conn['SSH'].run_ssh.assert_has_calls(ssh_calls)
1103 1104
 
1104
-    def test_get_cifs_nfs_interface(self):
1105
-        self.ssh_hook.append(self.vdm.output_get_interfaces())
1105
+    @ddt.data(fakes.VDMTestData().output_get_interfaces_vdm(),
1106
+              fakes.VDMTestData().output_get_interfaces_nfs())
1107
+    def test_get_cifs_nfs_interface(self, fake_output):
1108
+        self.ssh_hook.append(fake_output)
1106 1109
 
1107 1110
         context = self.manager.getStorageContext('VDM')
1108 1111
         context.conn['SSH'].run_ssh = mock.Mock(side_effect=self.ssh_hook)

+ 5
- 0
releasenotes/notes/share-server-delete-failure-ca29d6b286a2c790.yaml View File

@@ -0,0 +1,5 @@
1
+---
2
+fixes:
3
+  - Fix the issue of deleting share server in VNX driver. The VNX driver failed
4
+    to detect the NFS interface of share server, so the detach and deletion of
5
+    NFS interface were skipped.

Loading…
Cancel
Save