--- /dev/null
+=head1 NAME
+
+vos_remaddrs - removes a file server machine's entry from the VLDB
+
+=head1 SYNOPSIS
+
+=for html
+<div class="synopsis">
+
+B<vos remaddrs> S<<< B<-uuid> <I<UUID of server>> >>>
+ S<<< [B<-cell> <I<cell name>>] >>> [B<-noauth>] [B<-localauth>]
+ [B<-verbose>] [B<-encrypt>] [B<-noresolve>]
+ S<<< [B<-config> <I<config directory>>] >>>
+ [B<-help>]
+
+B<vos rema> S<<< B<-u> <I<UUID of server>> >>>
+ S<<< [B<-c> <I<cell name>>] >>>
+ [B<-noa>] [B<-l>] [B<-v>] [B<-e>] [B<-nor>]
+ S<<< [B<-co> <I<config directory>>] >>>
+ [B<-h>]
+
+=for html
+</div>
+
+=head1 DESCRIPTION
+
+The B<vos remaddrs> command removes a server entry from the Volume Location
+Database (VLDB). There must be no VLDB entries that list the machine as a site
+for any version of a volume. If necessary, use the B<vos move> or B<vos remove>
+command to move or remove volumes. It is appropriate to remove a VLDB server
+entry when removing the corresponding file server machine from service.
+
+To display all VLDB server entries, use the B<vos listaddrs> command.
+
+=head1 OPTIONS
+
+=over 4
+
+=item B<-uuid> <I<UUID of server>>
+
+The unique ID as provided by the C<vos listaddrs -printuuid> command.
+
+=back
+
+=head1 EXAMPLES
+
+The following command removes the VLDB server entry for the file server
+with the addresses C<192.12.107.214> and C<10.47.11.17>.
+
+ $ vos remaddrs -uuid 008f157e-bad0-157c-0ffee-357c4d1faa77 -verbose
+ vos: Removing UUID with addresses:
+ UUID: 008f157e-bad0-157c-0ffee-357c4d1faa77
+ 192.12.107.214
+ 10.47.11.17
+
+=head1 PRIVILEGE REQUIRED
+
+Issuer must be listed in the F</usr/afs/etc/UserList> file on each database
+server machine.
+
+=head1 SEE ALSO
+
+L<CellServDB(5)>,
+L<UserList(5)>,
+L<fileserver(8)>,
+L<vos(1)>,
+L<vos_listaddrs(1)>,
+L<vos_setaddrs(1)>
+
+=head1 COPYRIGHT
+
+Copyright 2014 Sine Nomine Associates. All Rights Reserved.
+
+This documentation is covered by the BSD License as written in the
+doc/LICENSE file. This man page was written by Michael Meffie for
+OpenAFS.
int print)
{
int i;
- afs_uint32 *addrp;
+ afs_uint32 addr;
char buf[1024];
if (print) {
}
/* print out the list of all the server */
- addrp = (afs_uint32 *) addrs->bulkaddrs_val;
- for (i = 0; i < nentries; i++, addrp++) {
- *addrp = htonl(*addrp);
+ for (i = 0; i < addrs->bulkaddrs_len; i++) {
+ addr = htonl(addrs->bulkaddrs_val[i]);
if (noresolve) {
char hoststr[16];
- printf("%s\n", afs_inet_ntoa_r(*addrp, hoststr));
+ printf("%s\n", afs_inet_ntoa_r(addr, hoststr));
} else {
- printf("%s\n", hostutil_GetNameByINet(*addrp));
+ printf("%s\n", hostutil_GetNameByINet(addr));
}
}
return 0;
}
+static int
+RemoveAddrs(struct cmd_syndesc *as, void *arock)
+{
+ afs_int32 code;
+ ListAddrByAttributes attrs;
+ afsUUID uuid;
+ afs_int32 uniq = 0;
+ afs_int32 nentries = 0;
+ bulkaddrs addrs;
+ afs_uint32 ip1;
+ afs_uint32 ip2;
+
+ memset(&attrs, 0, sizeof(ListAddrByAttributes));
+ memset(&addrs, 0, sizeof(bulkaddrs));
+ memset(&uuid, 0, sizeof(afsUUID));
+ attrs.Mask = VLADDR_UUID;
+
+ if (as->parms[0].items) { /* -uuid */
+ if (afsUUID_from_string(as->parms[0].items->data, &attrs.uuid) < 0) {
+ fprintf(STDERR, "vos: invalid UUID '%s'\n",
+ as->parms[0].items->data);
+ return EINVAL;
+ }
+ }
+
+ code =
+ ubik_VL_GetAddrsU(cstruct, UBIK_CALL_NEW, &attrs, &uuid, &uniq,
+ &nentries, &addrs);
+ if (code == VL_NOENT) {
+ fprintf(STDERR, "vos: UUID not found\n");
+ goto out;
+ }
+ if (code != 0) {
+ fprintf(STDERR, "vos: could not list the server addresses\n");
+ PrintError("", code);
+ goto out;
+ }
+ if (addrs.bulkaddrs_len == 0) {
+ fprintf(STDERR, "vos: no addresses found for UUID\n");
+ goto out;
+ }
+
+ ip2 = addrs.bulkaddrs_val[0]; /* network byte order */
+ ip1 = 0xffffffff; /* indicates removal mode */
+
+ if (verbose) {
+ printf("vos: Removing UUID with hosts:\n");
+ print_addrs(&addrs, &uuid, nentries, 1);
+ }
+
+ code = ubik_VL_ChangeAddr(cstruct, UBIK_CALL_NEW, ip1, ip2);
+ if (code) {
+ fprintf(STDERR, "Could not remove server entry from the VLDB.\n");
+ PrintError("", code);
+ }
+
+ out:
+ xdr_free((xdrproc_t) xdr_bulkaddrs, &addrs);
+ return code;
+}
+
+
static int
LockEntry(struct cmd_syndesc *as, void *arock)
{
COMMONPARMS;
ts = cmd_CreateSyntax("setaddrs", SetAddrs, NULL, 0,
- "set the list of IP address for a given UUID in the VLDB");
+ "set the list of IP addresses for a given UUID in the VLDB");
cmd_AddParm(ts, "-uuid", CMD_SINGLE, 0, "uuid of server");
cmd_AddParm(ts, "-host", CMD_LIST, 0, "address of host");
+ ts = cmd_CreateSyntax("remaddrs", RemoveAddrs, NULL, 0,
+ "remove the list of IP addresses for a given UUID in the VLDB");
+ cmd_AddParm(ts, "-uuid", CMD_SINGLE, 0, "uuid of server");
+
COMMONPARMS;
code = cmd_Dispatch(argc, argv);
if (rxInitDone) {