Thread (68 messages) 68 messages, 6 authors, 2021-10-15

Re: [dpdk-dev] [PATCH v8 4/4] usertools/dpdk-telemetry: provide info on available sockets

From: Walsh, Conor <hidden>
Date: 2021-10-13 13:17:00

From: dev <redacted> On Behalf Of Bruce Richardson
Sent: Tuesday 12 October 2021 17:39
To: dev@dpdk.org
Cc: Power, Ciara <redacted>; David Marchand
[off-list ref]; Burakov, Anatoly
[off-list ref]; Kevin Traynor [off-list ref];
Richardson, Bruce [off-list ref]
Subject: [dpdk-dev] [PATCH v8 4/4] usertools/dpdk-telemetry: provide info
on available sockets

When a user runs the dpdk-telemetry script and fails to connect because
the socket path does not exist, run a scan for possible sockets that
could be connected to and inform the user of the command needed to
connect to those.

For example:

  $ ./dpdk-telemetry.py -i4
  Connecting to /run/user/1000/dpdk/rte/dpdk_telemetry.v2:4
  Error connecting to /run/user/1000/dpdk/rte/dpdk_telemetry.v2:4

  Other DPDK telemetry sockets found:
  - dpdk_telemetry.v2  # Connect with './dpdk-telemetry.py'
  - dpdk_telemetry.v2:2  # Connect with './dpdk-telemetry.py -i 2'
  - dpdk_telemetry.v2:1  # Connect with './dpdk-telemetry.py -i 1'

Signed-off-by: Bruce Richardson <redacted>
Acked-by: Ciara Power <redacted>
---
<snip>
+def print_socket_options(prefix, paths):
+    """ Given a set of socket paths, give the commands needed to connect
"""
+    cmd = sys.argv[0]
+    if prefix != DEFAULT_PREFIX:
+        cmd += " -f " + prefix
+    for s in paths:
When I tested this the sockets were in the wrong order e.g. 2, 1, 0.
If the above paths variable was wrapped with sorted() it would ensure the list
was always in the correct order.

With or without this change:
Reviewed-by: Conor Walsh <redacted>
+        sock_name = os.path.basename(s)
+        if sock_name.endswith(TELEMETRY_VERSION):
+            print("- {}  # Connect with '{}'".format(os.path.basename(s),
+                                                     cmd))
+        else:
+            print("- {}  # Connect with '{} -i {}'".format(os.path.basename(s),
+                                                           cmd,
+                                                           s.split(':')[-1]))
<snip>
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help