]> git.apps.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)
committerSebastian Wagner <sebastian.wagner@suse.com>
Fri, 11 Sep 2020 12:17:09 +0000 (14:17 +0200)
Signed-off-by: Sebastian Wagner <sebastian.wagner@suse.com>
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 65f5996caa092516d5fb5a2628a150af7e3c40d9..84162ac87a976add387b5a5584bd44bbb34293dd 100644 (file)
@@ -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),