i.scsivhciconf revision 7c478bd95313f5f23a4c958a745db2134aa03244
#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License, Version 1.0 only
# (the "License"). You may not use this file except in compliance
# with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
#
# ident "%Z%%M% %I% %E% SMI"
#
# Copyright 2004 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
#
# Add any new entries to be added to fp.conf to this file. The class action
#
#
# Check if mpxio is enabled or disabled in the given scsi_vhci.conf file
# $1 scsi_vhci.conf file
#
# Returns 0 if disabled, 1 if enabled, 2 if can't determine.
#
{
return 0
fi
return 1
fi
return 2
}
#
# Make sed script to do most of the work of upgrading scsi_vhci.conf.
#
{
#
# remove mpxio-disable and forceattach properties.
# forceattach is no longer necessary as the framework always loads
# scsi_vhci early during boot.
#
cat > $SEDSCRIPT << EOF
/^# mpxio Global enable\/disable configuration$/d
/^# possible values are mpxio-disable="no" or mpxio-disable="yes"$/d
/^# mpxio global enable\/disable switch: setting mpxio-disable="no" will activate$/d
/^# I\/O multipathing; setting mpxio-disable="yes" disables this feature (do$/d
/^# not remove this property).$/d
/^[ ]*mpxio-disable[ ]*=/d
/^# Force load driver to support hotplug activity (do not remove this property).$/d
/^ddi-forceattach=1;$/d
EOF
}
#
# Upgrade the destination scsi_vhci.conf file.
# $1 source scsi_vhci.conf file
# $2 destination scsi_vhci.conf file (the file to be upgraded)
#
# Returns 0 on success, non zero on failure.
#
{
# make sed script to do most of the work of upgrading
# make sed script to replace old ident with new ident
IDENT="^#.*ident.*SMI\"$"
# replace / by \/
fi
sed -f $SEDSCRIPT $2 > $TMPSCSIVHCI 2>/dev/null
retval=$?
cp $TMPSCSIVHCI $2
fi
return $retval
}
#
# Preprocess a driver.conf file. The output is written to out file.
# $1 driver.conf file
# $2 out file
#
{
# strip comments, blank lines, leading and trailing spaces
-e "/^[ ]*$/d" \
-e "s/^[ ]*//" \
# combine entries that spawn more than one line
-e "/;$/d" \
-e ":rdnext" \
-e "N" \
-e "s/\n/ /" \
-e "/;$/p" \
-e "/;$/d" \
rm -f $TMPPREPROCESS
}
#
# Disable mpxio on all fp ports.
# $1 fp.conf file
#
# Returns 0 on success, non zero on failure.
#
{
if [ ! -f $1 ]; then
return 0
fi
#
# change all occurrences of mpxio-disable (including per port) value
# from "no" to "yes" except in comments.
#
retval=$?
# add global mpxio-disable if not already present
if [ $? -ne 0 ]; then
fi
fi
return $retval
}
#
# Check if mpxio-disable entry is present in fp.conf file for the specified
# controller and port.
#
# $1 fp.conf file
# $2 controller name
# $3 port number
#
# Returns 1 if the entry is present, 0 if not.
#
{
return 1
fi
return 0
}
#
# Reads vfstab entry fields corresponding to the specified mount point.
# This function assumes that stdin is already set to vfstab.
#
# $1 mount point
#
{
'#'* | '') # Ignore comments, empty lines
continue ;;
'-') # Ignore no-action lines
continue
esac
done
}
#
# Disable mpxio on the specified controller if the controller had mpxio
# disabled (implicitly) before the upgrade.
#
# $1 directory on which the root filesystem of the OS image being
# upgraded is mounted.
# $2 /dev link or /devices name of the root slice whose controller needs
# to have mpxio disabled.
#
{
# it is /dev link
else
return
fi
# extract controller and port number
#
# add an entry to fp.conf to disable mpxio only if not already
# present.
#
if [ $? -eq 0 ]; then
echo "name=\"fp\" parent=\"$controller\" port=$port \
mpxio-disable=\"yes\";" >> $NEW_FPCONF_ENTRIES
fi
fi
}
#
# Disable mpxio on the root controller if it was implicitly disabled before
# the upgrade.
#
# Note that s8 and s9 didn't have mpxio support on the root controller.
# So root controller always had mpxio disabled. But Network Storage supplies a
# patch to enable mpxio on the root controller.
#
# $1 directory on which the root filesystem of the OS image being
# upgraded is mounted.
#
{
# live upgrade
root=/
else
root=$1
fi
#
# if the root is a metadevice disable mpxio on each of the component
# controllers if the component controller had mpxio disabled before.
#
return
fi
do
disable_mpxio $1 /dev/dsk/$d
done
else
exec < ${root}/etc/vfstab; readvfstab "/"
fi
}
# first delete if a stale version of this file exists
if [ ! -f $dest ]; then
#
# If we are upgrading from s7 or s8, scsi_vhci.conf file
# won't exist and mpxio needs to be globally disabled.
#
# XXX Install doesn't provide a way to distinguish between
# fresh install and upgrade. In this hack we assume that if
# the system's vfstab already contains an entry for the root
# it must be an upgrade.
#
if [ "x$mountp" = x/ ]; then
if [ $? -ne 0 ]; then
exit 1
fi
fi
fi
exit 0
fi
mpxio_on=$?
if [ $? -ne 0 ]; then
exit 1
fi
if [ $? -ne 0 ]; then
exit 1
fi
if [ "x$PKG_INSTALL_ROOT" != x ]; then
else
fi
fi
fi
exit 0