17.2. Creating and Managing Domains with xm
You can use the xm application to create and manage domains.
You can use xm to connect to a domain or virtual machine:
xm console domain-id
This causes the console to attach to the domain-id's text console.
You can use xm to make a domain:
xm create domain001 [-c]
This creates a domain named domain001 with the file residing in the /etc/xen/ directory. The [-c]option aids with troubleshooting by allowing you to connect to the text console.
You can use xm to terminate a domain-id:
xm destroy [domain-id]
This instantly terminates the domain-id. If you prefer another method of safely terminating your session, you can use the shutdown parameter instead.
You can use xm to shut down any domain:
xm shutdown [domain-id] [ -a | -w ]
The [ -a] option shuts down all domains on your system. The [-w] option waits for a domain to completely shut down.
You can use xm to restore a previously saved domain.
xm restore [state-file]
You can use xm to resume a previously suspended session:
xm resume [domain-id]
You can use xm to reboot a domain:
xm reboot [domain-id] [ -a | -w ]
The [ -a] option reboots all domains on your system. The [-w]option waits for a domain to completely reboot. You can control the behavior of the rebooting domain by modifying the on_boot parameter of the xmdomain.cfg file.
You can use xm to assign a new name to an existing domain:
xm rename [domain-name] [new domain-name]
Domain renaming will keep the same settings (same hard disk, same memory, etc.).
You can use xm to unpause a domain:
xm unpause [domain-id]
This makes the domain available for scheduling by a hypervisor.
You can use xm to convert a domain name to a domain ID:
xm domid [domain-name]
You can use xm to convert a domain ID to a domain name:
xm domname [domain-id]
You can use xm to modify a domain's memory allocation:
xm mem-set [domain-id] [count]
You cannot grow a domain's memory beyond the maximum amount you specified when you first created the domain.
You can use xm to modify a domain's maximum memory:
xm mem-max [domain-id] [count]
You must specify the [count] in megabytes.
You can use xm to modify a domain's VCPU count:
xm vcpu-set [domain-id] [count]
You must specify the [count] in megabytes.
You cannot grow a domain's memory beyond the maximum amount you specified when you first created the domain.
You can use xm to pin a VCPU:
xm vcpu-pin [domain-id] [vcpu] [cpus]
Where [vcpu] is the VCPU that you want to attach to, and [cpus] is the target. Pinning ensures that certain VCPUs can only run on certain CPUs.
You can use xm to migrate a domain:
xm migrate [domain-id] [host] [options]
Where [domain-id] is the domain you want to migrate, and [host] is the target. The [options] include ——live (or -l) for a live migration, or ——resource (or -r) to specify maximum speed of the migration (in Mbs).
To ensure a successful migration, you must ensure that the xend daemon is running on all hosts domains. All hosts must also be running Red Hat RHEL 5.0+ and have migration TCP ports open to accept connections from the source hosts.