]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
qa/tasks/cephadm: add apply() method/task
authorSage Weil <sage@newdream.net>
Thu, 1 Apr 2021 20:37:13 +0000 (15:37 -0500)
committerSage Weil <sage@newdream.net>
Sat, 10 Apr 2021 13:06:49 +0000 (08:06 -0500)
Signed-off-by: Sage Weil <sage@newdream.net>
(cherry picked from commit 05b3ce258547d64a094b786a969d2b79c48a466e)

qa/suites/rados/cephadm/smoke-roleless/2-services/rgw.yaml
qa/tasks/cephadm.py

index fab3551c8531545692e672092027be362edcf649..161b15c770cf06b34826ad62b77d84b8f5e02be8 100644 (file)
@@ -1,5 +1,12 @@
 tasks:
-- cephadm.shell:
-    host.a:
-      - ceph orch apply rgw foo --port=8000 "--placement=count-per-host:4 *"
-      - sleep 60
+- cephadm.apply:
+    specs:
+      - service_type: rgw
+        service_id: foo
+        placement:
+          count_per_host: 4
+          host_pattern: "*"
+        spec:
+          rgw_frontend_port: 8000
+- sleep:
+    interval: 60
index 33bc9e4f922ac9d8d4909b61a24405c8a89e4c1f..01d49a7f3acbe772ffbaaa622f03f518c48ea27c 100644 (file)
@@ -956,6 +956,38 @@ def shell(ctx, config):
                    ['bash', '-c', c],
                    extra_cephadm_args=env)
 
+def apply(ctx, config):
+    """
+    Apply spec
+    
+      tasks:
+        - cephadm.apply:
+            specs:
+            - service_type: rgw
+              service_id: foo
+              spec:
+                rgw_frontend_port: 8000
+            - service_type: rgw
+              service_id: bar
+              spec:
+                rgw_frontend_port: 9000
+                zone: bar
+                realm: asdf
+
+    """
+    cluster_name = config.get('cluster', 'ceph')
+
+    specs = config.get('specs', [])
+    y = '\n---\n'.join(map(yaml.dump, specs))
+
+    log.info(f'Applying spec:\n{y}')
+    _shell(
+        ctx, cluster_name, ctx.ceph[cluster_name].bootstrap_remote,
+        ['ceph', 'orch', 'apply', '-i', '-'],
+        stdin=y,
+    )
+
+
 @contextlib.contextmanager
 def tweaked_option(ctx, config):
     """