User:Egberts/Drafts/QEMU

QEMU (Quick EMUlator) is Article description::a generic, open source hardware emulator and virtualization suite.

QEMU is a Type-2 hypervisor that runs within user space and performs virtual hardware emulation.

QEMU when used in conjunction with an accelerator becomes a Type-1 hypervisor that runs in kernel space, that allows a user space program access to the hardware virtualization features of various processors. Such accelerator can be KVM (Kernel-based Virtual Machine) or Xen.

If no accelerator is used, QEMU will run entirely in user-space using its built in binary translator TCG (Tiny Code Generator). Using QEMU without an accelerator is relatively inefficient and slow.

Overview

 * Firstly, QEMU is a type 2 hypervisor.
 * QEMU can be paired with KVM to run VMs at near native speed. This is accomplished by using hardware extensions such as: Intel VT-x or AMD-V.
 * It can then emulate for user-level processes that allow applications compiled for one architecture to run on a different one.
 * Multiple operating modes: User-mode emu, System emu, KVM hosting, and Xen Hosting,
 * QEMU can save and restore the state of VMs with all programs running.
 * QEMU VMs can interface with many types of physical host hardware such as CD-ROM Drives, USB Devices, Audio Interfaces, Hard Disks, Network Cards
 * Virtual Disk Images can be stored as qcow or qcow2 format which only uses as much disk space as the Guest OS is actually using. Therefore, allowing for a large emulated disk to only use a small portion of the host’s disk space. In turn, it also allows for the ability to revert the emulated disk’s contents to a previous state. (Snapshots)
 * It does not depend on graphical output methods on the host system, instead making use of an integrated VNC server to access the screen of the guest OS.
 * QEMU is able to execute multiple virtual CPUs in parallel.

Installation
This section details the fastest paravirtualization (QEMU/KVM) setup for a host that has been installed with Gentoo OS on either },, or CPU hardware platform.

BIOS and UEFI firmware
In order to utilize KVM either  or   must be supported by the host processor. or are Intel and AMD's respective technologies for permitting multiple operating systems to concurrently execute operations on the host processors.

To inspect host hardware for virtualization support, issue the following command:

If KVM support is available, there should be a device listed under. This will take effect after the system has booted to a KVM-enabled kernel.

Kernel
Described below are the basic requirements for KVM kernel configuration for the host OS. A more complete and up-to-date list can be found at the [//www.linux-kvm.org/page/Tuning_Kernel KVM Tuning Kernel] page.

Physical CPU processor support - Host
If KVM support is not available, insert CONFIG_KVM=y into the and rebuild/reinstall the kernel (and its initramfs image). Come back here after the host gets rebooted.

For the QEMU host, choose one of the two CPU architectures found on its hardware platform:

or

Since we are building the KVM into the kernel (and not as a module), only choose one CPU architecture: Intel or AMD.

Virtual CPU processor support - Guest(s)
For a list of supporting CPUs that the guest platform(s) on this host should support, consult the [QEMU use flags] and insert desire target(s) into the USE= string in the portage configuration  file.

Handling kernel config at CLI
To set the various kernel configuration settings from the command lines, the shall be used here:

Mandatory kernel configuration options to set:

Useful kernel configuration options to use:

Accelerated networking, required for  USE flag (recommend):

Needed for 802.1d Ethernet bridging:

Intel VT-g (integrated graphics adapter virtualization)
Mediated device passthrough for Intel GPUs (Broadwell and newer) [//forums.gentoo.org/viewtopic-p-8157704.html].

Additional software
User name is required; Defined by ; evoked by  package.

Group name is required. Defined by ; evoked by package.

Environment variables

 * G_MESSAGES_DEBUG
 * LISTEN_FDS
 * LISTEN_PID
 * QEMU_AUDIO_DRV
 * QEMU_MODULE_DIR
 * XDG_RUNTIME_DIR

Files

 * - QEMU configuration file.
 * - QEMU lock files
 * - QEMU SAN lock
 * - Domain XML setting for a virtual machine or container.
 * - Autostart this domain (virtual machine or container).
 * - Network XML setting file for a network connection
 * - Autostart this network connection.
 * - UNIX socket file for Libvertd daemon API
 * - Host OS capabilities in XML-format
 * - holds UNIX sockets and AES keys for this domain.
 * - holding directory of hibernation images
 * - holding directory of snapshots
 * - various UNIX socket and PID files for daemon.
 * - holding directory of hibernation images
 * - holding directory of snapshots
 * - various UNIX socket and PID files for daemon.
 * - various UNIX socket and PID files for daemon.

Troubleshooting
TBS