Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
#!/usr/bin/ksh
PROGNAME=${0##*/}
HMCUSER="hscroot" # User on HMC with super admin privilege
HMC="p5hmc" # TCP/IP host name of HMC
DEV="$1" # Device to move
DHOST="$2" # Destination host
function Die
{
print -u2 "$PROGNAME: $*"
exit 1
}
function GetManagedSystem
{
typeset LPAR="$*" TESTLPAR= TSYSTEM=
integer i
ssh $HMCUSER@$HMC lssyscfg -r sys -F name |
while read TSYSTEM
do
SYSTEM[${#SYSTEM[*]}]="$TSYSTEM"
done
(( i = 0 ))
while (( i < ${#SYSTEM[*]} )); do
ssh $HMCUSER@$HMC lssyscfg -r lpar -m \"${SYSTEM[i]}\" -F "lpar_id name" |
while read TESTLPAR
do
if [[ $TESTLPAR = $LPAR ]]
then
echo "${SYSTEM[i]}"
return
fi
done
(( i += 1 ))
done
echo ""
}
LPAR=$(uname -L) # ID and name of this partition
LPAR_ID=${LPAR% *} # Extract LPAR ID
# Test ssh connectivity to HMC
[[ $(ssh $HMCUSER@$HMC whoami 2>/dev/null) = $HMCUSER ]] || Die "ssh to HMC $HMC not functional"
# Test ssh connectivity to destination host
[[ $(ssh $DHOST id -un 2>/dev/null) = $(id -un) ]] || Die "ssh to $DHOST not functional"
# Get name of managed system to which this LPAR belongs
SYSTEM="$(GetManagedSystem "$LPAR")"
[[ $SYSTEM != "" ]] || Die "not able to determine managed system"
# Get LPAR ID and name of destination host
DLPAR=$(ssh $DHOST uname -L)
[[ $DLPAR != "" ]] || Die "$DHOST not an LPAR"
# Extract LPAR ID of destination
DLPAR_ID=${DLPAR%\ *}
# Verify that destination DLPAR is on the same managed system
[[ $(GetManagedSystem "$DLPAR") = "$SYSTEM" ]] || Die "$DHOST not in the same managed system"
# Find the PCI bus device to which this device connects.
while [[ $DEV != pci* ]]; do
SLOT=$(lscfg -l $DEV | awk '{print $2}')
DEV=$(lsdev -C -F parent -l $DEV)
done
set -x
# Get the drc_index for the slot we want to move
DRC_INDEX=$(ssh $HMCUSER@$HMC lshwres -r io --rsubtype slot -m \"$SYSTEM\" -F dr
c_name:drc_index | awk -F: '$1 == "'$SLOT'" {print $2}')
if /usr/sbin/rmdev -R -l $DEV
then
if ssh $HMCUSER@$HMC chhwres -r io -m \"$SYSTEM\" -o m --id $LPAR_ID --tid $DL
PAR_ID -l $DRC_INDEX
then
ssh $DHOST /usr/sbin/cfgmgr -s
fi
fi
movedevice.sh rmt0 dest_lpar_name