#!/bin/bash###enumerate uuid's of all _running_ VMs in the poolfor VM in`xe vm-list is-control-domain=false power-state=running params=uuid |egrep-o"[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}"`do###(uncomment following line to perform actual shutdown)#xe vm-shutdown vm=$VMecho$VM>/dev/null
done###get uuid of pool master - it must be the very last to shut downMASTER_UUID=`xe pool-list params=master |egrep-o"[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-0-9]{4}-[a-f0-9]{12}"`###enumerate of all xen hosts in the pool except masterfor HOST in`xe host-list params=uuid |egrep-o"[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}"`doif[$HOST!= $MASTER_UUID]then###(uncomment following line to perform actual shutdown)#xe host-shutdown host=$HOSTecho$HOST>/dev/null
fidone###finally shutdown pool master###(uncomment following line to perform actual shutdown)#xe host-shutdown host=$HOST

Currently you have JavaScript disabled. In order to post comments, please make sure JavaScript and Cookies are enabled, and reload the page.Click here for instructions on how to enable JavaScript in your browser.