Portal:MicroOS/XEN
Running MicroOS in XEN
Xen is a software that creates a virtual machine monitor (or hypervisor) that allows the execution of multiple virtual guest operating systems simultaneously on a single physical machine.
The hypervisor runs directly on top of the physical machine, instead of running within an operating system, like KVM.
Virtual machines referred as domains in Xen. Domain 0 (dom0) is a spacial domain that is responsible for controlling the underlining hypervisor, and starting other guest operating systems known as domain U (domU) for unprivileged.
There are two primary types of virtualization. One is paravirtualization (PV), that requires adjustment in the guest kernel in order to access the API of the hypervisor to access hardware resources like the CPU, storage or network.
The other mode is hardware virtualized machine (HVM), that can be a bit slower in performance, but do not requires any change or adaptation in the guest kernel.
Installing Xen
Before running MicroOS VMs under Xen, we need to install the Xen hypervisor in the host. We should install "Xen tools" from the Virtualization / Install Hypervisor and Tools from YaST. This will install the hypervisor and the different libvirt tools recommended for the management of the VMs. For more details, please follow the instructions from the openSUSE Virtualization Guide about how to install Xen using YaST.
We should now reboot the server and select from Grub the entry "Xen
kernel". If we are on remote we can execute sudo grub2-reboot 2
or
grub2-set-default
to pre-select the correct Grub menu entry.
After the reboot, to validate that we are in the correct domain
(dom0), we can execute sudo xl dmesg
. This will show information
from the Xen hypervisor.
Executing MicroOS as domU
We can run MicroOS inside Xen via PV downloading one of the official images from OBS. There are three flavors from where we can choose from:
- kvm-and-xen
- ContainerHost-kvm-and-xen
- Kubic-kubeadm-kvm-and-xen
The three of them provides a Xen aware kernel with the Xen tools CLI required to query the hypervisor. ContainerHost also includes podman container runtime, and Kubic-kubeadm provides cri-o, kubeadm and all the tools required to setup a Kubic cluster.
All the images also includes Ignition and Combustion in order to configure the initial boot. We use this service to make adjustment into the general image during the first boot. Typically is used to resize the disk, add a password to the root user, enable some services and install new packages.
We need to provide a configuration file via an ISO image or USB flash drive (refer to the Ignition documentation for an example about how to create one), together with the MicroOS qcow2 image. We should copy both images into "/var/lib/libvirt/images" before creating a Xen VM from virt-manager.
In virt-manager we can now create a Xen paravirtualized VM. We should remember to add a CD-ROM device attached to the ISO image that contain the "config.ign", required for the first boot.