tests: allow defining arbitrary number of OSDs

Some tests might want to set this since number of devices will not
necessarily map to number of OSDs

Signed-off-by: Alfredo Deza <adeza@redhat.com>
pull/3091/head
Alfredo Deza 2018-08-31 12:29:17 -07:00 committed by mergify[bot]
parent 772e6b9be2
commit e5fcb0d2d2
1 changed files with 4 additions and 0 deletions

View File

@ -91,6 +91,9 @@ def node(host, request):
num_devices = len(ansible_vars.get("devices", [])) num_devices = len(ansible_vars.get("devices", []))
if not num_devices: if not num_devices:
num_devices = len(ansible_vars.get("lvm_volumes", [])) num_devices = len(ansible_vars.get("lvm_volumes", []))
# If number of devices doesn't map to number of OSDs, allow tests to define
# that custom number, defaulting it to ``num_devices``
num_osds = ansible_vars.get('num_osds', num_devices)
cluster_name = ansible_vars.get("cluster", "ceph") cluster_name = ansible_vars.get("cluster", "ceph")
conf_path = "/etc/ceph/{}.conf".format(cluster_name) conf_path = "/etc/ceph/{}.conf".format(cluster_name)
if "osds" in group_names: if "osds" in group_names:
@ -116,6 +119,7 @@ def node(host, request):
osd_ids=osd_ids, osd_ids=osd_ids,
num_mons=num_mons, num_mons=num_mons,
num_devices=num_devices, num_devices=num_devices,
num_osds=num_osds,
cluster_name=cluster_name, cluster_name=cluster_name,
conf_path=conf_path, conf_path=conf_path,
cluster_address=cluster_address, cluster_address=cluster_address,