Xen is a native, or bare-metal, hypervisor that allows multiple distinct virtual machines referred to as domains to share a single physical machine. As the highest privilege process on the system, Xen is responsible for the distribution of processor and memory resources between guest domains on the host.
From its inception Xen has focused on the para-virtualization approach to hypervisor design. As a result, Xen guests or unprivileged domains domU are typically aware of the hypervisor and their status as guests.
While paravirtualized PV guests can run on a host without any form of hardware accelerated virtualization extensions this severely restricts the set of available guests and prevents the use of new and exciting modes such as PVH.
The following command should provide a highlighted row for each processor if the corresponding feature is present:. A dramatic change that might be necessary on bit systems is to rebuild the entire Gentoo installation with a different CFLAGS setting. Guest operating systems running under Xen might otherwise see major performance degradation. If you, however, are planning on checking out Xen rather than installing it for production use and are not terribly fond of rebuilding all programs, you can skip this step.
In this case you will notice performance degradation but you will still be able to use Xen. Add -mno-tls-direct-seg-refs ONLY if you have a bit dom0. You don't need this flag if you have a bit dom0. If you boot your system using an initial ramdisk initrd you need to rebuild the initrd as well which is best done by running all steps you would do when you rebuild your kernel. Next we'll build the Linux kernel with Xen support. For the domain 0 kernel you need to select the backend implementation: these are used by the other domains who use the frontend drivers to communicate directly with the hardware.
However, you should be able to configure the kernel to provide support for both frontend guest and backend host drivers. If you're wondering about networking: each interface in a domain has a point-to-point link to an interface on domain 0 called vifX. Y where X is the domain number and Y the Yth interface of that domainso you can configure your network the way you want bridging, NAT, etc. In some configurations it can be desirable to provide a guest with direct access to a PCI device.
The remaining drivers flesh out memory management, domain-to-domain communication, and communication to Xen via sysfs interfaces:. With all of the above configuration enabled, this kernel image should be able to boot as the dom0 host or as another domU guest. Note that the domU kernel can be slimmed down significantly if desired. The first set of use flags correspond directly to the Xen hypervisor.
In addition to the core hypervisor Xen depends on a set of supporting libraries and management tools. In case equery uses xen-tools does not list the hvm flag at all, or when emerge -a xen-tools shows this flag in brackets, the flag cannot be enabled unless you figure out how to unmask it.
Simply selecting a multilib profile on hosts that do not have a multilib installation is likely to give you error messages like about a missing stub You may need to re-install the host to a multilib installation then.This article or section needs language, wiki syntax or style improvements. See Help:Style for reference.
From Xen Overview :. The Xen hypervisor is a thin layer of software which emulates a computer architecture allowing multiple operating systems to run simultaneously. The hypervisor is started by the boot loader of the computer it is installed on.
Once the hypervisor is loaded, it starts the dom0 short for "domain 0", sometimes called the host or privileged domain which in our case runs Arch Linux.
Once the dom0 has started, one or more domU short for user domains, sometimes called VMs or guests can be started and controlled from the dom0. See Xen. The Xen hypervisor requires kernel level support which is included in recent Linux kernels and is built into the linux and linux-lts Arch kernel packages. In order to verify this, run the following command when the Xen hypervisor is not running:.
If the above command does not produce output, then hardware virtualization support is unavailable and your hardware is unable to run HVM domU or you are already running the Xen hypervisor. If you believe the CPU supports one of these features you should access the host system's BIOS configuration menu during the boot process and look if options related to virtualization support have been disabled. If such an option exists and is disabled, then enable it, boot the system and repeat the above command.
The Xen hypervisor also supports PCI passthrough where PCI devices can be passed directly to the domU even in the absence of dom0 support for the device. The Xen hypervisor relies on a full install of the base operating system. Before attempting to install the Xen hypervisor, the host machine should have a fully operational and up-to-date install of Arch Linux. This installation can be a minimal install with only the base package and does not require a Desktop environment or even Xorg.
If you are building a new host from scratch, see the Installation guide for instructions on installing Arch Linux. The following configuration steps are required to convert a standard installation into a working dom0 running on top of the Xen hypervisor:. To install the Xen hypervisor, install the xen AUR package. It provides the Xen hypervisor, current xl interface and all configuration and support files, including systemd services.
The multilib repository needs to be enabled and the multilib-devel package group installed to compile Xen. Install the xen-docs AUR package for the man pages and documentation. The boot loader must be modified to load a special Xen kernel xen. To do this a new bootloader entry is needed. It also might be necessary to use efibootmgr to set boot order and other parameters.
First, ensure the xen-X. This file must be placed in the same EFI system partition as the binary. Xen looks for several configuration files and uses the first one it finds. The order of search starts with the.
Mainline Linux Kernel Configs
Typically, a single file named xen. Add a new EFI-type loader entry.The Xen Project hypervisor is the only type-1 hypervisor that is available as open source. It is used as the basis for a number of different commercial and open source applications, such as: server virtualization, Infrastructure as a Service IaaSdesktop virtualization, security applications, embedded and hardware appliances.
The Xen Project hypervisor is powering the largest clouds in production today. The rest of this guide gives a basic overview of how to set up a basic Xen system and create simple guests. Our example uses LVM for virtual disks and network bridging for virtual network cards. It also assumes Xen 4.
It assumes a familiarity with general virtualization issues, as well as with the specific Xen terminology. Please see the Xen wiki for more information. During installation of Ubuntu During the install of Ubuntu for the partitioning method choose "Guided - use the entire disk and setup LVM". Then, when prompted to enter "Amount of volume group to use for guided partitioning:" Enter a value just large enough for the Xen Dom0 system, leaving the rest for virtual disks.
Enter a value smaller than the size of your installation drive. Entering a percentage of maximum size e. Installing Xen Install a bit hypervisor. A bit hypervisor works with a bit dom0 kernel, but allows you to run bit guests as well. If you're running a version of Ubuntu before WiFi networks are tricky to virtualize and many times not even possible. If you are feeling adventurous, please start here Xen in WiFi Networks.
For this example, we will use the most common Xen network setup: bridged. You will also find an example on how to set up Open vSwitch which has been available since Xen 4. Disable Network Manager If you are using Network Manager to control your internet connections, then you must first disable it as we will be manually configuring the connections.
Please note that you are about to temporarily lose your internet connection so it's important that you are physically connected to the machine. You should have your internet connection back at this point. The bridge folder only appears to be created after first creating a bridge with the ''brctl' command.This page covers the steps to get a working Xen Project host system a. Fedora 16 is the first version of Fedora shipping a Linux kernel suitable for being used as Xen Project dom0 out of the box the first since the time of Fedora 8.
This comes directly from the fact that dom0 support is now merged in mainline Linux. This page explains the steps needed to turn a plain Fedora installation into fully functional Xen Project host.
Some general information about virtualization and Fedora are available here. For the most part, you can follow the Installation steps outlined in the official Fedora installation guides: F18F19and F For the lazies, here they are the installation quick start guides: F18F19F For obtaining install media images, look here or here. The only portion one should watch out is the disk partitioning section.
If wanting to to use file-backed domUs, nothing special even there. Have a look here for more details about this.XCP NG Xenserver 7.4 Install Tutorial. From bare metal to loaded VM using XenCenter
People who would like to test the very latest virtualization related packages coming from Fedora rawhide can enable the Virtualization Preview Repository please, notice that Fedora discourages doing this in 'production' deployments. Fedora Core 21 and later should have most all issues resolved. As a part of that, it also create a new GRUB2 boot menu entry.
Once the installation is complete, just reboot and select "Xen 4. If on Fedora 18 and 19, you will likely see something like "Xen 4. If on Fedora 16 or 17, it will have "Xen 4.
It is also possible that you only see something like "Fedora, with Xen hypervisor", and that is also ok. Networking deserves some special attention. That is why, from Xen Project 4. More on this matter down in the page. In case of any networking issues, or if you want to manually manage the network configuration, disabling NetworkManager is necessary e.
This is particularly true if you do not plan to install and use the typical Fedora virtualization tools, like libvirtetc. In fact, libvirt automatically creates a bridge and sets up the VMs created via its interface s to use it by default.
On the other hand, if not using libvirt, the bridge has to be created by hand. Also, make sure that the network service is kicked off automatically on subsequent restarts by running:. Next, create the configuration file for the bridge. The most common bridge name is br0, so let's stick to that although other Xen Project documentation suggests using xenbr0 to make it obvious that the bridge is for the hypervisor :.
Next, you need to find the configuration file for your existing network adaptor. It's most likely named ifcfg-eth0 or ifcfg-em0 the part after the dash can and does change depending on the actual hardware. Once you know what config file you're using, open it, find the line.
Note that in earlier versions of Fedora prior to 21libvirt with xen would always assume that the default bridge was 'xenbr0'. And even if you did change the option using the libvirt overrides it would ignore it. Fedora 21 libvirt has that fixed.It is a safer as in more reliable but specifically as in more secure - see the technical details section and more efficient alternative to PyGrub to boot domU images: unlike pygrub it runs an adapted version of the grub boot loader inside the created domain itself, and uses the regular domU facilities to read the disk mounted as root directory, fetch files from network, etc.
Since it uses the codebase of a widely used software i. Also, since it is not scripted but a compiled binary, it is probably more efficient and has less dependencies at least for Python. Lastly; Since the bootloader is designed to run as a paravirtualized loader in the DomU environment rather than to perform risky operations such as copying a file from a potentially non-trusted virtual disk on the Dom0 as PyGrub does; it is also way more secure.
Inspired from backdrift. I imagine most sysadmins are. Which must be why we put so much effort into scripting and automating repeated tasks. This makes it rather difficult to patch and upgrade among other things, especially as the number and type of guests you support grows. PvGrub can help solve this problem. It implements GRUB in a stub domain which in turn loads your guest domain.
It works quite well and is rather easy to set up. Read on to learn more. This means that your DomU guests can install and manage their own kernels as if they were running on regular hardware. We add these so that when the kernel install process goes to build a new initrd it will include the correct driver modules for your hardware, so we want to be certain that the Xen block and net drivers are included.
This should ensure that scripts used to automatically update the grub config when a new kernel is installed will work correctly. Now that the VM has been prepped for booting with pvgrub we need to update its configuration file to load the pvgrub kernel instead of a linux kernel. My Xen guest is named superchunk. You should be familiar with shutdown and create at this point.
At this point you should see some kernel output and then either a grub menu or the grub command line.
Fedora Host Installation
If you get the command line, no worries. Good luck! And feel free to drop me a line at soundsoldier backdrift. Until there is a pvgrub2, one should use the following resources to get help and solve problems:. Jump to: navigationsearch. This page talks mainly about the PV port of Grub 1. Personal tools Create account Log in.In the very early days of Xen it was necessary for the host domain 0 administrator to explicitly supply a kernel and perhaps initial ramdisk from the domain 0 filesystem in order to start a new guest.
Chapter 29. Configuring the Xen kernel boot parameters
This mostly worked and for some use cases, i. However for other use cases it was rather inflexible since it meant that the host administrator needed to be involved in what many considered to be a guest administrator, or even distribution level, decision i. The first solution to this problem to come along was pygrub. This allowed host admins configure a guest to use pygrub and thereby delegate the management and selection of the guest kernel to the guest administrator.
Guest administrators could use the usual tools which they expect i. Since it was introduced pygrub has gone from supporting the grub-legacy menu.
This had several advantages:. One minor downside of pvgrub is that it did not support syslinux or LiLo configuration files that would need to be achived via a PV port of those respective bootloadersalthough in practice they are not so widely used so this was a minor shortcoming.
A second shortcoming was that it is not possible for a PV guest to switch between and bit operation. This means that the user needs to know a-priori the type of kernel which they will be booting and the host administrator needs to provide the ability to select between and bit builds of pvgrub. The most serious problem today though is the move of most distributions from grub-legacy to grub 2with its radically different architecture and configuration file syntax.
This meant that admins could no longer simply reuse their existing grub 2 based workflows and distribution integration. Some workarounds have evolved such as pv-grub-menu but something better was needed…. This meant that it was now possible to compile the upstream grub 2 code base to run as a pvgrub2 Xen PV guest, in much the same way as the original pvgrub-legacy port of Grub legacy.
This has the same advantages as the pvgrub-legacy port originally had, except using the more modern grub 2 code base. In addition since this support was part of upstream grub there was no fork to maintain and therefore no risk that the Xen PV support would languish. This guide assumes that the PV guest is already setup with a grub2 configuration file, as if it were a native system i.
Using Grub 2 as a bootloader for Xen PV guests
Many distribution installers at least those for distributions which use grub2 will do this automatically even within a PV guest. If not then you may need to install manually, e. The last release of grub was 2. Since then the grub development team have released beta versions of grub 2.
In particular the latest, 2. Grub 2. Alternatively you can fetch the code from the grub git repository:. Other than the obvious things, such as make and gcc and slightly less obvious things such as flex and bison it is worth noting that:.
If you are compiling from git then you will need to start by generating the configure script.Overview This documents how to set up a Xen virtualization host to be usable via libvirt from virt-manager. The descriptions are taken from a So usually the host is a ubuntu-server based installation.
It might be possible to have a desktop install and add the Xen hypervisor and virt-manager on the same machine I have not tested that and I am not sure how well the desktop runs within dom0 as it can differ from bare metal.
So Xen can only be used on a 64bit capable cpu. The base installation can be 32bit, though. The xen-system-amd64 meta-package has to be used for both. By default libvirt is set up to provide one virtual NAT-bridged network virbr0 which can be used if guests are not required to be accessible from outside a DHCP server inside that virtual network is configured as well. Those get passed to the dom0 kernel. This allows to have certain kernel arguments when booting a kernel bare-metal and a different set of options for the dom0 kernel.
This is quite useful when trying to re-direct console output. A full list of boot options can be found in [ 1 ]. The console statements only make sense together. The Xen arguments com1 and console create and use the hypervisor console which the dom0 kernel argument will tell the dom0 kernel to use as well. Of course the host needs some serial port for that. This prevents memory ballooning. Memory in Xen can not be overcommitted.
Starting with Previous releases only work with the xm toolstack. Disable ballooning dom0-min-mem enable-dom0-ballooning no This is necessary to allow libvirt to access xend xend-unix-server yes Specify the name of the default bridge.
The amount of memory for dom0-min-memory should be the same as specified by the dom0 command line option. Disabling any dom0 ballooning is described in [ 2 ]. Older Xen installations would recommend to allow its scripts to set up bridges. But now [ 2 ] strongly suggests to let the OS create any bridges.
Naming the default bridge here avoids the need of making that setting in manually created guest config files. Transparent Bridging When Xen guests should integrate into an existing local network for example to make use of common PXE infrastructure, or to appear as normal local machinesa transparent bridge is required.
This can easily be created bridge-utils was already installed by the virt-host task. A safe value is the address of eth0. Declaring DNS nameservers here and per interface became important with changes to resolvconf in Precise. User Setup Libvirt can allow normal users to manage virtual machines, storage pools and virtual networks on a virtualization host.