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 <adeza@redhat.com>
(cherry picked from commit d916246bfeb927779fa920bab2e0cc736128c8a7)
pull/2627/head
Alfredo Deza 2018-05-21 08:09:00 -04:00 committed by Sébastien Han
parent a9ad8eb5f3
commit 4d1338b4bf
1 changed files with 13 additions and 10 deletions

View 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),
)))