]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/nfs: Add __eq__ method to Export
authorSebastian Wagner <sewagner@redhat.com>
Wed, 2 Jun 2021 10:42:54 +0000 (12:42 +0200)
committerSebastian Wagner <sewagner@redhat.com>
Thu, 9 Sep 2021 14:17:47 +0000 (16:17 +0200)
Signed-off-by: Sebastian Wagner <sewagner@redhat.com>
(cherry picked from commit b3ddff838461be1805612184a6cd8ccbedb03ae5)

src/pybind/mgr/nfs/export_utils.py
src/pybind/mgr/nfs/tests/test_nfs.py
src/pybind/mgr/tests/__init__.py
src/pybind/mgr/tox.ini

index 4efe1dc8fac18cd2969c4e1354567f63d324f654..b5aceb24fe26b02bd3a799f18171ea3dd33469ea 100644 (file)
@@ -494,3 +494,8 @@ class Export:
             pass
         else:
             raise NFSInvalidOperation('FSAL {self.fsal.name} not supported')
+
+    def __eq__(self, other):
+        if not isinstance(other, Export):
+            return False
+        return self.to_dict() == other.to_dict()
index 13386c4a2283680b7a88690b0f8ec0a24e616cc9..f7a4ced10340542938f7a83f857a4a4e6660d99c 100644 (file)
@@ -198,9 +198,8 @@ EXPORT
                                                    pool=cluster_info['pool'],
                                                    namespace=cluster_info['namespace']))
         ] if enable else []
-        # pylint: disable=protected-access
-        #ganesha.Ganesha._get_orch_nfs_services = Mock(return_value=orch_nfs_services)
 
+        """
         # mock nfs daemons
         def _get_nfs_instances(service_name=None):
             if not enable:
@@ -220,6 +219,8 @@ EXPORT
             for _, daemons in instances.items():
                 result.extend(daemons)
             return result
+        """
+
         with mock.patch('nfs.module.Module.describe_service') as describe_service, \
              mock.patch('nfs.module.Module.rados') as rados:
 
@@ -233,9 +234,6 @@ EXPORT
 
             yield
 
-        #ganesha.ExportMgrOrchestrator._get_orch_nfs_instances = Mock(
-        #    side_effect=_get_nfs_instances)
-
     def test_parse_daemon_raw_config(self):
         expected_daemon_config = [
             {
index ff97d2e2c1f180a3d3d33a948a7274d66042a4f8..c80c3574677bc474b840663414b59dd59708b0bd 100644 (file)
@@ -176,11 +176,11 @@ if 'UNITTEST' in os.environ:
                 self._store = {}
 
 
-            if self.__class__.__name__ not in M_classes:
+            if self.__class__ not in M_classes:
                 # call those only once.
                 self._register_commands('')
                 self._register_options('')
-                M_classes.add(self.__class__.__name__)
+                M_classes.add(self.__class__)
 
             super(M, self).__init__()
             self._ceph_get_version = mock.Mock()
index 0b0ddc9bda84df9a1d2a3cb8df34db5a8ab32a8d..0e589f2ad59d65676e3234320b6b2747c2d0e181 100644 (file)
@@ -44,6 +44,7 @@ commands =
         tests/ \
         cephadm/ \
         mds_autoscaler/ \
+        nfs/ \
         orchestrator/ \
         insights/ \
         pg_autoscaler/ \