version 1.53, 2014/12/26 23:58:18
|
version 1.59, 2014/12/27 15:46:47
|
Line 2 Introduction
|
Line 2 Introduction
|
============ |
============ |
|
|
[![[Xen |
[![[Xen |
screenshot]](http://www.netbsd.org/gallery/in-Action/hubertf-xens.png)](../../gallery/in-Action/hubertf-xen.png) |
screenshot]](http://www.netbsd.org/gallery/in-Action/hubertf-xens.png)](http://www.netbsd.org/gallery/in-Action/hubertf-xen.png) |
|
|
Xen is a virtual machine monitor or hypervisor for x86 hardware |
Xen is a hypervisor (or virtual machine monitor) for x86 hardware |
(i686-class or higher), which supports running multiple guest |
(i686-class or higher), which supports running multiple guest |
operating systems on a single physical machine. With Xen, one uses |
operating systems on a single physical machine. Xen is a Type 1 or |
the Xen kernel to control the CPU, memory and console, a dom0 |
bare-metal hypervisor; one uses the Xen kernel to control the CPU, |
operating system which mediates access to other hardware (e.g., disks, |
memory and console, a dom0 operating system which mediates access to |
network, USB), and one or more domU operating systems which operate in |
other hardware (e.g., disks, network, USB), and one or more domU |
an unprivileged virtualized environment. IO requests from the domU |
operating systems which operate in an unprivileged virtualized |
systems are forwarded by the hypervisor (Xen) to the dom0 to be |
environment. IO requests from the domU systems are forwarded by the |
fulfilled. |
hypervisor (Xen) to the dom0 to be fulfilled. |
|
|
Xen supports two styles of guests. The original is Para-Virtualized |
Xen supports two styles of guests. The original is Para-Virtualized |
(PV) which means that the guest OS does not attempt to access hardware |
(PV) which means that the guest OS does not attempt to access hardware |
Line 49 specific PCI devices can be made availab
|
Line 49 specific PCI devices can be made availab
|
of the dom0. This can be useful to let a domU run X11, or access some |
of the dom0. This can be useful to let a domU run X11, or access some |
network interface or other peripheral. |
network interface or other peripheral. |
|
|
|
NetBSD used to support Xen2; this has been removed. |
|
|
Prerequisites |
Prerequisites |
------------- |
------------- |
|
|
Line 63 architecture. This HOWTO presumes famil
|
Line 65 architecture. This HOWTO presumes famil
|
on i386/amd64 hardware and installing software from pkgsrc. |
on i386/amd64 hardware and installing software from pkgsrc. |
See also the [Xen website](http://www.xenproject.org/). |
See also the [Xen website](http://www.xenproject.org/). |
|
|
History |
|
------- |
|
|
|
NetBSD used to support Xen2; this has been removed. |
|
|
|
Before NetBSD's native bootloader could support Xen, the use of |
|
grub was recommended. If necessary, see the |
|
[old grub information](/ports/xen/howto-grub/). |
|
|
|
Versions of Xen and NetBSD |
Versions of Xen and NetBSD |
========================== |
========================== |
|
|
Line 302 As with non-Xen systems, you should have
|
Line 295 As with non-Xen systems, you should have
|
kernel that works without Xen) and fallback versions of the non-Xen |
kernel that works without Xen) and fallback versions of the non-Xen |
kernel, Xen, and the dom0 kernel. |
kernel, Xen, and the dom0 kernel. |
|
|
|
Using grub (historic) |
|
--------------------- |
|
|
|
Before NetBSD's native bootloader could support Xen, the use of |
|
grub was recommended. If necessary, see the |
|
[old grub information](/ports/xen/howto-grub/). |
|
|
The [HowTo on Installing into |
The [HowTo on Installing into |
RAID-1](http://mail-index.NetBSD.org/port-xen/2006/03/01/0010.html) |
RAID-1](http://mail-index.NetBSD.org/port-xen/2006/03/01/0010.html) |
explains how to set up booting a dom0 with Xen using grub with |
explains how to set up booting a dom0 with Xen using grub with |
Line 339 For 4.1 (and thus xm; xl is believed not
|
Line 339 For 4.1 (and thus xm; xl is believed not
|
xencommons=YES |
xencommons=YES |
xend=YES |
xend=YES |
|
|
TODO: Explain why if xm is preferred on 4.1, rc.d/xendomains has xl. |
(If you are using xentools41 from before 2014-12-26, change |
Or fix the package. |
rc.d/xendomains to use xm rather than xl.) |
|
|
For 4.2 with xm, add to rc.conf |
For 4.2 with xm, add to rc.conf |
|
|
Line 407 and adjusts /etc.
|
Line 407 and adjusts /etc.
|
Note that one must update both the non-Xen kernel typically used for |
Note that one must update both the non-Xen kernel typically used for |
rescue purposes and the DOM0 kernel used with Xen. |
rescue purposes and the DOM0 kernel used with Xen. |
|
|
To convert from grub to /boot, install an mbr bootblock with fdisk, |
Converting from grub to /boot |
bootxx_ with installboot, /boot and /boot.cfg. This really should be |
----------------------------- |
no different than completely reinstalling boot blocks on a non-Xen |
|
system. |
These instructions were [TODO: will be] used to convert a system from |
|
grub to /boot. The system was originally installed in February of |
|
2006 with a RAID1 setup and grub to boot Xen 2, and has been updated |
|
over time. Before these commands, it was running NetBSD 6 i386, Xen |
|
4.1 and grub, much like the message linked earlier in the grub |
|
section. |
|
|
|
# Install mbr bootblocks on both disks. |
|
fdisk -i /dev/rwd0d |
|
fdisk -i /dev/rwd1d |
|
# Install NetBSD primary boot loader (/ is FFSv1) into RAID1 components. |
|
installboot -v /dev/rwd0d /usr/mdec/bootxx_ffsv1 |
|
installboot -v /dev/rwd1d /usr/mdec/bootxx_ffsv1 |
|
# Install secondary boot loader |
|
cp -p /usr/mdec/boot / |
|
# Create boog.cfg following earlier guidance: |
|
menu=Xen:load /netbsd-XEN3PAE_DOM0.gz console=pc;multiboot /xen.gz dom0_mem=256M |
|
menu=Xen.ok:load /netbsd-XEN3PAE_DOM0.ok.gz console=pc;multiboot /xen.ok.gz dom0_mem=256M |
|
menu=GENERIC:boot |
|
menu=GENERIC single-user:boot -s |
|
menu=GENERIC.ok:boot netbsd.ok |
|
menu=GENERIC.ok single-user:boot netbsd.ok -s |
|
menu=Drop to boot prompt:prompt |
|
default=1 |
|
timeout=30 |
|
|
|
TODO: actually do this and fix it if necessary. |
|
|
Updating Xen versions |
Updating Xen versions |
--------------------- |
--------------------- |
Line 505 anyplace, reasonable places to store dom
|
Line 531 anyplace, reasonable places to store dom
|
(so they are near the dom0 kernel), in /usr/pkg/etc/xen (near the |
(so they are near the dom0 kernel), in /usr/pkg/etc/xen (near the |
config files), or in /u0/xen (where the vdisks are). |
config files), or in /u0/xen (where the vdisks are). |
|
|
|
Note that loading the domU kernel from the dom0 implies that boot |
|
blocks, /boot, /boot.cfg, and so on are all ignored in the domU. |
See the VPS section near the end for discussion of alternate ways to |
See the VPS section near the end for discussion of alternate ways to |
obtain domU kernels. |
obtain domU kernels. |
|
|
Line 840 npf, run IPsec, or any other reason why
|
Line 868 npf, run IPsec, or any other reason why
|
their kernel. |
their kernel. |
|
|
One approach is to have an adminstrative interface to upload a kernel, |
One approach is to have an adminstrative interface to upload a kernel, |
or to select from a prepopulated list. |
or to select from a prepopulated list. Other approaches are py-grub |
|
(deprecated) and pvgrub, which are ways to have a bootloader obtain a |
|
kernel from the domU filesystem. This is closer to a regular physical |
|
computer, where someone who controls a machine can replace the kernel. |
|
|
Otehr approaches are pvgrub and py-grub, which are ways to start a |
py-grub |
bootloader from the dom0 instead of the actual domU kernel, and for |
------- |
that loader to then load a kernel from the domU filesystem. This is |
|
closer to a regular physical computer, where someone who controls a |
py-grub runs in the dom0 and looks into the domU filesystem. This |
machine can replace the kernel. |
implies that the domU must have a kernel in a filesystem in a format |
|
known to py-grub. As of 2014, py-grub seems to be of mostly historical interest. |
|
|
|
pvgrub |
|
------ |
|
|
|
pvgrub is a version of grub that uses PV operations instead of BIOS |
|
calls. It is booted from the dom0 as the domU kernel, and then reads |
|
/grub/menu.lst and loads a kernel from the domU filesystem. |
|
|
|
[prgmr.com](http://prgmr.com/) uses this approach to let users choose |
|
their own operating system and kernel. See then [prgmr.com NetBSD |
|
HOWTO](http://wiki.prgmr.com/mediawiki/index.php/NetBSD_as_a_DomU). |
|
|
|
Typically one has an ext2 or FAT partition for the kernel, so that |
|
grub can understand it, which leads to /netbsd not being the actual |
|
kernel. One must remember to update the special boot partiion. |
|
|
prmgr and pvgrub |
Amazon |
---------------- |
------ |
|
|
TODO: Perhaps reference panix, prmgr, amazon as interesting examples. |
TODO: add link to NetBSD amazon howto. |
Explain what prmgr does. |
|
|
|
Using npf |
Using npf |
--------- |
--------- |
Line 860 Using npf
|
Line 906 Using npf
|
In standard kernels, npf is a module, and thus cannot be loadeed in a |
In standard kernels, npf is a module, and thus cannot be loadeed in a |
DOMU kernel. |
DOMU kernel. |
|
|
TODO: explain how to compile npf into a custom kernel, answering: |
TODO: explain how to compile npf into a custom kernel, answering (but |
|
note that the problem was caused by not booting the right kernel): |
http://mail-index.netbsd.org/netbsd-users/2014/12/26/msg015576.html |
http://mail-index.netbsd.org/netbsd-users/2014/12/26/msg015576.html |