From 4d1338b4bffb2db18b699dd08e2d5caa87ba589d Mon Sep 17 00:00:00 2001 From: Alfredo Deza Date: Mon, 21 May 2018 08:09:00 -0400 Subject: [PATCH] validate: split schema for lvm osd scenario per objecstore 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 (cherry picked from commit d916246bfeb927779fa920bab2e0cc736128c8a7) --- plugins/actions/validate.py | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/plugins/actions/validate.py b/plugins/actions/validate.py index a7974fa84..60716a0d5 100644 --- a/plugins/actions/validate.py +++ b/plugins/actions/validate.py @@ -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), )))