ia64/xen-unstable

Move XendDomainInfo.{create,recreate,parseConfig} to the top level of the
domain. This allows us to refer to them using an import statement, rather than
a from .. import. This is a step towards getting rid of the xroot hack. All
other references to XendDomainInfo methods need to be doubly qualified (once
for the module, once for the class).

Remove XendDomainDict, replacing it with a simple dictionary, folding the
get_by_name method into XendDomain.

Replace XendDomain.refresh_lock with a domains_lock which goes around any
reference to XendDomain.domains or anything that will create or destroy a
domain. This serialises most accesses through XendDomain, ensuring that we will
not return stale state when racing against the watches fired in separate
threads. This should have fixed bugs #270 and #234.

Added a number of domain_get_xyz methods. Those named xyz_nr are to allow
components internal to XendDomain (XendDomainInfo, XendCheckpoint) to call back
into XendDomain without triggering further calls to XendDomain.refresh. The
other methods simply make it clear which fallback behaviour is expected.

Replace XendDomainInfo.domain_exists with XendDomainInfo.domain_by_name; the
internals of this method needed to change to match those changes above, and it
has been a misnomer for some time.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
author emellor@ewan Tue Oct 04 02:21:28 2005 +0100 (2005-10-04) 06d84bf87159 79e8991af6b4
line source
3 The first step in creating a new domain is to prepare a root
4 filesystem for it to boot from. Typically, this might be stored in a
5 normal partition, an LVM or other volume manager partition, a disk
6 file or on an NFS server. A simple way to do this is simply to boot
7 from your standard OS install CD and install the distribution into
8 another partition on your hard drive.
10 To start the \xend\ control daemon, type
11 \begin{quote}
12 \verb!# xend start!
13 \end{quote}
15 If you wish the daemon to start automatically, see the instructions in
16 Section~\ref{s:xend}. Once the daemon is running, you can use the
17 \path{xm} tool to monitor and maintain the domains running on your
18 system. This chapter provides only a brief tutorial. We provide full
19 details of the \path{xm} tool in the next chapter.
21 % \section{From the web interface}
22 %
23 % Boot the Xen machine and start Xensv (see Chapter~\ref{cha:xensv}
24 % for more details) using the command: \\
25 % \verb_# xensv start_ \\
26 % This will also start Xend (see Chapter~\ref{cha:xend} for more
27 % information).
28 %
29 % The domain management interface will then be available at {\tt
30 % http://your\_machine:8080/}. This provides a user friendly wizard
31 % for starting domains and functions for managing running domains.
32 %
33 % \section{From the command line}
36 \section{Creating a Domain Configuration File}
38 Before you can start an additional domain, you must create a
39 configuration file. We provide two example files which you can use as
40 a starting point:
41 \begin{itemize}
42 \item \path{/etc/xen/xmexample1} is a simple template configuration
43 file for describing a single VM.
45 \item \path{/etc/xen/xmexample2} file is a template description that
46 is intended to be reused for multiple virtual machines. Setting the
47 value of the \path{vmid} variable on the \path{xm} command line
48 fills in parts of this template.
49 \end{itemize}
51 Copy one of these files and edit it as appropriate. Typical values
52 you may wish to edit include:
54 \begin{quote}
55 \begin{description}
56 \item[kernel] Set this to the path of the kernel you compiled for use
57 with Xen (e.g.\ \path{kernel = /boot/vmlinuz-2.6-xenU'})
58 \item[memory] Set this to the size of the domain's memory in megabytes
59 (e.g.\ \path{memory = 64})
60 \item[disk] Set the first entry in this list to calculate the offset
61 of the domain's root partition, based on the domain ID. Set the
62 second to the location of \path{/usr} if you are sharing it between
63 domains (e.g.\ \path{disk = [phy:your\_hard\_drive\%d,sda1,w' \%
64 (base\_partition\_number + vmid),
65 phy:your\_usr\_partition,sda6,r' ]}
66 \item[dhcp] Uncomment the dhcp variable, so that the domain will
68 \end{description}
69 \end{quote}
71 You may also want to edit the {\bf vif} variable in order to choose
72 the MAC address of the virtual ethernet interface yourself. For
73 example:
74 \begin{quote}
75 \verb_vif = [`mac=00:06:AA:F6:BB:B3']_
76 \end{quote}
77 If you do not set this variable, \xend\ will automatically generate a
78 random MAC address from an unused range.
81 \section{Booting the Domain}
83 The \path{xm} tool provides a variety of commands for managing
84 domains. Use the \path{create} command to start new domains. Assuming
85 you've created a configuration file \path{myvmconf} based around
86 \path{/etc/xen/xmexample2}, to start a domain with virtual machine
87 ID~1 you should type:
89 \begin{quote}
90 \begin{verbatim}
91 # xm create -c myvmconf vmid=1
92 \end{verbatim}
93 \end{quote}
95 The \path{-c} switch causes \path{xm} to turn into the domain's
96 console after creation. The \path{vmid=1} sets the \path{vmid}
97 variable used in the \path{myvmconf} file.
99 You should see the console boot messages from the new domain appearing
100 in the terminal in which you typed the command, culminating in a login
101 prompt.
104 \section{Example: ttylinux}
106 Ttylinux is a very small Linux distribution, designed to require very
107 few resources. We will use it as a concrete example of how to start a
108 Xen domain. Most users will probably want to install a full-featured
109 distribution once they have mastered the basics\footnote{ttylinux is
112 http://www.minimalinux.org/ttylinux/}}.
114 \begin{enumerate}
115 \item Download and extract the ttylinux disk image from the Files
116 section of the project's SourceForge site (see
117 \path{http://sf.net/projects/xen/}).
118 \item Create a configuration file like the following:
119 \begin{verbatim}
120 kernel = "/boot/vmlinuz-2.6-xenU"
121 memory = 64
122 name = "ttylinux"
123 nics = 1
124 ip = "1.2.3.4"
125 disk = ['file:/path/to/ttylinux/rootfs,sda1,w']
126 root = "/dev/sda1 ro"
127 \end{verbatim}
128 \item Now start the domain and connect to its console:
129 \begin{verbatim}
130 xm create configfile -c
131 \end{verbatim}
133 \end{enumerate}
136 \section{Starting / Stopping Domains Automatically}
138 It is possible to have certain domains start automatically at boot
139 time and to have dom0 wait for all running domains to shutdown before
140 it shuts down the system.
142 To specify a domain is to start at boot-time, place its configuration
143 file (or a link to it) under \path{/etc/xen/auto/}.
145 A Sys-V style init script for Red Hat and LSB-compliant systems is
146 provided and will be automatically copied to \path{/etc/init.d/}
147 during install. You can then enable it in the appropriate way for
150 For instance, on Red Hat:
152 \begin{quote}