From: Michael Meffie Date: Wed, 16 Jan 2013 17:10:02 +0000 (-0500) Subject: vlclient: add -probe option X-Git-Tag: openafs-stable-1_8_0pre1~1612 X-Git-Url: https://git.openafs.org/?p=openafs.git;a=commitdiff_plain;h=bb733da134ce7d7742d5b7359edb36f67ec85632 vlclient: add -probe option Add a new option to the vlclient test program to call the probe server RPC to ping the vlservers in a cell. Uses a multi rx call to do the probes in parallel. The existing -host option can be used to ping a single vlserver. Change-Id: I25666b7ff139ae43364ac04869b14997f3ed0d53 Reviewed-on: http://gerrit.openafs.org/8911 Reviewed-by: Chas Williams - CONTRACTOR Reviewed-by: Derrick Brashear Tested-by: BuildBot --- diff --git a/src/vlserver/liboafs_vldb.la.sym b/src/vlserver/liboafs_vldb.la.sym index 1730061..ea9c653 100644 --- a/src/vlserver/liboafs_vldb.la.sym +++ b/src/vlserver/liboafs_vldb.la.sym @@ -28,3 +28,7 @@ ubik_VL_UpdateEntry ubik_VL_UpdateEntryByName xdr_bulkaddrs xdr_bulkentries +VL_ProbeServer +EndVL_ProbeServer +StartVL_ProbeServer +ubik_VL_ProbeServer diff --git a/src/vlserver/vlclient.c b/src/vlserver/vlclient.c index 4167d6e..403e20c 100644 --- a/src/vlserver/vlclient.c +++ b/src/vlserver/vlclient.c @@ -60,7 +60,7 @@ static char *opcode_names[VL_NUMBER_OPCODESX] = { "ListAttributes", "LinkedList", "GetStats", - "Probe", + "Probe", /* RPC is ProbeServer */ "GetAddrs", "ChangeAddr", "CreateEntryN", @@ -202,7 +202,42 @@ handleit(struct cmd_syndesc *as, void *arock) exit(1); } - if (as->parms[5].items) { /* -gstats */ + if (as->parms[6].items) { /* -probe */ + int nconns = 0; + int status = 0; + int i; + char hoststr[16]; + afs_uint32 addr; + + for (i = 0; cstruct->conns[i]; i++, nconns++) { + rx_SetConnDeadTime(cstruct->conns[i], 6); + addr = rx_HostOf(rx_PeerOf(cstruct->conns[i])); + if (!nconns) { + printf("probing"); + } + printf(" %s", afs_inet_ntoa_r(addr, hoststr)); + } + if (nconns == 0) { + printf("no connections\n"); + return 255; + } + printf("\n"); + multi_Rx(cstruct->conns, nconns) { + multi_VL_ProbeServer(); + addr = rx_HostOf(rx_PeerOf(cstruct->conns[multi_i])); + if (!multi_error) { + printf(" ok: %s\n", afs_inet_ntoa_r(addr, hoststr)); + } else { + status = 255; + printf(" not ok (%d): %s\n", multi_error, + afs_inet_ntoa_r(addr, hoststr)); + } + } + multi_End; + return status; + } + + if (as->parms[5].items) { /* -getstats */ vldstats stats; vital_vlheader vital_header; code = ubik_VL_GetStats(cstruct, 0, &stats, &vital_header); @@ -1015,6 +1050,8 @@ main(int argc, char **argv) "cellname '-host' belongs to (required for auth conns)"); cmd_AddParm(ts, "-getstats", CMD_FLAG, CMD_OPTIONAL, "print vldb statistics (non interactive)"); + cmd_AddParm(ts, "-probe", CMD_FLAG, CMD_OPTIONAL, + "probe vldb servers, use with -host to probe only one. (non interactive)"); code = cmd_Dispatch(argc, argv); exit(code); }