The xm command provides a command line interface for managing virtual machines. It can be used to create, pause, and shut down virtual machines. It can also be used to list the current domains, enable or pin virtual CPUs, and attach or detach block devices. For example, the xm list command displays the status of all virtual machines.
# xm list Name ID Mem VCPUs State Time(s) Domain-0 0 457 2 r----- 2712.9 OES 7 512 1 -b---- 16.3 SLES10 512 1 12.9
The syntax of the xm command usually follows the format:
xm <subcommand> [domain-id] [OPTIONS]
where subcommand is the xm command to run, domain-id is the ID number assigned to a domain or the name of the virtual machine, and OPTIONS indicates subcommand-specific options.
Other useful xm commands include:
xm start starts a virtual machine
xm reboot reboots a virtual machine
xm destroy immediately terminates a virtual machine
xm block-list displays all virtual block devices attached to a virtual machine
All xm operations require that the Xen control daemon, xend, be running. For this reason, you should make sure xend starts whenever the host boots.
Most xm commands require root privileges to allow interaction with the Xen hypervisor. Entering the xm command when you are not logged in as root returns an error.
Some xm commands return no information even though the action is completed. In some instances, for example, when shutting down a virtual machine, the action can take several seconds to complete. To verify that the action has completed, you might need to view its status another way, such as, using the xm list command.
For a complete list of xm command parameters, enter xm help at the command line or read the manual page of xm.