NAME

xl - Xen management tool, based on libxenlight

SYNOPSIS

xl subcommand [args]

DESCRIPTION

The xl program is the new tool for managing Xen guest domains. The program can be used to create, pause, and shutdown domains. It can also be used to list current domains, enable or pin VCPUs, and attach or detach virtual block devices.

The basic structure of every xl command is almost always:

Where subcommand is one of the subcommands listed below, domain-id is the numeric domain id, or the domain name (which will be internally translated to domain id), and OPTIONS are subcommand specific options. There are a few exceptions to this rule in the cases where the subcommand in question acts on all domains, the entire machine, or directly on the Xen hypervisor. Those exceptions will be clear for each of those subcommands.

NOTES

start the script /etc/init.d/xencommons at boot time

Most xl operations rely upon xenstored and xenconsoled: make sure you start the script /etc/init.d/xencommons at boot time to initialize all the daemons needed by xl.

setup a xenbr0 bridge in dom0

In the most common network configuration, you need to setup a bridge in dom0 named xenbr0 in order to have a working network in the guest domains. Please refer to the documentation of your Linux distribution to know how to setup the bridge.

autoballoon

If you specify the amount of memory dom0 has, passing dom0_mem to Xen, it is highly recommended to disable autoballoon. Edit /etc/xen/xl.conf and set it to 0.

run xl as root

Most xl commands require root privileges to run due to the communications channels used to talk to the hypervisor. Running as non root will return an error.

GLOBAL OPTIONS

Some global options are always available:

-v

Verbose.

-N

Dry run: do not actually execute the command.

-f

Force execution: xl will refuse to run some commands if it detects that xend is also running, this option will force the execution of those commands, even though it is unsafe.

-t

Always use carriage-return-based overwriting for displaying progress messages without scrolling the screen. Without -t, this is done only if stderr is a tty.

-T

Include timestamps and pid of the xl process in output.

DOMAIN SUBCOMMANDS

The following subcommands manipulate domains directly. As stated previously, most commands take domain-id as the first parameter.

button-press domain-id button

This command is deprecated. Please use xl trigger instead.

Indicate an ACPI button press to the domain, where button can be 'power' or 'sleep'. This command is only available for HVM domains.

create [configfile] [OPTIONS]

The create subcommand takes a config file as its first argument: see xl.cfg(5) for full details of the file format and possible options. If configfile is missing xl creates the domain assuming the default values for every option.

configfile has to be an absolute path to a file.

Create will return as soon as the domain is started. This does not mean the guest OS in the domain has actually booted, or is available for input.

If the -F option is specified, create will start the domain and not return until its death.

OPTIONS

-q, --quiet

No console output.

-f=FILE, --defconfig=FILE

Use the given configuration file.

-p

Leave the domain paused after it is created.

-F

Run in foreground until death of the domain.

-V, --vncviewer

Attach to domain's VNC server, forking a vncviewer process.

-A, --vncviewer-autopass

Pass the VNC password to vncviewer via stdin.

-c

Attach console to the domain as soon as it has started. This is useful for determining issues with crashing domains and just as a general convenience since you often want to watch the domain boot.

key=value

It is possible to pass key=value pairs on the command line to provide options as if they were written in the configuration file; these override whatever is in the configfile.

NB: Many config options require characters such as quotes or brackets which are interpreted by the shell (and often discarded) before being passed to xl, resulting in xl being unable to parse the value correctly. A simple work-around is to put all extra options within a single set of quotes, separated by semicolons. (See below for an example.)

EXAMPLES

with extra parameters
xl create hvm.cfg 'cpus="0-3"; pci=["01:05.1","01:05.2"]'

This creates a domain with the file hvm.cfg, but additionally pins it to cpus 0-3, and passes through two PCI devices.

config-update domain-id [configfile] [OPTIONS]

Update the saved configuration for a running domain. This has no immediate effect but will be applied when the guest is next restarted. This command is useful to ensure that runtime modifications made to the guest will be preserved when the guest is restarted.

Since Xen 4.5 xl has improved capabilities to handle dynamic domain configuration changes and will preserve any changes made at runtime when necessary. Therefore it should not normally be necessary to use this command any more.

configfile has to be an absolute path to a file.

OPTIONS

-f=FILE, --defconfig=FILE

Use the given configuration file.

key=value

It is possible to pass key=value pairs on the command line to provide options as if they were written in the configuration file; these override whatever is in the configfile. Please see the note under create on handling special characters when passing key=value pairs on the command line.

console [OPTIONS] domain-id

Attach to the console of a domain specified by domain-id. If you've set up your domains to have a traditional login console this will look much like a normal text login screen.

Use the key combination Ctrl+] to detach from the domain console.

OPTIONS

-t [pv|serial]

Connect to a PV console or connect to an emulated serial console. PV consoles are the only consoles available for PV domains while HVM domains can have both. If this option is not specified it defaults to emulated serial for HVM guests and PV console for PV guests.

-n NUM

Connect to console number NUM. Console numbers start from 0.

destroy [OPTIONS] domain-id

Immediately terminate the domain specified by domain-id. This doesn't give the domain OS any chance to react, and is the equivalent of ripping the power cord out on a physical machine. In most cases you will want to use the shutdown command instead.

OPTIONS

-f

Allow domain 0 to be destroyed. Because a domain cannot destroy itself, this is only possible when using a disaggregated toolstack, and is most useful when using a hardware domain separated from domain 0.

domid domain-name

Converts a domain name to a domain id.

domname domain-id

Converts a domain id to a domain name.

rename domain-id new-name

Change the domain name of a domain specified by domain-id to new-name.

dump-core domain-id [filename]

Dumps the virtual machine's memory for the specified domain to the filename specified, without pausing the domain. The dump file will be written to a distribution specific directory for dump files, for example: /var/lib/xen/dump/dump.

help [--long]

Displays the short help message (i.e. common commands) by default.

If the --long option is specified, it displays the complete set of xl subcommands, grouped by function.

list [OPTIONS] [domain-id ...]

Displays information about one or more domains. If no domains are specified it displays information about all domains.

OPTIONS

-l, --long

The output for xl list is not the table view shown below, but instead presents the data as a JSON data structure.

-Z, --context

Also displays the security labels.

-v, --verbose

Also displays the domain UUIDs, the shutdown reason and security labels.

-c, --cpupool

Also displays the cpupool the domain belongs to.

-n, --numa

Also displays the domain NUMA node affinity.

EXAMPLE

An example format for the list is as follows:

Name                                        ID   Mem VCPUs      State   Time(s)
Domain-0                                     0   750     4     r-----   11794.3
win                                          1  1019     1     r-----       0.3
linux                                        2  2048     2     r-----    5624.2

Name is the name of the domain. ID the numeric domain id. Mem is the desired amount of memory to allocate to the domain (although it may not be the currently allocated amount). VCPUs is the number of virtual CPUs allocated to the domain. State is the run state (see below). Time is the total run time of the domain as accounted for by Xen.

STATES

The State field lists 6 states for a Xen domain, and which ones the current domain is in.

r - running

The domain is currently running on a CPU.

b - blocked

The domain is blocked, and not running or runnable. This can be because the domain is waiting on IO (a traditional wait state) or has gone to sleep because there was nothing else for it to do.

p - paused

The domain has been paused, usually occurring through the administrator running xl pause. When in a paused state the domain will still consume allocated resources (like memory), but will not be eligible for scheduling by the Xen hypervisor.

s - shutdown

The guest OS has shut down (SCHEDOP_shutdown has been called) but the domain is not dying yet.

c - crashed

The domain has crashed, which is always a violent ending. Usually this state only occurs if the domain has been configured not to restart on a crash. See xl.cfg(5) for more info.

d - dying

The domain is in the process of dying, but hasn't completely shut down or crashed.

NOTES

mem-set domain-id mem

Set the target for the domain's balloon driver.

The default unit is kiB. Add 't' for TiB, 'g' for GiB, 'm' for MiB, 'k' for kiB, and 'b' for bytes (e.g., `2048m` for 2048 MiB).

This must be less than the initial maxmem parameter in the domain's configuration.

Note that this operation requests the guest operating system's balloon driver to reach the target amount of memory. The guest may fail to reach that amount of memory for any number of reasons, including:

Warning: There is no good way to know in advance how small of a mem-set will make a domain unstable and cause it to crash. Be very careful when using this command on running domains.

mem-max domain-id mem

Specify the limit Xen will place on the amount of memory a guest may allocate.

The default unit is kiB. Add 't' for TiB, 'g' for GiB, 'm' for MiB, 'k' for kiB, and 'b' for bytes (e.g., `2048m` for 2048 MiB).

mem can't be set lower than the current memory target for domain-id. It is allowed to be higher than the configured maximum memory size of the domain (maxmem parameter in the domain's configuration).

Setting the maximum memory size above the configured maximum memory size will require special guest support (memory hotplug) in order to be usable by the guest.

The domain will not receive any signal regarding the changed memory limit.

migrate [OPTIONS] domain-id host

Migrate a domain to another host machine. By default xl relies on ssh as a transport mechanism between the two hosts.

OPTIONS

-s sshcommand

Use <sshcommand> instead of ssh. String will be passed to sh. If empty, run <host> instead of ssh <host> xl migrate-receive [-d -e].

-e

On the new <host>, do not wait in the background for the death of the domain. See the corresponding option of the create subcommand.

-C config

Send the specified <config> file instead of the file used on creation of the domain.

--debug

Display huge (!) amount of debug information during the migration process.

-p

Leave the domain on the receive side paused after migration.

-D

Preserve the domain-id in the domain coniguration that is transferred such that it will be identical on the destination host, unless that configuration is overridden using the -C option. Note that it is not possible to use this option for a 'localhost' migration.

remus [OPTIONS] domain-id host

Enable Remus HA or COLO HA for domain. By default xl relies on ssh as a transport mechanism between the two hosts.

NOTES

COLO disk configuration looks like:

disk = ['...,colo,colo-host=xxx,colo-port=xxx,colo-export=xxx,active-disk=xxx,hidden-disk=xxx...']

The supported options are:

colo-host : Secondary host's ip address.
colo-port : Secondary host's port, we will run a nbd server on the secondary host, and the nbd server will listen on this port.
colo-export : Nbd server's disk export name of the secondary host.
active-disk : Secondary's guest write will be buffered to this disk, and it's used by the secondary.
hidden-disk : Primary's modified contents will be buffered in this disk, and it's used by the secondary.

COLO network configuration looks like:

vif = [ '...,forwarddev=xxx,...']

The supported options are:

forwarddev : Forward devices for the primary and the secondary, they are directly connected.

OPTIONS

-i MS

Checkpoint domain memory every MS milliseconds (default 200ms).

-u

Disable memory checkpoint compression.

-s sshcommand

Use <sshcommand> instead of ssh. String will be passed to sh. If empty, run <host> instead of ssh <host> xl migrate-receive -r [-e].

-e

On the new <host>, do not wait in the background for the death of the domain. See the corresponding option of the create subcommand.

-N netbufscript

Use <netbufscript> to setup network buffering instead of the default script (/etc/xen/scripts/remus-netbuf-setup).

-F

Run Remus in unsafe mode. Use this option with caution as failover may not work as intended.

-b

Replicate memory checkpoints to /dev/null (blackhole). Generally useful for debugging. Requires enabling unsafe mode.

-n

Disable network output buffering. Requires enabling unsafe mode.

-d

Disable disk replication. Requires enabling unsafe mode.

-c

Enable COLO HA. This conflicts with -i and -b, and memory checkpoint compression must be disabled.

-p

Use userspace COLO Proxy. This option must be used in conjunction with -c.

pause domain-id

Pause a domain. When in a paused state the domain will still consume allocated resources (such as memory), but will not be eligible for scheduling by the Xen hypervisor.

reboot [OPTIONS] domain-id

Reboot a domain. This acts just as if the domain had the reboot command run from the console. The command returns as soon as it has executed the reboot action, which may be significantly earlier than when the domain actually reboots.

For HVM domains this requires PV drivers to be installed in your guest OS. If PV drivers are not present but you have configured the guest OS to behave appropriately you may be able to use the -F option to trigger a reset button press.

The behavior of what happens to a domain when it reboots is set by the on_reboot parameter of the domain configuration file when the domain was created.

OPTIONS

-F

If the guest does not support PV reboot control then fallback to sending an ACPI power event (equivalent to the reset option to trigger).

You should ensure that the guest is configured to behave as expected in response to this event.

restore [OPTIONS] [configfile] checkpointfile

Build a domain from an xl save state file. See save for more info.

OPTIONS

-p

Do not unpause the domain after restoring it.

-e

Do not wait in the background for the death of the domain on the new host. See the corresponding option of the create subcommand.

-d

Enable debug messages.

-V, --vncviewer

Attach to the domain's VNC server, forking a vncviewer process.

-A, --vncviewer-autopass

Pass the VNC password to vncviewer via stdin.

save [OPTIONS] domain-id checkpointfile [configfile]

Saves a running domain to a state file so that it can be restored later. Once saved, the domain will no longer be running on the system, unless the -c or -p options are used. xl restore restores from this checkpoint file. Passing a config file argument allows the user to manually select the VM config file used to create the domain.

-c

Leave the domain running after creating the snapshot.

-p

Leave the domain paused after creating the snapshot.

-D

Preserve the domain-id in the domain coniguration that is embedded in the state file such that it will be identical when the domain is restored, unless that configuration is overridden. (See the restore operation above).

sharing [domain-id]

Display the number of shared pages for a specified domain. If no domain is specified it displays information about all domains.

shutdown [OPTIONS] -a|domain-id

Gracefully shuts down a domain. This coordinates with the domain OS to perform graceful shutdown, so there is no guarantee that it will succeed, and may take a variable length of time depending on what services must be shut down in the domain.

For HVM domains this requires PV drivers to be installed in your guest OS. If PV drivers are not present but you have configured the guest OS to behave appropriately you may be able to use the -F option to trigger a power button press.

The command returns immediately after signaling the domain unless the -w flag is used.

The behavior of what happens to a domain when it reboots is set by the on_shutdown parameter of the domain configuration file when the domain was created.

OPTIONS

-a, --all

Shutdown all guest domains. Often used when doing a complete shutdown of a Xen system.

-w, --wait

Wait for the domain to complete shutdown before returning. If given once, the wait is for domain shutdown or domain death. If given multiple times, the wait is for domain death only.

-F

If the guest does not support PV shutdown control then fallback to sending an ACPI power event (equivalent to the power option to trigger).

You should ensure that the guest is configured to behave as expected in response to this event.

sysrq domain-id letter
<