Xe cli commands

Show a list of XenServer CLI commands
# xe help --all|more

Runs up the XenServer text based console
# xsconsole

Restarts the XenServer management tools
# xe-toolstack-restart

Xen Hypervisor Boot messages
# xe host-dmesg

Look at xapi messages as they happen
# tail -f /var/log/xensource.log

Look at xapi messages only for vm uuid xxx
# tail -f /var/log/xensource.log | grep xxx

Send output to a file for analysis later
# tail -ff [log name] > [target filename]

Display XenSource Inventory info
# cat /etc/xensource-inventory

Build a status report when xapi is down
# xen-bugtool --yes

Back up Pool metadata for all VMs
# xe-backup-metadata -d -u [uuid of SR]

Get a Packet trace from [inf]. E.g. Inf=eth0, xenbr0, vif2.0 etc.
# tcpdump -i [inf] -vvv -w [filename]

List top Xen processes
# xentop

Lists VMs that are running
# list_domains

Look at NFS SRs
# cd /var/run/sr-mount

 

Script for mapping passthru disks (ext label must be set)

#!/bin/bash
# @ /root/xen_map_drives
LOG="/tmp/xen_diskmap.log";
DRIVES="BigData movies"  # labels of disks which are going to be passed   
for disk in $DRIVES;do
     echo "Start @ `date`"> $LOG
     echo "Disk $disk ">> $LOG
     dev=`/usr/sbin/blkid | /usr/bin/grep $disk | /usr/bin/awk '{print $1}'| /usr/bin/sed 's/1://g'`;
     echo "dev : $dev " >> $LOG
     dev_short=`echo $dev | /usr/bin/awk -F/ '{print $NF}'`;
     echo "dev_short : $dev_short " >> $LOG
     echo "creating symlink $dev /dev/xapi/block/$dev_short" >> $LOG
     /usr/bin/ln -s $dev /dev/xapi/block/$dev_short
done

This script needs to be launched by UDEV via "/etc/uder/rules.d/59-passthru.conf"

ACTION=="add", RUN+="/bin/sh -c 'mkdir -p  /dev/xapi/block/'"
ACTION=="add", RUN+="/bin/sh -c '/root/xen_map_drives'"