]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
qa/cephadm: Add iSCSI
authorSebastian Wagner <sebastian.wagner@suse.com>
Thu, 11 Jun 2020 14:11:29 +0000 (16:11 +0200)
committerNathan Cutler <ncutler@suse.com>
Tue, 6 Oct 2020 09:40:53 +0000 (11:40 +0200)
Signed-off-by: Sebastian Wagner <sebastian.wagner@suse.com>
(cherry picked from commit 430f2c51320ed0092c17273ea12e6b527ae735ed)

qa/suites/rados/cephadm/smoke/fixed-2.yaml
qa/tasks/cephadm.py

index 8a3ad9f58c3b445d6c4d75c3129e6d6eddefc7f3..827d887b6dd351953ff7553038dffe6d992b682e 100644 (file)
@@ -20,6 +20,7 @@ roles:
   - prometheus.a
   - grafana.a
   - node-exporter.b
+  - ceph.iscsi.iscsi.a
 openstack:
 - volumes: # attached to each instance
     count: 4
index 05408b2f0547fa7e0e713f87e6e9f392b3056ccf..d51c9cdfd84ffaac22b60a7088164d8f83e6c01d 100644 (file)
@@ -788,6 +788,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']
@@ -1219,6 +1269,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),