> From: dev <dev-boun...@dpdk.org> On Behalf Of Bruce Richardson > Sent: Tuesday 12 October 2021 17:39 > To: dev@dpdk.org > Cc: Power, Ciara <ciara.po...@intel.com>; David Marchand > <david.march...@redhat.com>; Burakov, Anatoly > <anatoly.bura...@intel.com>; Kevin Traynor <ktray...@redhat.com>; > Richardson, Bruce <bruce.richard...@intel.com> > 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 <bruce.richard...@intel.com> > Acked-by: Ciara Power <ciara.po...@intel.com> > ---
<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 <conor.wa...@intel.com> > + 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>