]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
qa/tasks: add client node info to smb workunit config dump
authorJohn Mulligan <jmulligan@redhat.com>
Fri, 9 Jan 2026 16:12:46 +0000 (11:12 -0500)
committerJohn Mulligan <jmulligan@redhat.com>
Thu, 29 Jan 2026 17:07:04 +0000 (12:07 -0500)
When generating the big ball of config JSON that helps define
parameters for the smb tests in the workunit add client "node"
info as well.
Add a function to avoid repeating the logic of getting node
info from the teuthology remote object.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
qa/tasks/smb.py

index ea226cc1aae14dce1107f3b903fdf1898fe03657..691b33677e16e87a84819bd69251acc89fd799ac 100644 (file)
@@ -383,6 +383,16 @@ def workunit(ctx, config):
         return workunit.task(ctx, _config)
 
 
+def _node_info(ctx, role_name, **kwargs):
+    (remote,) = ctx.cluster.only(role_name).remotes.keys()
+    info = dict(remote.inventory_info)
+    info['_role_name'] = role_name
+    info['shortname'] = remote.shortname
+    info['ip_address'] = remote.ip_address
+    info.update(kwargs)
+    return info
+
+
 @contextlib.contextmanager
 def write_metadata_file(ctx, config, *, roles=None):
     obj = {
@@ -395,18 +405,16 @@ def write_metadata_file(ctx, config, *, roles=None):
     }
     if config.get('admin_node'):
         role = config.get('admin_node')
-        (remote,) = ctx.cluster.only(role).remotes.keys()
-        n = obj['admin_node'] = remote.inventory_info
-        n['shortname'] = remote.shortname
-        n['ip_address'] = remote.ip_address
+        obj['admin_node'] = _node_info(ctx, role)
     if config.get('smb_nodes'):
-        snodes = obj['smb_nodes'] = []
-        for node in config.get('smb_nodes'):
-            (remote,) = ctx.cluster.only(node).remotes.keys()
-            n = dict(remote.inventory_info)
-            n['shortname'] = remote.shortname
-            n['ip_address'] = remote.ip_address
-            snodes.append(n)
+        obj['smb_nodes'] = [
+            _node_info(ctx, node) for node in config.get('smb_nodes')
+        ]
+    if config.get('clients'):
+        obj['client_nodes'] = [
+            _node_info(ctx, node, client_name=node)
+            for node in config.get('clients')
+        ]
     data = json.dumps(obj)
     log.debug('smb metadata: %r', obj)