XenTop name column too wide
When you have a cute long name for your virtual machine xentop (a.k.a. xm top) prints the whole thing out and messes up the table columns.
Use this script to truncate the names at run-time. Each time you restart the names go back to the originals though, requiring another run of the script.
#!/bin/bash
# 2007 Wombat Technology Enterprise Search. Free for all to use. Phill.
# Shorten all the domain names in a Xen environment so xentop displays them nicely.
#
gcTempFile="xen-shortnames.tmp"
#
# Get a list of domains.
#
xm list > $gcTempFile
let giLineCount=1
exec < "$gcTempFile"
while read gcLine
do
gcDomainName=`echo "$gcLine" | awk '{ print $1 }' | sed -e "s/.*\(..........$\)/\1/"`
if [ "$gcDomainName" != "Name" ]
then
if [ "$gcDomainName" != "Domain-0" ]
then
giDomainId=`echo "$gcLine" | awk '{ print $2 }'`
echo "xenstore-write /local/domain/$giDomainId/name $gcDomainName"
xenstore-write /local/domain/$giDomainId/name $gcDomainName
let giLineCount=$giLineCount+1
fi
fi
done
rm -f $gcTempFile




