]> 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)
committerMichael Fritch <mfritch@suse.com>
Tue, 9 Jun 2020 00:09:53 +0000 (18:09 -0600)
the ServiceSpec needs to be validated during `orch apply`, but not
during `orch daemon add`

Signed-off-by: Michael Fritch <mfritch@suse.com>
src/pybind/mgr/orchestrator/module.py
src/python-common/ceph/deployment/service_spec.py
src/python-common/ceph/tests/test_service_spec.py

index 7947cdb408c4ea019fb7280cf6421362c7e06eba..947778c70bae658e1ba75a500148f50a07b945b0 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 362dd1bfeb5169957913de6926a1bb2a3d805fd0..e9cc58b53645dd3302de213c30889f1e57fa6ded 100644 (file)
@@ -509,11 +509,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)