HMC: Cleanup unused memory/cpu assignment on offline LPARs

Short script:

for varSys in $(lssyscfg -r sys -F names) do
for varLpar in $(lssyscfg -r lpar -m $varSys -F ‘name,state’ |grep “Not Activated” |cut -d “,” -f1)
do
varMem=$(lshwres -r mem -m $varSys –level lpar –filter “lpar_names=$varLpar” -F curr_mem)
if [ “$varMem” -ne “0” ]
then
echo “$varSys $varLpar – removing Mem $varMem”
chhwres -r mem -m $varSys -o r -q $varMem -p $varLpar
fi
varProcunits=$(lshwres -r proc -m $varSys –level lpar –filter “lpar_names=$varLpar” -F curr_proc_units)
if [ “$varProcunits” != “null” -a “$varProcunits” != “0.0” ]
then
echo “$varSys $varLpar – removing Procunits $varProcunits”
chhwres -r proc -m $varSys -o r –procunits $varProcunits -p $varLpar
fi
done
done

Advertisements
This entry was posted in Uncategorized and tagged , , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.