From 430f2c51320ed0092c17273ea12e6b527ae735ed Mon Sep 17 00:00:00 2001 From: Sebastian Wagner Date: Thu, 11 Jun 2020 16:11:29 +0200 Subject: [PATCH] qa/cephadm: Add iSCSI Signed-off-by: Sebastian Wagner --- qa/suites/rados/cephadm/smoke/fixed-2.yaml | 1 + qa/tasks/cephadm.py | 51 ++++++++++++++++++++++ 2 files changed, 52 insertions(+) diff --git a/qa/suites/rados/cephadm/smoke/fixed-2.yaml b/qa/suites/rados/cephadm/smoke/fixed-2.yaml index 8a3ad9f58c3..827d887b6dd 100644 --- a/qa/suites/rados/cephadm/smoke/fixed-2.yaml +++ b/qa/suites/rados/cephadm/smoke/fixed-2.yaml @@ -20,6 +20,7 @@ roles: - prometheus.a - grafana.a - node-exporter.b + - ceph.iscsi.iscsi.a openstack: - volumes: # attached to each instance count: 4 diff --git a/qa/tasks/cephadm.py b/qa/tasks/cephadm.py index 65f5996caa0..84162ac87a9 100644 --- a/qa/tasks/cephadm.py +++ b/qa/tasks/cephadm.py @@ -777,6 +777,56 @@ def ceph_rgw(ctx, config): yield + +@contextlib.contextmanager +def ceph_iscsi(ctx, config): + """ + Deploy iSCSIs + """ + cluster_name = config['cluster'] + fsid = ctx.ceph[cluster_name].fsid + + nodes = [] + daemons = {} + for remote, roles in ctx.cluster.remotes.items(): + for role in [r for r in roles + if teuthology.is_type('iscsi', cluster_name)(r)]: + c_, _, id_ = teuthology.split_role(role) + log.info('Adding %s on %s' % (role, remote.shortname)) + nodes.append(remote.shortname + '=' + id_) + daemons[role] = (remote, id_) + if nodes: + poolname = 'iscsi' + # ceph osd pool create iscsi 3 3 replicated + _shell(ctx, cluster_name, remote, [ + 'ceph', 'osd', 'pool', 'create', + poolname, '3', '3', 'replicated'] + ) + + _shell(ctx, cluster_name, remote, [ + 'ceph', 'osd', 'pool', 'application', 'enable', + poolname, 'rbd'] + ) + + # ceph orch apply iscsi iscsi user password + _shell(ctx, cluster_name, remote, [ + 'ceph', 'orch', 'apply', 'iscsi', + poolname, 'user', 'password', + '--placement', str(len(nodes)) + ';' + ';'.join(nodes)] + ) + for role, i in daemons.items(): + remote, id_ = i + ctx.daemons.register_daemon( + remote, 'iscsi', id_, + cluster=cluster_name, + fsid=fsid, + logger=log.getChild(role), + wait=False, + started=True, + ) + + yield + @contextlib.contextmanager def ceph_clients(ctx, config): cluster_name = config['cluster'] @@ -1198,6 +1248,7 @@ def task(ctx, config): lambda: ceph_osds(ctx=ctx, config=config), lambda: ceph_mdss(ctx=ctx, config=config), lambda: ceph_rgw(ctx=ctx, config=config), + lambda: ceph_iscsi(ctx=ctx, config=config), lambda: ceph_monitoring('prometheus', ctx=ctx, config=config), lambda: ceph_monitoring('node-exporter', ctx=ctx, config=config), lambda: ceph_monitoring('alertmanager', ctx=ctx, config=config), -- 2.39.5