i.scsivhciconf revision cdf0c1d55d9b3b6beaf994835440dfb01aef5cf0
75c0816e8295e180f4bc7f10db3d0d880383bc1cMark Andrews# CDDL HEADER START
4a14ce5ba00ab7bc55c99ffdcf59c7a4ab902721Automatic Updater# The contents of this file are subject to the terms of the
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# Common Development and Distribution License (the "License").
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# You may not use this file except in compliance with the License.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# See the License for the specific language governing permissions
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# and limitations under the License.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# When distributing Covered Code, include this CDDL HEADER in each
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# If applicable, add the following below this CDDL HEADER, with the
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# fields enclosed by brackets "[]" replaced with your own identifying
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# information: Portions Copyright [yyyy] [name of copyright owner]
cd32f419a8a5432fbb139f56ee73cbf68b9350ccTinderbox User# CDDL HEADER END
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt# ident "%Z%%M% %I% %E% SMI"
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
cd32f419a8a5432fbb139f56ee73cbf68b9350ccTinderbox User# Use is subject to license terms.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# Add any new entries to be added to fp.conf to this file. The class action
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# script for fp.conf will append the entries of this file to fp.conf.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# Check if mpxio is enabled or disabled in the given scsi_vhci.conf file
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User# Returns 0 if disabled, 1 if enabled, 2 if can't determine.
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User if egrep "^[ ]*mpxio-disable[ ]*=[ ]*\"yes\"[ ]*;" \
46472a450e043434d78fa18edc73bca8c47f3981Tinderbox User $1 > /dev/null 2>&1; then
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt if egrep "^[ ]*mpxio-disable[ ]*=[ ]*\"no\"[ ]*;" \
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt $1 > /dev/null 2>&1; then
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# Make sed script to do most of the work of upgrading scsi_vhci.conf.
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt # remove mpxio-disable and forceattach properties.
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt # forceattach is no longer necessary as the framework always loads
46472a450e043434d78fa18edc73bca8c47f3981Tinderbox User/^# mpxio Global enable\/disable configuration$/d
46472a450e043434d78fa18edc73bca8c47f3981Tinderbox User/^# possible values are mpxio-disable="no" or mpxio-disable="yes"$/d
46472a450e043434d78fa18edc73bca8c47f3981Tinderbox User/^# mpxio global enable\/disable switch: setting mpxio-disable="no" will activate$/d
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt/^# I\/O multipathing; setting mpxio-disable="yes" disables this feature (do$/d
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User/^# not remove this property).$/d
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User/^[ ]*mpxio-disable[ ]*=/d
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt/^# Force load driver to support hotplug activity (do not remove this property).$/d
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt/^ddi-forceattach=1;$/d
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User # convert old 'scsi-options' oriented device-type-scsi-options-list to
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt/^# For enabling MPxIO support for 3rd party symmetric device need an$/d
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User/^# entry similar to following in this file. Just replace the "SUN SENA"$/d
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User/^# part with the Vendor ID\/Product ID for the device, exactly as reported by$/d
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt/^# Inquiry cmd.$/d
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt/^# device-type-scsi-options-list =$/d
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User/^# "SUN SENA", "symmetric-option";$/d
df3d1c56e488c98f2b10e8fcb35a07a797c66ed7Tinderbox User/^# symmetric-option = 0x1000000;$/d
df3d1c56e488c98f2b10e8fcb35a07a797c66ed7Tinderbox Users/device-type-scsi-options-list/scsi-vhci-failover-override/
df3d1c56e488c98f2b10e8fcb35a07a797c66ed7Tinderbox User # old 'symetric' scsi-options property of 1000000 -> f_sym name
df3d1c56e488c98f2b10e8fcb35a07a797c66ed7Tinderbox User SYMMETRIC_OPTION=`grep -v '^#' $2 | grep 1000000 | \
c42708dcc8ca18a41152251654d29f0cdd5b9533Tinderbox User echo "/^[ ]*$SYMMETRIC_OPTION/d" >> $SEDSCRIPT
c42708dcc8ca18a41152251654d29f0cdd5b9533Tinderbox User echo "s/$SYMMETRIC_OPTION/f_sym/" >> $SEDSCRIPT
c42708dcc8ca18a41152251654d29f0cdd5b9533Tinderbox User # old 'disable' scsi-options property of 7000000 -> NONE name
2ba8603ca962450068fe45f04c5caf8219b0d5f1Tinderbox User DISABLE_OPTION=`grep -v '^#' $2 | grep 7000000 | \
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User# Make FAILOVER_MODULE_BLOCK file
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt # Form file with new scsi_vhci FAILOVER_MODULE_BLOCK information
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt#BEGIN: FAILOVER_MODULE_BLOCK (DO NOT MOVE OR DELETE)
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User# Declare scsi_vhci failover module paths with 'ddi-forceload' so that
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt# they get loaded early enough to be available for scsi_vhci root use.
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt# NOTE: Correct operation depends on the value of 'ddi-forceload', this
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt# value should not be changed. The ordering of entries is from
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt# most-specific failover modules (with a "probe" implementation that is
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User# completely VID/PID table based), to most generic (failover modules that
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt# are based on T10 standards like TPGS). By convention the last part of a
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt# failover module path, after "/scsi_vhci_", is called the
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt# "failover-module-name", which begins with "f_" (like "f_asym_sun"). The
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User# "failover-module-name" is also used in the override mechanism below.
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Huntddi-forceload =
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User "misc/scsi_vhci/scsi_vhci_f_asym_sun",
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt "misc/scsi_vhci/scsi_vhci_f_asym_lsi",
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt "misc/scsi_vhci/scsi_vhci_f_asym_emc",
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt "misc/scsi_vhci/scsi_vhci_f_sym_emc",
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt "misc/scsi_vhci/scsi_vhci_f_sym_hds",
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User "misc/scsi_vhci/scsi_vhci_f_sym",
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt# "misc/scsi_vhci/scsi_vhci_f_tpgs_tape",
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt# "misc/scsi_vhci/scsi_vhci_f_tape",
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt "misc/scsi_vhci/scsi_vhci_f_tpgs";
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User# For a device that has a GUID, discovered on a pHCI with mpxio enabled, vHCI
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt# access also depends on one of the scsi_vhci failover modules accepting the
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt# device. The default way this occurs is by a failover module's "probe"
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt# implementation (sfo_device_probe) indicating the device is supported under
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt# scsi_vhci. To override this default probe-oriented configuration in
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt# 1) establish support for a device not currently accepted under scsi_vhci
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt# or 2) override the module selected by "probe"
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt# or 3) disable scsi_vhci support for a device
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User# you can add a 'scsi-vhci-failover-override' tuple, as documented in
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt# scsi_get_device_type_string(9F). For each tuple, the first part provides
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt# basic device identity information (vid/pid) and the second part selects
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt# the failover module by "failover-module-name". If you want to disable
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User# scsi_vhci support for a device, use the special failover-module-name "NONE".
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt# Currently, for each failover-module-name in 'scsi-vhci-failover-override'
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User# (except "NONE") there needs to be a
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt# "misc/scsi_vhci/scsi_vhci_<failover-module-name>" in 'ddi-forceload' above.
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt# "012345670123456789012345", "failover-module-name" or "NONE"
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt# "|-VID--||-----PID------|",
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt# scsi-vhci-failover-override =
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt# "STK FLEXLINE 400", "f_asym_lsi",
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt# "SUN T4", "f_tpgs",
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt# "CME XIRTEMMYS", "NONE";
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt#END: FAILOVER_MODULE_BLOCK (DO NOT MOVE OR DELETE)
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt# Upgrade the destination scsi_vhci.conf file.
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt# $1 source scsi_vhci.conf file
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt# $2 destination scsi_vhci.conf file (the file to be upgraded)
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt# Returns 0 on success, non zero on failure.
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt # make sed script to do most of the work of upgrading
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt if [ $retval -eq 0 ]; then
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User if [ $? -ne 0 ]; then
1609eab3caf63287d1caa0d3f8b4819a0c2becffTinderbox User# Preprocess a driver.conf file. The output is written to out file.
ba38c6b4bcc2c1cff3d281225c497f1d5884a2b2Tinderbox User # strip comments, blank lines, leading and trailing spaces
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt# Disable mpxio on all fp ports.
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User# Returns 0 on success, non zero on failure.
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User if [ ! -f $1 ]; then
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt echo "mpxio-disable=\"yes\";" > $NEW_FPCONF_ENTRIES
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt # change all occurrences of mpxio-disable (including per port) value
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt -e "s/mpxio-disable[ ]*=[ ]*\"no\"/mpxio-disable=\"yes\"/g"\
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt if [ $retval -eq 0 ]; then
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt if [ $? -ne 0 ]; then
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User echo "mpxio-disable=\"yes\";" > $NEW_FPCONF_ENTRIES
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt# Check if mpxio-disable entry is present in fp.conf file for the specified
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User# controller and port.
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt# $2 controller name
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt# $3 port number
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt# Returns 1 if the entry is present, 0 if not.
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User 2>/dev/null | egrep "port[ ]*=[ ]*$3" 2>/dev/null | \
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt egrep "mpxio-disable[ ]*=[ ]*\".*\"" >/dev/null 2>&1; then
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt# Reads vfstab entry fields corresponding to the specified mount point.
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt# This function assumes that stdin is already set to vfstab.
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt# $1 mount point
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User while read special fsckdev mountp fstype fsckpass automnt mntopts; do
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User# Disable mpxio on the specified controller if the controller had mpxio
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt# disabled (implicitly) before the upgrade.
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt# $1 directory on which the root filesystem of the OS image being
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt# upgraded is mounted.
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt# $2 /dev link or /devices name of the root slice whose controller needs
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt# to have mpxio disabled.
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User if echo "$2" | grep "/devices/" >/dev/null 2>&1; then
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt physpath=`echo "$2" | sed "s/^.*\/devices\//\//" 2>/dev/null`
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt elif echo "$2" | grep "/dev/" >/dev/null 2>&1; then
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt physpath=`ls -l $1/$2 | sed "s/^.*\/devices\//\//" 2>/dev/null`
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt if echo "$physpath" | grep "/fp@" >/dev/null 2>&1; then
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt controller=`echo "$physpath" | sed "s/\/fp@.*$//" 2>/dev/null`
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User port=`echo "$physpath" | sed -e "s/^.*\/fp@//" 2>/dev/null \
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt # add an entry to fp.conf to disable mpxio only if not already
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User if [ $? -eq 0 ]; then
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User echo "name=\"fp\" parent=\"$controller\" port=$port \
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt# Disable mpxio on the root controller if it was implicitly disabled before
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt# the upgrade.
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt# Note that s8 and s9 didn't have mpxio support on the root controller.
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User# So root controller always had mpxio disabled. But Network Storage supplies a
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User# patch to enable mpxio on the root controller.
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt# $1 directory on which the root filesystem of the OS image being
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User# upgraded is mounted.
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User if [ $rel -lt 10 ]; then
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User # if the root is a metadevice disable mpxio on each of the component
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt # controllers if the component controller had mpxio disabled before.
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt if mount | grep "^$root on /dev/md/dsk/" >/dev/null 2>&1; then
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User metadev=`mount | grep "^$root on /dev/md/dsk/" | \
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User # first delete if a stale version of this file exists
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User if [ ! -f $dest ]; then
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt # If we are upgrading from s7 or s8, scsi_vhci.conf file
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt # won't exist and mpxio needs to be globally disabled.
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User # XXX Install doesn't provide a way to distinguish between
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt # fresh install and upgrade. In this hack we assume that if
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt # the system's vfstab already contains an entry for the root
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt # it must be an upgrade.
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt exec < $PKG_INSTALL_ROOT/etc/vfstab; readvfstab "/"
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt if [ "x$mountp" = x/ ]; then
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User disable_mpxio_globally $PKG_INSTALL_ROOT/$FPCONF
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt if [ "x$PKG_INSTALL_ROOT" != x ]; then