17.2. Creating and Managing Domains with xm

17.2. Creating and Managing Domains with xm

17.2. Creating and Managing Domains with xm

You can use the xm application to create and manage domains.

17.2.1. Connecting to a Domain

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.

17.2.2. Creating a Domain

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.

17.2.3. Saving a Domain

You can use xm to save a domain:

xm save [domain-id] [statefile] 

17.2.4. Terminating a Domain ID

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.

17.2.5. Shutting Down a Domain

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.

17.2.6. Restoring a Domain

You can use xm to restore a previously saved domain.

xm restore [state-file] 

17.2.7. Suspending a Domain

You can use xm to suspend a domain:

xm suspend [domain-id]

17.2.8. Resuming a Domain

You can use xm to resume a previously suspended session:

xm resume [domain-id] 

17.2.9. Rebooting a Domain

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.

17.2.10. Renaming a Domain

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.).

17.2.11. Pausing a Domain

You can use xm to pause a domain:

xm pause [domain-id]

17.2.12. Unpausing a Domain

You can use xm to unpause a domain:

xm unpause [domain-id]

This makes the domain available for scheduling by a hypervisor.

17.2.13. Converting a Domain Name to Domain ID

You can use xm to convert a domain name to a domain ID:

xm domid [domain-name] 

17.2.14. Converting a Domain ID to Domain Name

You can use xm to convert a domain ID to a domain name:

xm domname [domain-id]  

17.2.15. Configuring Memory Allocation

You can use xm to modify a domain's memory allocation:

xm mem-set [domain-id] [count]  

Note

You cannot grow a domain's memory beyond the maximum amount you specified when you first created the domain.

17.2.16. Configuring Maximum Memory

You can use xm to modify a domain's maximum memory:

 
xm mem-max [domain-id] [count] 

You must specify the [count] in megabytes.

17.2.17. Configuring VCPU Count

You can use xm to modify a domain's VCPU count:

 
xm vcpu-set [domain-id] [count]  

You must specify the [count] in megabytes.

Note

You cannot grow a domain's memory beyond the maximum amount you specified when you first created the domain.

17.2.18. Pinning a VCPU

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.

17.2.19. Migrating a Domain

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.