view docs/man/xm.pod.1 @ 17183:96453af916b9

x86_emulate: Load FPU context before FWAIT.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
author Keir Fraser <keir.fraser@citrix.com>
date Tue Mar 04 13:28:00 2008 +0000 (2008-03-04)
parents 62fc84adc8ed
children c6f80d1227cb
line source
1 =head1 NAME
3 xm - Xen management user interface
5 =head1 SYNOPSIS
7 B<xm> I<subcommand> [I<args>]
11 The B<xm> program is the main interface for managing Xen guest
12 domains. The program can be used to create, pause, and shutdown
13 domains. It can also be used to list current domains, enable or pin
14 VCPUs, and attach or detach virtual block devices.
16 The basic structure of every B<xm> command is almost always:
18 =over 2
20 B<xm> I<subcommand> I<domain-id> [I<OPTIONS>]
22 =back
24 Where I<subcommand> is one of the subcommands listed below, I<domain-id>
25 is the numeric domain id, or the domain name (which will be internally
26 translated to domain id), and I<OPTIONS> are subcommand specific
27 options. There are a few exceptions to this rule in the cases where
28 the subcommand in question acts on all domains, the entire machine,
29 or directly on the Xen hypervisor. Those exceptions will be clear for
30 each of those subcommands.
32 =head1 NOTES
34 All B<xm> operations rely upon the Xen control daemon, aka B<xend>.
35 For any B<xm> commands to run, xend must also be running. For this
36 reason you should start xend as a service when your system first boots
37 using Xen.
39 Most B<xm> commands require root privileges to run due to the
40 communications channels used to talk to the hypervisor. Running as
41 non root will return an error.
43 Most B<xm> commands act asynchronously, so just because the B<xm>
44 command returned doesn't mean the action is complete. This is
45 important, as many operations on domains, like create and shutdown,
46 can take considerable time (30 seconds or more) to bring the machine
47 into a fully compliant state. If you want to know when one of these
48 actions has finished you must poll through B<xm list> periodically.
52 The following subcommands manipulate domains directly. As stated
53 previously, most commands take I<domain-id> as the first parameter.
55 =over 4
57 =item B<console> I<domain-id>
59 Attach to domain I<domain-id>'s console. If you've set up your domains to
60 have a traditional log in console this will look much like a normal
61 text log in screen.
63 This uses the back end xenconsole service which currently only
64 works for para-virtual domains.
66 The attached console will perform much like a standard serial console,
67 so running curses based interfaces over the console B<is not
68 advised>. Vi tends to get very odd when using it over this interface.
70 =item B<create> [B<-c>] I<configfile> [I<name>=I<value>]..
72 The create sub command requires a config file and can optionally take a
73 series of name value pairs that add to or override variables defined
74 in the config file. See L<xmdomain.cfg> for full details of that file
75 format, and possible options used in either the configfile or
76 I<name>=I<value> combinations.
78 I<configfile> can either be an absolute path to a file, or a relative
79 path to a file located in /etc/xen.
81 Create will return B<as soon> as the domain is started. This B<does
82 not> mean the guest OS in the domain has actually booted, or is
83 available for input.
87 =over 4
89 =item B<-c>
91 Attache console to the domain as soon as it has started. This is
92 useful for determining issues with crashing domains.
94 =back
98 =over 4
100 =item I<with config file>
102 xm create Fedora4
104 This creates a domain with the file /etc/xen/Fedora4, and returns as
105 soon as it is run.
107 =item I<without config file>
109 xm create /dev/null ramdisk=initrd.img \
110 kernel=/boot/vmlinuz- \
111 name=ramdisk vif='' vcpus=1 \
112 memory=64 root=/dev/ram0
114 This creates the domain without using a config file (more specifically
115 using /dev/null as an empty config file), kernel and ramdisk as
116 specified, setting the name of the domain to "ramdisk", also disabling
117 virtual networking. (This example comes from the xm-test test suite.)
119 =back
121 =item B<destroy> I<domain-id>
123 Immediately terminate the domain I<domain-id>. This doesn't give the
124 domain OS any chance to react, and is the equivalent of ripping the
125 power cord out on a physical machine. In most cases you will want to
126 use the B<shutdown> command instead.
128 =item B<domid> I<domain-name>
130 Converts a domain name to a domain id using xend's internal mapping.
132 =item B<domname> I<domain-id>
134 Converts a domain id to a domain name using xend's internal mapping.
136 =item B<help> [B<--long>]
138 Displays the short help message (i.e. common commands).
140 The B<--long> option prints out the complete set of B<xm> subcommands,
141 grouped by function.
143 =item B<list> [B<--long> | B<--label>] [I<domain-id> ...]
145 Prints information about one or more domains. If no domains are
146 specified it prints out information about all domains.
148 An example format for the list is as follows:
150 Name ID Mem(MiB) VCPUs State Time(s)
151 Domain-0 0 98 1 r----- 5068.6
152 Fedora3 164 128 1 r----- 7.6
153 Fedora4 165 128 1 ------ 0.6
154 Mandrake2006 166 128 1 -b---- 3.6
155 Mandrake10.2 167 128 1 ------ 2.5
156 Suse9.2 168 100 1 ------ 1.8
158 Name is the name of the domain. ID the numeric domain id. Mem is the
159 desired amount of memory to allocate to the domain (although it may
160 not be the currently allocated amount). VCPUs is the number of
161 virtual CPUs allocated to the domain. State is the run state (see
162 below). Time is the total run time of the domain as accounted for by
163 Xen.
167 =over 4
169 The State field lists 6 states for a Xen domain, and which ones the
170 current domain is in.
172 =item B<r - running>
174 The domain is currently running on a CPU.
176 =item B<b - blocked>
178 The domain is blocked, and not running or runnable. This can be caused
179 because the domain is waiting on IO (a traditional wait state) or has
180 gone to sleep because there was nothing else for it to do.
182 =item B<p - paused>
184 The domain has been paused, usually occurring through the administrator
185 running B<xm pause>. When in a paused state the domain will still
186 consume allocated resources like memory, but will not be eligible for
187 scheduling by the Xen hypervisor.
189 =item B<s - shutdown>
191 FIXME: Why would you ever see this state?
193 =item B<c - crashed>
195 The domain has crashed, which is always a violent ending. Usually
196 this state can only occur if the domain has been configured not to
197 restart on crash. See L<xmdomain.cfg> for more info.
199 =item B<d - dying>
201 The domain is in process of dying, but hasn't completely shutdown or
202 crashed.
204 FIXME: Is this right?
206 =back
210 =over 4
212 If B<--long> is specified, the output for B<xm list> is not the table
213 view shown above, but instead is an S-Expression representing all
214 information known about all domains asked for. This is mostly only
215 useful for external programs to parse the data.
217 B<Note:> There is no stable guarantees on the format of this data.
218 Use at your own risk.
220 =back
224 =over 4
226 If B<--label> is specified, the security labels are added to the
227 output of B<xm list> and the lines are sorted by the labels (ignoring
228 case). The B<--long> option prints the labels by default and cannot be
229 combined with B<--label>. See the ACCESS CONTROL SUBCOMMAND section of
230 this man page for more information about labels.
232 ==back
234 B<NOTES>
236 =over 4
238 The Time column is deceptive. Virtual IO (network and block devices)
239 used by domains requires coordination by Domain0, which means that
240 Domain0 is actually charged for much of the time that a DomainU is
241 doing IO. Use of this time value to determine relative utilizations
242 by domains is thus very suspect, as a high IO workload may show as
243 less utilized than a high CPU workload. Consider yourself warned.
245 =back
247 =item B<mem-max> I<domain-id> I<mem>
249 Specify the maximum amount of memory the domain is able to use. I<mem>
250 is specified in megabytes.
252 The mem-max value may not correspond to the actual memory used in the
253 domain, as it may balloon down its memory to give more back to the OS.
255 =item B<mem-set> I<domain-id> I<mem>
257 Set the domain's used memory using the balloon driver.
259 Because this operation requires cooperation from the domain operating
260 system, there is no guarantee that it will succeed. This command will
261 definitely not work unless the domain has the required paravirt
262 driver.
264 B<Warning:> There is no good way to know in advance how small of a
265 mem-set will make a domain unstable and cause it to crash. Be very
266 careful when using this command on running domains.
268 =item B<migrate> I<domain-id> I<host> [I<OPTIONS>]
270 Migrate a domain to another host machine. Xend must be running on
271 other host machine, it must be running the same version of Xen, it
272 must have the migration TCP port open and accepting connections from
273 the source host, and there must be sufficient resources for the domain
274 to run (memory, disk, etc).
276 Migration is pretty complicated, and has many security implications.
277 Please read the Xen User's Guide to ensure you understand the
278 ramifications and limitations on migration before attempting it in
279 production.
283 =over 4
285 =item B<-l>, B<--live>
287 Use live migration. This will migrate the domain between hosts
288 without shutting down the domain. See the Xen User's Guide for more
289 information.
291 =item B<-r>, B<--resource> I<Mbs>
293 Set maximum Mbs allowed for migrating the domain. This ensures that
294 the network link is not saturated with migration traffic while
295 attempting to do other useful work.
297 =back
299 =item B<pause> I<domain-id>
301 Pause a domain. When in a paused state the domain will still consume
302 allocated resources such as memory, but will not be eligible for
303 scheduling by the Xen hypervisor.
305 =item B<reboot> [I<OPTIONS>] I<domain-id>
307 Reboot a domain. This acts just as if the domain had the B<reboot>
308 command run from the console. The command returns as soon as it has
309 executed the reboot action, which may be significantly before the
310 domain actually reboots.
312 The behavior of what happens to a domain when it reboots is set by the
313 B<on_reboot> parameter of the xmdomain.cfg file when the domain was
314 created.
318 =over 4
320 =item B<-a>, B<--all>
322 Reboot all domains.
324 =item B<-w>, B<--wait>
326 Wait for reboot to complete before returning. This may take a while,
327 as all services in the domain will have to be shut down cleanly.
329 =back
331 =item B<restore> I<state-file>
333 Build a domain from an B<xm save> state file. See B<save> for more info.
335 =item B<save> I<domain-id> I<state-file>
337 Saves a running domain to a state file so that it can be restored
338 later. Once saved, the domain will no longer be running on the
339 system, thus the memory allocated for the domain will be free for
340 other domains to use. B<xm restore> restores from this state file.
342 This is roughly equivalent to doing a hibernate on a running computer,
343 with all the same limitations. Open network connections may be
344 severed upon restore, as TCP timeouts may have expired.
346 =item B<shutdown> [I<OPTIONS>] I<domain-id>
348 Gracefully shuts down a domain. This coordinates with the domain OS
349 to perform graceful shutdown, so there is no guarantee that it will
350 succeed, and may take a variable length of time depending on what
351 services must be shutdown in the domain. The command returns
352 immediately after signally the domain unless that B<-w> flag is used.
354 The behavior of what happens to a domain when it reboots is set by the
355 B<on_shutdown> parameter of the xmdomain.cfg file when the domain was
356 created.
360 =over 4
362 =item B<-a>
364 Shutdown B<all> domains. Often used when doing a complete shutdown of
365 a Xen system.
367 =item B<-w>
369 Wait for the domain to complete shutdown before returning.
371 =back
373 =item B<sysrq> I<domain-id> I<letter>
375 Send a I<Magic System Request> signal to the domain. For more
376 information on available magic sys req operations, see sysrq.txt in
377 your Linux Kernel sources.
379 =item B<unpause> I<domain-id>
381 Moves a domain out of the paused state. This will allow a previously
382 paused domain to now be eligible for scheduling by the Xen hypervisor.
384 =item B<vcpu-set> I<domain-id> I<vcpu-count>
386 Enables the I<vcpu-count> virtual CPUs for the domain in question.
387 Like mem-set, this command can only allocate up to the maximum virtual
388 CPU count configured at boot for the domain.
390 If the I<vcpu-count> is smaller than the current number of active
391 VCPUs, the highest number VCPUs will be hotplug removed. This may be
392 important for pinning purposes.
394 Attempting to set the VCPUs to a number larger than the initially
395 configured VCPU count is an error. Trying to set VCPUs to < 1 will be
396 quietly ignored.
398 Because this operation requires cooperation from the domain operating
399 system, there is no guarantee that it will succeed. This command will
400 not work with a full virt domain.
402 =item B<vcpu-list> [I<domain-id>]
404 Lists VCPU information for a specific domain. If no domain is
405 specified, VCPU information for all domains will be provided.
407 =item B<vcpu-pin> I<domain-id> I<vcpu> I<cpus>
409 Pins the the VCPU to only run on the specific CPUs. The keyword
410 B<all> can be used to apply the I<cpus> list to all VCPUs in the
411 domain.
413 Normally VCPUs can float between available CPUs whenever Xen deems a
414 different run state is appropriate. Pinning can be used to restrict
415 this, by ensuring certain VCPUs can only run on certain physical
416 CPUs.
418 =back
422 =over 4
424 =item B<dmesg> [B<-c>]
426 Reads the Xen message buffer, similar to dmesg on a Linux system. The
427 buffer contains informational, warning, and error messages created
428 during Xen's boot process. If you are having problems with Xen, this
429 is one of the first places to look as part of problem determination.
433 =over 4
435 =item B<-c>, B<--clear>
437 Clears Xen's message buffer.
439 =back
441 =item B<info>
443 Print information about the Xen host in I<name : value> format. When
444 reporting a Xen bug, please provide this information as part of the
445 bug report.
447 Sample output looks as follows (lines wrapped manually to make the man
448 page more readable):
450 host : talon
451 release :
452 version : #1 Mon Nov 14 14:26:26 EST 2005
453 machine : i686
454 nr_cpus : 2
455 nr_nodes : 1
456 cores_per_socket : 1
457 threads_per_core : 1
458 cpu_mhz : 696
459 hw_caps : 0383fbff:00000000:00000000:00000040
460 total_memory : 767
461 free_memory : 37
462 xen_major : 3
463 xen_minor : 0
464 xen_extra : -devel
465 xen_caps : xen-3.0-x86_32
466 xen_scheduler : credit
467 xen_pagesize : 4096
468 platform_params : virt_start=0xfc000000
469 xen_changeset : Mon Nov 14 18:13:38 2005 +0100
470 7793:090e44133d40
471 cc_compiler : gcc version 3.4.3 (Mandrakelinux
472 10.2 3.4.3-7mdk)
473 cc_compile_by : sdague
474 cc_compile_domain : (none)
475 cc_compile_date : Mon Nov 14 14:16:48 EST 2005
476 xend_config_format : 3
480 =over 4
482 Not all fields will be explained here, but some of the less obvious
483 ones deserve explanation:
485 =item B<hw_caps>
487 A vector showing what hardware capabilities are supported by your
488 processor. This is equivalent to, though more cryptic, the flags
489 field in /proc/cpuinfo on a normal Linux machine.
491 =item B<free_memory>
493 Available memory (in MB) not allocated to Xen, or any other domains.
495 =item B<xen_caps>
497 The Xen version and architecture. Architecture values can be one of:
498 x86_32, x86_32p (i.e. PAE enabled), x86_64, ia64.
500 =item B<xen_changeset>
502 The Xen mercurial changeset id. Very useful for determining exactly
503 what version of code your Xen system was built from.
505 =back
507 =item B<log>
509 Print out the xend log. This log file can be found in
510 /var/log/xend.log.
512 =item B<top>
514 Executes the B<xentop> command, which provides real time monitoring of
515 domains. Xentop is a curses interface, and reasonably self
516 explanatory.
518 =back
522 Xen ships with a number of domain schedulers, which can be set at boot
523 time with the B<sched=> parameter on the Xen command line. By
524 default B<credit> is used for scheduling.
526 FIXME: we really need a scheduler expert to write up this section.
528 =over 4
530 =item B<sched-credit> [ B<-d> I<domain-id> [ B<-w>[B<=>I<WEIGHT>] | B<-c>[B<=>I<CAP>] ] ]
532 Set credit scheduler parameters. The credit scheduler is a
533 proportional fair share CPU scheduler built from the ground up to be
534 work conserving on SMP hosts.
536 Each domain (including Domain0) is assigned a weight and a cap.
540 =over 4
542 =item I<WEIGHT>
544 A domain with a weight of 512 will get twice as much CPU as a domain
545 with a weight of 256 on a contended host. Legal weights range from 1
546 to 65535 and the default is 256.
548 =item I<CAP>
550 The cap optionally fixes the maximum amount of CPU a domain will be
551 able to consume, even if the host system has idle CPU cycles. The cap
552 is expressed in percentage of one physical CPU: 100 is 1 physical CPU,
553 50 is half a CPU, 400 is 4 CPUs, etc. The default, 0, means there is
554 no upper cap.
556 =back
558 =item B<sched-sedf> I<period> I<slice> I<latency-hint> I<extratime> I<weight>
560 Set Simple EDF (Earliest Deadline First) scheduler parameters. This
561 scheduler provides weighted CPU sharing in an intuitive way and uses
562 realtime-algorithms to ensure time guarantees. For more information
563 see docs/misc/sedf_scheduler_mini-HOWTO.txt in the Xen distribution.
567 =over 4
569 =item I<period>
571 The normal EDF scheduling usage in nanoseconds
573 =item I<slice>
575 The normal EDF scheduling usage in nanoseconds
577 FIXME: these are lame, should explain more.
579 =item I<latency-hint>
581 Scaled period if domain is doing heavy I/O.
583 =item I<extratime>
585 Flag for allowing domain to run in extra time.
587 =item I<weight>
589 Another way of setting CPU slice.
591 =back
595 I<normal EDF (20ms/5ms):>
597 xm sched-sedf <dom-id> 20000000 5000000 0 0 0
599 I<best-effort domains (i.e. non-realtime):>
601 xm sched-sedf <dom-id> 20000000 0 0 1 0
603 I<normal EDF (20ms/5ms) + share of extra-time:>
605 xm sched-sedf <dom-id> 20000000 5000000 0 1 0
607 I<4 domains with weights 2:3:4:2>
609 xm sched-sedf <d1> 0 0 0 0 2
610 xm sched-sedf <d2> 0 0 0 0 3
611 xm sched-sedf <d3> 0 0 0 0 4
612 xm sched-sedf <d4> 0 0 0 0 2
614 I<1 fully-specified (10ms/3ms) domain, 3 other domains share available
615 rest in 2:7:3 ratio:>
617 xm sched-sedf <d1> 10000000 3000000 0 0 0
618 xm sched-sedf <d2> 0 0 0 0 2
619 xm sched-sedf <d3> 0 0 0 0 7
620 xm sched-sedf <d4> 0 0 0 0 3
622 =back
626 Most virtual devices can be added and removed while guests are
627 running. The effect to the guest OS is much the same as any hotplug
628 event.
630 =head2 BLOCK DEVICES
632 =over 4
634 =item B<block-attach> I<domain-id> I<be-dev> I<fe-dev> I<mode> [I<bedomain-id>]
636 Create a new virtual block device. This will trigger a hotplug event
637 for the guest.
641 =over 4
643 =item I<domain-id>
645 The domain id of the guest domain that the device will be attached to.
647 =item I<be-dev>
649 The device in the backend domain (usually domain 0) to be exported.
650 This can be specified as a physical partition (phy:sda7) or as a file
651 mounted as loopback (file://path/to/loop.iso).
653 =item I<fe-dev>
655 How the device should be presented to the guest domain. It can be
656 specified as either a symbolic name, such as /dev/hdc, for common
657 devices, or by device id, such as 0x1400 (/dev/hdc device id in hex).
659 =item I<mode>
661 The access mode for the device from the guest domain. Supported modes
662 are B<w> (read/write) or B<r> (read-only).
664 =item I<bedomain-id>
666 The back end domain hosting the device. This defaults to domain 0.
668 =back
672 =over 4
674 =item I<Mount an ISO as a Disk>
676 xm block-attach guestdomain file://path/to/dsl-2.0RC2.iso /dev/hdc ro
678 This will mount the dsl ISO as /dev/hdc in the guestdomain as a read
679 only device. This will probably not be detected as a CD-ROM by the
680 guest, but mounting /dev/hdc manually will work.
682 =back
684 =item B<block-detach> I<domain-id> I<devid> [B<--force>]
686 Detach a domain's virtual block device. I<devid> may be the symbolic
687 name or the numeric device id given to the device by domain 0. You
688 will need to run B<xm block-list> to determine that number.
690 Detaching the device requires the cooperation of the domain. If the
691 domain fails to release the device (perhaps because the domain is hung
692 or is still using the device), the detach will fail. The B<--force>
693 parameter will forcefully detach the device, but may cause IO errors
694 in the domain.
696 =item B<block-list> [B<-l>|B<--long>] I<domain-id>
698 List virtual block devices for a domain. The returned output is
699 formatted as a list or as an S-Expression if the B<--long> option was given.
703 =item B<network-attach> I<domain-id> [B<script=>I<scriptname>] [B<ip=>I<ipaddr>]
704 [B<mac=>I<macaddr>] [B<bridge=>I<bridge-name>] [B<backend=>I<bedomain-id>]
706 Creates a new network device in the domain specified by I<domain-id>. It
707 takes the following optional options:
711 =over 4
713 =item B<script=>I<scriptname>
715 Use the specified script name to bring up the network. Defaults to
716 the default setting in xend-config.sxp for B<vif-script>.
718 =item B<ip=>I<ipaddr>
720 Passes the specified IP Address to the adapter on creation.
722 FIXME: this currently appears to be B<broken>. I'm not sure under what
723 circumstances this should actually work.
725 =item B<mac=>I<macaddr>
727 The MAC address that the domain will see on its Ethernet device. If
728 the device is not specified it will be randomly generated with the
729 00:16:3e vendor id prefix.
731 =item B<bridge=>I<bridge-name>
733 The name of the bridge to attach the vif to, in case you have more
734 than one. This defaults to xenbr0.
736 =item B<backend=>I<bedomain-id>
738 The backend domain id. By default this is domain 0.
740 =back
742 =item B<network-detach> I<domain-id> I<devid>
744 Removes the network device from the domain specified by I<domain-id>.
745 I<devid> is the virtual interface device number within the domain
746 (i.e. the 3 in vif22.3).
748 FIXME: this is currently B<broken>. Network devices aren't completely
749 removed from domain 0.
751 =item B<network-list> [B<-l>|B<--long>]> I<domain-id>
753 List virtual network interfaces for a domain. The returned output is
754 formatted as a list or as an S-Expression if the B<--long> option was given.
758 =item B<vtpm-list> [B<-l>|B<--long>] I<domain-id>
760 Show the virtual TPM device for a domain. The returned output is
761 formatted as a list or as an S-Expression if the B<--long> option was given.
763 =back
765 =head1 VNET COMMANDS
767 The Virtual Network interfaces for Xen.
769 FIXME: This needs a lot more explanation, or it needs to be ripped
770 out entirely.
772 =over 4
774 =item B<vnet-list> [B<-l>|B<--long>]
776 List vnets.
778 =item B<vnet-create> I<config>
780 Create a vnet from a config file.
782 =item B<vnet-delete> I<vnetid>
784 Delete a vnet.
786 =back
790 Access Control in Xen consists of two components: (i) The Access
791 Control Policy (ACP) defines security labels and access rules based on
792 these labels. (ii) The Access Control Module (ACM) makes access control
793 decisions by interpreting the policy when domains require to
794 communicate or to access resources. The Xen access control has
795 sufficient mechanisms in place to enforce the access decisions even
796 against maliciously acting user domains (mandatory access control).
798 Access rights for domains in Xen are determined by the domain security
799 label only and not based on the domain Name or ID. The ACP specifies
800 security labels that can then be assigned to domains and
801 resources. Every domain must be assigned exactly one security label,
802 otherwise access control decisions could become indeterministic. ACPs
803 are distinguished by their name, which is a parameter to most of the
804 subcommands described below. Currently, the ACP specifies two ways to
805 interpret labels:
807 (1) Simple Type Enforcement: Labels are interpreted to decide access
808 of domains to communication means and virtual or physical
809 resources. Communication between domains as well as access to
810 resources are forbidden by default and can only take place if they are
811 explicitly allowed by the security policy. The proper assignment of
812 labels to domains controls the sharing of information (directly
813 through communication or indirectly through shared resources) between
814 domains. This interpretation allows to control the overt (intended)
815 communication channels in Xen.
817 (2) Chinese Wall: Labels are interpreted to decide which domains can
818 co-exist (be run simultaneously) on the same system. This
819 interpretation allows to prevent direct covert (unintended) channels
820 and mitigates risks caused by imperfect core domain isolation
821 (trade-off between security and other system requirements). For a
822 short introduction to covert channels, please refer to
823 http://www.multicians.org/timing-chn.html.
825 The following subcommands help you to manage security policies in Xen
826 and to assign security labels to domains. To enable access control
827 security in Xen, you must compile Xen with ACM support enabled as
828 described under "Configuring Security" below. There, you will find
829 also examples of each subcommand described here.
831 =item B<setpolicy> ACM I<policy>
833 Makes the given ACM policy available to xend as a I<xend-managed policy>.
834 The policy is compiled and a mapping (.map) as well as a binary (.bin)
835 version of the policy is created. The policy is loaded and the system's
836 bootloader is prepared to boot the system with this policy the next time
837 it is started.
839 =over 4
841 I<policy> is a dot-separated list of names. The last part is the file
842 name pre-fix for the policy XML file. The preceding name parts are
843 translated into the local path pointing to the policy XML file
844 relative to the global policy root directory
845 (/etc/xen/acm-security/policies). For example,
846 example.chwall_ste.client_v1 denotes the policy file
847 example/chwall_ste/client_v1-security_policy.xml relative to the
848 global policy root directory.
850 =back
852 =item B<resetpolicy>
854 Reset the system's policy to the default state where the DEFAULT policy
855 is loaded and enforced. This operation may fail if for example guest VMs are
856 running and and one of them uses a different label than what Domain-0
857 does. It is best to make sure that no guests are running before issuing
858 this command.
860 =item B<getpolicy> [--dumpxml]
862 Displays information about the current xend-managed policy, such as
863 name and type of the policy, the uuid xend has assigned to it on the
864 local system, the version of the XML representation and the status
865 of the policy, such as whether it is currently loaded into Xen or
866 whether the policy is automatically loaded during system boot. With
867 the I<--dumpxml> option, the XML representation of the policy is
868 displayed.
870 =item B<dumppolicy>
872 Prints the current security policy state information of Xen.
874 =item B<labels> [I<policy>] [B<type=dom>|B<res>|B<any>]
876 Lists all labels of a I<type> (domain, resource, or both) that are
877 defined in the I<policy>. Unless specified, the default I<policy> is
878 the currently enforced access control policy. The default for I<type>
879 is 'dom'. The labels are arranged in alphabetical order.
881 =item B<addlabel> I<label> B<dom> I<configfile> [I<policy>]
883 =item B<addlabel> I<label> B<mgt> I<domain name> [I<policy type>:I<policy>]
885 =item B<addlabel> I<label> B<res> I<resource> [I<policy>]
887 =item B<addlabel> I<label> B<vif-idx> I<domain name> [I<policy type>:I<policy>]
890 Adds the security label with name I<label> to a domain
891 I<configfile> (dom), a Xend-managed domain (mgt), to the global resource label
892 file for the given I<resource> (res), or to a managed domain's virtual network
893 interface (vif) that is specified by its index. Unless specified,
894 the default I<policy> is the currently enforced access control policy.
895 This subcommand also verifies that the I<policy> definition supports the
896 specified I<label> name.
898 The only I<policy type> that is currently supported is I<ACM>.
900 =item B<rmlabel> B<dom> I<configfile>
902 =item B<rmlabel> B<mgt> I<domain name>
904 =item B<rmlabel> B<res> I<resource>
906 =item B<rmlabel> B<vif-idx> I<domain name>
908 Works the same as the B<addlabel> command (above), except that this
909 command will remove the label from the domain I<configfile> (dom),
910 a Xend-managed domain (mgt), the global resource label file (res),
911 or a managed domain's network interface (vif).
913 =item B<getlabel> B<dom> I<configfile>
915 =item B<getlabel> B<mgt> I<domain name>
917 =item B<getlabel> B<res> I<resource>
919 =item B<getlabel> B<vif-idx> I<domain name>
921 Shows the label for a domain's configuration in the given I<configfile>,
922 a xend-managed domain (mgt), a resource, or a managed domain's network
923 interface (vif).
925 =item B<resources>
927 Lists all resources in the global resource label file. Each resource
928 is listed with its associated label and policy name.
930 =item B<dry-run> I<configfile>
932 Determines if the specified I<configfile> describes a domain with a valid
933 security configuration for type enforcement. The test shows the policy
934 decision made for each resource label against the domain label as well as
935 the overall decision.
939 =over 4
941 In xen_source_dir/Config.mk set the following parameter:
943 XSM_ENABLE ?= y
946 Then recompile and install xen and the security tools and then reboot:
948 cd xen_source_dir; make clean; make install
949 reboot into Xen
951 =back
955 =over 4
957 To set the system's security policy enforcement into its default state,
958 the follow command can be issued. Make sure that no guests are running
959 while doing this.
961 xm resetpolicy
963 After this command has successfully completed, the system's DEFAULT policy
964 is enforced.
966 =back
970 =over 4
972 This step sets the system's policy and automatically loads it into Xen
973 for enforcement.
975 xm setpolicy ACM example.client_v1
977 =back
981 =over 4
983 This subcommand shows all labels that are defined and which can be
984 attached to domains.
986 xm labels example.client_v1 type=dom
988 will print for our example policy:
990 dom_BoincClient
991 dom_Fun
992 dom_HomeBanking
993 dom_NetworkDomain
994 dom_StorageDomain
995 dom_SystemManagement
997 =back
1001 =over 4
1003 The B<addlabel> subcommand can attach a security label to a domain
1004 configuration file, here a HomeBanking label. The example policy
1005 ensures that this domain does not share information with other
1006 non-homebanking user domains (i.e., domains labeled as dom_Fun or
1007 dom_Boinc) and that it will not run simultaneously with domains
1008 labeled as dom_Fun.
1010 We assume that the specified myconfig.xm configuration file actually
1011 instantiates a domain that runs workloads related to home-banking,
1012 probably just a browser environment for online-banking.
1014 xm addlabel dom_HomeBanking dom myconfig.xm
1016 The very simple configuration file might now look as printed
1017 below. The B<addlabel> subcommand added the B<access_control> entry at
1018 the end of the file, consisting of a label name and the policy that
1019 specifies this label name:
1021 kernel = "/boot/vmlinuz-2.6.16-xen"
1022 ramdisk="/boot/U1_home_banking_ramdisk.img"
1023 memory = 164
1024 name = "homebanking"
1025 vif = [ '' ]
1026 dhcp = "dhcp"
1027 access_control = ['policy=example.chwall_ste.client_v1,
1028 label=dom_HomeBanking']
1030 Security labels must be assigned to domain configurations because
1031 these labels are essential for making access control decisions as
1032 early as during the configuration phase of a newly instantiated
1033 domain. Consequently, a security-enabled Xen hypervisor will only
1034 start domains that have a security label configured and whose security
1035 label is consistent with the currently enforced policy. Otherwise,
1036 starting the domain will fail with the error condition "operation not
1037 permitted".
1039 =back
1043 =over 4
1045 The addlabel subcommand supports labeling of domains that are managed
1046 by xend. This includes domains that are currently running, such as for
1047 example Domain-0, or those that are in a dormant state.
1048 Depending on the state of the system, it is possible that the new label
1049 is rejected. An example for a reason for the rejection of the relabeling
1050 of a domain would be if a domain is currently allowed to
1051 access its labeled resources but due to the new label would be prevented
1052 from accessing one or more of them.
1054 xm addlabel dom_Fun mgt Domain-0
1056 This changes the label of Domain-0 to dom_Fun under the condition that
1057 this new label of Domain-0 would not prevent any other domain from
1058 accessing its resources that are provided through Domain-0, such as for
1059 example network or block device access.
1061 =back
1065 =over 4
1067 The B<addlabel> subcommand can also be used to attach a security
1068 label to a resource. Following the home banking example from above,
1069 we can label a disk resource (e.g., a physical partition or a file)
1070 to make it accessible to the home banking domain. The example policy
1071 provides a resource label, res_LogicalDiskPartition1(hda1), that is
1072 compatible with the HomeBanking domain label.
1074 xm addlabel "res_LogicalDiskPartition1(hda1)" res phy:hda6
1076 After labeling this disk resource, it can be attached to the domain
1077 by adding a line to the domain configuration file. The line below
1078 attaches this disk to the domain at boot time.
1080 disk = [ 'phy:hda6,sda2,w' ]
1082 Alternatively, the resource can be attached after booting the domain
1083 by using the B<block-attach> subcommand.
1085 xm block-attach homebanking phy:hda6 sda2 w
1087 Note that labeled resources cannot be used when security is turned
1088 off. Any attempt to use labeled resources with security turned off
1089 will result in a failure with a corresponding error message. The
1090 solution is to enable security or, if security is no longer desired,
1091 to remove the resource label using the B<rmlabel> subcommand.
1093 =back
1097 =over 4
1099 xm create myconfig.xm
1101 xm list --label
1103 Name ID ... Time(s) Label
1104 homebanking 23 ... 4.4 dom_HomeBanking
1105 Domain-0 0 ... 2658.8 dom_SystemManagement
1107 =back
1111 =over 4
1113 xm resources
1115 phy:hda6
1116 type: ACM
1117 policy: example.chwall_ste.client_v1
1118 label: res_LogicalDiskPartition1(hda1)
1119 file:/xen/disk_image/disk.img
1120 type: ACM
1121 policy: example.chwall_ste.client_v1
1122 label: res_LogicalDiskPartition2(hda2)
1124 =back
1128 =over 4
1130 We distinguish three representations of the Xen access control policy:
1131 the source XML version, its binary counterpart, and a mapping
1132 representation that enables the tools to deterministically translate
1133 back and forth between label names of the XML policy and label
1134 identifiers of the binary policy. All three versions must be kept
1135 consistent to achieve predictable security guarantees.
1137 The XML version is the version that users are supposed to create or
1138 change, either by manually editing the XML file or by using the Xen
1139 policy generation tool (B<xensec_gen>). After changing the XML file,
1140 run the B<setpolicy> subcommand to ensure that the new policy is
1141 available to xend. Use, for example, the subcommand
1142 B<activatepolicy> to activate the changes during the next system
1143 reboot.
1145 The binary version of the policy is derived from the XML policy by
1146 tokenizing the specified labels and is used inside Xen only. It is
1147 created with the B<setpolicy> subcommand. Essentially, the binary
1148 version is much more compact than the XML version and is easier to
1149 evaluate during access control decisions.
1151 The mapping version of the policy is created during the XML-to-binary
1152 policy translation (B<setpolicy>) and is used by xend and the management
1153 tools to translate between label names used as input to the tools and
1154 their binary identifiers (ssidrefs) used inside Xen.
1156 =back
1158 =head1 SEE ALSO
1160 B<xmdomain.cfg>(5), B<xentop>(1)
1162 =head1 AUTHOR
1164 Sean Dague <sean at dague dot net>
1165 Daniel Stekloff <dsteklof at us dot ibm dot com>
1166 Reiner Sailer <sailer at us dot ibm dot com>
1167 Stefan Berger <stefanb at us dot ibm dot com>
1169 =head1 BUGS