4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
22 * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
26 #pragma ident "%Z%%M% %I% %E% SMI"
29 * Just in case we're not in a build environment, make sure that
30 * TEXT_DOMAIN gets set to something.
32 #if !defined(TEXT_DOMAIN)
33 #define TEXT_DOMAIN "SYS_TEST"
37 * print metedevice errors
41 #include <sys/lvm/md_mddb.h>
57 if (ep
->extra
!= NULL
)
59 (void) memset(ep
, '\0', sizeof (*ep
));
72 /* get name, or fake it */
73 if ((name
= get_mdname(NULL
, mnum
)) == NULL
) {
76 (void) sprintf(buf
, "%lu/%lu", MD_MIN2SET(mnum
),
80 return (Strdup(name
));
91 /* get name or fake it */
93 return (Strdup(dgettext(TEXT_DOMAIN
, "unknown device")));
94 if ((name
= get_devname(setno
, dev
)) == NULL
) {
97 (void) sprintf(buf
, "%lu.%lu", meta_getmajor(dev
),
101 return (Strdup(name
));
111 if ((name
= get_hspname(NULL
, hsp
)) == NULL
) {
114 (void) sprintf(buf
, "%u/%u", HSP_SET(hsp
), HSP_ID(hsp
));
115 return (Strdup(buf
));
117 return (Strdup(name
));
126 md_error_t xep
= mdnullerror
;
128 if (setno
== MD_SET_BAD
)
131 if ((sp
= metasetnosetname(setno
, &xep
)) == NULL
) {
135 (void) sprintf(buf
, "setno %u", setno
);
136 return (Strdup(buf
));
138 return (Strdup(sp
->setname
));
142 * fill in all the appropriate md_error_t fields
146 md_error_t
*ep
, /* generic error */
147 char *name
/* optional name or host */
151 if (ep
->host
!= NULL
) {
155 if ((ep
->info
.errclass
== MDEC_RPC
) &&
156 (name
!= NULL
) && (*name
!= '\0')) {
157 ep
->host
= Strdup(name
);
160 ep
->host
= Strdup(mynode());
162 /* get appropriate name */
163 if (ep
->name
!= NULL
) {
167 if ((name
!= NULL
) && (*name
!= '\0')) {
168 ep
->name
= Strdup(name
);
170 switch (ep
->info
.errclass
) {
172 /* can't do anything about these */
183 &ep
->info
.md_error_info_t_u
.dev_error
;
185 ep
->name
= dev_name(MD_SET_BAD
, ip
->dev
);
193 &ep
->info
.md_error_info_t_u
.use_error
;
195 ep
->name
= dev_name(MD_SET_BAD
, ip
->dev
);
196 if (ip
->where
== NULL
) {
197 ip
->where
= Strdup(dgettext(TEXT_DOMAIN
,
203 /* metadevice name */
207 &ep
->info
.md_error_info_t_u
.md_error
;
209 ep
->name
= md_name(ip
->mnum
);
216 md_comp_error_t
*ip
=
217 &ep
->info
.md_error_info_t_u
.comp_error
;
218 char *mdname
, *devname
;
221 mdname
= md_name(ip
->comp
.mnum
);
222 devname
= dev_name(MD_MIN2SET(ip
->comp
.mnum
),
224 len
= strlen(mdname
) + strlen(": ")
225 + strlen(devname
) + 1;
226 ep
->name
= Malloc(len
);
227 (void) snprintf(ep
->name
, len
, "%s: %s",
234 /* hotspare pool name */
238 &ep
->info
.md_error_info_t_u
.hsp_error
;
240 ep
->name
= hsp_name(ip
->hsp
);
248 &ep
->info
.md_error_info_t_u
.hs_error
;
249 char *hspname
, *devname
;
252 hspname
= hsp_name(ip
->hs
.hsp
);
253 devname
= dev_name(HSP_SET(ip
->hs
.hsp
), ip
->hs
.dev
);
254 len
= strlen(hspname
) + strlen(": ")
255 + strlen(devname
) + 1;
256 ep
->name
= Malloc(len
);
257 (void) snprintf(ep
->name
, len
, "%s: %s",
267 md_mddb_error_t
*ip
=
268 &ep
->info
.md_error_info_t_u
.mddb_error
;
269 if (ip
->mnum
!= NODEV32
)
270 ep
->name
= md_name(ip
->mnum
);
271 ep
->name
= set_name(ip
->setno
);
279 &ep
->info
.md_error_info_t_u
.ds_error
;
281 ep
->name
= set_name(ip
->setno
);
294 md_void_errno_t errnum
,
298 md_void_error_t
*ip
= &ep
->info
.md_error_info_t_u
.void_error
;
301 ep
->info
.errclass
= MDEC_VOID
;
304 metacookerror(ep
, name
);
318 md_sys_error_t
*ip
= &ep
->info
.md_error_info_t_u
.sys_error
;
322 ep
->info
.errclass
= MDEC_SYS
;
326 metacookerror(ep
, name
);
341 md_rpc_error_t
*ip
= &ep
->info
.md_error_info_t_u
.rpc_error
;
342 struct rpc_err rpcerr
;
345 clnt_geterr(clntp
, &rpcerr
);
346 ep
->info
.errclass
= MDEC_RPC
;
347 ip
->errnum
= rpcerr
.re_status
;
349 metacookerror(ep
, host
);
350 mderrorextra(ep
, extra
);
364 md_rpc_error_t
*ip
= &ep
->info
.md_error_info_t_u
.rpc_error
;
367 ep
->info
.errclass
= MDEC_RPC
;
368 ip
->errnum
= rpc_createerr
.cf_stat
;
370 metacookerror(ep
, host
);
371 mderrorextra(ep
, extra
);
381 md_dev_errno_t errnum
,
386 md_dev_error_t
*ip
= &ep
->info
.md_error_info_t_u
.dev_error
;
389 ep
->info
.errclass
= MDEC_DEV
;
393 metacookerror(ep
, name
);
403 md_use_errno_t errnum
,
409 md_use_error_t
*ip
= &ep
->info
.md_error_info_t_u
.use_error
;
411 assert(where
!= NULL
);
413 ep
->info
.errclass
= MDEC_USE
;
416 ip
->where
= Strdup(where
);
418 metacookerror(ep
, name
);
428 md_overlap_errno_t errnum
,
434 md_overlap_error_t
*ip
=
435 &ep
->info
.md_error_info_t_u
.overlap_error
;
437 assert(overlap
!= NULL
);
439 ep
->info
.errclass
= MDEC_OVERLAP
;
441 ip
->overlap
= Strdup(overlap
);
444 ip
->where
= Strdup(where
);
446 metacookerror(ep
, name
);
456 md_md_errno_t errnum
,
461 md_md_error_t
*ip
= &ep
->info
.md_error_info_t_u
.md_error
;
464 ep
->info
.errclass
= MDEC_MD
;
468 metacookerror(ep
, name
);
478 md_comp_errno_t errnum
,
484 md_comp_error_t
*ip
= &ep
->info
.md_error_info_t_u
.comp_error
;
487 ep
->info
.errclass
= MDEC_COMP
;
489 ip
->comp
.mnum
= mnum
;
492 metacookerror(ep
, name
);
497 * hotspare pool error
502 md_hsp_errno_t errnum
,
507 md_hsp_error_t
*ip
= &ep
->info
.md_error_info_t_u
.hsp_error
;
510 ep
->info
.errclass
= MDEC_HSP
;
514 metacookerror(ep
, name
);
524 md_hs_errno_t errnum
,
530 md_hs_error_t
*ip
= &ep
->info
.md_error_info_t_u
.hs_error
;
533 ep
->info
.errclass
= MDEC_HS
;
538 metacookerror(ep
, name
);
548 md_mddb_errno_t errnum
,
555 md_mddb_error_t
*ip
= &ep
->info
.md_error_info_t_u
.mddb_error
;
558 ep
->info
.errclass
= MDEC_MDDB
;
564 metacookerror(ep
, name
);
569 * metadevice diskset (ds) error
574 md_ds_errno_t errnum
,
581 md_ds_error_t
*ip
= &ep
->info
.md_error_info_t_u
.ds_error
;
584 ep
->info
.errclass
= MDEC_DS
;
587 ip
->node
= ((node
!= NULL
) ? Strdup(node
) : NULL
);
588 ip
->drive
= ((drive
!= NULL
) ? Strdup(drive
) : NULL
);
590 metacookerror(ep
, name
);
595 * clear/attach extra context information
603 if (ep
->extra
!= NULL
)
606 ep
->extra
= Strdup(extra
);
612 * steal (copy) an error code safely
622 (void) memset(from
, '\0', sizeof (*from
));
627 * do an ioctl, cook the error, and return status
639 /* open admin device */
640 if ((fd
= open_admin(ep
)) < 0)
645 if (ioctl(fd
, cmd
, data
) != 0) {
646 return (mdsyserror(ep
, errno
, name
));
647 } else if (! mdisok(ep
)) {
648 metacookerror(ep
, name
);
657 * print void class errors
666 md_void_error_t
*ip
= &ep
->info
.md_error_info_t_u
.void_error
;
667 char *p
= buf
+ strlen(buf
);
668 size_t psize
= size
- strlen(buf
);
670 switch (ip
->errnum
) {
672 (void) snprintf(p
, psize
,
673 dgettext(TEXT_DOMAIN
, "no error"));
675 case MDE_UNIT_NOT_FOUND
:
676 (void) snprintf(p
, psize
,
677 dgettext(TEXT_DOMAIN
, "unit not found"));
680 (void) snprintf(p
, psize
,
681 dgettext(TEXT_DOMAIN
, "drive specified more than once"));
684 (void) snprintf(p
, psize
,
685 dgettext(TEXT_DOMAIN
, "illegal hot spare operation"));
688 (void) snprintf(p
, psize
,
689 dgettext(TEXT_DOMAIN
, "no such set"));
692 (void) snprintf(p
, psize
,
693 dgettext(TEXT_DOMAIN
, "set name is inconsistent"));
696 (void) snprintf(p
, psize
,
697 dgettext(TEXT_DOMAIN
, "invalid read option"));
700 (void) snprintf(p
, psize
,
701 dgettext(TEXT_DOMAIN
, "invalid write option"));
703 case MDE_BAD_PASS_NUM
:
704 (void) snprintf(p
, psize
,
705 dgettext(TEXT_DOMAIN
, "invalid pass number"));
707 case MDE_BAD_RESYNC_OPT
:
708 (void) snprintf(p
, psize
,
709 dgettext(TEXT_DOMAIN
, "invalid resync option"));
711 case MDE_BAD_INTERLACE
:
712 (void) snprintf(p
, psize
,
713 dgettext(TEXT_DOMAIN
, "invalid interlace"));
716 (void) snprintf(p
, psize
,
717 dgettext(TEXT_DOMAIN
, "no hotspare pools found"));
719 case MDE_NOTENOUGH_DB
:
720 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
721 "must have at least 1 database (-f overrides)"));
723 case MDE_DELDB_NOTALLOWED
:
724 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
725 "cannot delete the last database replica in the diskset"));
727 case MDE_DEL_VALIDDB_NOTALLOWED
:
728 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
729 "Deleting specified valid replicas results in stale "
730 "state database. Configuration changes with stale "
731 "database result in panic(-f overrides)"));
733 case MDE_SYSTEM_FILE
:
734 (void) snprintf(p
, psize
,
735 dgettext(TEXT_DOMAIN
, "error in system file"));
738 (void) snprintf(p
, psize
,
739 dgettext(TEXT_DOMAIN
, "error in mddb.cf file"));
742 (void) snprintf(p
, psize
,
743 dgettext(TEXT_DOMAIN
, "checksum error in mddb.cf file"));
745 case MDE_VFSTAB_FILE
:
746 (void) snprintf(p
, psize
,
747 dgettext(TEXT_DOMAIN
, "error in vfstab file"));
750 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
751 "invalid slice number for drive name"));
754 (void) snprintf(p
, psize
,
755 dgettext(TEXT_DOMAIN
, "syntax error"));
758 (void) snprintf(p
, psize
,
759 dgettext(TEXT_DOMAIN
, "illegal option"));
762 (void) snprintf(p
, psize
,
763 dgettext(TEXT_DOMAIN
, "failed to reserve any drives"));
765 case MDE_NOT_DRIVENAME
:
766 (void) snprintf(p
, psize
,
767 dgettext(TEXT_DOMAIN
, "not a valid drive name"));
770 (void) snprintf(p
, psize
,
771 dgettext(TEXT_DOMAIN
, "reserved by another host"));
774 (void) snprintf(p
, psize
,
775 dgettext(TEXT_DOMAIN
, "driver version mismatch"));
778 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
779 "metadevice state database version mismatch"));
782 (void) snprintf(p
, psize
,
783 dgettext(TEXT_DOMAIN
, "TEST ERROR MESSAGE"));
785 case MDE_BAD_ORIG_NCOL
:
786 (void) snprintf(p
, psize
,
787 dgettext(TEXT_DOMAIN
, "invalid column count"));
789 case MDE_RAID_INVALID
:
790 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
791 "devices were not RAIDed previously or "
792 "are specified in the wrong order"));
797 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
798 "too many mediator hosts requested"));
801 (void) snprintf(p
, psize
,
802 dgettext(TEXT_DOMAIN
, "no mediator hosts found"));
804 case MDE_ONLYNODENAME
:
805 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
806 "only the nodename of a host is required for deletes"));
808 case MDE_RAID_BAD_PW_CNT
:
809 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
810 "simultaneous writes out of range"));
812 case MDE_DEVID_TOOBIG
:
813 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
814 "relocation information size is greater than reported"));
817 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
818 "Permission denied. You must have root privilege "
819 "to execute this command."));
822 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
823 "Device relocation information not available "
827 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
828 "no root filesystem in /etc/mnttab"));
831 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
835 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
836 "option only valid within a multi-owner set"));
839 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
840 "Invalid command for mirror with ABR set"));
843 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
844 "Invalid operation on multi-owner set"));
846 case MDE_MNSET_NOTRANS
:
847 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
848 "Trans metadevice not supported on multi-owner set"));
850 case MDE_MNSET_NORAID
:
851 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
852 "RAID-5 metadevice not supported on multi-owner set"));
854 case MDE_FORCE_DEL_ALL_DRV
:
855 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
856 "Must specify -f option to delete all drives from set"));
858 case MDE_STRIPE_TRUNC_SINGLE
:
859 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
860 "The necessary rounding would result in data loss. "
861 "You can avoid this by concatenating additional devices "
862 "totaling at least %s blocks, or by increasing the size "
863 "of the specified component by exactly %s blocks."),
864 ep
->extra
, ep
->extra
);
866 case MDE_STRIPE_TRUNC_MULTIPLE
:
867 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
868 "The necessary rounding would result in data loss. "
869 "You can avoid this by concatenating additional devices "
870 "totaling at least %s blocks."), ep
->extra
);
873 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
874 "failed to enable/disable SVM service"));
876 case MDE_SMF_NO_SERVICE
:
877 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
878 "service(s) not online in SMF"));
880 case MDE_AMBIGUOUS_DEV
:
881 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
882 "Specify complete path to avoid ambiguity."));
884 case MDE_NAME_IN_USE
:
885 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
886 "Name already in use for metadevice or hot spare pool."));
888 case MDE_NAME_ILLEGAL
:
889 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
890 "Invalid name for metadevice or hot spare pool."));
893 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
894 "Volume administration unavailable within non-global zones."));
896 case MDE_MISSING_DEVID_DISK
:
897 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
898 "device id does not exist."));
901 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
902 "unknown void error code %d"), ip
->errnum
);
910 * print sys class errors
919 md_sys_error_t
*ip
= &ep
->info
.md_error_info_t_u
.sys_error
;
921 char *p
= buf
+ strlen(buf
);
922 size_t psize
= size
- strlen(buf
);
924 if ((emsg
= strerror(ip
->errnum
)) == NULL
) {
925 (void) snprintf(p
, psize
,
926 dgettext(TEXT_DOMAIN
, "unknown errno %d out of range"),
929 (void) snprintf(p
, psize
, "%s", emsg
);
936 * print RPC class errors
945 md_rpc_error_t
*ip
= &ep
->info
.md_error_info_t_u
.rpc_error
;
946 char *p
= buf
+ strlen(buf
);
947 size_t psize
= size
- strlen(buf
);
949 (void) snprintf(p
, psize
, "%s", clnt_sperrno(ip
->errnum
));
954 * print dev class errors
963 md_dev_error_t
*ip
= &ep
->info
.md_error_info_t_u
.dev_error
;
964 char *p
= buf
+ strlen(buf
);
965 size_t psize
= size
- strlen(buf
);
967 switch (ip
->errnum
) {
969 (void) snprintf(p
, psize
,
970 dgettext(TEXT_DOMAIN
, "hotspare doesn't exist"));
972 case MDE_FIX_INVAL_STATE
:
973 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
974 "cannot enable hotspared device"));
976 case MDE_FIX_INVAL_HS_STATE
:
977 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
978 "hotspare isn't broken, can't enable"));
981 (void) snprintf(p
, psize
,
982 dgettext(TEXT_DOMAIN
, "not a metadevice"));
985 (void) snprintf(p
, psize
,
986 dgettext(TEXT_DOMAIN
, "is a dump device"));
989 (void) snprintf(p
, psize
,
990 dgettext(TEXT_DOMAIN
, "is a metadevice"));
993 (void) snprintf(p
, psize
,
994 dgettext(TEXT_DOMAIN
, "is swapped on"));
997 (void) snprintf(p
, psize
,
998 dgettext(TEXT_DOMAIN
, "namespace error"));
1000 case MDE_IN_SHARED_SET
:
1001 (void) snprintf(p
, psize
,
1002 dgettext(TEXT_DOMAIN
, "device in shared set"));
1004 case MDE_NOT_IN_SET
:
1005 (void) snprintf(p
, psize
,
1006 dgettext(TEXT_DOMAIN
, "device not in set"));
1009 (void) snprintf(p
, psize
,
1010 dgettext(TEXT_DOMAIN
, "not a disk device"));
1012 case MDE_CANT_CONFIRM
:
1013 (void) snprintf(p
, psize
,
1014 dgettext(TEXT_DOMAIN
, "can't confirm device"));
1016 case MDE_INVALID_PART
:
1017 (void) snprintf(p
, psize
,
1018 dgettext(TEXT_DOMAIN
, "invalid partition"));
1021 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
1022 "has a metadevice database replica"));
1025 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
1026 "no metadevice database replica on device"));
1028 case MDE_CANTVERIFY_VTOC
:
1029 (void) snprintf(p
, psize
,
1030 dgettext(TEXT_DOMAIN
, "unable to verify the vtoc"));
1033 (void) snprintf(p
, psize
,
1034 dgettext(TEXT_DOMAIN
, "not in local set"));
1036 case MDE_DEVICES_NAME
:
1037 (void) snprintf(p
, psize
,
1038 dgettext(TEXT_DOMAIN
, "can't parse /devices name"));
1040 case MDE_REPCOMP_INVAL
:
1041 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
1042 "replica slice is not usable as a metadevice component"));
1044 case MDE_REPCOMP_ONLY
:
1045 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
1046 "only replica slice is usable for a diskset "
1047 "database replica"));
1050 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
1051 "invalid root device for this operation"));
1054 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
1055 "multiple entries for device in Solaris Volume Manager "
1058 case MDE_TOO_MANY_PARTS
:
1059 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
1060 "Disks with more than %d partitions are not supported "
1061 "in Solaris Volume Manager"), MD_MAX_PARTS
);
1063 case MDE_REPART_REPLICA
:
1064 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
1065 "cannot repartition a slice with an existing replica"));
1067 case MDE_DISKNAMETOOLONG
:
1068 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
1069 "disk name is too long with device ids disabled "
1070 "in Solaris Volume Manager. Check /kernel/drv/md.conf "
1071 "for md_devid_destroy, remove it and reboot"));
1074 (void) snprintf(p
, psize
,
1075 dgettext(TEXT_DOMAIN
, "unknown dev error code %d"),
1084 * print overlap class errors
1093 md_overlap_error_t
*ip
=
1094 &ep
->info
.md_error_info_t_u
.overlap_error
;
1095 char *p
= buf
+ strlen(buf
);
1096 size_t psize
= size
- strlen(buf
);
1098 switch (ip
->errnum
) {
1099 case MDE_OVERLAP_MOUNTED
:
1100 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
1101 "overlaps with %s which is mounted as \'%s\'"),
1102 ip
->overlap
, ip
->where
);
1104 case MDE_OVERLAP_SWAP
:
1105 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
1106 "overlaps with %s which is a swap device"), ip
->overlap
);
1108 case MDE_OVERLAP_DUMP
:
1109 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
1110 "overlaps with %s which is the dump device"), ip
->overlap
);
1113 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
1114 "unknown overlap error code %d"), ip
->errnum
);
1122 * print use class errors
1131 md_use_error_t
*ip
= &ep
->info
.md_error_info_t_u
.use_error
;
1132 char *p
= buf
+ strlen(buf
);
1133 size_t psize
= size
- strlen(buf
);
1135 switch (ip
->errnum
) {
1136 case MDE_IS_MOUNTED
:
1137 (void) snprintf(p
, psize
,
1138 dgettext(TEXT_DOMAIN
, "is mounted on %s"),
1143 * when the object of the error (existing device that
1144 * would being used by SVM) is the metadb then it is necessary
1145 * to explicitly specify the string in the error message so
1146 * that it can be successfully localized for the Asian locales.
1148 if (strcmp(ip
->where
, MDB_STR
) != 0) {
1149 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
1150 "has appeared more than once in the "
1151 "specification of %s"), ip
->where
);
1153 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
1154 "has appeared more than once in the "
1155 "specification of " MDB_STR
));
1160 * when the object of the error (existing device that
1161 * would overlap) is the metadb then it is necessary
1162 * to explicitly specify the string in the error message so
1163 * that it can be successfully localized for the Asian locales.
1165 if (strcmp(ip
->where
, MDB_STR
) != 0) {
1166 (void) snprintf(p
, psize
,
1167 dgettext(TEXT_DOMAIN
, "overlaps with device in %s"),
1170 (void) snprintf(p
, psize
,
1171 dgettext(TEXT_DOMAIN
, "overlaps with device in "
1175 case MDE_SAME_DEVID
:
1177 * when the object of the error (existing device in the
1178 * metaconfiguration that has the same devid)
1179 * is the metadb then it is necessary
1180 * to explicitly specify the string in the error message so
1181 * that it can be successfully localized for the Asian locales.
1183 if (strcmp(ip
->where
, MDB_STR
) != 0) {
1184 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
1185 "identical devid detected on %s"), ip
->where
);
1187 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
1188 "identical devid detected in " MDB_STR
));
1192 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
1193 "unknown dev error code %d"), ip
->errnum
);
1201 * print md class errors
1210 md_md_error_t
*ip
= &ep
->info
.md_error_info_t_u
.md_error
;
1211 char *p
= buf
+ strlen(buf
);
1212 size_t psize
= size
- strlen(buf
);
1214 switch (ip
->errnum
) {
1215 case MDE_INVAL_UNIT
:
1216 (void) snprintf(p
, psize
,
1217 dgettext(TEXT_DOMAIN
, "invalid unit"));
1219 case MDE_UNIT_NOT_SETUP
:
1220 (void) snprintf(p
, psize
,
1221 dgettext(TEXT_DOMAIN
, "unit not set up"));
1223 case MDE_UNIT_ALREADY_SETUP
:
1224 (void) snprintf(p
, psize
,
1225 dgettext(TEXT_DOMAIN
, "unit already set up"));
1228 (void) snprintf(p
, psize
,
1229 dgettext(TEXT_DOMAIN
, "unit is not a mirror"));
1232 (void) snprintf(p
, psize
,
1233 dgettext(TEXT_DOMAIN
, "illegal to clear submirror"));
1236 (void) snprintf(p
, psize
,
1237 dgettext(TEXT_DOMAIN
, "metadevice is open"));
1239 case MDE_C_WITH_INVAL_SM
:
1240 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
1241 "attempted to clear mirror with submirror(s) "
1242 "in invalid state"));
1244 case MDE_RESYNC_ACTIVE
:
1245 (void) snprintf(p
, psize
,
1246 dgettext(TEXT_DOMAIN
, "resync in progress"));
1248 case MDE_LAST_SM_RE
:
1249 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
1250 "attempt to replace a component on the last "
1251 "running submirror"));
1253 case MDE_MIRROR_FULL
:
1254 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
1255 "mirror has maximum number of submirrors"));
1257 case MDE_IN_UNAVAIL_STATE
:
1258 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
1259 "component is in unavailable state; run 'metastat -i'"));
1262 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
1263 "metadevice in use"));
1265 case MDE_SM_TOO_SMALL
:
1266 (void) snprintf(p
, psize
,
1267 dgettext(TEXT_DOMAIN
, "submirror too small to attach"));
1269 case MDE_NO_LABELED_SM
:
1270 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
1271 "can't attach labeled submirror to an unlabeled mirror"));
1273 case MDE_SM_OPEN_ERR
:
1274 (void) snprintf(p
, psize
,
1275 dgettext(TEXT_DOMAIN
, "submirror open error"));
1277 case MDE_CANT_FIND_SM
:
1278 (void) snprintf(p
, psize
,
1279 dgettext(TEXT_DOMAIN
, "can't find submirror in mirror"));
1282 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
1283 "attempt to detach last running submirror"));
1285 case MDE_NO_READABLE_SM
:
1286 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
1287 "operation would result in no readable submirrors"));
1289 case MDE_SM_FAILED_COMPS
:
1290 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
1291 "attempt an operation on a submirror "
1292 "that has erred components"));
1294 case MDE_ILLEGAL_SM_STATE
:
1295 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
1296 "attempt operation on a submirror in illegal state"));
1298 case MDE_RR_ALLOC_ERROR
:
1299 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
1300 "attach failed, unable to allocate new resync info"));
1302 case MDE_MIRROR_OPEN_FAILURE
:
1303 (void) snprintf(p
, psize
,
1304 dgettext(TEXT_DOMAIN
, "insufficient devices to open"));
1306 case MDE_MIRROR_THREAD_FAILURE
:
1307 (void) snprintf(p
, psize
,
1308 dgettext(TEXT_DOMAIN
, "mirror thread failure"));
1310 case MDE_GROW_DELAYED
:
1311 (void) snprintf(p
, psize
,
1312 dgettext(TEXT_DOMAIN
, "growing of metadevice delayed"));
1315 (void) snprintf(p
, psize
,
1316 dgettext(TEXT_DOMAIN
, "unit is not a trans"));
1319 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
1320 "can't modify hot spare pool, hot spare in use"));
1323 (void) snprintf(p
, psize
,
1324 dgettext(TEXT_DOMAIN
, "already has log"));
1326 case MDE_UNKNOWN_TYPE
:
1327 (void) snprintf(p
, psize
,
1328 dgettext(TEXT_DOMAIN
, "unknown metadevice type"));
1330 case MDE_NOT_STRIPE
:
1331 (void) snprintf(p
, psize
,
1332 dgettext(TEXT_DOMAIN
, "unit is not a concat/stripe"));
1335 (void) snprintf(p
, psize
,
1336 dgettext(TEXT_DOMAIN
, "unit is not a RAID"));
1339 (void) snprintf(p
, psize
,
1340 dgettext(TEXT_DOMAIN
, "not enough stripes specified"));
1343 (void) snprintf(p
, psize
,
1344 dgettext(TEXT_DOMAIN
, "not enough components specified"));
1347 (void) snprintf(p
, psize
,
1348 dgettext(TEXT_DOMAIN
, "not enough submirrors specified"));
1350 case MDE_BAD_STRIPE
:
1351 (void) snprintf(p
, psize
,
1352 dgettext(TEXT_DOMAIN
, "invalid stripe configuration"));
1354 case MDE_BAD_MIRROR
:
1355 (void) snprintf(p
, psize
,
1356 dgettext(TEXT_DOMAIN
, "invalid mirror configuration"));
1359 (void) snprintf(p
, psize
,
1360 dgettext(TEXT_DOMAIN
, "invalid trans configuration"));
1363 (void) snprintf(p
, psize
,
1364 dgettext(TEXT_DOMAIN
, "invalid RAID configuration"));
1366 case MDE_RAID_OPEN_FAILURE
:
1367 (void) snprintf(p
, psize
,
1368 dgettext(TEXT_DOMAIN
, "resync unable to open RAID unit"));
1370 case MDE_RAID_THREAD_FAILURE
:
1371 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
1372 "attempt to start resync thread failed"));
1374 case MDE_RAID_NEED_FORCE
:
1375 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
1376 "operation requires -f (force) flag"));
1379 (void) snprintf(p
, psize
,
1380 dgettext(TEXT_DOMAIN
, "log has already been detached"));
1383 (void) snprintf(p
, psize
,
1384 dgettext(TEXT_DOMAIN
, "only valid action is metaclear"));
1386 case MDE_RAID_LAST_ERRED
:
1387 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
1388 "in Last Erred state, "
1389 "errored components must be replaced"));
1391 case MDE_RAID_NOT_OKAY
:
1392 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
1393 "all components must be Okay to perform this operation"));
1395 case MDE_RENAME_BUSY
:
1396 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
1397 "metadevice is temporarily too busy for renames"));
1399 case MDE_RENAME_SOURCE_BAD
:
1400 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
1401 "source metadevice is not able to be renamed"));
1403 case MDE_RENAME_TARGET_BAD
:
1404 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
1405 "target metadevice is not able to be renamed"));
1407 case MDE_RENAME_TARGET_UNRELATED
:
1408 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
1409 "target metadevice is not related to source metadevice"));
1411 case MDE_RENAME_CONFIG_ERROR
:
1412 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
1413 "metadevice driver configuration error; "
1414 "rename can't occur"));
1416 case MDE_RENAME_ORDER
:
1417 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
1418 "units may not be renamed in that order"));
1420 case MDE_RECOVER_FAILED
:
1421 (void) snprintf(p
, psize
,
1422 dgettext(TEXT_DOMAIN
, "recovery failed"));
1424 case MDE_SP_NOSPACE
:
1425 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
1426 "not enough space available for request"));
1428 case MDE_SP_BADWMREAD
:
1429 (void) snprintf(p
, psize
,
1430 dgettext(TEXT_DOMAIN
, "error reading extent header"));
1432 case MDE_SP_BADWMWRITE
:
1433 (void) snprintf(p
, psize
,
1434 dgettext(TEXT_DOMAIN
, "error writing extent header"));
1436 case MDE_SP_BADWMMAGIC
:
1437 (void) snprintf(p
, psize
,
1438 dgettext(TEXT_DOMAIN
, "bad magic number in extent header"));
1440 case MDE_SP_BADWMCRC
:
1441 (void) snprintf(p
, psize
,
1442 dgettext(TEXT_DOMAIN
, "bad checksum in extent header"));
1445 (void) snprintf(p
, psize
,
1446 dgettext(TEXT_DOMAIN
, "unit is not a soft partition"));
1448 case MDE_SP_OVERLAP
:
1449 (void) snprintf(p
, psize
,
1450 dgettext(TEXT_DOMAIN
, "overlapping extents specified"));
1452 case MDE_SP_BAD_LENGTH
:
1453 (void) snprintf(p
, psize
,
1454 dgettext(TEXT_DOMAIN
, "bad length specified"));
1457 (void) snprintf(p
, psize
,
1458 dgettext(TEXT_DOMAIN
, "no soft partitions on this device"));
1460 case MDE_UNIT_TOO_LARGE
:
1461 (void) snprintf(p
, psize
,
1462 dgettext(TEXT_DOMAIN
, "Volume size cannot exceed 1 TByte"));
1464 case MDE_LOG_TOO_LARGE
:
1465 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
1466 "Trans log size must be less than 1 TByte"));
1469 (void) snprintf(p
, psize
,
1470 dgettext(TEXT_DOMAIN
, "unknown md error code %d"),
1479 * print comp class errors
1488 md_comp_error_t
*ip
= &ep
->info
.md_error_info_t_u
.comp_error
;
1489 char *p
= buf
+ strlen(buf
);
1490 size_t psize
= size
- strlen(buf
);
1492 switch (ip
->errnum
) {
1493 case MDE_CANT_FIND_COMP
:
1494 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
1495 "can't find component in unit"));
1497 case MDE_REPL_INVAL_STATE
:
1498 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
1499 "component in invalid state to replace - "
1500 "Replace \"Maintenance\" components first"));
1502 case MDE_COMP_TOO_SMALL
:
1503 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
1504 "replace failure, new component is too small"));
1506 case MDE_COMP_OPEN_ERR
:
1507 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
1508 "unable to open concat/stripe component"));
1510 case MDE_RAID_COMP_ERRED
:
1511 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
1512 "must replace errored component first"));
1515 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
1516 "maxtransfer is too small"));
1518 case MDE_SP_COMP_OPEN_ERR
:
1519 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
1520 "error opening device under soft partition. Check"
1521 " device status, then use metadevadm(1M)."));
1524 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
1525 "unknown comp error code %d"), ip
->errnum
);
1533 * print hsp class errors
1542 md_hsp_error_t
*ip
= &ep
->info
.md_error_info_t_u
.hsp_error
;
1543 char *p
= buf
+ strlen(buf
);
1544 size_t psize
= size
- strlen(buf
);
1546 switch (ip
->errnum
) {
1547 case MDE_HSP_CREATE_FAILURE
:
1548 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
1549 "hotspare pool database create failure"));
1551 case MDE_HSP_IN_USE
:
1552 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
1553 "hotspare pool in use"));
1556 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
1557 "invalid hotspare pool"));
1560 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
1561 "hotspare pool is busy"));
1564 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
1565 "hotspare pool is referenced"));
1567 case MDE_HSP_ALREADY_SETUP
:
1568 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
1569 "hotspare pool is already setup"));
1572 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
1573 "invalid hotspare pool configuration"));
1575 case MDE_HSP_UNIT_TOO_LARGE
:
1576 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
1577 "units in the hotspare pool cannot exceed 1 TByte"));
1580 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
1581 "unknown hsp error code %d"), ip
->errnum
);
1589 * print hs class errors
1598 md_hs_error_t
*ip
= &ep
->info
.md_error_info_t_u
.hs_error
;
1599 char *p
= buf
+ strlen(buf
);
1600 size_t psize
= size
- strlen(buf
);
1602 switch (ip
->errnum
) {
1604 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
1605 "hotspare is in use"));
1607 case MDE_HS_CREATE_FAILURE
:
1608 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
1609 "hotspare database create failure"));
1612 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
1613 "add or replace failed, hot spare is already in use"));
1615 case MDE_HS_UNIT_TOO_LARGE
:
1616 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
1617 "hotspare size cannot exceed 1 TByte"));
1620 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
1621 "unknown hs error code %d"), ip
->errnum
);
1629 * print mddb class errors
1638 md_mddb_error_t
*ip
= &ep
->info
.md_error_info_t_u
.mddb_error
;
1639 char *p
= buf
+ strlen(buf
);
1640 size_t psize
= size
- strlen(buf
);
1642 switch (ip
->errnum
) {
1643 case MDE_TOOMANY_REPLICAS
:
1644 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
1645 "%d metadevice database replicas is too many; the maximum is %d"),
1646 ip
->size
, MDDB_NLB
);
1648 case MDE_REPLICA_TOOSMALL
:
1649 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
1650 "device size %d is too small for metadevice database replica"),
1653 case MDE_NOTVERIFIED
:
1654 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
1655 "data not returned correctly from disk"));
1657 case MDE_DB_INVALID
:
1658 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
1659 "invalid argument"));
1662 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
1663 "metadevice database replica exists on device"));
1666 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
1667 "has bad master block on device"));
1669 case MDE_DB_TOOSMALL
:
1670 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
1671 "device is too small"));
1673 case MDE_DB_NORECORD
:
1674 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
1675 "no such metadevice database record"));
1677 case MDE_DB_NOSPACE
:
1678 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
1679 "metadevice database is full, can't create new records"));
1682 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
1683 "metadevice database has too few replicas, for "
1684 "metadevice database operation"));
1687 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
1688 "there are no existing databases"));
1690 case MDE_DB_NOTOWNER
:
1691 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
1692 "not owner of metadevice database"));
1695 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
1696 "stale databases"));
1699 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
1700 "not enough databases"));
1702 case MDE_DB_TAGDATA
:
1703 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
1704 "tagged data detected, user intervention required"));
1707 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
1708 "50% replicas & 50% mediator hosts available, "
1709 "user intervention required"));
1711 case MDE_DB_NTAGDATA
:
1712 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
1713 "no tagged data available or only one tag found"));
1715 case MDE_DB_ACCNOTOK
:
1716 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
1717 "50% replicas & 50% mediator hosts not available"));
1719 case MDE_DB_NOLOCBLK
:
1720 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
1721 "no valid locator blocks were found"));
1723 case MDE_DB_NOLOCNMS
:
1724 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
1725 "no valid locator name information was found"));
1727 case MDE_DB_NODIRBLK
:
1728 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
1729 "no valid directory blocks were found"));
1731 case MDE_DB_NOTAGREC
:
1732 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
1733 "no tag record was allocated, so data "
1734 "tagging is disabled"));
1737 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
1738 "no tag records exist or no matching tag was found"));
1740 case MDE_DB_BLKRANGE
:
1741 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
1742 "logical block number %d out of range"), ip
->size
);
1745 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
1746 "unknown mddb error code %d"), ip
->errnum
);
1754 * print diskset (ds) class errors
1763 md_ds_error_t
*ip
= &ep
->info
.md_error_info_t_u
.ds_error
;
1764 char *p
= buf
+ strlen(buf
);
1765 size_t psize
= size
- strlen(buf
);
1767 switch (ip
->errnum
) {
1768 case MDE_DS_DUPHOST
:
1769 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
1770 "host %s is specified more than once"), ip
->node
);
1772 case MDE_DS_NOTNODENAME
:
1773 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
1774 "\"%s\" is not a nodename, but a network name"), ip
->node
);
1776 case MDE_DS_SELFNOTIN
:
1777 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
1778 "nodename of host %s creating the set must be included"),
1781 case MDE_DS_NODEHASSET
:
1782 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
1783 "host %s already has set"), ip
->node
);
1785 case MDE_DS_NODENOSET
:
1786 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
1787 "host %s does not have set"), ip
->node
);
1789 case MDE_DS_NOOWNER
:
1790 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
1791 "must be owner of the set for this command"));
1793 case MDE_DS_NOTOWNER
:
1794 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
1795 "only the current owner %s may operate on this set"),
1798 case MDE_DS_NODEISNOTOWNER
:
1799 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
1800 "host %s is not the owner"), ip
->node
);
1802 case MDE_DS_NODEINSET
:
1803 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
1804 "host %s is already in the set"), ip
->node
);
1806 case MDE_DS_NODENOTINSET
:
1807 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
1808 "host %s is not in the set"), ip
->node
);
1810 case MDE_DS_SETNUMBUSY
:
1811 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
1812 "host %s already has a set numbered %ld"),
1813 ip
->node
, ip
->setno
);
1815 case MDE_DS_SETNUMNOTAVAIL
:
1816 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
1817 "no available set numbers"));
1819 case MDE_DS_SETNAMEBUSY
:
1820 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
1821 "set name is in-use or invalid on host %s"), ip
->node
);
1823 case MDE_DS_DRIVENOTCOMMON
:
1824 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
1825 "drive %s is not common with host %s"),
1826 ip
->drive
, ip
->node
);
1828 case MDE_DS_DRIVEINSET
:
1829 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
1830 "drive %s is in set %s"), ip
->drive
, ip
->node
);
1832 case MDE_DS_DRIVENOTINSET
:
1833 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
1834 "drive %s is not in set"), ip
->drive
);
1836 case MDE_DS_DRIVEINUSE
:
1837 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
1838 "drive %s is in use"), ip
->drive
);
1840 case MDE_DS_DUPDRIVE
:
1841 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
1842 "drive %s is specified more than once"), ip
->drive
);
1844 case MDE_DS_INVALIDSETNAME
:
1845 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
1846 "set name contains invalid characters"));
1848 case MDE_DS_HASDRIVES
:
1849 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
1850 "unable to delete set, it still has drives"));
1852 case MDE_DS_SIDENUMNOTAVAIL
:
1853 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
1854 "maximum number of nodenames exceeded"));
1856 case MDE_DS_SETNAMETOOLONG
:
1857 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
1858 "set name is too long"));
1860 case MDE_DS_NODENAMETOOLONG
:
1861 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
1862 "host name %s is too long"), ip
->node
);
1864 case MDE_DS_OHACANTDELSELF
:
1865 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
1866 "administrator host %s deletion disallowed in one host admin mode"),
1869 case MDE_DS_HOSTNOSIDE
:
1870 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
1871 "side information missing for host %s"), ip
->node
);
1873 case MDE_DS_SETLOCKED
:
1874 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
1875 "host %s is modifying set - try later or restart rpc.metad"),
1878 case MDE_DS_ULKSBADKEY
:
1879 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
1880 "set unlock failed - bad key"));
1882 case MDE_DS_LKSBADKEY
:
1883 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
1884 "set lock failed - bad key"));
1886 case MDE_DS_WRITEWITHSULK
:
1887 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
1888 "write operation attempted on set with set unlocked"));
1890 case MDE_DS_SETCLEANUP
:
1891 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
1892 "set \"%s\" is out of date - cleaning up - take failed"),
1895 case MDE_DS_CANTDELSELF
:
1896 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
1897 "administrator host %s can't be deleted, other hosts still in set\n"
1898 "Use -f to override"), ip
->node
);
1901 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
1902 "unable to delete set, it still has mediator hosts"));
1904 case MDE_DS_TOOMANYALIAS
:
1905 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
1906 "%s causes there to be more aliases than allowed"),
1910 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
1911 "%s is already a mediator host"), ip
->node
);
1913 case MDE_DS_ISNOTMED
:
1914 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
1915 "%s is not a mediator host"), ip
->node
);
1917 case MDE_DS_INVALIDMEDNAME
:
1918 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
1919 "mediator name \"%s\" contains invalid characters"),
1922 case MDE_DS_ALIASNOMATCH
:
1923 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
1924 "mediator alias \"%s\" is not an alias for host "
1925 "\"%s\""), ip
->node
, ip
->drive
);
1927 case MDE_DS_NOMEDONHOST
:
1928 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
1929 "unable to contact %s on host \"%s\""),
1930 MED_SERVNAME
, ip
->node
);
1932 case MDE_DS_DRIVENOTONHOST
:
1933 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
1934 "drive %s is not present on host %s"),
1935 ip
->drive
, ip
->node
);
1937 case MDE_DS_CANTDELMASTER
:
1938 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
1939 "master %s can't be deleted, other hosts still in set"),
1942 case MDE_DS_NOTINMEMBERLIST
:
1943 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
1944 "node %s is not in membership list"),
1947 case MDE_DS_MNCANTDELSELF
:
1948 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
1949 "host %s can't delete self from multi-owner set\n"
1950 "while other hosts still in set"),
1953 case MDE_DS_RPCVERSMISMATCH
:
1954 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
1955 "host %s does not support multi-owner diskset"),
1958 case MDE_DS_WITHDRAWMASTER
:
1959 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
1960 "master host %s cannot withdraw from multi-owner diskset "
1961 "when other owner nodes are still present in diskset"),
1964 case MDE_DS_CANTRESNARF
:
1965 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
1966 "imported set could not be loaded"));
1968 case MDE_DS_INSUFQUORUM
:
1969 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
1970 "insufficient replica quorum detected. Use "
1971 "-f to force import of the set"));
1973 case MDE_DS_EXTENDEDNM
:
1974 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
1975 "multiple namespace records detected"));
1977 case MDE_DS_COMMDCTL_SUSPEND_NYD
:
1978 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
1979 "rpc.mdcommd on host %s is not yet drained during "
1980 "suspend operation"),
1983 case MDE_DS_COMMDCTL_SUSPEND_FAIL
:
1984 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
1985 "rpc.mdcommd on host %s failed suspend operation"),
1988 case MDE_DS_COMMDCTL_REINIT_FAIL
:
1989 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
1990 "rpc.mdcommd on host %s failed reinitialization operation"),
1993 case MDE_DS_COMMDCTL_RESUME_FAIL
:
1994 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
1995 "rpc.mdcommd on host %s failed resume operation"),
1998 case MDE_DS_NOTNOW_RECONFIG
:
1999 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
2000 "command terminated, host %s starting reconfig cycle"),
2003 case MDE_DS_NOTNOW_CMD
:
2004 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
2005 "metaset or metadb command already running on diskset "
2006 "on host %s"), ip
->node
);
2008 case MDE_DS_COMMD_SEND_FAIL
:
2009 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
2010 "rpc.mdcommd on host %s failed operation"),
2013 case MDE_DS_MASTER_ONLY
:
2014 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
2015 "this command must be run on the master node of the set,"
2016 " which is currently %s"), ip
->node
);
2018 case MDE_DS_SINGLEHOST
:
2019 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
2020 "diskset is auto-take; cannot accept additional hosts"));
2022 case MDE_DS_AUTONOTSET
:
2023 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
2024 "auto-take is not enabled on diskset"));
2026 case MDE_DS_INVALIDDEVID
:
2027 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
2028 "Invalid device id on drive %s on host %s"), ip
->drive
,
2031 case MDE_DS_SETNOTIMP
:
2032 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
2033 "Unable to import set on node %s"), ip
->node
);
2035 case MDE_DS_NOTSELFIDENTIFY
:
2036 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
2037 "Drive %s won't be self identifying"), ip
->drive
);
2040 (void) snprintf(p
, psize
, dgettext(TEXT_DOMAIN
,
2041 "unknown diskset error code %d"), ip
->errnum
);
2049 * convert error to printable string
2056 static char buf
[BUFSIZ
];
2061 bufsz
= sizeof (buf
);
2063 /* class specific */
2064 switch (ep
->info
.errclass
) {
2066 return (void_to_str(ep
, buf
, bufsz
));
2068 return (sys_to_str(ep
, buf
, bufsz
));
2070 return (rpc_to_str(ep
, buf
, bufsz
));
2072 return (dev_to_str(ep
, buf
, bufsz
));
2074 return (use_to_str(ep
, buf
, bufsz
));
2076 return (md_to_str(ep
, buf
, bufsz
));
2078 return (comp_to_str(ep
, buf
, bufsz
));
2080 return (hsp_to_str(ep
, buf
, bufsz
));
2082 return (hs_to_str(ep
, buf
, bufsz
));
2084 return (mddb_to_str(ep
, buf
, bufsz
));
2086 return (ds_to_str(ep
, buf
, bufsz
));
2088 return (overlap_to_str(ep
, buf
, bufsz
));
2090 (void) snprintf(buf
, bufsz
,
2091 dgettext(TEXT_DOMAIN
, "unknown error class %d"),
2109 if ((time(&t
) != (time_t)-1) &&
2110 ((tm
= localtime(&t
)) != NULL
) &&
2111 (strftime(buf
, sizeof (buf
), (char *)0, tm
) < sizeof (buf
))) {
2112 (void) fprintf(fp
, "%s: ", buf
);
2114 (void) fprintf(fp
, "%s: ", myname
);
2128 static char buf
[BUFSIZ
];
2129 size_t bufsz
= sizeof (buf
);
2139 if ((ep
->host
!= NULL
) && (*(ep
->host
) != '\0')) {
2143 if ((ep
->extra
!= NULL
) && (*(ep
->extra
) != '\0')) {
2147 if ((ep
->name
!= NULL
) && (*(ep
->name
) != '\0')) {
2153 (void) snprintf(p
, bufsz
, "%s%s%s%s%s%s",
2154 host1
, host2
, extra1
, extra2
, name1
, name2
);
2155 p
= &buf
[strlen(buf
)];
2156 bufsz
-= strlen(buf
);
2158 /* user defined part */
2159 if ((fmt
!= NULL
) && (*fmt
!= '\0')) {
2160 (void) vsnprintf(p
, bufsz
, fmt
, ap
);
2161 p
= &buf
[strlen(buf
)];
2162 bufsz
= sizeof (buf
) - strlen(buf
);
2163 (void) snprintf(p
, bufsz
, ": ");
2164 p
= &buf
[strlen(buf
)];
2165 bufsz
= sizeof (buf
) - strlen(buf
);
2169 (void) snprintf(p
, bufsz
, "%s\n", mde_to_str(ep
));
2171 /* return error message */
2176 * printf-like sperror()
2190 emsg
= mde_vsperror(ep
, fmt
, ap
);
2196 * printf-like perror()
2209 /* get error message */
2211 emsg
= mde_vsperror(ep
, fmt
, ap
);
2213 assert((emsg
!= NULL
) && (*emsg
!= '\0'));
2216 (void) fprintf(stderr
, "%s: %s\n", myname
, emsg
);
2217 (void) fflush(stderr
);
2220 if (metalogfp
!= NULL
) {
2221 md_logpfx(metalogfp
);
2222 (void) fprintf(metalogfp
, "%s\n", emsg
);
2223 (void) fflush(metalogfp
);
2224 (void) fsync(fileno(metalogfp
));
2229 syslog(LOG_ERR
, emsg
);
2234 * printf-like perror()
2243 md_error_t status
= mdnullerror
;
2247 /* get error message */
2248 (void) mdsyserror(&status
, errno
, NULL
);
2250 emsg
= mde_vsperror(&status
, fmt
, ap
);
2252 assert((emsg
!= NULL
) && (*emsg
!= '\0'));
2253 mdclrerror(&status
);
2256 (void) fprintf(stderr
, "%s: %s\n", myname
, emsg
);
2257 (void) fflush(stderr
);
2260 if (metalogfp
!= NULL
) {
2261 md_logpfx(metalogfp
);
2262 (void) fprintf(metalogfp
, "%s\n", emsg
);
2263 (void) fflush(metalogfp
);
2264 (void) fsync(fileno(metalogfp
));
2269 syslog(LOG_ERR
, emsg
);
2289 (void) fprintf(stderr
, "%s: ", myname
);
2290 (void) vfprintf(stderr
, fmt
, ap
);
2291 (void) fflush(stderr
);
2294 if (metalogfp
!= NULL
) {
2295 md_logpfx(metalogfp
);
2296 (void) vfprintf(metalogfp
, fmt
, ap
);
2297 (void) fflush(metalogfp
);
2298 (void) fsync(fileno(metalogfp
));
2303 vsyslog(LOG_ERR
, fmt
, ap
);
2311 * metaclust timing messages logging routine
2313 * level - The class of the message to be logged. Message will be logged
2314 * if this is less than or equal to the verbosity level.
2317 meta_mc_log(int level
, const char *fmt
, ...)
2321 va_start(args
, fmt
);
2323 * Log all messages upto MC_LOG2 to syslog regardless of the
2326 if (metasyslog
&& (level
<= MC_LOG2
)) {
2327 if (level
<= MC_LOG1
)
2328 (void) vsyslog(LOG_ERR
, fmt
, args
);
2330 (void) vsyslog(LOG_INFO
, fmt
, args
);
2333 * Print all messages to stderr provided the message level is
2334 * within the verbosity level
2336 if (level
<= verbosity
) {
2337 (void) fprintf(stderr
, "%s: ", myname
);
2338 (void) vfprintf(stderr
, fmt
, args
);
2339 (void) fprintf(stderr
, "\n");
2340 (void) fflush(stderr
);