=head1 NAME xm - Xen management user interface =head1 SYNOPSIS B I [I] =head1 DESCRIPTION The B program is the main interface 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 B command is almost always: =over 2 B I I [I] =back Where I is one of the subcommands listed below, I is the numeric domain id, or the domain name (which will be internally translated to domain id), and I 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. =head1 NOTES All B operations rely upon the Xen control daemon, aka B. For any B commands to run, xend must also be running. For this reason you should start xend as a service when your system first boots using Xen. Most B 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. Most B commands act asynchronously, so just because the B command returned doesn't mean the action is complete. This is important, as many operations on domains, like create and shutdown, can take considerable time (30 seconds or more) to bring the machine into a fully compliant state. If you want to know when one of these actions has finished you must poll through B periodically. =head1 DOMAIN SUBCOMMANDS The following subcommands manipulate domains directly. As stated previously, most commands take I as the first parameter. =over 4 =item B I Attach to domain I's console. If you've set up your domains to have a traditional log in console this will look much like a normal text log in screen. This uses the back end xenconsole service which currently only works for para-virtual domains. The attached console will perform much like a standard serial console, so running curses based interfaces over the console B. Vi tends to get very odd when using it over this interface. =item B [B<-c>] I [I=I].. The create sub command requires a config file and can optionally take a series of name value pairs that add to or override variables defined in the config file. See L for full details of that file format, and possible options used in either the configfile or I=I combinations. I can either be an absolute path to a file, or a relative path to a file located in /etc/xen. Create will return B as the domain is started. This B mean the guest OS in the domain has actually booted, or is available for input. B =over 4 =item B<-c> Attache console to the domain as soon as it has started. This is useful for determining issues with crashing domains. =back B =over 4 =item I xm create Fedora4 This creates a domain with the file /etc/xen/Fedora4, and returns as soon as it is run. =item I xm create /dev/null ramdisk=initrd.img \ kernel=/boot/vmlinuz-2.6.12.6-xenU \ name=ramdisk nics=0 vcpus=1 \ memory=64 root=/dev/ram0 This creates the domain without using a config file (more specifically using /dev/null as an empty config file), kernel and ramdisk as specified, setting the name of the domain to "ramdisk", also disabling virtual networking. (This example comes from the xm-test test suite.) =back =item B I Immediately terminate the domain I. 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 B command instead. =item B I Converts a domain name to a domain id using xend's internal mapping. =item B I Converts a domain id to a domain name using xend's internal mapping. =item B [B<--long>] Displays the short help message (i.e. common commands). The B<--long> option prints out the complete set of B subcommands, grouped by function. =item B [B<--long> | B<--label>] [I ...] Prints information about one or more domains. If no domains are specified it prints out information about all domains. An example format for the list is as follows: Name ID Mem(MiB) VCPUs State Time(s) Domain-0 0 98 1 r----- 5068.6 Fedora3 164 128 1 r----- 7.6 Fedora4 165 128 1 ------ 0.6 Mandrake2006 166 128 1 -b---- 3.6 Mandrake10.2 167 128 1 ------ 2.5 Suse9.2 168 100 1 ------ 1.8 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. B =over 4 The State field lists 6 states for a Xen domain, and which ones the current domain is in. =item B The domain is currently running on a CPU. =item B The domain is blocked, and not running or runnable. This can be caused 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. =item B

The domain has been paused, usually occurring through the administrator running B. 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. =item B FIXME: Why would you ever see this state? =item B The domain has crashed, which is always a violent ending. Usually this state can only occur if the domain has been configured not to restart on crash. See L for more info. =item B The domain is in process of dying, but hasn't completely shutdown or crashed. FIXME: Is this right? =back B =over 4 If B<--long> is specified, the output for B is not the table view shown above, but instead is an S-Expression representing all information known about all domains asked for. This is mostly only useful for external programs to parse the data. B There is no stable guarantees on the format of this data. Use at your own risk. =back B

=over 4 This subcommand shows all labels that are defined and which can be attached to domains. xm labels example.client_v1 type=dom will print for our example policy: dom_BoincClient dom_Fun dom_HomeBanking dom_NetworkDomain dom_StorageDomain dom_SystemManagement =back B =over 4 The B subcommand can attach a security label to a domain configuration file, here a HomeBanking label. The example policy ensures that this domain does not share information with other non-homebanking user domains (i.e., domains labeled as dom_Fun or dom_Boinc) and that it will not run simultaneously with domains labeled as dom_Fun. We assume that the specified myconfig.xm configuration file actually instantiates a domain that runs workloads related to home-banking, probably just a browser environment for online-banking. xm addlabel dom_HomeBanking dom myconfig.xm The very simple configuration file might now look as printed below. The B subcommand added the B entry at the end of the file, consisting of a label name and the policy that specifies this label name: kernel = "/boot/vmlinuz-2.6.16-xen" ramdisk="/boot/U1_home_banking_ramdisk.img" memory = 164 name = "homebanking" vif = [ '' ] dhcp = "dhcp" access_control = ['policy=example.chwall_ste.client_v1, label=dom_HomeBanking'] Security labels must be assigned to domain configurations because these labels are essential for making access control decisions as early as during the configuration phase of a newly instantiated domain. Consequently, a security-enabled Xen hypervisor will only start domains that have a security label configured and whose security label is consistent with the currently enforced policy. Otherwise, starting the domain will fail with the error condition "operation not permitted". =back B =over 4 The addlabel subcommand supports labeling of domains that are managed by xend. This includes domains that are currently running, such as for example Domain-0, or those that are in a dormant state. Depending on the state of the system, it is possible that the new label is rejected. An example for a reason for the rejection of the relabeling of a domain would be if a domain is currently allowed to access its labeled resources but due to the new label would be prevented from accessing one or more of them. xm addlabel dom_Fun mgt Domain-0 This changes the label of Domain-0 to dom_Fun under the condition that this new label of Domain-0 would not prevent any other domain from accessing its resources that are provided through Domain-0, such as for example network or block device access. =back B =over 4 The B subcommand can also be used to attach a security label to a resource. Following the home banking example from above, we can label a disk resource (e.g., a physical partition or a file) to make it accessible to the home banking domain. The example policy provides a resource label, res_LogicalDiskPartition1(hda1), that is compatible with the HomeBanking domain label. xm addlabel "res_LogicalDiskPartition1(hda1)" res phy:hda6 After labeling this disk resource, it can be attached to the domain by adding a line to the domain configuration file. The line below attaches this disk to the domain at boot time. disk = [ 'phy:hda6,sda2,w' ] Alternatively, the resource can be attached after booting the domain by using the B subcommand. xm block-attach homebanking phy:hda6 sda2 w Note that labeled resources cannot be used when security is turned off. Any attempt to use labeled resources with security turned off will result in a failure with a corresponding error message. The solution is to enable security or, if security is no longer desired, to remove the resource label using the B subcommand. =back B =over 4 xm create myconfig.xm xm list --label Name ID ... Time(s) Label homebanking 23 ... 4.4 dom_HomeBanking Domain-0 0 ... 2658.8 dom_SystemManagement =back B =over 4 xm resources phy:hda6 type: ACM policy: example.chwall_ste.client_v1 label: res_LogicalDiskPartition1(hda1) file:/xen/disk_image/disk.img type: ACM policy: example.chwall_ste.client_v1 label: res_LogicalDiskPartition2(hda2) =back B =over 4 We distinguish three representations of the Xen access control policy: the source XML version, its binary counterpart, and a mapping representation that enables the tools to deterministically translate back and forth between label names of the XML policy and label identifiers of the binary policy. All three versions must be kept consistent to achieve predictable security guarantees. The XML version is the version that users are supposed to create or change, either by manually editing the XML file or by using the Xen policy generation tool (B). After changing the XML file, run the B subcommand to ensure that the new policy is available to xend. Use, for example, the subcommand B to activate the changes during the next system reboot. The binary version of the policy is derived from the XML policy by tokenizing the specified labels and is used inside Xen only. It is created with the B subcommand. Essentially, the binary version is much more compact than the XML version and is easier to evaluate during access control decisions. The mapping version of the policy is created during the XML-to-binary policy translation (B) and is used by xend and the management tools to translate between label names used as input to the tools and their binary identifiers (ssidrefs) used inside Xen. =back =head1 SEE ALSO B(5), B(1) =head1 AUTHOR Sean Dague Daniel Stekloff Reiner Sailer Stefan Berger =head1 BUGS