Gentoo Archives: gentoo-doc-cvs

From: "Sven Vermeulen (swift)" <swift@g.o>
To: gentoo-doc-cvs@l.g.o
Subject: [gentoo-doc-cvs] gentoo commit in xml/htdocs/doc/en: xen-guide.xml
Date: Sun, 07 Oct 2012 15:02:14
Message-Id: 20121007133249.9649521600@flycatcher.gentoo.org
1 swift 12/10/07 13:32:49
2
3 Modified: xen-guide.xml
4 Log:
5 Bug #437222 - Update Xen document to reflect later releases
6
7 Revision Changes Path
8 1.14 xml/htdocs/doc/en/xen-guide.xml
9
10 file : http://sources.gentoo.org/viewvc.cgi/gentoo/xml/htdocs/doc/en/xen-guide.xml?rev=1.14&view=markup
11 plain: http://sources.gentoo.org/viewvc.cgi/gentoo/xml/htdocs/doc/en/xen-guide.xml?rev=1.14&content-type=text/plain
12 diff : http://sources.gentoo.org/viewvc.cgi/gentoo/xml/htdocs/doc/en/xen-guide.xml?r1=1.13&r2=1.14
13
14 Index: xen-guide.xml
15 ===================================================================
16 RCS file: /var/cvsroot/gentoo/xml/htdocs/doc/en/xen-guide.xml,v
17 retrieving revision 1.13
18 retrieving revision 1.14
19 diff -u -r1.13 -r1.14
20 --- xen-guide.xml 24 Jul 2012 12:12:51 -0000 1.13
21 +++ xen-guide.xml 7 Oct 2012 13:32:49 -0000 1.14
22 @@ -1,8 +1,8 @@
23 <?xml version='1.0' encoding='UTF-8'?>
24 <!DOCTYPE guide SYSTEM "/dtd/guide.dtd">
25 -<!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/xen-guide.xml,v 1.13 2012/07/24 12:12:51 swift Exp $ -->
26 +<!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/xen-guide.xml,v 1.14 2012/10/07 13:32:49 swift Exp $ -->
27
28 -<guide disclaimer="obsolete">
29 +<guide disclaimer="draft">
30 <title>Configuring Gentoo with Xen</title>
31
32 <author title="Author">
33 @@ -20,8 +20,8 @@
34 <!-- See http://creativecommons.org/licenses/by-sa/2.5 -->
35 <license/>
36
37 -<version>8</version>
38 -<date>2012-07-24</date>
39 +<version>9</version>
40 +<date>2012-10-07</date>
41
42 <chapter>
43 <title>Introduction</title>
44 @@ -114,7 +114,7 @@
45 </p>
46
47 <pre caption="Installing Xen">
48 -~# <i>emerge xen xen-tools xen-sources</i>
49 +~# <i>emerge xen xen-tools gentoo-sources</i>
50 </pre>
51
52 </body>
53 @@ -125,89 +125,64 @@
54
55 <p>
56 Next we'll build the Linux kernel with Xen support. This kernel, whose sources
57 -are available at <path>/usr/src/linux-2.6.x.z-xen</path>, will be our main
58 +are available at <path>/usr/src/linux</path>, will be our main
59 running kernel (i.e. the one running domain 0). In the <c>XEN</c> section you'll
60 find drivers for all kinds of input/output, each driver having a <e>backend</e>
61 and <e>frontend</e> implementation available. For the domain 0 kernel you need
62 to select the <e>backend</e> implementation: these are used by the other
63 domains (who use the <e>frontend</e> drivers) to communicate directly with
64 -the hardware.
65 +the hardware. However, you should be able to configure the kernel to provide
66 +support for both frontend (guest) and backend (host) drivers.
67 </p>
68
69 <p>
70 -Of course, don't forget to select <c>Xen-compatible</c> at <c>Processor type and
71 -features</c>. If you're wondering about networking: each interface in a domain
72 +If you're wondering about networking: each interface in a domain
73 has a point-to-point link to an interface on domain 0 (called
74 <path>vifX.Y</path> where X is the domain number and Y the Yth interface of that
75 domain), so you can configure your network the way you want (bridging, NAT,
76 etc.)
77 </p>
78
79 -<pre caption="Enabling Xen Support for i386 Kernels">
80 +<pre caption="Enabling Xen Support">
81 Processor type and features ---&gt;
82 - Subarchitecture Type (Xen-compatible)
83 + [*] Paravirtualized guest support ---&gt;
84 + [*] Xen guest support
85 </pre>
86
87 -<pre caption="Enabling Xen Support for x86_64 Kernels">
88 -Processor type and features ---&gt;
89 - Subarchitecture Type (PC-compatible)
90 - [*] Enable Xen compatible kernel
91 - [*] Support for hot-pluggable CPUs
92 -</pre>
93 -
94 -<pre caption="Domain-0 Kernel Config">
95 -Bus options (PCI etc.) ---&gt;
96 - [*] PCI support
97 - [ ] Xen PCI Frontend Debugging
98 -
99 -Networking ---&gt;
100 - Networking options ---&gt;
101 - &lt;*&gt; 802.1d Ethernet Bridging
102 - <comment>Only required by bridged networking.</comment>
103 -
104 -XEN ---&gt;
105 - [*] Privileged Guest (domain 0)
106 - &lt;*&gt; Backend driver support
107 - &lt;*&gt; Block-device backend driver
108 - &lt;*&gt; Network-device backend driver
109 - &lt;*&gt; PCI-device backend driver
110 - PCI Backend Mode (Virtual PCI) ---&gt;
111 - [*] Scrub memory before freeing it to Xen
112 - [*] Disable serial port drivers
113 - Xen version compatibility (3.0.4 and later)
114 -</pre>
115 -
116 -<pre caption="Domain-U Kernel Config">
117 +<pre caption="Kernel Config">
118 Bus options (PCI etc.) ---&gt;
119 - [ ] PCI support
120 + [*] Xen PCI Frontend
121
122 -Device Drivers ---&gt;
123 - SCSI device support ---&gt;
124 - &lt; &gt; SCSI device support
125 - <comment>Disabling SCSI support frees up the /dev/sd* device names
126 - for use as Xen virtual block devices.</comment>
127 -
128 -XEN ---&gt;
129 - [ ] Privileged Guest (domain 0)
130 - &lt;*&gt; Block-device frontend driver
131 - &lt;*&gt; Network-device frontend driver
132 - [*] Scrub memory before freeing it to Xen
133 - [*] Disable serial port drivers
134 - Xen version compatibility (3.0.4 and later)
135 +[*] Networking support ---&gt;
136 + Networking options ---&gt;
137 + &lt;*&gt; 802.1d Ethernet Bridging
138 + [*] Network packet filtering framework (Netfilter) ---&gt;
139 + [*] Advanced netfilter configuration
140 + [*] Bridged IP/ARP packets filtering
141 +
142 +Device Drivers ---&gt;
143 + [*] Block devices (NEW) ---&gt;
144 + &lt;*&gt; Xen block-device backend driver
145 + [*] Network device support ---&gt;
146 + &lt;*&gt; Xen backend network device
147 + Xen driver support ---&gt;
148 + [*] Xen memory balloon driver (NEW)
149 + [*] Scrub pages before returning them to system (NEW)
150 + &lt;*&gt; Xen /dev/xen/evtchn device (NEW)
151 + [*] Backend driver support (NEW)
152 + &lt;*&gt; Xen filesystem (NEW)
153 + [*] Create compatibility mount point /proc/xen (NEW)
154 + [*] Create xen entries under /sys/hypervisor (NEW)
155 + &lt;M&gt; userspace grant access device driver (NEW)
156 + &lt;M&gt; user-space grant reference allocator driver (NEW)
157 + &lt;M&gt; xen platform pci device driver (NEW)
158 </pre>
159
160 <p>
161 -A nice hint is to have the kernel make process store its intermediate object
162 -files elsewhere so that you can reuse the same kernel tree to build different
163 -configurations:
164 -</p>
165 -
166 -<pre caption="Building the Kernel">
167 -~# <i>mkdir -p ~/build/dom0 ~/build/domU</i>
168 -~# <i>make O=~/build/dom0 menuconfig</i>
169 -<comment>(Configure the kernel)</comment>
170 -~# <i>make O=~/build/dom0 &amp;&amp; make O=~/build/dom0 modules_install</i>
171 -</pre>
172 +The shown kernel configuration should allow the kernel image to boot both as a
173 +host as well as a guest. However, if you want to, you can slim down the guest
174 +image kernel considerably. Refer to the Xen documentation for more information.
175 +</p>
176
177 <p>
178 Once the kernel is built you'll find the kernel image immediately in the
179 @@ -220,26 +195,16 @@
180 </p>
181
182 <pre caption="GRUB Configuration for Xen">
183 -title Xen 3.0 / Gentoo Linux 2.6.x.y
184 +title Xen Gentoo Linux 3.5
185 root (hd0,0)
186 kernel /boot/xen.gz
187 -module /boot/kernel-2.6.x.y-xen0 root=/dev/sda3
188 +module /boot/kernel-3.5.x.y-xen0 root=/dev/sda3
189 </pre>
190
191 <p>
192 -Now reboot your system into Xen. Once you are booted, you need to load the Xen
193 -daemon:
194 -</p>
195 -
196 -<pre caption="Loading the Xen daemon">
197 -~# <i>/etc/init.d/xend start</i>
198 -</pre>
199 -
200 -<p>
201 -Now check if you can do whatever you normally do on your system. If this is the
202 -case, you can edit your bootloader configuration to always boot into Xen and add
203 -the Xen deamon to the default runlevel so that it is started automatically
204 -next time you boot.
205 +Now reboot your system into Xen and check if you can do whatever you
206 +normally do on your system. If this is the case, you can edit your
207 +bootloader configuration to always boot into Xen.
208 </p>
209
210 <note>
211 @@ -259,25 +224,18 @@
212 <body>
213
214 <p>
215 -Go to the Xen-powered Linux kernel source and update the configuration. It is
216 -wise to keep as many topics as possible similar to the main kernel except the
217 -<c>XEN</c> settings where drivers should now have their <e>frontend</e>
218 -implementation selected instead of the <e>backend</e>. Then build the kernel
219 +Go to the Xen-powered Linux kernel source and, if necessary, update the
220 +configuration. It is wise to keep as many topics as possible similar to
221 +the main kernel. Then build the kernel
222 and place the resulting <path>vmlinuz</path> file where you want (we assume this
223 is <path>/mnt/data/xen/kernel</path>):
224 </p>
225
226 <pre caption="Building the guest kernel">
227 ~# <i>make O=~/build/domU</i>
228 -~# <i>cp ~/build/domU/vmlinuz /mnt/data/xen/kernel/kernel-2.6.x.y-xen</i>
229 +~# <i>cp ~/build/domU/vmlinuz /mnt/data/xen/kernel/kernel-3.5.x.y-xen</i>
230 </pre>
231
232 -<p>
233 -It is also possible to create a single kernel image for both the administrative
234 -domain and the unpriviledged domain. More information about this can be found
235 -in the Xen user manual.
236 -</p>
237 -
238 </body>
239 </section>
240 <section>
241 @@ -293,13 +251,13 @@
242
243 <p>
244 You can create a file based filesystem using <c>dd</c> and <c>mke2fs</c> (or
245 -any other file system creation tool). For instance, to create a 2Gbyte ext3
246 +any other file system creation tool). For instance, to create a 4 Gbyte ext4
247 filesystem:
248 </p>
249
250 <pre caption="Creating a file based filesystem">
251 -~# <i>dd if=/dev/zero of=/mnt/data/xen/disks/ext3root.img bs=1M count=2048</i>
252 -~# <i>mke2fs -j /mnt/data/xen/disks/ext3root.img</i>
253 +~# <i>dd if=/dev/zero of=/mnt/data/xen/disks/ext4root.img bs=1M count=4096</i>
254 +~# <i>mkfs.ext4 /mnt/data/xen/disks/ext4root.img</i>
255 </pre>
256
257 </body>
258 @@ -319,11 +277,11 @@
259 <pre caption="Creating a domain configuration file">
260 ~# <i>nano -w /mnt/data/xen/configs/gentoo</i>
261
262 -kernel = "/mnt/data/xen/kernel/kernel-2.6.x.y-xen"
263 +kernel = "/mnt/data/xen/kernel/kernel-3.5.x.y-xen"
264 memory = 512
265 name = "gentoo"
266 <comment>(Map the disk image to the virtual /dev/sda1)</comment>
267 -disk = ['file:/mnt/data/xen/disks/ext3root.img,sda1,w']
268 +disk = ['file:/mnt/data/xen/disks/ext4root.img,sda1,w']
269 root = "/dev/sda1 ro"
270 </pre>
271
272 @@ -353,11 +311,11 @@
273 <p>
274 Now we're all set and we can launch the new domain. If the disk image contained
275 an operating system, we could just create and attach the domain using the
276 -<c>xm</c> command (Xen manager):
277 +<c>xl</c> command:
278 </p>
279
280 <pre caption="Creating and starting a new domain">
281 -~# <i>xm create /mnt/data/xen/configs/gentoo -c</i>
282 +~# <i>xl create /mnt/data/xen/configs/gentoo -c</i>
283 </pre>
284
285 <p>
286 @@ -369,7 +327,7 @@
287
288 <p>
289 If you want to disconnect from the domain, press <path>Ctrl+]</path>. You can
290 -always reconnect to the domains' console using <c>xm console gentoo</c>.
291 +always reconnect to the domains' console using <c>xl console gentoo</c>.
292 However, there is only one console per domain, so only use it when you can't
293 access the domain otherwise (for instance, through SSH).
294 </p>
295 @@ -384,23 +342,8 @@
296 <body>
297
298 <p>
299 -Xen supports at least two ways of configuring your (virtual) network:
300 -<e>routed</e> and <e>bridged</e>.
301 -</p>
302 -
303 -<p>
304 -When selecting the <e>routed</e> approach, the interface inside your
305 -unpriviledged domain is connected to the virtual interface on your
306 -administrative domain. On your administrative domain (domain 0), the virtual
307 -interface is linked together with <path>eth0</path>. The
308 -interface inside your unpriviledged domain should have an IP address on the same
309 -network as the interface on the administrative domain. Any communication to
310 -that IP address can only occur from the administrative domain, unless you set
311 -up specific routing rules.
312 -</p>
313 -
314 -<p>
315 -When selecting the <e>bridged</e> approach, your default network interface on
316 +Xen works best when using a bridged mode network configuration.
317 +This means that your default network interface on
318 the administrative domain becomes a bridge which accepts connections to the
319 virtual domains as well as to the IP address your administrative domain has.
320 </p>
321 @@ -408,119 +351,39 @@
322 </body>
323 </section>
324 <section>
325 -<title>Regular Routed Interfaces</title>
326 -<body>
327 -
328 -<p>
329 -Before you set up the interface on your unpriviledged domain, make sure that
330 -Xen's <path>netloop</path> and <path>netbk</path> drivers are loaded. A quick
331 -hint: if you have <path>netloop</path> as a module, load it with
332 -<c>nloopbacks=0</c> so that it doesn't create pointless interfaces to the
333 -loopback device. Then, edit your domain configuration file and add a <c>vif</c>
334 -instruction to it.
335 -</p>
336 -
337 -<pre caption="Configuring a virtual interface">
338 -~# <i>nano -w /mnt/data/xen/configs/gentoo</i>
339 -
340 -<comment>(Add the vif instruction)</comment>
341 -vif = [ 'ip=192.168.1.101, vifname=veth1' ]
342 -</pre>
343 -
344 -<p>
345 -In the above example, the interface will be created for the unpriviledged domain
346 -(in which it will be called <path>eth0</path>) and Xen will ensure that address
347 -192.168.1.101 will be reachable from the administrative domain through interface
348 -<path>veth1</path>.
349 -</p>
350 -
351 -<p>
352 -This doesn't mean that the virtual <path>eth0</path> interface will
353 -automatically have IP 192.168.1.101 assigned to it, but rather that, if you
354 -don't give it that IP, it will not be connected with the administrative domain
355 -and thus cannot be reached.
356 -</p>
357 -
358 -<p>
359 -Now edit <path>/etc/xen/xend-config.sxp</path> as follows to select routed
360 -network configuration:
361 -</p>
362 -
363 -<pre caption="Editing xend-config.sxp">
364 -~# <i>nano -w /etc/xen/xend-config.sxp</i>
365 -
366 -<comment>(Comment out the following lines)</comment>
367 -<i>#</i>(network-script network-bridge)
368 -<i>#</i>(vif-script vif-bridge)
369 -
370 -<comment>(Enable the following lines)</comment>
371 -(network-script network-route)
372 -(vif-script vif-route)
373 -</pre>
374 -
375 -</body>
376 -</section>
377 -<section>
378 <title>Bridged Interfaces</title>
379 <body>
380
381 <p>
382 -Unlike the routed interfaces you now need to load the <path>netloop</path>
383 -driver with <c>nloopbacks=1</c> (or higher) as the additional loopback devices
384 -are used to create the bridge. For the other modules you still need the
385 -<path>netbk</path> module as well as briding functionality (<path>bridge</path>
386 -module if build as such).
387 -</p>
388 -
389 -<p>
390 -Now edit your virtual domain and add the <c>vif</c> construct:
391 +Create a bridge interface by creating a new link to the networking init script
392 +as provided by Gentoo:
393 </p>
394
395 -<pre caption="Configuring a virtual interface">
396 -~# <i>nano -w /mnt/data/xen/configs/gentoo</i>
397 -
398 -<comment>(Add the vif instruction)</comment>
399 -vif = [ 'ip=192.168.1.101, vifname=veth0' ]
400 -</pre>
401 -
402 -<p>
403 -Next edit <path>/etc/xen/xend-config.sxp</path> as follows to select bridged
404 -network configuration:
405 -</p>
406 -
407 -<pre caption="Editing xend-config.sxp">
408 -~# <i>nano -w /etc/xen/xend-config.sxp</i>
409 -
410 -<comment>(Enable the following lines)</comment>
411 -(network-script network-bridge)
412 -(vif-script vif-bridge)
413 -
414 -<comment>(Comment out the following lines if not done already)</comment>
415 -<i>#</i> (network-script network-route)
416 -<i>#</i> (vif-script vif-route)
417 +<pre caption="Creating a bridge interface">
418 +# <i>cd /etc/init.d</i>
419 +# <i>ln -s net.lo net.br0</i>
420 </pre>
421
422 <p>
423 -By default, the bridge will contain whatever interface is configured to be the
424 -default interface (the device that is listed under the default route through
425 -<c>ip route list</c>). If you want to alter this behavior, edit the
426 -<path>xend-config.sxp</path> as follows:
427 +Next, edit <path>/etc/conf.d/net</path> and setup the bridge:
428 </p>
429
430 -<pre caption="Editing xend-config.sxp to change bridge configuration">
431 -~# <i>nano -w /etc/xen/xend-config.sxp</i>
432 +<pre caption="Enabling the bridge br0 interface">
433 +# <i>nano -w /etc/conf.d/net</i>
434
435 -<comment>(Edit the network-script line)</comment>
436 -(network-script <i>'</i>network-bridge <i>netdev=eth0 bridge=xenbr0 vifnum=0'</i>)
437 +bridge_br0="eth0"
438 +config_br0="192.168.1.200 netmask 255.255.255.0 brd 192.168.1.255"
439 +routes_br0="default via 192.168.1.1"
440 </pre>
441
442 <p>
443 -Once the configuration is done, restart the <c>xend</c> init script to have Xen
444 -build the bridge:
445 +Finally, install the <e>net-misc/bridge-utils</e> package, and make sure the
446 +<path>net.br0</path> init script is loaded at boot.
447 </p>
448
449 -<pre caption="Restarting the xend daemon">
450 -~# <i>/etc/init.d/xend restart</i>
451 +<pre caption="Finishing the bridge setup">
452 +# <i>emerge net-misc/bridge-utils</i>
453 +# <i>rc-update add net.br0 default</i>
454 </pre>
455
456 </body>