12150Sjeanm#!/bin/sh 22150Sjeanm# 32150Sjeanm# CDDL HEADER START 42150Sjeanm# 52150Sjeanm# The contents of this file are subject to the terms of the 62150Sjeanm# Common Development and Distribution License (the "License"). 72150Sjeanm# You may not use this file except in compliance with the License. 82150Sjeanm# 92150Sjeanm# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 102150Sjeanm# or http://www.opensolaris.org/os/licensing. 112150Sjeanm# See the License for the specific language governing permissions 122150Sjeanm# and limitations under the License. 132150Sjeanm# 142150Sjeanm# When distributing Covered Code, include this CDDL HEADER in each 152150Sjeanm# file and include the License file at usr/src/OPENSOLARIS.LICENSE. 162150Sjeanm# If applicable, add the following below this CDDL HEADER, with the 172150Sjeanm# fields enclosed by brackets "[]" replaced with your own identifying 182150Sjeanm# information: Portions Copyright [yyyy] [name of copyright owner] 192150Sjeanm# 202150Sjeanm# CDDL HEADER END 212150Sjeanm# 222150Sjeanm# 232150Sjeanm# Copyright 2006 Sun Microsystems, Inc. All rights reserved. 242150Sjeanm# Use is subject to license terms. 252150Sjeanm# 262150Sjeanm# ident "%Z%%M% %I% %E% SMI" 272150Sjeanm# 282150Sjeanm# Start mirror resync threads. 292150Sjeanm 302150SjeanmDEVFSADM=/usr/sbin/devfsadm 312150SjeanmMETADEVADM=/usr/sbin/metadevadm 322150SjeanmMETASYNC=/usr/sbin/metasync 332150SjeanmMETADEV=/dev/md/admin 342150SjeanmMETASET=/usr/sbin/metaset 352150SjeanmTMPFILE=/var/run/metaset.$$ 362150Sjeanm 372150Sjeanm. /lib/svc/share/smf_include.sh 382150Sjeanm 392150Sjeanmprint_verbose() 402150Sjeanm{ 412150Sjeanm echo "Unable to resolve unnamed devices for volume management." 422150Sjeanm echo "Please refer to the Solaris Volume Manager documentation," 432150Sjeanm echo "Troubleshooting section, at http://docs.sun.com or from" 442150Sjeanm echo "your local copy." 452150Sjeanm} 462150Sjeanm 472150Sjeanmresolve_auto_take_sets() 482150Sjeanm{ 492150Sjeanm if [ -x $METASET ]; then 502150Sjeanm # Fixing up of the ctd names for devices in auto take 512150Sjeanm # sets relies heavily on the output of the metaset 522150Sjeanm # command. Any change to the output of the metaset command 532150Sjeanm # should modify this script as well in order ensure nothing 542150Sjeanm # breaks 552150Sjeanm # 562150Sjeanm # The following command saves all of the auto-take set names 572150Sjeanm # into the TMPFILE 582150Sjeanm name_str=`gettext "Set name"` 592150Sjeanm mn_str=`gettext "Multi-owner"` 602150Sjeanm $METASET | /bin/nawk -F ' |\t|,' -v snm="$name_str" \ 612150Sjeanm -v mstr="$mn_str" '$0 ~ snm { \ 622150Sjeanm if (index($0, mstr) == 0) print $4 \ 632150Sjeanm }' > $TMPFILE 2>&1 642150Sjeanm 652150Sjeanm if [ -s "$TMPFILE" ]; then 662150Sjeanm localised_string=`gettext "Yes (auto)"` 672150Sjeanm for i in `cat $TMPFILE`; do 682150Sjeanm $METASET -s $i | grep "$localised_string" \ 692150Sjeanm > /dev/null 2>&1 702150Sjeanm if [ $? -eq 0 ]; then 712150Sjeanm $METADEVADM -l -r -s $i 722150Sjeanm error=$? 732150Sjeanm case $error in 742150Sjeanm 0|2) ;; 752150Sjeanm 3) print_verbose 762150Sjeanm ;; 772150Sjeanm *) echo "$METADEVADM \ 782150Sjeanm -r failure $error." 792150Sjeanm ;; 802150Sjeanm esac 812150Sjeanm fi 822150Sjeanm done 83*2589Shshaw fi 84*2589Shshaw if [ -f "$TMPFILE" ]; then 852150Sjeanm /usr/bin/rm -f $TMPFILE 862150Sjeanm fi 872150Sjeanm fi 882150Sjeanm} 892150Sjeanm 902150Sjeanmif [ ! -s /kernel/drv/md.conf ]; then 912150Sjeanm echo "/kernel/drv/md.conf is missing." 922150Sjeanm exit 0 932150Sjeanmfi 942150Sjeanm 952150Sjeanmif grep '^mddb_bootlist' /kernel/drv/md.conf >/dev/null 2>&1; then :; else 962150Sjeanm echo "No 'mddb_bootlist' entry in /kernel/drv/md.conf." 972150Sjeanm exit 0 982150Sjeanmfi 992150Sjeanm 1002150Sjeanmif [ ! -x $METADEVADM ]; then 1012150Sjeanm echo "$METADEVADM is missing or not executable." 1022150Sjeanm exit $SMF_EXIT_ERR_CONFIG 1032150Sjeanmfi 1042150Sjeanm 1052150Sjeanmif [ ! -x $METASYNC ]; then 1062150Sjeanm echo "$METASYNC is missing or not executable." 1072150Sjeanm exit $SMF_EXIT_ERR_CONFIG 1082150Sjeanmfi 1092150Sjeanm 1102150Sjeanmif [ ! -c $METADEV ]; then 1112150Sjeanm echo "$METADEV is missing or not a character device." 1122150Sjeanm exit 0 1132150Sjeanmfi 1142150Sjeanm 1152150Sjeanm$METADEVADM -l -r 1162150Sjeanmerror=$? 1172150Sjeanmcase $error in 1182150Sjeanm0|2) ;; 1192150Sjeanm 1202150Sjeanm3) echo "Executing devfsadm" 1212150Sjeanm $DEVFSADM 1222150Sjeanm devfsadmerror=$? 1232150Sjeanm if [ $devfsadmerror = 0 ]; then 1242150Sjeanm echo "Executing metadevadm -r" 1252150Sjeanm $METADEVADM -l -r 1262150Sjeanm error=$? 1272150Sjeanm fi 1282150Sjeanm if [ $devfsadmerror != 0 -o $error = 3 ]; then 1292150Sjeanm print_verbose 1302150Sjeanm elif [ $error != 0 -a $error != 2 ]; then 1312150Sjeanm echo "$METADEVADM -r failure $error." 1322150Sjeanm fi 1332150Sjeanm ;; 1342150Sjeanm 1352150Sjeanm*) echo "$METADEVADM -r failure $error." 1362150Sjeanm exit 1 1372150Sjeanm ;; 1382150Sjeanmesac 1392150Sjeanm 1402150Sjeanmresolve_auto_take_sets 1412150Sjeanm 1422150Sjeanm$METASYNC -r 1432150Sjeanmerror=$? 1442150Sjeanmcase $error in 1452150Sjeanm0) ;; 1462150Sjeanm 1472150Sjeanm*) echo "Unknown $METASYNC -r failure $error." 1482150Sjeanm exit 1 1492150Sjeanm ;; 1502150Sjeanmesac 1512150Sjeanm 152