]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
python-common: Add NFSServiceSpec validate
authorMichael Fritch <mfritch@suse.com>
Mon, 8 Jun 2020 22:31:23 +0000 (16:31 -0600)
committerSebastian Wagner <sebastian.wagner@suse.com>
Tue, 14 Jul 2020 09:39:06 +0000 (11:39 +0200)
the ServiceSpec needs to be validated during `orch apply`, but not
during `orch daemon add`

Signed-off-by: Michael Fritch <mfritch@suse.com>
(cherry picked from commit 45391a1270178de87c6d2305f657809d5e1e6072)

src/pybind/mgr/orchestrator/module.py
src/python-common/ceph/deployment/service_spec.py
src/python-common/ceph/tests/test_service_spec.py

index db5c5ffd1bf6e9812ad19987baf77275d1cbe160..2818a4263f2d0d63da6490d79be1862ca34fd5c3 100644 (file)
@@ -885,7 +885,6 @@ Usage:
             placement=PlacementSpec.from_string(placement),
         )
 
-        spec.validate_add()
         completion = self.add_nfs(spec)
         self._orchestrator_wait([completion])
         raise_if_exception(completion)
index 0d36512cd02609264f4f550ccfaa4d1678697df4..139420e817ffedfb51352dcf344830c6214bd5af 100644 (file)
@@ -523,11 +523,12 @@ class NFSServiceSpec(ServiceSpec):
         #: RADOS namespace where NFS client recovery data is stored in the pool.
         self.namespace = namespace
 
-    def validate_add(self):
-        servicespec_validate_add(self)
+    def validate(self):
+        super(NFSServiceSpec, self).validate()
 
         if not self.pool:
-            raise ServiceSpecValidationError('Cannot add NFS: No Pool specified')
+            raise ServiceSpecValidationError(
+                'Cannot add NFS: No Pool specified')
 
     def rados_config_name(self):
         # type: () -> str
index 12a8be84bfd6569018e988813c8e37f8805e6054..43bf8ee3afcf619bde74777f3f88eecee9471b01 100644 (file)
@@ -92,6 +92,8 @@ def test_servicespec_map_test(s_type, o_spec, s_id):
         "placement":
             dict(hosts=["host1:1.1.1.1"])
     }
+    if s_type == 'nfs':
+        dict_spec['pool'] = 'pool'
     spec = ServiceSpec.from_json(dict_spec)
     assert isinstance(spec, o_spec)
     assert isinstance(spec.placement, PlacementSpec)