This is the next post in my look at the commands of the excellent Xen Cloud Platform data center cloud computing system. This post isn’t going to be about a single command, but a modifier that makes a range of commands much more powerful.
Many of the XCP CLI commands take “power-state=” as a way to select which virtual machine you want to perform the command on. Say you want to shut down all virtual machines on a particular cloud host. You could do this the hard way from the console, shutting them down one at a time. Alternatively, you could just go to the command line and enter xe vm-shutdown power-state=running –multiple. You’ve just told the host to shut down everything that’s currently running, no messing around with identifying and entering separate commands for each virtual machine. Also, note the –multiple on the end. This tells the command to run for every virtual machine that the power-state selector finds. Otherwise, if the selector finds more than one virtual machine to act on, the command will exit with an error.
This is also handy for firing up a bunch of halted virtual machines. Simply use xe vm-start power-state=halted –multiple and all virtual machines on the host will be started up, nice and easy, with just one command. Just use one of the power states (halted, running, or suspended) and you can turn a big cloud management job into a tiny one!