2 * Copyright 2000, International Business Machines Corporation and others.
5 * This software has been released under the terms of the IBM Public
6 * License. For details, see the LICENSE file in the top-level source
7 * directory or online at http://www.openafs.org/dl/license10.html
10 #include <afsconfig.h>
11 #include <afs/param.h>
14 #include <sys/types.h>
24 #include <netinet/in.h>
25 #include <arpa/inet.h>
29 #include <sys/statfs.h>
37 #include <rx/rx_globals.h>
39 #include <afs/vlserver.h>
40 #include <afs/cellconfig.h>
42 #include <afs/afsutil.h>
44 #include <afs/afsint.h>
49 #include <afs/ihandle.h>
50 #include <afs/vnode.h>
51 #include <afs/volume.h>
58 #include "volser_prototypes.h"
59 #include "vsutils_prototypes.h"
60 #include "lockprocs_prototypes.h"
62 #ifdef HAVE_POSIX_REGEX
66 /* Local Prototypes */
67 int PrintDiagnostics(char *astring, afs_int32 acode);
68 int GetVolumeInfo(afs_uint32 volid, afs_int32 *server, afs_int32 *part,
69 afs_int32 *voltype, struct nvldbentry *rentry);
81 #define COMMONPARMS cmd_Seek(ts, 12);\
82 cmd_AddParm(ts, "-cell", CMD_SINGLE, CMD_OPTIONAL, "cell name");\
83 cmd_AddParm(ts, "-noauth", CMD_FLAG, CMD_OPTIONAL, "don't authenticate");\
84 cmd_AddParm(ts, "-localauth",CMD_FLAG,CMD_OPTIONAL,"use server tickets");\
85 cmd_AddParm(ts, "-verbose", CMD_FLAG, CMD_OPTIONAL, "verbose");\
86 cmd_AddParm(ts, "-encrypt", CMD_FLAG, CMD_OPTIONAL, "encrypt commands");\
87 cmd_AddParm(ts, "-noresolve", CMD_FLAG, CMD_OPTIONAL, "don't resolve addresses"); \
89 #define ERROR_EXIT(code) {error=(code); goto error_exit;}
92 struct rx_connection *tconn;
94 extern struct ubik_client *cstruct;
97 static struct tqHead busyHead, notokHead;
100 qInit(struct tqHead *ahead)
102 memset((char *)ahead, 0, sizeof(struct tqHead));
108 qPut(struct tqHead *ahead, afs_uint32 volid)
112 elem = (struct tqElem *)malloc(sizeof(struct tqElem));
113 elem->next = ahead->next;
121 qGet(struct tqHead *ahead, afs_uint32 *volid)
125 if (ahead->count <= 0)
127 *volid = ahead->next->volid;
129 ahead->next = tmp->next;
135 /* returns 1 if <filename> exists else 0 */
137 FileExists(char *filename)
143 code = usd_Open(filename, USD_OPEN_RDONLY, 0, &ufd);
147 code = USD_IOCTL(ufd, USD_IOCTL_GETSIZE, &size);
155 /* returns 1 if <name> doesnot end in .readonly or .backup, else 0 */
157 VolNameOK(char *name)
162 total = strlen(name);
163 if (!strcmp(&name[total - 9], ".readonly")) {
165 } else if (!strcmp(&name[total - 7], ".backup")) {
172 /* return 1 if name is a number else 0 */
174 IsNumeric(char *name)
182 for (i = 0; i < len; i++) {
183 if (*ptr < '0' || *ptr > '9') {
195 * Parse a server name/address and return the address in HOST BYTE order
198 GetServer(char *aname)
200 register struct hostent *th;
203 register afs_int32 code;
204 char hostname[MAXHOSTCHARS];
206 code = sscanf(aname, "%d.%d.%d.%d", &b1, &b2, &b3, &b4);
208 addr = (b1 << 24) | (b2 << 16) | (b3 << 8) | b4;
209 addr = ntohl(addr); /* convert to host order */
211 th = gethostbyname(aname);
214 memcpy(&addr, th->h_addr, sizeof(addr));
217 if (addr == htonl(0x7f000001)) { /* local host */
218 code = gethostname(hostname, MAXHOSTCHARS);
221 th = gethostbyname(hostname); /* returns host byte order */
224 memcpy(&addr, th->h_addr, sizeof(addr));
231 GetVolumeType(char *aname)
234 if (!strcmp(aname, "ro"))
236 else if (!strcmp(aname, "rw"))
238 else if (!strcmp(aname, "bk"))
245 IsPartValid(afs_int32 partId, afs_int32 server, afs_int32 *code)
247 struct partList dummyPartList;
253 *code = UV_ListPartitions(server, &dummyPartList, &cnt);
256 for (i = 0; i < cnt; i++) {
257 if (dummyPartList.partFlags[i] & PARTVALID)
258 if (dummyPartList.partId[i] == partId)
266 /*sends the contents of file associated with <fd> and <blksize> to Rx Stream
267 * associated with <call> */
269 SendFile(usd_handle_t ufd, register struct rx_call *call, long blksize)
271 char *buffer = (char *)0;
276 buffer = (char *)malloc(blksize);
278 fprintf(STDERR, "malloc failed\n");
282 while (!error && !done) {
283 #ifndef AFS_NT40_ENV /* NT csn't select on non-socket fd's */
286 FD_SET((int)(ufd->handle), &in);
287 /* don't timeout if read blocks */
288 #if defined(AFS_PTHREAD_ENV)
289 select(((int)(ufd->handle)) + 1, &in, 0, 0, 0);
291 IOMGR_Select(((int)(ufd->handle)) + 1, &in, 0, 0, 0);
294 error = USD_READ(ufd, buffer, blksize, &nbytes);
296 fprintf(STDERR, "File system read failed\n");
303 if (rx_Write(call, buffer, nbytes) != nbytes) {
313 /* function invoked by UV_RestoreVolume, reads the data from rx_trx_stream and
314 * writes it out to the volume. */
316 WriteData(struct rx_call *call, void *rock)
318 char *filename = (char *) rock;
321 afs_int32 error, code;
323 afs_hyper_t filesize, currOffset;
329 if (!filename || !*filename) {
330 usd_StandardInput(&ufd);
334 code = usd_Open(filename, USD_OPEN_RDONLY, 0, &ufd);
337 code = USD_IOCTL(ufd, USD_IOCTL_GETBLKSIZE, &blksize);
340 fprintf(STDERR, "Could not access file '%s'\n", filename);
344 /* test if we have a valid dump */
345 hset64(filesize, 0, 0);
346 USD_SEEK(ufd, filesize, SEEK_END, &currOffset);
347 hset64(filesize, hgethi(currOffset), hgetlo(currOffset)-sizeof(afs_uint32));
348 USD_SEEK(ufd, filesize, SEEK_SET, &currOffset);
349 USD_READ(ufd, (char *)&buffer, sizeof(afs_uint32), &got);
350 if ((got != sizeof(afs_uint32)) || (ntohl(buffer) != DUMPENDMAGIC)) {
351 fprintf(STDERR, "Signature missing from end of file '%s'\n", filename);
355 /* rewind, we are done */
356 hset64(filesize, 0, 0);
357 USD_SEEK(ufd, filesize, SEEK_SET, &currOffset);
359 code = SendFile(ufd, call, blksize);
366 code = USD_CLOSE(ufd);
368 fprintf(STDERR, "Could not close dump file %s\n",
369 (filename && *filename) ? filename : "STDOUT");
377 /* Receive data from <call> stream into file associated
378 * with <fd> <blksize>
381 ReceiveFile(usd_handle_t ufd, struct rx_call *call, long blksize)
385 afs_uint32 bytesleft, w;
388 buffer = (char *)malloc(blksize);
390 fprintf(STDERR, "memory allocation failed\n");
394 while ((bytesread = rx_Read(call, buffer, blksize)) > 0) {
395 for (bytesleft = bytesread; bytesleft; bytesleft -= w) {
396 #ifndef AFS_NT40_ENV /* NT csn't select on non-socket fd's */
399 FD_SET((int)(ufd->handle), &out);
400 /* don't timeout if write blocks */
401 #if defined(AFS_PTHREAD_ENV)
402 select(((int)(ufd->handle)) + 1, &out, 0, 0, 0);
404 IOMGR_Select(((int)(ufd->handle)) + 1, 0, &out, 0, 0);
408 USD_WRITE(ufd, &buffer[bytesread - bytesleft], bytesleft, &w);
410 fprintf(STDERR, "File system write failed\n");
423 DumpFunction(struct rx_call *call, void *rock)
425 char *filename = (char *)rock;
426 usd_handle_t ufd; /* default is to stdout */
427 afs_int32 error = 0, code;
432 /* Open the output file */
433 if (!filename || !*filename) {
434 usd_StandardOutput(&ufd);
439 usd_Open(filename, USD_OPEN_CREATE | USD_OPEN_RDWR, 0666, &ufd);
443 code = USD_IOCTL(ufd, USD_IOCTL_SETSIZE, &size);
446 code = USD_IOCTL(ufd, USD_IOCTL_GETBLKSIZE, &blksize);
449 fprintf(STDERR, "Could not create file '%s'\n", filename);
450 ERROR_EXIT(VOLSERBADOP);
454 code = ReceiveFile(ufd, call, blksize);
459 /* Close the output file */
461 code = USD_CLOSE(ufd);
463 fprintf(STDERR, "Could not close dump file %s\n",
464 (filename && *filename) ? filename : "STDIN");
474 DisplayFormat(volintInfo *pntr, afs_int32 server, afs_int32 part,
475 int *totalOK, int *totalNotOK, int *totalBusy, int fast,
476 int longlist, int disp)
482 fprintf(STDOUT, "%-10lu\n", (unsigned long)pntr->volid);
483 } else if (longlist) {
484 if (pntr->status == VOK) {
485 fprintf(STDOUT, "%-32s ", pntr->name);
486 fprintf(STDOUT, "%10lu ", (unsigned long)pntr->volid);
488 fprintf(STDOUT, "RW ");
490 fprintf(STDOUT, "RO ");
492 fprintf(STDOUT, "BK ");
493 fprintf(STDOUT, "%10d K ", pntr->size);
494 if (pntr->inUse == 1) {
495 fprintf(STDOUT, "On-line");
498 fprintf(STDOUT, "Off-line");
501 if (pntr->needsSalvaged == 1)
502 fprintf(STDOUT, "**needs salvage**");
503 fprintf(STDOUT, "\n");
504 MapPartIdIntoName(part, pname);
505 fprintf(STDOUT, " %s %s \n", hostutil_GetNameByINet(server),
507 fprintf(STDOUT, " RWrite %10lu ROnly %10lu Backup %10lu \n",
508 (unsigned long)pntr->parentID,
509 (unsigned long)pntr->cloneID,
510 (unsigned long)pntr->backupID);
511 fprintf(STDOUT, " MaxQuota %10d K \n", pntr->maxquota);
512 t = pntr->creationDate;
513 fprintf(STDOUT, " Creation %s",
515 #ifdef FULL_LISTVOL_SWITCH
517 fprintf(STDOUT, " Copy %s",
520 t = pntr->backupDate;
522 fprintf(STDOUT, " Backup Never\n");
524 fprintf(STDOUT, " Backup %s",
527 t = pntr->accessDate;
529 fprintf(STDOUT, " Last Access %s",
532 t = pntr->updateDate;
534 fprintf(STDOUT, " Last Update Never\n");
536 fprintf(STDOUT, " Last Update %s",
539 " %d accesses in the past day (i.e., vnode references)\n",
541 } else if (pntr->status == VBUSY) {
543 qPut(&busyHead, pntr->volid);
545 fprintf(STDOUT, "**** Volume %lu is busy ****\n",
546 (unsigned long)pntr->volid);
549 qPut(¬okHead, pntr->volid);
551 fprintf(STDOUT, "**** Could not attach volume %lu ****\n",
552 (unsigned long)pntr->volid);
554 fprintf(STDOUT, "\n");
555 } else { /* default listing */
556 if (pntr->status == VOK) {
557 fprintf(STDOUT, "%-32s ", pntr->name);
558 fprintf(STDOUT, "%10lu ", (unsigned long)pntr->volid);
560 fprintf(STDOUT, "RW ");
562 fprintf(STDOUT, "RO ");
564 fprintf(STDOUT, "BK ");
565 fprintf(STDOUT, "%10d K ", pntr->size);
566 if (pntr->inUse == 1) {
567 fprintf(STDOUT, "On-line");
570 fprintf(STDOUT, "Off-line");
573 if (pntr->needsSalvaged == 1)
574 fprintf(STDOUT, "**needs salvage**");
575 fprintf(STDOUT, "\n");
576 } else if (pntr->status == VBUSY) {
578 qPut(&busyHead, pntr->volid);
580 fprintf(STDOUT, "**** Volume %lu is busy ****\n",
581 (unsigned long)pntr->volid);
584 qPut(¬okHead, pntr->volid);
586 fprintf(STDOUT, "**** Could not attach volume %lu ****\n",
587 (unsigned long)pntr->volid);
592 /*------------------------------------------------------------------------
593 * PRIVATE XDisplayFormat
596 * Display the contents of one extended volume info structure.
599 * a_xInfoP : Ptr to extended volume info struct to print.
600 * a_servID : Server ID to print.
601 * a_partID : Partition ID to print.
602 * a_totalOKP : Ptr to total-OK counter.
603 * a_totalNotOKP : Ptr to total-screwed counter.
604 * a_totalBusyP : Ptr to total-busy counter.
605 * a_fast : Fast listing?
606 * a_int32 : Int32 listing?
607 * a_showProblems : Show volume problems?
613 * Nothing interesting.
617 *------------------------------------------------------------------------*/
620 XDisplayFormat(volintXInfo *a_xInfoP, afs_int32 a_servID, afs_int32 a_partID,
621 int *a_totalOKP, int *a_totalNotOKP, int *a_totalBusyP,
622 int a_fast, int a_int32, int a_showProblems)
623 { /*XDisplayFormat */
631 fprintf(STDOUT, "%-10lu\n", (unsigned long)a_xInfoP->volid);
632 } else if (a_int32) {
634 * Fully-detailed listing.
636 if (a_xInfoP->status == VOK) {
638 * Volume's status is OK - all the fields are valid.
640 fprintf(STDOUT, "%-32s ", a_xInfoP->name);
641 fprintf(STDOUT, "%10lu ", (unsigned long)a_xInfoP->volid);
642 if (a_xInfoP->type == 0)
643 fprintf(STDOUT, "RW ");
644 if (a_xInfoP->type == 1)
645 fprintf(STDOUT, "RO ");
646 if (a_xInfoP->type == 2)
647 fprintf(STDOUT, "BK ");
648 fprintf(STDOUT, "%10d K used ", a_xInfoP->size);
649 fprintf(STDOUT, "%d files ", a_xInfoP->filecount);
650 if (a_xInfoP->inUse == 1) {
651 fprintf(STDOUT, "On-line");
654 fprintf(STDOUT, "Off-line");
657 fprintf(STDOUT, "\n");
658 MapPartIdIntoName(a_partID, pname);
659 fprintf(STDOUT, " %s %s \n", hostutil_GetNameByINet(a_servID),
661 fprintf(STDOUT, " RWrite %10lu ROnly %10lu Backup %10lu \n",
662 (unsigned long)a_xInfoP->parentID,
663 (unsigned long)a_xInfoP->cloneID,
664 (unsigned long)a_xInfoP->backupID);
665 fprintf(STDOUT, " MaxQuota %10d K \n", a_xInfoP->maxquota);
667 t = a_xInfoP->creationDate;
668 fprintf(STDOUT, " Creation %s",
670 #ifdef FULL_LISTVOL_SWITCH
671 t = a_xInfoP->copyDate;
672 fprintf(STDOUT, " Copy %s",
675 t = a_xInfoP->backupDate;
677 fprintf(STDOUT, " Backup Never\n");
679 fprintf(STDOUT, " Backup %s",
682 t = a_xInfoP->accessDate;
684 fprintf(STDOUT, " Last Access %s",
687 t = a_xInfoP->updateDate;
689 fprintf(STDOUT, " Last Update Never\n");
691 fprintf(STDOUT, " Last Update %s",
694 " %d accesses in the past day (i.e., vnode references)\n",
698 * Print all the read/write and authorship stats.
700 fprintf(STDOUT, "\n Raw Read/Write Stats\n");
702 " |-------------------------------------------|\n");
704 " | Same Network | Diff Network |\n");
706 " |----------|----------|----------|----------|\n");
708 " | Total | Auth | Total | Auth |\n");
710 " |----------|----------|----------|----------|\n");
711 fprintf(STDOUT, "Reads | %8d | %8d | %8d | %8d |\n",
712 a_xInfoP->stat_reads[VOLINT_STATS_SAME_NET],
713 a_xInfoP->stat_reads[VOLINT_STATS_SAME_NET_AUTH],
714 a_xInfoP->stat_reads[VOLINT_STATS_DIFF_NET],
715 a_xInfoP->stat_reads[VOLINT_STATS_DIFF_NET_AUTH]);
716 fprintf(STDOUT, "Writes | %8d | %8d | %8d | %8d |\n",
717 a_xInfoP->stat_writes[VOLINT_STATS_SAME_NET],
718 a_xInfoP->stat_writes[VOLINT_STATS_SAME_NET_AUTH],
719 a_xInfoP->stat_writes[VOLINT_STATS_DIFF_NET],
720 a_xInfoP->stat_writes[VOLINT_STATS_DIFF_NET_AUTH]);
722 " |-------------------------------------------|\n\n");
725 " Writes Affecting Authorship\n");
727 " |-------------------------------------------|\n");
729 " | File Authorship | Directory Authorship|\n");
731 " |----------|----------|----------|----------|\n");
733 " | Same | Diff | Same | Diff |\n");
735 " |----------|----------|----------|----------|\n");
736 fprintf(STDOUT, "0-60 sec | %8d | %8d | %8d | %8d |\n",
737 a_xInfoP->stat_fileSameAuthor[VOLINT_STATS_TIME_IDX_0],
738 a_xInfoP->stat_fileDiffAuthor[VOLINT_STATS_TIME_IDX_0],
739 a_xInfoP->stat_dirSameAuthor[VOLINT_STATS_TIME_IDX_0],
740 a_xInfoP->stat_dirDiffAuthor[VOLINT_STATS_TIME_IDX_0]);
741 fprintf(STDOUT, "1-10 min | %8d | %8d | %8d | %8d |\n",
742 a_xInfoP->stat_fileSameAuthor[VOLINT_STATS_TIME_IDX_1],
743 a_xInfoP->stat_fileDiffAuthor[VOLINT_STATS_TIME_IDX_1],
744 a_xInfoP->stat_dirSameAuthor[VOLINT_STATS_TIME_IDX_1],
745 a_xInfoP->stat_dirDiffAuthor[VOLINT_STATS_TIME_IDX_1]);
746 fprintf(STDOUT, "10min-1hr | %8d | %8d | %8d | %8d |\n",
747 a_xInfoP->stat_fileSameAuthor[VOLINT_STATS_TIME_IDX_2],
748 a_xInfoP->stat_fileDiffAuthor[VOLINT_STATS_TIME_IDX_2],
749 a_xInfoP->stat_dirSameAuthor[VOLINT_STATS_TIME_IDX_2],
750 a_xInfoP->stat_dirDiffAuthor[VOLINT_STATS_TIME_IDX_2]);
751 fprintf(STDOUT, "1hr-1day | %8d | %8d | %8d | %8d |\n",
752 a_xInfoP->stat_fileSameAuthor[VOLINT_STATS_TIME_IDX_3],
753 a_xInfoP->stat_fileDiffAuthor[VOLINT_STATS_TIME_IDX_3],
754 a_xInfoP->stat_dirSameAuthor[VOLINT_STATS_TIME_IDX_3],
755 a_xInfoP->stat_dirDiffAuthor[VOLINT_STATS_TIME_IDX_3]);
756 fprintf(STDOUT, "1day-1wk | %8d | %8d | %8d | %8d |\n",
757 a_xInfoP->stat_fileSameAuthor[VOLINT_STATS_TIME_IDX_4],
758 a_xInfoP->stat_fileDiffAuthor[VOLINT_STATS_TIME_IDX_4],
759 a_xInfoP->stat_dirSameAuthor[VOLINT_STATS_TIME_IDX_4],
760 a_xInfoP->stat_dirDiffAuthor[VOLINT_STATS_TIME_IDX_4]);
761 fprintf(STDOUT, "> 1wk | %8d | %8d | %8d | %8d |\n",
762 a_xInfoP->stat_fileSameAuthor[VOLINT_STATS_TIME_IDX_5],
763 a_xInfoP->stat_fileDiffAuthor[VOLINT_STATS_TIME_IDX_5],
764 a_xInfoP->stat_dirSameAuthor[VOLINT_STATS_TIME_IDX_5],
765 a_xInfoP->stat_dirDiffAuthor[VOLINT_STATS_TIME_IDX_5]);
767 " |-------------------------------------------|\n");
768 } /*Volume status OK */
769 else if (a_xInfoP->status == VBUSY) {
771 qPut(&busyHead, a_xInfoP->volid);
773 fprintf(STDOUT, "**** Volume %lu is busy ****\n",
774 (unsigned long)a_xInfoP->volid);
778 qPut(¬okHead, a_xInfoP->volid);
780 fprintf(STDOUT, "**** Could not attach volume %lu ****\n",
781 (unsigned long)a_xInfoP->volid);
782 } /*Screwed volume */
783 fprintf(STDOUT, "\n");
789 if (a_xInfoP->status == VOK) {
790 fprintf(STDOUT, "%-32s ", a_xInfoP->name);
791 fprintf(STDOUT, "%10lu ", (unsigned long)a_xInfoP->volid);
792 if (a_xInfoP->type == 0)
793 fprintf(STDOUT, "RW ");
794 if (a_xInfoP->type == 1)
795 fprintf(STDOUT, "RO ");
796 if (a_xInfoP->type == 2)
797 fprintf(STDOUT, "BK ");
798 fprintf(STDOUT, "%10d K ", a_xInfoP->size);
799 if (a_xInfoP->inUse == 1) {
800 fprintf(STDOUT, "On-line");
803 fprintf(STDOUT, "Off-line");
806 fprintf(STDOUT, "\n");
808 else if (a_xInfoP->status == VBUSY) {
810 qPut(&busyHead, a_xInfoP->volid);
812 fprintf(STDOUT, "**** Volume %lu is busy ****\n",
813 (unsigned long)a_xInfoP->volid);
817 qPut(¬okHead, a_xInfoP->volid);
819 fprintf(STDOUT, "**** Could not attach volume %lu ****\n",
820 (unsigned long)a_xInfoP->volid);
821 } /*Screwed volume */
822 } /*Default listing */
823 } /*XDisplayFormat */
825 #ifdef FULL_LISTVOL_SWITCH
826 /*------------------------------------------------------------------------
827 * PRIVATE XDisplayFormat2
830 * Display the formated contents of one extended volume info structure.
833 * a_xInfoP : Ptr to extended volume info struct to print.
834 * a_servID : Server ID to print.
835 * a_partID : Partition ID to print.
836 * a_totalOKP : Ptr to total-OK counter.
837 * a_totalNotOKP : Ptr to total-screwed counter.
838 * a_totalBusyP : Ptr to total-busy counter.
839 * a_fast : Fast listing?
840 * a_int32 : Int32 listing?
841 * a_showProblems : Show volume problems?
847 * Nothing interesting.
851 *------------------------------------------------------------------------*/
854 XDisplayFormat2(volintXInfo *a_xInfoP, afs_int32 a_servID, afs_int32 a_partID,
855 int *a_totalOKP, int *a_totalNotOKP, int *a_totalBusyP,
856 int a_fast, int a_int32, int a_showProblems)
857 { /*XDisplayFormat */
863 fprintf(STDOUT, "vold_id\t%-10lu\n", (unsigned long)a_xInfoP->volid);
864 } else if (a_int32) {
866 * Fully-detailed listing.
868 if (a_xInfoP->status == VOK) {
870 * Volume's status is OK - all the fields are valid.
873 static long server_cache = -1, partition_cache = -1;
874 static char hostname[256], address[32], pname[16];
875 int i,ai[] = {VOLINT_STATS_TIME_IDX_0,VOLINT_STATS_TIME_IDX_1,VOLINT_STATS_TIME_IDX_2,
876 VOLINT_STATS_TIME_IDX_3,VOLINT_STATS_TIME_IDX_4,VOLINT_STATS_TIME_IDX_5};
878 if (a_servID != server_cache) {
882 strcpy(hostname, hostutil_GetNameByINet(a_servID));
883 strcpy(address, inet_ntoa(s));
884 server_cache = a_servID;
886 if (a_partID != partition_cache) {
887 MapPartIdIntoName(a_partID, pname);
888 partition_cache = a_partID;
891 fprintf(STDOUT, "name\t\t%s\n", a_xInfoP->name);
892 fprintf(STDOUT, "id\t\t%lu\n", afs_printable_uint32_lu(a_xInfoP->volid));
893 fprintf(STDOUT, "serv\t\t%s\t%s\n", address, hostname);
894 fprintf(STDOUT, "part\t\t%s\n", pname);
895 fprintf(STDOUT, "status\t\tOK\n");
896 fprintf(STDOUT, "backupID\t%lu\n",
897 afs_printable_uint32_lu(a_xInfoP->backupID));
898 fprintf(STDOUT, "parentID\t%lu\n",
899 afs_printable_uint32_lu(a_xInfoP->parentID));
900 fprintf(STDOUT, "cloneID\t\t%lu\n",
901 afs_printable_uint32_lu(a_xInfoP->cloneID));
902 fprintf(STDOUT, "inUse\t\t%s\n", a_xInfoP->inUse ? "Y" : "N");
903 switch (a_xInfoP->type) {
905 fprintf(STDOUT, "type\t\tRW\n");
908 fprintf(STDOUT, "type\t\tRO\n");
911 fprintf(STDOUT, "type\t\tBK\n");
914 fprintf(STDOUT, "type\t\t?\n");
917 t = a_xInfoP->creationDate;
918 fprintf(STDOUT, "creationDate\t%-9lu\t%s",
919 afs_printable_uint32_lu(a_xInfoP->creationDate),
922 t = a_xInfoP->accessDate;
923 fprintf(STDOUT, "accessDate\t%-9lu\t%s",
924 afs_printable_uint32_lu(a_xInfoP->accessDate),
927 t = a_xInfoP->updateDate;
928 fprintf(STDOUT, "updateDate\t%-9lu\t%s",
929 afs_printable_uint32_lu(a_xInfoP->updateDate),
932 t = a_xInfoP->backupDate;
933 fprintf(STDOUT, "backupDate\t%-9lu\t%s",
934 afs_printable_uint32_lu(a_xInfoP->backupDate),
937 t = a_xInfoP->copyDate;
938 fprintf(STDOUT, "copyDate\t%-9lu\t%s",
939 afs_printable_uint32_lu(a_xInfoP->copyDate),
942 fprintf(STDOUT, "diskused\t%u\n", a_xInfoP->size);
943 fprintf(STDOUT, "maxquota\t%u\n", a_xInfoP->maxquota);
945 fprintf(STDOUT, "filecount\t%u\n", a_xInfoP->filecount);
946 fprintf(STDOUT, "dayUse\t\t%u\n", a_xInfoP->dayUse);
950 fprintf(STDOUT,"reads_same_net\t%8d\n",a_xInfoP->stat_reads[VOLINT_STATS_SAME_NET]);
951 fprintf(STDOUT,"reads_same_net_auth\t%8d\n",a_xInfoP->stat_reads[VOLINT_STATS_SAME_NET_AUTH]);
952 fprintf(STDOUT,"reads_diff_net\t%8d\n",a_xInfoP->stat_reads[VOLINT_STATS_DIFF_NET]);
953 fprintf(STDOUT,"reads_diff_net_auth\t%8d\n",a_xInfoP->stat_reads[VOLINT_STATS_DIFF_NET_AUTH]);
955 fprintf(STDOUT,"writes_same_net\t%8d\n",a_xInfoP->stat_writes[VOLINT_STATS_SAME_NET]);
956 fprintf(STDOUT,"writes_same_net_auth\t%8d\n",a_xInfoP->stat_writes[VOLINT_STATS_SAME_NET_AUTH]);
957 fprintf(STDOUT,"writes_diff_net\t%8d\n",a_xInfoP->stat_writes[VOLINT_STATS_DIFF_NET]);
958 fprintf(STDOUT,"writes_diff_net_auth\t%8d\n",a_xInfoP->stat_writes[VOLINT_STATS_DIFF_NET_AUTH]);
962 fprintf(STDOUT,"file_same_author_idx_%d\t%8d\n",i+1,a_xInfoP->stat_fileSameAuthor[ai[i]]);
963 fprintf(STDOUT,"file_diff_author_idx_%d\t%8d\n",i+1,a_xInfoP->stat_fileDiffAuthor[ai[i]]);
964 fprintf(STDOUT,"dir_same_author_idx_%d\t%8d\n",i+1,a_xInfoP->stat_dirSameAuthor[ai[i]]);
965 fprintf(STDOUT,"dir_dif_author_idx_%d\t%8d\n",i+1,a_xInfoP->stat_dirDiffAuthor[ai[i]]);
968 } /*Volume status OK */
969 else if (a_xInfoP->status == VBUSY) {
971 qPut(&busyHead, a_xInfoP->volid);
973 fprintf(STDOUT, "BUSY_VOL\t%lu\n",
974 (unsigned long)a_xInfoP->volid);
978 qPut(¬okHead, a_xInfoP->volid);
980 fprintf(STDOUT, "COULD_NOT_ATTACH\t%lu\n",
981 (unsigned long)a_xInfoP->volid);
982 } /*Screwed volume */
988 if (a_xInfoP->status == VOK) {
989 fprintf(STDOUT, "name\t%-32s\n", a_xInfoP->name);
990 fprintf(STDOUT, "volID\t%10lu\n", (unsigned long)a_xInfoP->volid);
991 if (a_xInfoP->type == 0)
992 fprintf(STDOUT, "type\tRW\n");
993 if (a_xInfoP->type == 1)
994 fprintf(STDOUT, "type\tRO\n");
995 if (a_xInfoP->type == 2)
996 fprintf(STDOUT, "type\tBK\n");
997 fprintf(STDOUT, "size\t%10dK\n", a_xInfoP->size);
999 fprintf(STDOUT, "inUse\t%d\n",a_xInfoP->inUse);
1000 if (a_xInfoP->inUse == 1)
1006 else if (a_xInfoP->status == VBUSY) {
1008 qPut(&busyHead, a_xInfoP->volid);
1010 fprintf(STDOUT, "VOLUME_BUSY\t%lu\n",
1011 (unsigned long)a_xInfoP->volid);
1015 qPut(¬okHead, a_xInfoP->volid);
1017 fprintf(STDOUT, "COULD_NOT_ATTACH_VOLUME\t%lu\n",
1018 (unsigned long)a_xInfoP->volid);
1019 } /*Screwed volume */
1020 } /*Default listing */
1021 } /*XDisplayFormat */
1022 #endif /*FULL_LISTVOL_SWITCH*/
1024 #ifdef FULL_LISTVOL_SWITCH
1026 DisplayFormat2(long server, long partition, volintInfo *pntr)
1028 static long server_cache = -1, partition_cache = -1;
1029 static char hostname[256], address[32], pname[16];
1032 if (server != server_cache) {
1036 strcpy(hostname, hostutil_GetNameByINet(server));
1037 strcpy(address, inet_ntoa(s));
1038 server_cache = server;
1040 if (partition != partition_cache) {
1041 MapPartIdIntoName(partition, pname);
1042 partition_cache = partition;
1045 if (pntr->status == VOK)
1046 fprintf(STDOUT, "name\t\t%s\n", pntr->name);
1048 fprintf(STDOUT, "id\t\t%lu\n",
1049 afs_printable_uint32_lu(pntr->volid));
1050 fprintf(STDOUT, "serv\t\t%s\t%s\n", address, hostname);
1051 fprintf(STDOUT, "part\t\t%s\n", pname);
1052 switch (pntr->status) {
1054 fprintf(STDOUT, "status\t\tOK\n");
1057 fprintf(STDOUT, "status\t\tBUSY\n");
1060 fprintf(STDOUT, "status\t\tUNATTACHABLE\n");
1063 fprintf(STDOUT, "backupID\t%lu\n",
1064 afs_printable_uint32_lu(pntr->backupID));
1065 fprintf(STDOUT, "parentID\t%lu\n",
1066 afs_printable_uint32_lu(pntr->parentID));
1067 fprintf(STDOUT, "cloneID\t\t%lu\n",
1068 afs_printable_uint32_lu(pntr->cloneID));
1069 fprintf(STDOUT, "inUse\t\t%s\n", pntr->inUse ? "Y" : "N");
1070 fprintf(STDOUT, "needsSalvaged\t%s\n", pntr->needsSalvaged ? "Y" : "N");
1071 /* 0xD3 is from afs/volume.h since I had trouble including the file */
1072 fprintf(STDOUT, "destroyMe\t%s\n", pntr->destroyMe == 0xD3 ? "Y" : "N");
1073 switch (pntr->type) {
1075 fprintf(STDOUT, "type\t\tRW\n");
1078 fprintf(STDOUT, "type\t\tRO\n");
1081 fprintf(STDOUT, "type\t\tBK\n");
1084 fprintf(STDOUT, "type\t\t?\n");
1087 t = pntr->creationDate;
1088 fprintf(STDOUT, "creationDate\t%-9lu\t%s",
1089 afs_printable_uint32_lu(pntr->creationDate),
1092 t = pntr->accessDate;
1093 fprintf(STDOUT, "accessDate\t%-9lu\t%s",
1094 afs_printable_uint32_lu(pntr->accessDate),
1097 t = pntr->updateDate;
1098 fprintf(STDOUT, "updateDate\t%-9lu\t%s",
1099 afs_printable_uint32_lu(pntr->updateDate),
1102 t = pntr->backupDate;
1103 fprintf(STDOUT, "backupDate\t%-9lu\t%s",
1104 afs_printable_uint32_lu(pntr->backupDate),
1108 fprintf(STDOUT, "copyDate\t%-9lu\t%s",
1109 afs_printable_uint32_lu(pntr->copyDate),
1112 fprintf(STDOUT, "flags\t\t%#lx\t(Optional)\n",
1113 afs_printable_uint32_lu(pntr->flags));
1114 fprintf(STDOUT, "diskused\t%u\n", pntr->size);
1115 fprintf(STDOUT, "maxquota\t%u\n", pntr->maxquota);
1116 fprintf(STDOUT, "minquota\t%lu\t(Optional)\n",
1117 afs_printable_uint32_lu(pntr->spare0));
1118 fprintf(STDOUT, "filecount\t%u\n", pntr->filecount);
1119 fprintf(STDOUT, "dayUse\t\t%u\n", pntr->dayUse);
1120 fprintf(STDOUT, "weekUse\t\t%lu\t(Optional)\n",
1121 afs_printable_uint32_lu(pntr->spare1));
1122 fprintf(STDOUT, "spare2\t\t%lu\t(Optional)\n",
1123 afs_printable_uint32_lu(pntr->spare2));
1124 fprintf(STDOUT, "spare3\t\t%lu\t(Optional)\n",
1125 afs_printable_uint32_lu(pntr->spare3));
1130 DisplayVolumes2(long server, long partition, volintInfo *pntr, long count)
1134 for (i = 0; i < count; i++) {
1135 fprintf(STDOUT, "BEGIN_OF_ENTRY\n");
1136 DisplayFormat2(server, partition, pntr);
1137 fprintf(STDOUT, "END_OF_ENTRY\n\n");
1142 #endif /* FULL_LISTVOL_SWITCH */
1145 DisplayVolumes(afs_int32 server, afs_int32 part, volintInfo *pntr,
1146 afs_int32 count, afs_int32 longlist, afs_int32 fast,
1149 int totalOK, totalNotOK, totalBusy, i;
1150 afs_uint32 volid = 0;
1157 for (i = 0; i < count; i++) {
1158 DisplayFormat(pntr, server, part, &totalOK, &totalNotOK, &totalBusy,
1163 while (busyHead.count) {
1164 qGet(&busyHead, &volid);
1165 fprintf(STDOUT, "**** Volume %lu is busy ****\n",
1166 (unsigned long)volid);
1170 while (notokHead.count) {
1171 qGet(¬okHead, &volid);
1172 fprintf(STDOUT, "**** Could not attach volume %lu ****\n",
1173 (unsigned long)volid);
1177 fprintf(STDOUT, "\n");
1180 "Total volumes onLine %d ; Total volumes offLine %d ; Total busy %d\n\n",
1181 totalOK, totalNotOK, totalBusy);
1185 /*------------------------------------------------------------------------
1186 * PRIVATE XDisplayVolumes
1189 * Display extended volume information.
1192 * a_servID : Pointer to the Rx call we're performing.
1193 * a_partID : Partition for which we want the extended list.
1194 * a_xInfoP : Ptr to extended volume info.
1195 * a_count : Number of volume records contained above.
1196 * a_int32 : Int32 listing generated?
1197 * a_fast : Fast listing generated?
1198 * a_quiet : Quiet listing generated?
1204 * Nothing interesting.
1208 *------------------------------------------------------------------------*/
1211 XDisplayVolumes(afs_int32 a_servID, afs_int32 a_partID, volintXInfo *a_xInfoP,
1212 afs_int32 a_count, afs_int32 a_int32, afs_int32 a_fast,
1214 { /*XDisplayVolumes */
1216 int totalOK; /*Total OK volumes */
1217 int totalNotOK; /*Total screwed volumes */
1218 int totalBusy; /*Total busy volumes */
1219 int i; /*Loop variable */
1220 afs_uint32 volid = 0; /*Current volume ID */
1223 * Initialize counters and (global!!) queues.
1232 * Display each volume in the list.
1234 for (i = 0; i < a_count; i++) {
1235 XDisplayFormat(a_xInfoP, a_servID, a_partID, &totalOK, &totalNotOK,
1236 &totalBusy, a_fast, a_int32, 0);
1241 * If any volumes were found to be busy or screwed, display them.
1244 while (busyHead.count) {
1245 qGet(&busyHead, &volid);
1246 fprintf(STDOUT, "**** Volume %lu is busy ****\n",
1247 (unsigned long)volid);
1251 while (notokHead.count) {
1252 qGet(¬okHead, &volid);
1253 fprintf(STDOUT, "**** Could not attach volume %lu ****\n",
1254 (unsigned long)volid);
1259 fprintf(STDOUT, "\n");
1262 "Total volumes: %d on-line, %d off-line, %d busyd\n\n",
1263 totalOK, totalNotOK, totalBusy);
1267 } /*XDisplayVolumes */
1268 #ifdef FULL_LISTVOL_SWITCH
1269 /*------------------------------------------------------------------------
1270 * PRIVATE XDisplayVolumes2
1273 * Display extended formated volume information.
1276 * a_servID : Pointer to the Rx call we're performing.
1277 * a_partID : Partition for which we want the extended list.
1278 * a_xInfoP : Ptr to extended volume info.
1279 * a_count : Number of volume records contained above.
1280 * a_int32 : Int32 listing generated?
1281 * a_fast : Fast listing generated?
1282 * a_quiet : Quiet listing generated?
1288 * Nothing interesting.
1292 *------------------------------------------------------------------------*/
1295 XDisplayVolumes2(afs_int32 a_servID, afs_int32 a_partID, volintXInfo *a_xInfoP,
1296 afs_int32 a_count, afs_int32 a_int32, afs_int32 a_fast,
1298 { /*XDisplayVolumes */
1300 int totalOK; /*Total OK volumes */
1301 int totalNotOK; /*Total screwed volumes */
1302 int totalBusy; /*Total busy volumes */
1303 int i; /*Loop variable */
1304 afs_uint32 volid = 0; /*Current volume ID */
1307 * Initialize counters and (global!!) queues.
1316 * Display each volume in the list.
1318 for (i = 0; i < a_count; i++) {
1319 fprintf(STDOUT, "BEGIN_OF_ENTRY\n");
1320 XDisplayFormat2(a_xInfoP, a_servID, a_partID, &totalOK, &totalNotOK,
1321 &totalBusy, a_fast, a_int32, 0);
1322 fprintf(STDOUT, "END_OF_ENTRY\n");
1327 * If any volumes were found to be busy or screwed, display them.
1330 while (busyHead.count) {
1331 qGet(&busyHead, &volid);
1332 fprintf(STDOUT, "BUSY_VOL\t%lu\n",
1333 (unsigned long)volid);
1337 while (notokHead.count) {
1338 qGet(¬okHead, &volid);
1339 fprintf(STDOUT, "COULD_NOT_ATTACH\t%lu\n",
1340 (unsigned long)volid);
1345 fprintf(STDOUT, "\n");
1348 "VOLUMES_ONLINE\t%d\nVOLUMES_OFFLINE\t%d\nVOLUMES_BUSY\t%d\n",
1349 totalOK, totalNotOK, totalBusy);
1353 } /*XDisplayVolumes2 */
1354 #endif /* FULL_LISTVOL_SWITCH */
1357 /* set <server> and <part> to the correct values depending on
1358 * <voltype> and <entry> */
1360 GetServerAndPart(struct nvldbentry *entry, int voltype, afs_int32 *server,
1361 afs_int32 *part, int *previdx)
1363 int i, istart, vtype;
1368 /* Doesn't check for non-existance of backup volume */
1369 if ((voltype == RWVOL) || (voltype == BACKVOL)) {
1371 istart = 0; /* seach the entire entry */
1374 /* Seach from beginning of entry or pick up where we left off */
1375 istart = ((*previdx < 0) ? 0 : *previdx + 1);
1378 for (i = istart; i < entry->nServers; i++) {
1379 if (entry->serverFlags[i] & vtype) {
1380 *server = entry->serverNumber[i];
1381 *part = entry->serverPartition[i];
1387 /* Didn't find any, return -1 */
1393 PostVolumeStats(struct nvldbentry *entry)
1395 SubEnumerateEntry(entry);
1396 /* Check for VLOP_ALLOPERS */
1397 if (entry->flags & VLOP_ALLOPERS)
1398 fprintf(STDOUT, " Volume is currently LOCKED \n");
1402 /*------------------------------------------------------------------------
1403 * PRIVATE XVolumeStats
1406 * Display extended volume information.
1409 * a_xInfoP : Ptr to extended volume info.
1410 * a_entryP : Ptr to the volume's VLDB entry.
1411 * a_srvID : Server ID.
1412 * a_partID : Partition ID.
1413 * a_volType : Type of volume to print.
1419 * Nothing interesting.
1423 *------------------------------------------------------------------------*/
1426 XVolumeStats(volintXInfo *a_xInfoP, struct nvldbentry *a_entryP,
1427 afs_int32 a_srvID, afs_int32 a_partID, int a_volType)
1430 int totalOK, totalNotOK, totalBusy; /*Dummies - we don't really count here */
1432 XDisplayFormat(a_xInfoP, /*Ptr to extended volume info */
1433 a_srvID, /*Server ID to print */
1434 a_partID, /*Partition ID to print */
1435 &totalOK, /*Ptr to total-OK counter */
1436 &totalNotOK, /*Ptr to total-screwed counter */
1437 &totalBusy, /*Ptr to total-busy counter */
1438 0, /*Don't do a fast listing */
1439 1, /*Do a long listing */
1440 1); /*Show volume problems */
1446 VolumeStats_int(volintInfo *pntr, struct nvldbentry *entry, afs_int32 server,
1447 afs_int32 part, int voltype)
1449 int totalOK, totalNotOK, totalBusy;
1451 DisplayFormat(pntr, server, part, &totalOK, &totalNotOK, &totalBusy, 0, 1,
1456 /* command to forcibly remove a volume */
1458 NukeVolume(register struct cmd_syndesc *as)
1460 register afs_int32 code;
1467 server = GetServer(tp = as->parms[0].items->data);
1469 fprintf(STDERR, "vos: server '%s' not found in host table\n", tp);
1473 partID = volutil_GetPartitionID(tp = as->parms[1].items->data);
1475 fprintf(STDERR, "vos: could not parse '%s' as a partition name", tp);
1479 volID = vsu_GetVolumeID(tp = as->parms[2].items->data, cstruct, &err);
1482 PrintError("", err);
1485 "vos: could not parse '%s' as a numeric volume ID", tp);
1490 "vos: forcibly removing all traces of volume %d, please wait...",
1493 code = UV_NukeVolume(server, partID, volID);
1495 fprintf(STDOUT, "done.\n");
1497 fprintf(STDOUT, "failed with code %d.\n", code);
1502 /*------------------------------------------------------------------------
1503 * PRIVATE ExamineVolume
1506 * Routine used to examine a single volume, contacting the VLDB as
1507 * well as the Volume Server.
1510 * as : Ptr to parsed command line arguments.
1513 * 0 for a successful operation,
1514 * Otherwise, one of the ubik or VolServer error values.
1517 * Nothing interesting.
1521 *------------------------------------------------------------------------
1524 ExamineVolume(register struct cmd_syndesc *as, void *arock)
1526 struct nvldbentry entry;
1527 afs_int32 vcode = 0;
1528 volintInfo *pntr = (volintInfo *) 0;
1529 volintXInfo *xInfoP = (volintXInfo *) 0;
1531 afs_int32 code, err, error = 0;
1532 int voltype, foundserv = 0, foundentry = 0;
1533 afs_int32 aserver, apart;
1535 int wantExtendedInfo; /*Do we want extended vol info? */
1537 wantExtendedInfo = (as->parms[1].items ? 1 : 0); /* -extended */
1539 volid = vsu_GetVolumeID(as->parms[0].items->data, cstruct, &err); /* -id */
1542 PrintError("", err);
1544 fprintf(STDERR, "Unknown volume ID or name '%s'\n",
1545 as->parms[0].items->data);
1550 fprintf(STDOUT, "Fetching VLDB entry for %lu .. ",
1551 (unsigned long)volid);
1554 vcode = VLDB_GetEntryByID(volid, -1, &entry);
1557 "Could not fetch the entry for volume number %lu from VLDB \n",
1558 (unsigned long)volid);
1562 fprintf(STDOUT, "done\n");
1563 MapHostToNetwork(&entry);
1565 if (entry.volumeId[RWVOL] == volid)
1567 else if (entry.volumeId[BACKVOL] == volid)
1569 else /* (entry.volumeId[ROVOL] == volid) */
1572 do { /* do {...} while (voltype == ROVOL) */
1573 /* Get the entry for the volume. If its a RW vol, get the RW entry.
1574 * It its a BK vol, get the RW entry (even if VLDB may say the BK doen't exist).
1575 * If its a RO vol, get the next RO entry.
1577 GetServerAndPart(&entry, ((voltype == ROVOL) ? ROVOL : RWVOL),
1578 &aserver, &apart, &previdx);
1579 if (previdx == -1) { /* searched all entries */
1581 fprintf(STDERR, "Volume %s does not exist in VLDB\n\n",
1582 as->parms[0].items->data);
1589 /* Get information about the volume from the server */
1591 fprintf(STDOUT, "Getting volume listing from the server %s .. ",
1592 hostutil_GetNameByINet(aserver));
1595 if (wantExtendedInfo)
1596 code = UV_XListOneVolume(aserver, apart, volid, &xInfoP);
1598 code = UV_ListOneVolume(aserver, apart, volid, &pntr);
1600 fprintf(STDOUT, "done\n");
1604 if (code == ENODEV) {
1605 if ((voltype == BACKVOL) && !(entry.flags & BACK_EXISTS)) {
1606 /* The VLDB says there is no backup volume and its not on disk */
1607 fprintf(STDERR, "Volume %s does not exist\n",
1608 as->parms[0].items->data);
1612 "Volume does not exist on server %s as indicated by the VLDB\n",
1613 hostutil_GetNameByINet(aserver));
1616 PrintDiagnostics("examine", code);
1618 fprintf(STDOUT, "\n");
1621 if (wantExtendedInfo)
1622 XVolumeStats(xInfoP, &entry, aserver, apart, voltype);
1624 #ifdef FULL_LISTVOL_SWITCH
1625 if (as->parms[2].items) {
1626 DisplayFormat2(aserver, apart, pntr);
1627 EnumerateEntry(&entry);
1629 #endif /* FULL_LISTVOL_SWITCH */
1630 VolumeStats_int(pntr, &entry, aserver, apart, voltype);
1632 if ((voltype == BACKVOL) && !(entry.flags & BACK_EXISTS)) {
1633 /* The VLDB says there is no backup volume yet we found one on disk */
1634 fprintf(STDERR, "Volume %s does not exist in VLDB\n",
1635 as->parms[0].items->data);
1644 } while (voltype == ROVOL);
1647 fprintf(STDERR, "Dump only information from VLDB\n\n");
1648 fprintf(STDOUT, "%s \n", entry.name); /* PostVolumeStats doesn't print name */
1650 PostVolumeStats(&entry);
1655 /*------------------------------------------------------------------------
1659 * Routine used to change the status of a single volume.
1662 * as : Ptr to parsed command line arguments.
1665 * 0 for a successful operation,
1666 * Otherwise, one of the ubik or VolServer error values.
1669 * Nothing interesting.
1673 *------------------------------------------------------------------------
1676 SetFields(register struct cmd_syndesc *as, void *arock)
1678 struct nvldbentry entry;
1681 afs_int32 code, err;
1682 afs_int32 aserver, apart;
1685 volid = vsu_GetVolumeID(as->parms[0].items->data, cstruct, &err); /* -id */
1688 PrintError("", err);
1690 fprintf(STDERR, "Unknown volume ID or name '%s'\n",
1691 as->parms[0].items->data);
1695 code = VLDB_GetEntryByID(volid, RWVOL, &entry);
1698 "Could not fetch the entry for volume number %lu from VLDB \n",
1699 (unsigned long)volid);
1702 MapHostToNetwork(&entry);
1704 GetServerAndPart(&entry, RWVOL, &aserver, &apart, &previdx);
1705 if (previdx == -1) {
1706 fprintf(STDERR, "Volume %s does not exist in VLDB\n\n",
1707 as->parms[0].items->data);
1711 init_volintInfo(&info);
1715 if (as->parms[1].items) {
1717 code = util_GetHumanInt32(as->parms[1].items->data, &info.maxquota);
1719 fprintf(STDERR, "invalid quota value\n");
1723 if (as->parms[2].items) {
1727 if (as->parms[3].items) {
1728 /* -clearVolUpCounter */
1731 code = UV_SetVolumeInfo(aserver, apart, volid, &info);
1734 "Could not update volume info fields for volume number %lu\n",
1735 (unsigned long)volid);
1739 /*------------------------------------------------------------------------
1743 * Brings a volume online.
1746 * as : Ptr to parsed command line arguments.
1749 * 0 for a successful operation,
1752 * Nothing interesting.
1756 *------------------------------------------------------------------------
1759 volOnline(register struct cmd_syndesc *as, void *arock)
1761 afs_int32 server, partition;
1763 afs_int32 code, err = 0;
1765 server = GetServer(as->parms[0].items->data);
1767 fprintf(STDERR, "vos: server '%s' not found in host table\n",
1768 as->parms[0].items->data);
1772 partition = volutil_GetPartitionID(as->parms[1].items->data);
1773 if (partition < 0) {
1774 fprintf(STDERR, "vos: could not interpret partition name '%s'\n",
1775 as->parms[1].items->data);
1779 volid = vsu_GetVolumeID(as->parms[2].items->data, cstruct, &err); /* -id */
1782 PrintError("", err);
1784 fprintf(STDERR, "Unknown volume ID or name '%s'\n",
1785 as->parms[0].items->data);
1789 code = UV_SetVolume(server, partition, volid, ITOffline, 0 /*online */ ,
1792 fprintf(STDERR, "Failed to set volume. Code = %d\n", code);
1799 /*------------------------------------------------------------------------
1800 * PRIVATE volOffline
1803 * Brings a volume offline.
1806 * as : Ptr to parsed command line arguments.
1809 * 0 for a successful operation,
1812 * Nothing interesting.
1816 *------------------------------------------------------------------------
1819 volOffline(register struct cmd_syndesc *as, void *arock)
1821 afs_int32 server, partition;
1823 afs_int32 code, err = 0;
1824 afs_int32 transflag, sleeptime, transdone;
1826 server = GetServer(as->parms[0].items->data);
1828 fprintf(STDERR, "vos: server '%s' not found in host table\n",
1829 as->parms[0].items->data);
1833 partition = volutil_GetPartitionID(as->parms[1].items->data);
1834 if (partition < 0) {
1835 fprintf(STDERR, "vos: could not interpret partition name '%s'\n",
1836 as->parms[1].items->data);
1840 volid = vsu_GetVolumeID(as->parms[2].items->data, cstruct, &err); /* -id */
1843 PrintError("", err);
1845 fprintf(STDERR, "Unknown volume ID or name '%s'\n",
1846 as->parms[0].items->data);
1850 transflag = (as->parms[4].items ? ITBusy : ITOffline);
1851 sleeptime = (as->parms[3].items ? atol(as->parms[3].items->data) : 0);
1852 transdone = (sleeptime ? 0 /*online */ : VTOutOfService);
1853 if (as->parms[4].items && !as->parms[3].items) {
1854 fprintf(STDERR, "-sleep option must be used with -busy flag\n");
1859 UV_SetVolume(server, partition, volid, transflag, transdone,
1862 fprintf(STDERR, "Failed to set volume. Code = %d\n", code);
1870 CreateVolume(register struct cmd_syndesc *as, void *arock)
1876 struct nvldbentry entry;
1881 tserver = GetServer(as->parms[0].items->data);
1883 fprintf(STDERR, "vos: host '%s' not found in host table\n",
1884 as->parms[0].items->data);
1887 pnum = volutil_GetPartitionID(as->parms[1].items->data);
1889 fprintf(STDERR, "vos: could not interpret partition name '%s'\n",
1890 as->parms[1].items->data);
1893 if (!IsPartValid(pnum, tserver, &code)) { /*check for validity of the partition */
1895 PrintError("", code);
1898 "vos : partition %s does not exist on the server\n",
1899 as->parms[1].items->data);
1902 if (!ISNAMEVALID(as->parms[2].items->data)) {
1904 "vos: the name of the root volume %s exceeds the size limit of %d\n",
1905 as->parms[2].items->data, VOLSER_OLDMAXVOLNAME - 10);
1908 if (!VolNameOK(as->parms[2].items->data)) {
1910 "Illegal volume name %s, should not end in .readonly or .backup\n",
1911 as->parms[2].items->data);
1914 if (IsNumeric(as->parms[2].items->data)) {
1915 fprintf(STDERR, "Illegal volume name %s, should not be a number\n",
1916 as->parms[2].items->data);
1919 vcode = VLDB_GetEntryByName(as->parms[2].items->data, &entry);
1921 fprintf(STDERR, "Volume %s already exists\n",
1922 as->parms[2].items->data);
1923 PrintDiagnostics("create", code);
1927 if (as->parms[3].items) {
1928 code = util_GetHumanInt32(as->parms[3].items->data, "a);
1930 fprintf(STDERR, "vos: bad integer specified for quota.\n");
1936 UV_CreateVolume2(tserver, pnum, as->parms[2].items->data, quota, 0,
1939 PrintDiagnostics("create", code);
1942 MapPartIdIntoName(pnum, part);
1943 fprintf(STDOUT, "Volume %lu created on partition %s of %s\n",
1944 (unsigned long)volid, part, as->parms[0].items->data);
1951 DeleteAll(struct nvldbentry *entry)
1954 afs_int32 error, code, curserver, curpart;
1957 MapHostToNetwork(entry);
1959 for (i = 0; i < entry->nServers; i++) {
1960 curserver = entry->serverNumber[i];
1961 curpart = entry->serverPartition[i];
1962 if (entry->serverFlags[i] & ITSROVOL) {
1963 volid = entry->volumeId[ROVOL];
1965 volid = entry->volumeId[RWVOL];
1967 code = UV_DeleteVolume(curserver, curpart, volid);
1976 DeleteVolume(struct cmd_syndesc *as, void *arock)
1978 afs_int32 err, code = 0;
1979 afs_int32 server = 0, partition = -1;
1984 if (as->parms[0].items) {
1985 server = GetServer(as->parms[0].items->data);
1987 fprintf(STDERR, "vos: server '%s' not found in host table\n",
1988 as->parms[0].items->data);
1993 if (as->parms[1].items) {
1994 partition = volutil_GetPartitionID(as->parms[1].items->data);
1995 if (partition < 0) {
1996 fprintf(STDERR, "vos: could not interpret partition name '%s'\n",
1997 as->parms[1].items->data);
2001 /* Check for validity of the partition */
2002 if (!IsPartValid(partition, server, &code)) {
2004 PrintError("", code);
2007 "vos : partition %s does not exist on the server\n",
2008 as->parms[1].items->data);
2014 volid = vsu_GetVolumeID(as->parms[2].items->data, cstruct, &err);
2016 fprintf(STDERR, "Can't find volume name '%s' in VLDB\n",
2017 as->parms[2].items->data);
2019 PrintError("", err);
2023 /* If the server or partition option are not complete, try to fill
2024 * them in from the VLDB entry.
2026 if ((partition == -1) || !server) {
2027 struct nvldbentry entry;
2029 code = VLDB_GetEntryByID(volid, -1, &entry);
2032 "Could not fetch the entry for volume %lu from VLDB\n",
2033 (unsigned long)volid);
2034 PrintError("", code);
2038 if (((volid == entry.volumeId[RWVOL]) && (entry.flags & RW_EXISTS))
2039 || ((volid == entry.volumeId[BACKVOL])
2040 && (entry.flags & BACK_EXISTS))) {
2041 idx = Lp_GetRwIndex(&entry);
2042 if ((idx == -1) || (server && (server != entry.serverNumber[idx]))
2043 || ((partition != -1)
2044 && (partition != entry.serverPartition[idx]))) {
2045 fprintf(STDERR, "VLDB: Volume '%s' no match\n",
2046 as->parms[2].items->data);
2049 } else if ((volid == entry.volumeId[ROVOL])
2050 && (entry.flags & RO_EXISTS)) {
2051 for (idx = -1, j = 0; j < entry.nServers; j++) {
2052 if (entry.serverFlags[j] != ITSROVOL)
2055 if (((server == 0) || (server == entry.serverNumber[j]))
2056 && ((partition == -1)
2057 || (partition == entry.serverPartition[j]))) {
2060 "VLDB: Volume '%s' matches more than one RO\n",
2061 as->parms[2].items->data);
2068 fprintf(STDERR, "VLDB: Volume '%s' no match\n",
2069 as->parms[2].items->data);
2073 fprintf(STDERR, "VLDB: Volume '%s' no match\n",
2074 as->parms[2].items->data);
2078 server = htonl(entry.serverNumber[idx]);
2079 partition = entry.serverPartition[idx];
2083 code = UV_DeleteVolume(server, partition, volid);
2085 PrintDiagnostics("remove", code);
2089 MapPartIdIntoName(partition, pname);
2090 fprintf(STDOUT, "Volume %lu on partition %s server %s deleted\n",
2091 (unsigned long)volid, pname, hostutil_GetNameByINet(server));
2095 #define TESTM 0 /* set for move space tests, clear for production */
2097 MoveVolume(register struct cmd_syndesc *as, void *arock)
2101 afs_int32 fromserver, toserver, frompart, topart;
2102 afs_int32 flags, code, err;
2103 char fromPartName[10], toPartName[10];
2105 struct diskPartition64 partition; /* for space check */
2108 volid = vsu_GetVolumeID(as->parms[0].items->data, cstruct, &err);
2111 PrintError("", err);
2113 fprintf(STDERR, "vos: can't find volume ID or name '%s'\n",
2114 as->parms[0].items->data);
2117 fromserver = GetServer(as->parms[1].items->data);
2118 if (fromserver == 0) {
2119 fprintf(STDERR, "vos: server '%s' not found in host table\n",
2120 as->parms[1].items->data);
2123 toserver = GetServer(as->parms[3].items->data);
2124 if (toserver == 0) {
2125 fprintf(STDERR, "vos: server '%s' not found in host table\n",
2126 as->parms[3].items->data);
2129 frompart = volutil_GetPartitionID(as->parms[2].items->data);
2131 fprintf(STDERR, "vos: could not interpret partition name '%s'\n",
2132 as->parms[2].items->data);
2135 if (!IsPartValid(frompart, fromserver, &code)) { /*check for validity of the partition */
2137 PrintError("", code);
2140 "vos : partition %s does not exist on the server\n",
2141 as->parms[2].items->data);
2144 topart = volutil_GetPartitionID(as->parms[4].items->data);
2146 fprintf(STDERR, "vos: could not interpret partition name '%s'\n",
2147 as->parms[4].items->data);
2150 if (!IsPartValid(topart, toserver, &code)) { /*check for validity of the partition */
2152 PrintError("", code);
2155 "vos : partition %s does not exist on the server\n",
2156 as->parms[4].items->data);
2161 if (as->parms[5].items) flags |= RV_NOCLONE;
2164 * check source partition for space to clone volume
2167 MapPartIdIntoName(topart, toPartName);
2168 MapPartIdIntoName(frompart, fromPartName);
2171 * check target partition for space to move volume
2174 code = UV_PartitionInfo64(toserver, toPartName, &partition);
2176 fprintf(STDERR, "vos: cannot access partition %s\n", toPartName);
2180 fprintf(STDOUT, "target partition %s free space %" AFS_INT64_FMT "\n", toPartName,
2183 p = (volintInfo *) 0;
2184 code = UV_ListOneVolume(fromserver, frompart, volid, &p);
2186 fprintf(STDERR, "vos:cannot access volume %lu\n",
2187 (unsigned long)volid);
2191 fprintf(STDOUT, "volume %lu size %d\n", (unsigned long)volid,
2193 if (partition.free <= p->size) {
2195 "vos: no space on target partition %s to move volume %lu\n",
2196 toPartName, (unsigned long)volid);
2203 fprintf(STDOUT, "size test - don't do move\n");
2207 /* successful move still not guaranteed but shoot for it */
2210 UV_MoveVolume2(volid, fromserver, frompart, toserver, topart, flags);
2212 PrintDiagnostics("move", code);
2215 MapPartIdIntoName(topart, toPartName);
2216 MapPartIdIntoName(frompart, fromPartName);
2217 fprintf(STDOUT, "Volume %lu moved from %s %s to %s %s \n",
2218 (unsigned long)volid, as->parms[1].items->data, fromPartName,
2219 as->parms[3].items->data, toPartName);
2225 CopyVolume(register struct cmd_syndesc *as, void *arock)
2228 afs_int32 fromserver, toserver, frompart, topart, code, err, flags;
2229 char fromPartName[10], toPartName[10], *tovolume;
2230 struct nvldbentry entry;
2231 struct diskPartition64 partition; /* for space check */
2234 volid = vsu_GetVolumeID(as->parms[0].items->data, cstruct, &err);
2237 PrintError("", err);
2239 fprintf(STDERR, "vos: can't find volume ID or name '%s'\n",
2240 as->parms[0].items->data);
2243 fromserver = GetServer(as->parms[1].items->data);
2244 if (fromserver == 0) {
2245 fprintf(STDERR, "vos: server '%s' not found in host table\n",
2246 as->parms[1].items->data);
2250 toserver = GetServer(as->parms[4].items->data);
2251 if (toserver == 0) {
2252 fprintf(STDERR, "vos: server '%s' not found in host table\n",
2253 as->parms[4].items->data);
2257 tovolume = as->parms[3].items->data;
2258 if (!ISNAMEVALID(tovolume)) {
2260 "vos: the name of the root volume %s exceeds the size limit of %d\n",
2261 tovolume, VOLSER_OLDMAXVOLNAME - 10);
2264 if (!VolNameOK(tovolume)) {
2266 "Illegal volume name %s, should not end in .readonly or .backup\n",
2270 if (IsNumeric(tovolume)) {
2271 fprintf(STDERR, "Illegal volume name %s, should not be a number\n",
2275 code = VLDB_GetEntryByName(tovolume, &entry);
2277 fprintf(STDERR, "Volume %s already exists\n", tovolume);
2278 PrintDiagnostics("copy", code);
2282 frompart = volutil_GetPartitionID(as->parms[2].items->data);
2284 fprintf(STDERR, "vos: could not interpret partition name '%s'\n",
2285 as->parms[2].items->data);
2288 if (!IsPartValid(frompart, fromserver, &code)) { /*check for validity of the partition */
2290 PrintError("", code);
2293 "vos : partition %s does not exist on the server\n",
2294 as->parms[2].items->data);
2298 topart = volutil_GetPartitionID(as->parms[5].items->data);
2300 fprintf(STDERR, "vos: could not interpret partition name '%s'\n",
2301 as->parms[5].items->data);
2304 if (!IsPartValid(topart, toserver, &code)) { /*check for validity of the partition */
2306 PrintError("", code);
2309 "vos : partition %s does not exist on the server\n",
2310 as->parms[5].items->data);
2315 if (as->parms[6].items) flags |= RV_OFFLINE;
2316 if (as->parms[7].items) flags |= RV_RDONLY;
2317 if (as->parms[8].items) flags |= RV_NOCLONE;
2319 MapPartIdIntoName(topart, toPartName);
2320 MapPartIdIntoName(frompart, fromPartName);
2323 * check target partition for space to move volume
2326 code = UV_PartitionInfo64(toserver, toPartName, &partition);
2328 fprintf(STDERR, "vos: cannot access partition %s\n", toPartName);
2332 fprintf(STDOUT, "target partition %s free space %" AFS_INT64_FMT "\n", toPartName,
2335 p = (volintInfo *) 0;
2336 code = UV_ListOneVolume(fromserver, frompart, volid, &p);
2338 fprintf(STDERR, "vos:cannot access volume %lu\n",
2339 (unsigned long)volid);
2343 if (partition.free <= p->size) {
2345 "vos: no space on target partition %s to copy volume %lu\n",
2346 toPartName, (unsigned long)volid);
2352 /* successful copy still not guaranteed but shoot for it */
2355 UV_CopyVolume2(volid, fromserver, frompart, tovolume, toserver,
2358 PrintDiagnostics("copy", code);
2361 MapPartIdIntoName(topart, toPartName);
2362 MapPartIdIntoName(frompart, fromPartName);
2363 fprintf(STDOUT, "Volume %lu copied from %s %s to %s on %s %s \n",
2364 (unsigned long)volid, as->parms[1].items->data, fromPartName,
2365 tovolume, as->parms[4].items->data, toPartName);
2372 ShadowVolume(register struct cmd_syndesc *as, void *arock)
2374 afs_uint32 volid, tovolid;
2375 afs_int32 fromserver, toserver, frompart, topart;
2376 afs_int32 code, err, flags;
2377 char fromPartName[10], toPartName[10], toVolName[32], *tovolume;
2378 struct diskPartition64 partition; /* for space check */
2381 p = (volintInfo *) 0;
2382 q = (volintInfo *) 0;
2384 volid = vsu_GetVolumeID(as->parms[0].items->data, cstruct, &err);
2387 PrintError("", err);
2389 fprintf(STDERR, "vos: can't find volume ID or name '%s'\n",
2390 as->parms[0].items->data);
2393 fromserver = GetServer(as->parms[1].items->data);
2394 if (fromserver == 0) {
2395 fprintf(STDERR, "vos: server '%s' not found in host table\n",
2396 as->parms[1].items->data);
2400 toserver = GetServer(as->parms[3].items->data);
2401 if (toserver == 0) {
2402 fprintf(STDERR, "vos: server '%s' not found in host table\n",
2403 as->parms[3].items->data);
2407 frompart = volutil_GetPartitionID(as->parms[2].items->data);
2409 fprintf(STDERR, "vos: could not interpret partition name '%s'\n",
2410 as->parms[2].items->data);
2413 if (!IsPartValid(frompart, fromserver, &code)) { /*check for validity of the partition */
2415 PrintError("", code);
2418 "vos : partition %s does not exist on the server\n",
2419 as->parms[2].items->data);
2423 topart = volutil_GetPartitionID(as->parms[4].items->data);
2425 fprintf(STDERR, "vos: could not interpret partition name '%s'\n",
2426 as->parms[4].items->data);
2429 if (!IsPartValid(topart, toserver, &code)) { /*check for validity of the partition */
2431 PrintError("", code);
2434 "vos : partition %s does not exist on the server\n",
2435 as->parms[4].items->data);
2439 if (as->parms[5].items) {
2440 tovolume = as->parms[5].items->data;
2441 if (!ISNAMEVALID(tovolume)) {
2443 "vos: the name of the root volume %s exceeds the size limit of %d\n",
2444 tovolume, VOLSER_OLDMAXVOLNAME - 10);
2447 if (!VolNameOK(tovolume)) {
2449 "Illegal volume name %s, should not end in .readonly or .backup\n",
2453 if (IsNumeric(tovolume)) {
2455 "Illegal volume name %s, should not be a number\n",
2460 /* use actual name of source volume */
2461 code = UV_ListOneVolume(fromserver, frompart, volid, &p);
2463 fprintf(STDERR, "vos:cannot access volume %lu\n",
2464 (unsigned long)volid);
2467 strcpy(toVolName, p->name);
2468 tovolume = toVolName;
2469 /* save p for size checks later */
2472 if (as->parms[6].items) {
2473 tovolid = vsu_GetVolumeID(as->parms[6].items->data, cstruct, &err);
2476 PrintError("", err);
2478 fprintf(STDERR, "vos: can't find volume ID or name '%s'\n",
2479 as->parms[6].items->data);
2485 tovolid = vsu_GetVolumeID(tovolume, cstruct, &err);
2488 PrintError("", err);
2490 fprintf(STDERR, "vos: can't find volume ID or name '%s'\n",
2499 if (as->parms[7].items) flags |= RV_OFFLINE;
2500 if (as->parms[8].items) flags |= RV_RDONLY;
2501 if (as->parms[9].items) flags |= RV_NOCLONE;
2502 if (as->parms[10].items) flags |= RV_CPINCR;
2504 MapPartIdIntoName(topart, toPartName);
2505 MapPartIdIntoName(frompart, fromPartName);
2508 * check target partition for space to move volume
2511 code = UV_PartitionInfo64(toserver, toPartName, &partition);
2513 fprintf(STDERR, "vos: cannot access partition %s\n", toPartName);
2517 fprintf(STDOUT, "target partition %s free space %" AFS_INT64_FMT "\n", toPartName,
2520 /* Don't do this again if we did it above */
2522 code = UV_ListOneVolume(fromserver, frompart, volid, &p);
2524 fprintf(STDERR, "vos:cannot access volume %lu\n",
2525 (unsigned long)volid);
2530 /* OK if this fails */
2531 code = UV_ListOneVolume(toserver, topart, tovolid, &q);
2533 /* Treat existing volume size as "free" */
2535 p->size = (q->size < p->size) ? p->size - q->size : 0;
2537 if (partition.free <= p->size) {
2539 "vos: no space on target partition %s to copy volume %lu\n",
2540 toPartName, (unsigned long)volid);
2548 /* successful copy still not guaranteed but shoot for it */
2551 UV_CopyVolume2(volid, fromserver, frompart, tovolume, toserver,
2552 topart, tovolid, flags);
2554 PrintDiagnostics("shadow", code);
2557 MapPartIdIntoName(topart, toPartName);
2558 MapPartIdIntoName(frompart, fromPartName);
2559 fprintf(STDOUT, "Volume %lu shadowed from %s %s to %s %s \n",
2560 (unsigned long)volid, as->parms[1].items->data, fromPartName,
2561 as->parms[3].items->data, toPartName);
2568 CloneVolume(register struct cmd_syndesc *as, void *arock)
2570 afs_uint32 volid, cloneid;
2571 afs_int32 server, part, voltype;
2572 char partName[10], *volname;
2573 afs_int32 code, err, flags;
2574 struct nvldbentry entry;
2576 volid = vsu_GetVolumeID(as->parms[0].items->data, cstruct, &err);
2579 PrintError("", err);
2581 fprintf(STDERR, "vos: can't find volume ID or name '%s'\n",
2582 as->parms[0].items->data);
2586 if (as->parms[1].items || as->parms[2].items) {
2587 if (!as->parms[1].items || !as->parms[2].items) {
2589 "Must specify both -server and -partition options\n");
2592 server = GetServer(as->parms[1].items->data);
2594 fprintf(STDERR, "vos: server '%s' not found in host table\n",
2595 as->parms[1].items->data);
2598 part = volutil_GetPartitionID(as->parms[2].items->data);
2600 fprintf(STDERR, "vos: could not interpret partition name '%s'\n",
2601 as->parms[2].items->data);
2604 if (!IsPartValid(part, server, &code)) { /*check for validity of the partition */
2606 PrintError("", code);
2609 "vos : partition %s does not exist on the server\n",
2610 as->parms[2].items->data);
2614 code = GetVolumeInfo(volid, &server, &part, &voltype, &entry);
2620 if (as->parms[3].items) {
2621 volname = as->parms[3].items->data;
2622 if (strlen(volname) > VOLSER_OLDMAXVOLNAME - 1) {
2624 "vos: the name of the root volume %s exceeds the size limit of %d\n",
2625 volname, VOLSER_OLDMAXVOLNAME - 1);
2630 * In order that you be able to make clones of RO or BK, this
2631 * check must be omitted.
2633 if (!VolNameOK(volname)) {
2635 "Illegal volume name %s, should not end in .readonly or .backup\n",
2640 if (IsNumeric(volname)) {
2642 "Illegal volume name %s, should not be a number\n",
2649 if (as->parms[4].items) {
2650 cloneid = vsu_GetVolumeID(as->parms[4].items->data, cstruct, &err);
2653 PrintError("", err);
2655 fprintf(STDERR, "vos: can't find volume ID or name '%s'\n",
2656 as->parms[4].items->data);
2662 if (as->parms[5].items) flags |= RV_OFFLINE;
2663 if (as->parms[6].items) flags |= RV_RDONLY;
2667 UV_CloneVolume(server, part, volid, cloneid, volname, flags);
2670 PrintDiagnostics("clone", code);
2673 MapPartIdIntoName(part, partName);
2674 fprintf(STDOUT, "Created clone for volume %s\n",
2675 as->parms[0].items->data);
2682 BackupVolume(register struct cmd_syndesc *as, void *arock)
2685 afs_int32 aserver, apart, vtype, code, err;
2686 struct nvldbentry entry;
2689 afs_int32 buserver, bupart, butype;
2690 struct nvldbentry buentry;
2692 avolid = vsu_GetVolumeID(as->parms[0].items->data, cstruct, &err);
2695 PrintError("", err);
2697 fprintf(STDERR, "vos: can't find volume ID or name '%s'\n",
2698 as->parms[0].items->data);
2701 code = GetVolumeInfo(avolid, &aserver, &apart, &vtype, &entry);
2705 /* verify this is a readwrite volume */
2707 if (vtype != RWVOL) {
2708 fprintf(STDERR, "%s not RW volume\n", as->parms[0].items->data);
2712 /* is there a backup volume already? */
2714 if (entry.flags & BACK_EXISTS) {
2715 /* yep, where is it? */
2717 buvolid = entry.volumeId[BACKVOL];
2718 code = GetVolumeInfo(buvolid, &buserver, &bupart, &butype, &buentry);
2723 code = VLDB_IsSameAddrs(buserver, aserver, &err);
2726 "Failed to get info about server's %d address(es) from vlserver; aborting call!\n",
2732 "FATAL ERROR: backup volume %lu exists on server %lu\n",
2733 (unsigned long)buvolid, (unsigned long)buserver);
2738 /* nope, carry on */
2740 code = UV_BackupVolume(aserver, apart, avolid);
2743 PrintDiagnostics("backup", code);
2746 fprintf(STDOUT, "Created backup volume for %s \n",
2747 as->parms[0].items->data);
2752 ReleaseVolume(register struct cmd_syndesc *as, void *arock)
2755 struct nvldbentry entry;
2757 afs_int32 aserver, apart, vtype, code, err;
2760 if (as->parms[1].items)
2762 avolid = vsu_GetVolumeID(as->parms[0].items->data, cstruct, &err);
2765 PrintError("", err);
2767 fprintf(STDERR, "vos: can't find volume '%s'\n",
2768 as->parms[0].items->data);
2771 code = GetVolumeInfo(avolid, &aserver, &apart, &vtype, &entry);
2775 if (vtype != RWVOL) {
2776 fprintf(STDERR, "%s not a RW volume\n", as->parms[0].items->data);
2780 if (!ISNAMEVALID(entry.name)) {
2782 "Volume name %s is too long, rename before releasing\n",
2787 code = UV_ReleaseVolume(avolid, aserver, apart, force);
2789 PrintDiagnostics("release", code);
2792 fprintf(STDOUT, "Released volume %s successfully\n",
2793 as->parms[0].items->data);
2798 DumpVolumeCmd(register struct cmd_syndesc *as, void *arock)
2801 afs_int32 aserver, apart, voltype, fromdate = 0, code, err, i, flags;
2802 char filename[MAXPATHLEN];
2803 struct nvldbentry entry;
2805 rx_SetRxDeadTime(60 * 10);
2806 for (i = 0; i < MAXSERVERS; i++) {
2807 struct rx_connection *rxConn = ubik_GetRPCConn(cstruct, i);
2810 rx_SetConnDeadTime(rxConn, rx_connDeadTime);
2811 if (rxConn->service)
2812 rxConn->service->connDeadTime = rx_connDeadTime;
2815 avolid = vsu_GetVolumeID(as->parms[0].items->data, cstruct, &err);
2818 PrintError("", err);
2820 fprintf(STDERR, "vos: can't find volume '%s'\n",
2821 as->parms[0].items->data);
2825 if (as->parms[3].items || as->parms[4].items) {
2826 if (!as->parms[3].items || !as->parms[4].items) {
2828 "Must specify both -server and -partition options\n");
2831 aserver = GetServer(as->parms[3].items->data);
2833 fprintf(STDERR, "Invalid server name\n");
2836 apart = volutil_GetPartitionID(as->parms[4].items->data);
2838 fprintf(STDERR, "Invalid partition name\n");
2842 code = GetVolumeInfo(avolid, &aserver, &apart, &voltype, &entry);
2847 if (as->parms[1].items && strcmp(as->parms[1].items->data, "0")) {
2848 code = ktime_DateToInt32(as->parms[1].items->data, &fromdate);
2850 fprintf(STDERR, "vos: failed to parse date '%s' (error=%d))\n",
2851 as->parms[1].items->data, code);
2855 if (as->parms[2].items) {
2856 strcpy(filename, as->parms[2].items->data);
2858 strcpy(filename, "");
2861 flags = as->parms[6].items ? VOLDUMPV2_OMITDIRS : 0;
2863 if (as->parms[5].items) {
2865 UV_DumpClonedVolume(avolid, aserver, apart, fromdate,
2866 DumpFunction, filename, flags);
2869 UV_DumpVolume(avolid, aserver, apart, fromdate, DumpFunction,
2872 if ((code == RXGEN_OPCODE) && (as->parms[6].items)) {
2873 flags &= ~VOLDUMPV2_OMITDIRS;
2877 PrintDiagnostics("dump", code);
2880 if (strcmp(filename, ""))
2881 fprintf(STDERR, "Dumped volume %s in file %s\n",
2882 as->parms[0].items->data, filename);
2884 fprintf(STDERR, "Dumped volume %s in stdout \n",
2885 as->parms[0].items->data);
2899 RestoreVolumeCmd(register struct cmd_syndesc *as, void *arock)
2901 afs_uint32 avolid, aparentid;
2902 afs_int32 aserver, apart, code, vcode, err;
2903 afs_int32 aoverwrite = ASK;
2904 afs_int32 acreation = 0, alastupdate = 0;
2905 int restoreflags = 0;
2906 int readonly = 0, offline = 0, voltype = RWVOL;
2908 char afilename[MAXPATHLEN], avolname[VOLSER_MAXVOLNAME + 1], apartName[10];
2909 char volname[VOLSER_MAXVOLNAME + 1];
2910 struct nvldbentry entry;
2915 if (as->parms[4].items) {
2916 avolid = vsu_GetVolumeID(as->parms[4].items->data, cstruct, &err);
2919 PrintError("", err);
2921 fprintf(STDERR, "vos: can't find volume '%s'\n",
2922 as->parms[4].items->data);
2928 if (as->parms[5].items) {
2929 if ((strcmp(as->parms[5].items->data, "a") == 0)
2930 || (strcmp(as->parms[5].items->data, "abort") == 0)) {
2932 } else if ((strcmp(as->parms[5].items->data, "f") == 0)
2933 || (strcmp(as->parms[5].items->data, "full") == 0)) {
2935 } else if ((strcmp(as->parms[5].items->data, "i") == 0)
2936 || (strcmp(as->parms[5].items->data, "inc") == 0)
2937 || (strcmp(as->parms[5].items->data, "increment") == 0)
2938 || (strcmp(as->parms[5].items->data, "incremental") == 0)) {
2941 fprintf(STDERR, "vos: %s is not a valid argument to -overwrite\n",
2942 as->parms[5].items->data);
2946 if (as->parms[6].items)
2948 if (as->parms[7].items) {
2953 if (as->parms[8].items) {
2954 if ((strcmp(as->parms[8].items->data, "d") == 0)
2955 || (strcmp(as->parms[8].items->data, "dump") == 0)) {
2956 acreation = TS_DUMP;
2957 } else if ((strcmp(as->parms[8].items->data, "k") == 0)
2958 || (strcmp(as->parms[8].items->data, "keep") == 0)) {
2959 acreation = TS_KEEP;
2960 } else if ((strcmp(as->parms[8].items->data, "n") == 0)
2961 || (strcmp(as->parms[8].items->data, "new") == 0)) {
2964 fprintf(STDERR, "vos: %s is not a valid argument to -creation\n",
2965 as->parms[8].items->data);
2970 if (as->parms[9].items) {
2971 if ((strcmp(as->parms[9].items->data, "d") == 0)
2972 || (strcmp(as->parms[9].items->data, "dump") == 0)) {
2973 alastupdate = TS_DUMP;
2974 } else if ((strcmp(as->parms[9].items->data, "k") == 0)
2975 || (strcmp(as->parms[9].items->data, "keep") == 0)) {
2976 alastupdate = TS_KEEP;
2977 } else if ((strcmp(as->parms[9].items->data, "n") == 0)
2978 || (strcmp(as->parms[9].items->data, "new") == 0)) {
2979 alastupdate = TS_NEW;
2981 fprintf(STDERR, "vos: %s is not a valid argument to -lastupdate\n",
2982 as->parms[9].items->data);
2987 aserver = GetServer(as->parms[0].items->data);
2989 fprintf(STDERR, "vos: server '%s' not found in host table\n",
2990 as->parms[0].items->data);
2993 apart = volutil_GetPartitionID(as->parms[1].items->data);
2995 fprintf(STDERR, "vos: could not interpret partition name '%s'\n",
2996 as->parms[1].items->data);
2999 if (!IsPartValid(apart, aserver, &code)) { /*check for validity of the partition */
3001 PrintError("", code);
3004 "vos : partition %s does not exist on the server\n",
3005 as->parms[1].items->data);
3008 strcpy(avolname, as->parms[2].items->data);
3009 if (!ISNAMEVALID(avolname)) {
3011 "vos: the name of the volume %s exceeds the size limit\n",
3015 if (!VolNameOK(avolname)) {
3017 "Illegal volume name %s, should not end in .readonly or .backup\n",
3021 if (as->parms[3].items) {
3022 strcpy(afilename, as->parms[3].items->data);
3023 if (!FileExists(afilename)) {
3024 fprintf(STDERR, "Can't access file %s\n", afilename);
3028 strcpy(afilename, "");
3031 /* Check if volume exists or not */
3033 vsu_ExtractName(volname, avolname);
3034 vcode = VLDB_GetEntryByName(volname, &entry);
3035 if (vcode) { /* no volume - do a full restore */
3036 restoreflags = RV_FULLRST;
3037 if ((aoverwrite == INC) || (aoverwrite == ABORT))
3039 "Volume does not exist; Will perform a full restore\n");
3042 else if ((!readonly && Lp_GetRwIndex(&entry) == -1) /* RW volume does not exist - do a full */
3043 ||(readonly && !Lp_ROMatch(0, 0, &entry))) { /* RO volume does not exist - do a full */
3044 restoreflags = RV_FULLRST;
3045 if ((aoverwrite == INC) || (aoverwrite == ABORT))
3047 "%s Volume does not exist; Will perform a full restore\n",
3048 readonly ? "RO" : "RW");
3051 avolid = entry.volumeId[voltype];
3052 } else if (entry.volumeId[voltype] != 0
3053 && entry.volumeId[voltype] != avolid) {
3054 avolid = entry.volumeId[voltype];
3056 aparentid = entry.volumeId[RWVOL];
3059 else { /* volume exists - do we do a full incremental or abort */
3060 int Oserver, Opart, Otype, vol_elsewhere = 0;
3061 struct nvldbentry Oentry;
3065 avolid = entry.volumeId[voltype];
3066 } else if (entry.volumeId[voltype] != 0
3067 && entry.volumeId[voltype] != avolid) {
3068 avolid = entry.volumeId[voltype];
3070 aparentid = entry.volumeId[RWVOL];
3072 /* A file name was specified - check if volume is on another partition */
3073 vcode = GetVolumeInfo(avolid, &Oserver, &Opart, &Otype, &Oentry);
3077 vcode = VLDB_IsSameAddrs(Oserver, aserver, &err);
3080 "Failed to get info about server's %d address(es) from vlserver (err=%d); aborting call!\n",
3084 if (!vcode || (Opart != apart))
3087 if (aoverwrite == ASK) {
3088 if (strcmp(afilename, "") == 0) { /* The file is from standard in */
3090 "Volume exists and no -overwrite option specified; Aborting restore command\n");
3094 /* Ask what to do */
3095 if (vol_elsewhere) {
3097 "The volume %s %u already exists on a different server/part\n",
3098 volname, entry.volumeId[voltype]);
3100 "Do you want to do a full restore or abort? [fa](a): ");
3103 "The volume %s %u already exists in the VLDB\n",
3104 volname, entry.volumeId[voltype]);
3106 "Do you want to do a full/incremental restore or abort? [fia](a): ");
3109 while (!(dc == EOF || dc == '\n'))
3110 dc = getchar(); /* goto end of line */
3111 if ((c == 'f') || (c == 'F'))
3113 else if ((c == 'i') || (c == 'I'))
3119 if (aoverwrite == ABORT) {
3120 fprintf(STDERR, "Volume exists; Aborting restore command\n");
3122 } else if (aoverwrite == FULL) {
3123 restoreflags = RV_FULLRST;
3125 "Volume exists; Will delete and perform full restore\n");
3126 } else if (aoverwrite == INC) {
3128 if (vol_elsewhere) {
3130 "%s volume %lu already exists on a different server/part; not allowed\n",
3131 readonly ? "RO" : "RW", (unsigned long)avolid);
3137 restoreflags |= RV_OFFLINE;
3139 restoreflags |= RV_RDONLY;
3141 switch (acreation) {
3143 restoreflags |= RV_CRDUMP;
3146 restoreflags |= RV_CRKEEP;
3149 restoreflags |= RV_CRNEW;
3152 if (aoverwrite == FULL)
3153 restoreflags |= RV_CRNEW;
3155 restoreflags |= RV_CRKEEP;
3158 switch (alastupdate) {
3160 restoreflags |= RV_LUDUMP;
3163 restoreflags |= RV_LUKEEP;
3166 restoreflags |= RV_LUNEW;
3169 restoreflags |= RV_LUDUMP;
3171 if (as->parms[10].items) {
3172 restoreflags |= RV_NODEL;
3177 UV_RestoreVolume2(aserver, apart, avolid, aparentid,
3178 avolname, restoreflags, WriteData, afilename);
3180 PrintDiagnostics("restore", code);
3183 MapPartIdIntoName(apart, apartName);
3186 * patch typo here - originally "parms[1]", should be "parms[0]"
3189 fprintf(STDOUT, "Restored volume %s on %s %s\n", avolname,
3190 as->parms[0].items->data, apartName);
3195 LockReleaseCmd(register struct cmd_syndesc *as, void *arock)
3198 afs_int32 code, err;
3200 avolid = vsu_GetVolumeID(as->parms[0].items->data, cstruct, &err);
3203 PrintError("", err);
3205 fprintf(STDERR, "vos: can't find volume '%s'\n",
3206 as->parms[0].items->data);
3210 code = UV_LockRelease(avolid);
3212 PrintDiagnostics("unlock", code);
3215 fprintf(STDOUT, "Released lock on vldb entry for volume %s\n",
3216 as->parms[0].items->data);
3221 AddSite(register struct cmd_syndesc *as, void *arock)
3224 afs_int32 aserver, apart, code, err, valid = 0;
3225 char apartName[10], avolname[VOLSER_MAXVOLNAME + 1];
3227 vsu_ExtractName(avolname, as->parms[2].items->data);;
3228 avolid = vsu_GetVolumeID(avolname, cstruct, &err);
3231 PrintError("", err);
3233 fprintf(STDERR, "vos: can't find volume '%s'\n",
3234 as->parms[2].items->data);
3237 aserver = GetServer(as->parms[0].items->data);
3239 fprintf(STDERR, "vos: server '%s' not found in host table\n",
3240 as->parms[0].items->data);
3243 apart = volutil_GetPartitionID(as->parms[1].items->data);
3245 fprintf(STDERR, "vos: could not interpret partition name '%s'\n",
3246 as->parms[1].items->data);
3249 if (!IsPartValid(apart, aserver, &code)) { /*check for validity of the partition */
3251 PrintError("", code);
3254 "vos : partition %s does not exist on the server\n",
3255 as->parms[1].items->data);
3258 if (as->parms[3].items) {
3261 code = UV_AddSite(aserver, apart, avolid, valid);
3263 PrintDiagnostics("addsite", code);
3266 MapPartIdIntoName(apart, apartName);
3267 fprintf(STDOUT, "Added replication site %s %s for volume %s\n",
3268 as->parms[0].items->data, apartName, as->parms[2].items->data);
3273 RemoveSite(register struct cmd_syndesc *as, void *arock)
3277 afs_int32 aserver, apart, code, err;
3278 char apartName[10], avolname[VOLSER_MAXVOLNAME + 1];
3280 vsu_ExtractName(avolname, as->parms[2].items->data);
3281 avolid = vsu_GetVolumeID(avolname, cstruct, &err);
3284 PrintError("", err);
3286 fprintf(STDERR, "vos: can't find volume '%s'\n",
3287 as->parms[2].items->data);
3290 aserver = GetServer(as->parms[0].items->data);
3292 fprintf(STDERR, "vos: server '%s' not found in host table\n",
3293 as->parms[0].items->data);
3296 apart = volutil_GetPartitionID(as->parms[1].items->data);
3298 fprintf(STDERR, "vos: could not interpret partition name '%s'\n",
3299 as->parms[1].items->data);
3303 *skip the partition validity check, since it is possible that the partition
3304 *has since been decomissioned.
3307 if (!IsPartValid(apart,aserver,&code)){
3308 if(code) PrintError("",code);
3309 else fprintf(STDERR,"vos : partition %s does not exist on the server\n",as->parms[1].items->data);
3313 code = UV_RemoveSite(aserver, apart, avolid);
3315 PrintDiagnostics("remsite", code);
3318 MapPartIdIntoName(apart, apartName);
3319 fprintf(STDOUT, "Removed replication site %s %s for volume %s\n",
3320 as->parms[0].items->data, apartName, as->parms[2].items->data);
3325 ChangeLocation(register struct cmd_syndesc *as, void *arock)
3328 afs_int32 aserver, apart, code, err;
3331 avolid = vsu_GetVolumeID(as->parms[2].items->data, cstruct, &err);
3334 PrintError("", err);
3336 fprintf(STDERR, "vos: can't find volume '%s'\n",
3337 as->parms[2].items->data);
3340 aserver = GetServer(as->parms[0].items->data);
3342 fprintf(STDERR, "vos: server '%s' not found in host table\n",
3343 as->parms[0].items->data);
3346 apart = volutil_GetPartitionID(as->parms[1].items->data);
3348 fprintf(STDERR, "vos: could not interpret partition name '%s'\n",
3349 as->parms[1].items->data);
3352 if (!IsPartValid(apart, aserver, &code)) { /*check for validity of the partition */
3354 PrintError("", code);
3357 "vos : partition %s does not exist on the server\n",
3358 as->parms[1].items->data);
3361 code = UV_ChangeLocation(aserver, apart, avolid);
3363 PrintDiagnostics("addsite", code);
3366 MapPartIdIntoName(apart, apartName);
3367 fprintf(STDOUT, "Changed location to %s %s for volume %s\n",
3368 as->parms[0].items->data, apartName, as->parms[2].items->data);
3373 ListPartitions(register struct cmd_syndesc *as, void *arock)
3375 afs_int32 aserver, code;
3376 struct partList dummyPartList;
3381 aserver = GetServer(as->parms[0].items->data);
3383 fprintf(STDERR, "vos: server '%s' not found in host table\n",
3384 as->parms[0].items->data);
3389 code = UV_ListPartitions(aserver, &dummyPartList, &cnt);
3391 PrintDiagnostics("listpart", code);
3395 fprintf(STDOUT, "The partitions on the server are:\n");
3396 for (i = 0; i < cnt; i++) {
3397 if (dummyPartList.partFlags[i] & PARTVALID) {
3398 memset(pname, 0, sizeof(pname));
3399 MapPartIdIntoName(dummyPartList.partId[i], pname);
3400 fprintf(STDOUT, " %10s ", pname);
3402 if ((i % 5) == 0 && (i != 0))
3403 fprintf(STDOUT, "\n");
3406 fprintf(STDOUT, "\n");
3407 fprintf(STDOUT, "Total: %d\n", total);
3413 CompareVolName(const void *p1, const void *p2)
3415 volintInfo *arg1, *arg2;
3417 arg1 = (volintInfo *) p1;
3418 arg2 = (volintInfo *) p2;
3419 return (strcmp(arg1->name, arg2->name));
3423 /*------------------------------------------------------------------------
3424 * PRIVATE XCompareVolName
3427 * Comparison routine for volume names coming from an extended
3431 * a_obj1P : Char ptr to first extended vol info object
3432 * a_obj1P : Char ptr to second extended vol info object
3435 * The value of strcmp() on the volume names within the passed
3436 * objects (i,e., -1, 0, or 1).
3439 * Passed to qsort() as the designated comparison routine.
3443 *------------------------------------------------------------------------*/
3446 XCompareVolName(const void *a_obj1P, const void *a_obj2P)
3447 { /*XCompareVolName */
3450 (((struct volintXInfo *)(a_obj1P))->name,
3451 ((struct volintXInfo *)(a_obj2P))->name));
3453 } /*XCompareVolName */
3456 CompareVolID(const void *p1, const void *p2)
3458 volintInfo *arg1, *arg2;
3460 arg1 = (volintInfo *) p1;
3461 arg2 = (volintInfo *) p2;
3462 if (arg1->volid == arg2->volid)
3464 if (arg1->volid > arg2->volid)
3471 /*------------------------------------------------------------------------
3472 * PRIVATE XCompareVolID
3475 * Comparison routine for volume IDs coming from an extended
3479 * a_obj1P : Char ptr to first extended vol info object
3480 * a_obj1P : Char ptr to second extended vol info object
3483 * The value of strcmp() on the volume names within the passed
3484 * objects (i,e., -1, 0, or 1).
3487 * Passed to qsort() as the designated comparison routine.
3491 *------------------------------------------------------------------------*/
3494 XCompareVolID(const void *a_obj1P, const void *a_obj2P)
3495 { /*XCompareVolID */
3497 afs_int32 id1, id2; /*Volume IDs we're comparing */
3499 id1 = ((struct volintXInfo *)(a_obj1P))->volid;
3500 id2 = ((struct volintXInfo *)(a_obj2P))->volid;
3508 } /*XCompareVolID */
3510 /*------------------------------------------------------------------------
3511 * PRIVATE ListVolumes
3514 * Routine used to list volumes, contacting the Volume Server
3515 * directly, bypassing the VLDB.
3518 * as : Ptr to parsed command line arguments.
3521 * 0 Successful operation
3524 * Nothing interesting.
3528 *------------------------------------------------------------------------*/
3531 ListVolumes(register struct cmd_syndesc *as, void *arock)
3533 afs_int32 apart, int32list, fast;
3534 afs_int32 aserver, code;
3536 volintInfo *oldpntr = NULL;
3540 volintXInfo *xInfoP;
3541 volintXInfo *origxInfoP = NULL; /*Ptr to current/orig extended vol info */
3542 int wantExtendedInfo; /*Do we want extended vol info? */
3545 struct partList dummyPartList;
3553 if (as->parms[3].items)
3555 if (as->parms[4].items)
3559 if (as->parms[2].items)
3565 if (as->parms[5].items) {
3567 * We can't coexist with the fast flag.
3571 "vos: Can't use the -fast and -extended flags together\n");
3576 * We need to turn on ``long'' listings to get the full effect.
3578 wantExtendedInfo = 1;
3581 wantExtendedInfo = 0;
3582 if (as->parms[1].items) {
3583 apart = volutil_GetPartitionID(as->parms[1].items->data);
3585 fprintf(STDERR, "vos: could not interpret partition name '%s'\n",
3586 as->parms[1].items->data);
3589 dummyPartList.partId[0] = apart;
3590 dummyPartList.partFlags[0] = PARTVALID;
3593 aserver = GetServer(as->parms[0].items->data);
3595 fprintf(STDERR, "vos: server '%s' not found in host table\n",
3596 as->parms[0].items->data);
3601 if (!IsPartValid(apart, aserver, &code)) { /*check for validity of the partition */
3603 PrintError("", code);
3606 "vos : partition %s does not exist on the server\n",
3607 as->parms[1].items->data);
3611 code = UV_ListPartitions(aserver, &dummyPartList, &cnt);
3613 PrintDiagnostics("listvol", code);
3617 for (i = 0; i < cnt; i++) {
3618 if (dummyPartList.partFlags[i] & PARTVALID) {
3619 if (wantExtendedInfo)
3621 UV_XListVolumes(aserver, dummyPartList.partId[i], all,
3625 UV_ListVolumes(aserver, dummyPartList.partId[i], all,
3628 PrintDiagnostics("listvol", code);
3633 if (wantExtendedInfo) {
3634 origxInfoP = xInfoP;
3635 base = (char *)xInfoP;
3638 base = (char *)pntr;
3642 if (wantExtendedInfo)
3643 qsort(base, count, sizeof(volintXInfo), XCompareVolName);
3645 qsort(base, count, sizeof(volintInfo), CompareVolName);
3647 if (wantExtendedInfo)
3648 qsort(base, count, sizeof(volintXInfo), XCompareVolID);
3650 qsort(base, count, sizeof(volintInfo), CompareVolID);
3652 MapPartIdIntoName(dummyPartList.partId[i], pname);
3655 "Total number of volumes on server %s partition %s: %lu \n",
3656 as->parms[0].items->data, pname,