]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-ansible.git/commitdiff
validate: split schema for lvm osd scenario per objecstore
authorAlfredo Deza <adeza@redhat.com>
Mon, 21 May 2018 12:09:00 +0000 (08:09 -0400)
committerSébastien Han <seb@redhat.com>
Tue, 22 May 2018 15:57:28 +0000 (17:57 +0200)
The bluestore lvm osd scenario does not require a journal entry. For
this reason we need to have a separate schema for that and filestore or
notario will fail validation for the bluestore lvm scenario because the
journal key does not exist in lvm_volumes.

Signed-off-by: Alfredo Deza <adeza@redhat.com>
(cherry picked from commit d916246bfeb927779fa920bab2e0cc736128c8a7)

plugins/actions/validate.py

index a7974fa848ff6ac3394678d10c5691163467896c..60716a0d569b12e085fbe38498fddb7a3038665d 100644 (file)
@@ -82,7 +82,10 @@ class ActionModule(ActionBase):
                     notario.validate(host_vars, non_collocated_osd_scenario, defined_keys=True)
 
                 if host_vars["osd_scenario"] == "lvm":
-                    notario.validate(host_vars, lvm_osd_scenario, defined_keys=True)
+                    if notario_store['osd_objectstore'] == 'filestore':
+                        notario.validate(host_vars, lvm_filestore_scenario, defined_keys=True)
+                    elif notario_store['osd_objectstore'] == 'bluestore':
+                        notario.validate(host_vars, lvm_bluestore_scenario, defined_keys=True)
 
         except Invalid as error:
             display.vvvv("Notario Failure: %s" % str(error))
@@ -147,11 +150,6 @@ def validate_objectstore(value):
     assert value in ["filestore", "bluestore"], "objectstore must be set to 'filestore' or 'bluestore'"
 
 
-def validate_lvm_volumes(value):
-    if notario_store['osd_objectstore'] == "filestore":
-        assert isinstance(value, basestring), "lvm_volumes must contain a 'journal' key when the objectstore is 'filestore'"
-
-
 def validate_ceph_stable_release(value):
     assert value in CEPH_RELEASES, "ceph_stable_release must be set to one of the following: %s" % ", ".join(CEPH_RELEASES)
 
@@ -170,7 +168,6 @@ def validate_rados_options(value):
     assert any([radosgw_address_given, radosgw_address_block_given, radosgw_interface_given]), msg
 
 
-
 install_options = (
     ("ceph_origin", ceph_origin_choices),
     ("containerized_deployment", types.boolean),
@@ -225,14 +222,20 @@ non_collocated_osd_scenario = (
     ("devices", iterables.AllItems(types.string)),
 )
 
-lvm_osd_scenario = ("lvm_volumes", iterables.AllItems((
+lvm_filestore_scenario = ("lvm_volumes", iterables.AllItems((
+    (optional('crush_device_class'), types.string),
+    ('data', types.string),
+    (optional('data_vg'), types.string),
+    ('journal', types.string),
+    (optional('journal_vg'), types.string),
+)))
+
+lvm_bluestore_scenario = ("lvm_volumes", iterables.AllItems((
     (optional('crush_device_class'), types.string),
     ('data', types.string),
     (optional('data_vg'), types.string),
     (optional('db'), types.string),
     (optional('db_vg'), types.string),
-    ('journal', optional(validate_lvm_volumes)),
-    (optional('journal_vg'), types.string),
     (optional('wal'), types.string),
     (optional('wal_vg'), types.string),
 )))