User:Egberts/Drafts/Virtualization

From Gentoo Wiki
Jump to:navigation Jump to:search
This article is a stub. Please help out by expanding it - how to get started.
Warning
most of the content has been transferred to Virtualization, we can delete this page soon.

ouch, a Xen developer reached out to me thus upstaging all the diagrams and talking points of Virtualization.

this is now a Rough Draft only and not ready for release.


Note
Upon completion, be sure to remove all User:Egberts/Drafts from all Wiki links.

Virtualization is the concept and technique that permits running software in an environment separate from a computer operating system.

The operating system actually running on the hardware is referred to as the host. On this host resides a hypervisor (aka virtual machine manager), which runs virtual machines containing guest software.

Concepts

There are two types of hypervisors:

  • Type-1 hypervisors are installed directly on hardware. (VMware ESXi, Xen)
  • Type-2 hypervisors are installed on top of an operating system. (VMware Workstation, QEMU/KVM)

Type-1 hypervisor

Type 1 hypervisors provide a higher level of performance as there is no overhead from the interaction of the hypervisor with the guest OS.

Type-2 hypervisor

Type-2 hypervisor subcategories are broken down into:

  • Software-assisted virtualization (also known as software-based emulation or software emulation)
  • (Pure) hardware-assisted (native) virtualization
  • Hybrid hardware-assisted virtualization



Virtualization concept is shown below:


Virtualization Modeling


Software-assisted virtualization

  • use of machine code translator (qemu/tcg, (VMware Workstation <7)

(Pure) hardware-assisted (native) virtualization

Hardware-assisted virtualization provides virtual machines with high performance because the physical CPU is partly mapped directly to the virtual CPU (vCPU); machine codes within guest VM are directly executed on host CPU.

  • CPU VT flag enables direct execution of binary code.

Hybrid hardware-assisted virtualization

By mitigating some performance hit, guest drivers are deployed to replace the direct-PCI drivers and allow multiple guest to share the same host devices.

This combination has been called "hybrid virtualization"

Virtualization software

There is a comparison table of virtualization software that can handle virtual machines and containers. QEMU is also broken out by its supported accelerators add-ons as well as its default software-emulation mode.

Virtual machines

A virtual machine controls their own CPU scheduling, chipset memory management, storage accesses, and networking interfaces; in short, a virtual CPU that can do pretty much everything the bare-metal CPU can do; an operating system is installed as-is inside a virtual machine to gain a functional platform.

Virtualizer Virtualization type Description Gentoo package name
qemu full[1]/software-emulation QEMU's own Tiny Code Generator. This is the default. More frequently denoted as qemu and not qemu/tcg so often. app-emulation/qemu
VMware ESXi native VMware, Inc. sells a variety of closed-source hypervisors. Type-1 virtualization. Also uses libvirt driver. app-emulation/open-vm-tools
Xen native, paravirtualization[2] Native, bare-metal, hypervisor that allows multiple distinct virtual machines (referred to as domains) to share a single physical machine. Type-1 Virtualization; supports Microsoft Windows as a guest OS. Also can do Type-2 Virtualization which does not support Microsoft Windows as a guest OS[3] app-emulation/xen
VirtualBox paravirtualization[4] Cross-platform virtualization software that allows users to run guest operating systems inside a Virtualbox host operating system. app-emulation/virtualbox
Bhyve (FreeBSD) paravirtualization[5] bhyve, the "BSD hypervisor" is a hypervisor/virtual machine manager available on FreeBSD, macOS, and Illumos.
User-Mode Linux (UML) paravirtualization[6] The UML driver for libvirt allows use and management of paravirtualized guests built for User Mode Linux. UML is a software-assist, Type-2 virtualization. incorporated into mainstream Linux repository in 2016

Wikipedia has more on virtualization this over at Libvirt#Supported Hypervisors.

Containers

A container is the sharing of its OS libraries and/or OS-resources by providing a jail-like environment. Its jail-like environment may be in a form of operating system-level virtualization or an application-level virtualization.

Only operating system-level virtualization are covered here; application-level virtualization is typically instructed by using a sequence of byte-code through a just-in-time compiler or interpreter on a stack-based/register-based machine model platform.

Virtualizer Virtualization type Description Gentoo package name
Buildah OS Tool that facilitates building OCI images app-containers/buildah
Docker OS[7] Container virtualization environment which can establish development or runtime environments without modifying the environment of the base operating system. app-containers/docker
LXC (Linux Containers) OS[8] Virtualization system making use of the cgroups feature of the Linux kernel. app-containers/lxc
LXD OS[9] Next generation system container manager. app-containers/lxd
Podman OS[10] Daemonless container engine for developing, managing, and running OCI Containers on linux. app-containers/podman
systemd-nspawn[11] OS[12] Systemd nspawn sys-apps/gentoo-systemd-integration


Kernel support

AMD CPUs

To inspect hardware for virtualization support issue the following command:

user $grep --color -E "svm" /proc/cpuinfo

The running kernel supports hardware virtualization when "svm" is visible in the output.

Intel CPUs

Hardware virtualization support for Intel based systems can be tested by running the following command:

user $grep --color -E "vmx" /proc/cpuinfo

The running kernel supports hardware virtualization when "vmx" is visible in the output.

See also

  • Libvirt — a virtualization management toolkit.
  • Libvirt/QEMU_networking — details the setup of Gentoo networking by Libvirt for use by guest containers and QEMU-based virtual machines.
  • Libvirt/QEMU_guest — covers libvirt and its creation of a virtual machine (VM) for use under the soft-emulation mode QEMU hypervisor Type-2, notably using virsh command.
  • Virt-manager — desktop user interface for management of virtual machines and containers through the libvirt library
  • Virt-manager/QEMU_guest — QEMU creation of a guest (VM or container)
  • QEMU/Linux guest — describes the setup of a Gentoo Linux guest in QEMU using Gentoo bootable media.

External resources

References