1 #!/sbin/sh 2 # 3 # CDDL HEADER START 4 # 5 # The contents of this file are subject to the terms of the 6 # Common Development and Distribution License (the "License"). 7 # You may not use this file except in compliance with the License. 8 # 9 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10 # or http://www.opensolaris.org/os/licensing. 11 # See the License for the specific language governing permissions 12 # and limitations under the License. 13 # 14 # When distributing Covered Code, include this CDDL HEADER in each 15 # file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16 # If applicable, add the following below this CDDL HEADER, with the 17 # fields enclosed by brackets "[]" replaced with your own identifying 18 # information: Portions Copyright [yyyy] [name of copyright owner] 19 # 20 # CDDL HEADER END 21 # 22 # 23 # Copyright 2006 Sun Microsystems, Inc. All rights reserved. 24 # Use is subject to license terms. 25 # 26 # 27 # Start mirror resync threads. 28 29 DEVFSADM=/usr/sbin/devfsadm 30 METADEVADM=/usr/sbin/metadevadm 31 METASYNC=/usr/sbin/metasync 32 METADEV=/dev/md/admin 33 METASET=/usr/sbin/metaset 34 TMPFILE=/var/run/metaset.$$ 35 36 . /lib/svc/share/smf_include.sh 37 38 print_verbose() 39 { 40 echo "Unable to resolve unnamed devices for volume management." 41 echo "Please refer to the Solaris Volume Manager documentation," 42 echo "Troubleshooting section, at http://docs.sun.com or from" 43 echo "your local copy." 44 } 45 46 resolve_auto_take_sets() 47 { 48 if [ -x $METASET ]; then 49 # Fixing up of the ctd names for devices in auto take 50 # sets relies heavily on the output of the metaset 51 # command. Any change to the output of the metaset command 52 # should modify this script as well in order ensure nothing 53 # breaks 54 # 55 # The following command saves all of the auto-take set names 56 # into the TMPFILE 57 name_str=`gettext "Set name"` 58 mn_str=`gettext "Multi-owner"` 59 $METASET | /bin/nawk -F ' |\t|,' -v snm="$name_str" \ 60 -v mstr="$mn_str" '$0 ~ snm { \ 61 if (index($0, mstr) == 0) print $4 \ 62 }' > $TMPFILE 2>&1 63 64 if [ -s "$TMPFILE" ]; then 65 localised_string=`gettext "Yes (auto)"` 66 for i in `cat $TMPFILE`; do 67 $METASET -s $i | grep "$localised_string" \ 68 > /dev/null 2>&1 69 if [ $? -eq 0 ]; then 70 $METADEVADM -l -r -s $i 71 error=$? 72 case $error in 73 0|2) ;; 74 3) print_verbose 75 ;; 76 *) echo "$METADEVADM \ 77 -r failure $error." 78 ;; 79 esac 80 fi 81 done 82 fi 83 if [ -f "$TMPFILE" ]; then 84 /usr/bin/rm -f $TMPFILE 85 fi 86 fi 87 } 88 89 if [ ! -s /kernel/drv/md.conf ]; then 90 echo "/kernel/drv/md.conf is missing." 91 exit 0 92 fi 93 94 if grep '^mddb_bootlist' /kernel/drv/md.conf >/dev/null 2>&1; then :; else 95 echo "No 'mddb_bootlist' entry in /kernel/drv/md.conf." 96 exit 0 97 fi 98 99 if [ ! -x $METADEVADM ]; then 100 echo "$METADEVADM is missing or not executable." 101 exit $SMF_EXIT_ERR_CONFIG 102 fi 103 104 if [ ! -x $METASYNC ]; then 105 echo "$METASYNC is missing or not executable." 106 exit $SMF_EXIT_ERR_CONFIG 107 fi 108 109 if [ ! -c $METADEV ]; then 110 echo "$METADEV is missing or not a character device." 111 exit 0 112 fi 113 114 $METADEVADM -l -r 115 error=$? 116 case $error in 117 0|2) ;; 118 119 3) echo "Executing devfsadm" 120 $DEVFSADM 121 devfsadmerror=$? 122 if [ $devfsadmerror = 0 ]; then 123 echo "Executing metadevadm -r" 124 $METADEVADM -l -r 125 error=$? 126 fi 127 if [ $devfsadmerror != 0 -o $error = 3 ]; then 128 print_verbose 129 elif [ $error != 0 -a $error != 2 ]; then 130 echo "$METADEVADM -r failure $error." 131 fi 132 ;; 133 134 *) echo "$METADEVADM -r failure $error." 135 exit 1 136 ;; 137 esac 138 139 resolve_auto_take_sets 140 141 $METASYNC -r 142 error=$? 143 case $error in 144 0) ;; 145 146 *) echo "Unknown $METASYNC -r failure $error." 147 exit 1 148 ;; 149 esac 150