>>>>> "Daniel" == Daniel Bromberg <[EMAIL PROTECTED]> writes:
Daniel> For logging purposes, we'd like to be able, from a client, to
Daniel> get the names and/or IP addrs of all the machines running
Daniel> fileserver processes within our cell. I know they're all named
Daniel> somewhere in binary format in /usr/afs/db/vldb.{DB0,DBSYS1},
Daniel> but is there a human-readable interface to this?
[EMAIL PROTECTED] (W. Phillip Moore) writes:
>There is not canonical list of fileserver in a given cell, not using
>any Transarc-supplied AFS command. fs listcells shows you who the
>database servers are, but the fileserver list you have to maintain on
>your own. We use NIS netgroups here, but they may or may not suit
>your purposes.
Actually, in recent versions of AFS (3.3, 3.4), there *is* (surprise!)
a canonical list of fileservers in the cell.
There is also a transarc utility that (with some coaxing) can be
made to give such a list.
Here's a run with a cell that seems to be running some version of AFS 3.3
(well, more likely, converted over, but hasn't added any servers since.):
% ./vlclient -noauth -host 18.181.0.23
vl> ga
[0x124600db 306577627] OLD-RONALD-ANN.MIT.EDU
[0x124600d2 306577618] OLD-ROSEBUD.MIT.EDU
[0x12b50016 313851926] ROSEBUD2.MIT.EDU
[0x12b50017 313851927] RONALD-ANN2.MIT.EDU
[0x129e0027 312344615] W20-SPARE-DEC.MIT.EDU
[0x12b50013 313851923] REYNELDA.MIT.EDU
vl> gau
vl> quit
Here's another run with somebody who seems to have converted over
to AFS 3.4 and commissioned some new servers since:
% ./vlclient -noauth -host 35.9.7.10 -noauth
vl> ga
[0x23080704 587728644] 35.8.7.4
[0x23080246 587727430] faxgw.cl.msu.edu
[0x23080247 587727431] maps.miep.org
[0x23080248 587727432] www.canr.msu.edu
[0x23080705 587728645] cxc1.cl.msu.edu
[0x2308032c 587727660] afsdev.cl.msu.edu
[0x23080118 587727128] crh.cl.msu.edu
[0x23090702 587794178] afstest.cl.msu.edu
[0xff000009 4278190089] (special multi-homed entry)
[0xff000007 4278190087] (special multi-homed entry)
[0xff000008 4278190088] (special multi-homed entry)
[0xff000001 4278190081] (special multi-homed entry)
[0x230803f1 587727857] moe.cl.msu.edu
[0xff000002 4278190082] (special multi-homed entry)
[0xff000005 4278190085] (special multi-homed entry)
[0xff000004 4278190084] (special multi-homed entry)
[0xff000003 4278190083] (special multi-homed entry)
[0xff000006 4278190086] (special multi-homed entry)
vl> gau
[1]: uuid[1937d2,84af,11c6,ae,25,0,0,0,0,aa,77] addrunique=1, ip address(es):
35.9.6.20 (afsfs0.cl.msu.edu)
[2]: uuid[7194e,1013,1254,8f,2,32,54,10,13,aa,77] addrunique=2, ip address(es):
35.9.7.21 (afsfs1.cl.msu.edu)
[3]: uuid[7a7f74,19bf,1207,a1,83,32,7,17,6d,aa,77] addrunique=2, ip
address(es):
35.9.7.22 (afsfs2.cl.msu.edu)
[4]: uuid[2c7d42,84b5,11c6,88,a7,0,0,0,0,aa,77] addrunique=1, ip address(es):
35.9.7.23 (afsfs3.cl.msu.edu)
[5]: uuid[59420a,ff76,11ce,a7,43,31,ce,ff,76,aa,77] addrunique=1, ip
address(es):
35.9.7.30 (afsblue.cl.msu.edu)
[6]: uuid[4b882c,afbf,1239,82,9a,32,39,af,bf,aa,77] addrunique=2, ip
address(es):
35.9.7.31 (afsgray.cl.msu.edu)
[7]: uuid[44b29a,8b8b,11fe,a0,15,0,0,0,0,aa,77] addrunique=1, ip address(es):
35.9.7.12 (afsdb2.cl.msu.edu)
[8]: uuid[43a56c,90da,11fe,bc,ee,0,0,0,0,aa,77] addrunique=1, ip address(es):
35.9.7.11 (afsdb1.cl.msu.edu)
[9]: uuid[907da6,93a0,11fe,bb,35,0,0,0,0,aa,77] addrunique=1, ip address(es):
35.9.7.10 (afsdb0.cl.msu.edu)
vl> quit
The IP address to give above for `host' is that of one of the DB
servers in the cell in question, ie, any IP address from CellServDB.
Normally, it seems, this utility only comes as AFS source.
I imagine you could ask your transarc representative
for a binary built for your architecture(s). However, it
would probably be easier to just write a GLP that calls the
appropriate interface routines. The relevant ones seem
to be:
VL_GetAddrs
and
VL_GetAddrsU
ie,
auto int nentries;
auto bulkaddrs addrs;
auto struct VLCallBack vlcb;
auto XDR xdr[1];
bzero((char*) &addrs, sizeof addrs);
code = ubik_Call(VL_GetAddrs, cstruct, 0, 0, 0, &vlcb, &nentries, &addrs);
if (code) {
/* error */
} else {
/* success. Process (nentries) results in (entries) */
/* strange. nentries always == entries.bulkaddrs_len */
}
xdrs->x_op = XDR_FREE;
xdr_bulkentries(xdrs, &addrs);
or:
auto int nentries;
auto bulkaddrs addrs;
ListAddrByAttributes attrs;
afsUUID uuid;
auto XDR xdr[1];
attrs.Mask = VLADDR_INDEX;
for (i = 0; i < VL_MAX_ADDREXTBLKS*VL_MHSRV_PERBLK; ++i)
{
attrs.index = i;
bzero((char *)&addrs, sizeof addrs);
code = ubik_Call(VL_GetAddrsU, cstruct, 0, &attrs, &uuid,
&unique, &nentries, &addrs);
if (code == VL_INDEXERANGE)
break;
else if (code == VL_NOENT) continue;
else {
/* error */
if (code < 0) break;
continue;
}
/* success. Process results in unique, uuid & addrs */
/* free storage after use */
xdrs->x_op = XDR_FREE;
xdr_bulkentries(xdrs, &addrs);
}
You can use ubik_Call & a ubik_client connnections for this,
and you can make a "struct ubik_client *cstruct" by setting
these variables:
auto int noauthflag = 1; /* (or 0) */
auto char *confdir = AFSCONF_CLIENTNAME;
auto char *tcell = 0; /* or "umich.edu" etc. */
auto int sauth = 0;
extern int UV_SetSecurity();
extern struct ubik_client *cstruct;
auto int32 code;
and calling:
code = vsu_ClientInit(noauthflag, confdir, tcell, sauth,
&cstruct, UV_SetSecurity);
To vlclient, when calling VL_GetAddrs, the first octet of the address of
a "special multi-homed" entry is all 1's (ie, addr & 0xff000000 = 0xff000000)
-Marcus Watts
UM ITD PD&D Umich Systems Group