37.4. Starting and Controlling Xen Domains

Before the guest domain may be started, the Xen hypervisor must have enough free memory for the new guest. First, check the amount of memory used:

xm list
Name              Id  Mem(MB)  CPU  State  Time(s)  Console
Domain-0           0      458    0  r----    181.8

If this is a computer with 512 MB, the Xen hypervisor takes away 64 MB and Domain-0 occupies the rest. To free some of the memory for the new guest, the command xm balloon is used. To set the size of Domain-0 to 330 MB, enter the following as root:

xm balloon 0 330

In the next xm list, the memory usage of Domain-0 should have dropped to 330 MB. Now there is enough memory available to start a guest with 128 MB. The command xm start guest1 -c starts the guest and links the console of the starting guest to the current terminal. If this is the first time that this guest starts, finish the installation with YaST.

It is always possible to detach this console or reattach it from another terminal. To detach, use Ctrl-]. To reattach, first check the ID of the needed guest with xm list and attach to that ID with xm console ID.

The xm tool of Xen has many possible parameters. View a list with a short explanation by entering xm help. Table 37.1, “xm Commands” provides some of the most important commands as a starting point.

Table 37.1. xm Commands

xm help

Print a list of commands that are available for the xm tool.

xm console ID

Connect to the first console (tty1) of the guest with ID ID.

xm balloon ID Mem

Set the memory size of the domain with ID ID to Mem in MB.

xm create domname [-c]

Start the domain with configuration file domname. The optional -c links the current terminal to the first tty of the new guest.

xm shutdown ID

Do a normal shutdown of the guest with ID ID.

xm destroy ID

Terminate the guest with ID ID immediately.

xm list

Print a list of all running domains with their respective ID, memory, and CPU time values.

xm info

Display information about the Xen host, including CPU and memory information.