virt-manager

From Gentoo Wiki
(Redirected from VirtManager)
Jump to:navigation Jump to:search

The virt-manager application is a desktop user interface for management of virtual machines and containers through the libvirt library.

Virt-manager shows all domains as running or inactive, presents performance data and utilization statistics. Virt-manager enables the easy creation of new domains, storage, network connections. Virt-manager also can reallocate host resources amongst the guest domain.

Virt-manager primarily handles KVM VMs, but also manages Xen and LXC (linux containers).

It presents a summary view of running domains, their live performance & resource utilization statistics.

Wizards enable the creation of new domains, and configuration & adjustment of a domain’s resource allocation & virtual hardware.

An embedded VNC and SPICE client viewer presents a full graphical console to the guest domain [1].

Overview

  • Firstly, virt-manager is a front-end to QEMU.
  • virt-manager can create/delete/maintain an instance of many virtual machine (VM).
  • virt-manager can start/stop a VM or a container.
  • virt-manager can mount a CD-ROM ISO image.
  • virt-manager can create different networking connections for the guest OS in VM to use.
  • virt-manager can create bridges, MACVLAN, static netdev, and NAT'd IP interface.
  • virt-manager can create/delete/maintain storage pools using many different filesystems such as directory, direct hard drive, gluster, iSCSI, LVM, multi-path devices, netfs, SCSI, RADOS/Ceph, and Sheepdog.

Installation

BIOS/UEFI

Verify that the host hardware has the needed virtualization support, issue the following command:

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

The vmx or svm CPU flag should be red highlighted and available.

And file /dev/kvm must exist as well:

user $ls /dev/kvm
/dev/kvm

Return back to QEMU for compliance.

USE flags

USE flags for app-emulation/virt-manager A graphical tool for administering virtual machines

gui Enable support for a graphical user interface
policykit Enables sys-auth/polkit authentication support, required when using app-emulation/libvirt with PolicyKit authentication
sasl Depend on the proper libraries needed to connect to SASL-enabled libvirtd instances (e.g. Kerberos-protected instances).
test Enable dependencies and/or preparations necessary to run tests (usually controlled by FEATURES=test but can be toggled independently)

Note
If virt-manager is going to be used, be sure to enable the usbredir and spice USE flags on the qemu package for correct operation.

USE_EXPAND

Additional ebuild configuration frobs are provided as the USE_EXPAND variables QEMU_USER_TARGETS and QEMU_SOFTMMU_TARGETS. See app-emulation/qemu for a list of all the available targets (there are a heck of a lot of them; most of them are very obscure and may be ignored; leaving these variables at their default values will disable almost everything which is probably just fine for most users).

For each target specified, a qemu executable will be built. A softmmu target is the standard qemu use-case of emulating an entire system (like VirtualBox or VMWare, but with optional support for emulating CPU hardware along with peripherals). user targets execute user-mode code only; the (somewhat shockingly ambitious) purpose of these targets is to "magically" allow importing user-space linux ELF binaries from a different architecture into the native system (that is, they are like multilib, without the awkward need for a software stack or CPU capable of running it).

In order to enable QEMU_USER_TARGETS and QEMU_SOFTMMU_TARGETS we can edit the variables globally in /etc/portage/make.conf, i.e.:

FILE /etc/portage/make.conf
QEMU_SOFTMMU_TARGETS="arm x86_64 sparc"
QEMU_USER_TARGETS="x86_64"

Or, the /etc/portage/package.use file(s) can be modified. Two equivalent syntaxes are available: traditional USE flag syntax, i.e.:

FILE /etc/portage/package.use
app-emulation/qemu qemu_softmmu_targets_arm qemu_softmmu_targets_x86_64 qemu_softmmu_targets_sparc
app-emulation/qemu qemu_user_targets_x86_64

Another alternative is to use the newer sexy USE_EXPAND-specific syntax:

FILE /etc/portage/package.use
app-emulation/qemu QEMU_SOFTMMU_TARGETS: arm x86_64 sparc QEMU_USER_TARGETS: x86_64

Emerge

root #emerge --ask app-emulation/virt-manager

Additional software

The virt-manager requires the app-emulation/libvirt package. See libvirt for installation.

Usage

To start :

user $virt-manager

To start virt-manager with the configuration window to gentoo guest, using default QEMU UNIX socket connection:

user $virt-manager --connect qemu:///system --show-domain-editor gentoo


Invocation

user $virt-manager --help
usage: virt-manager [options]

optional arguments:
  -h, --help            show this help message and exit
  --version             show program's version number and exit
  -c URI, --connect URI
                        Connect to hypervisor at URI
  --debug               Print debug output to stdout (implies --no-fork)
  --no-fork             Don't fork into background on startup
  --show-domain-creator
                        Show 'New VM' wizard
  --show-domain-editor NAME|ID|UUID
                        Show domain details window
  --show-domain-performance NAME|ID|UUID
                        Show domain performance window
  --show-domain-console NAME|ID|UUID
                        Show domain graphical console window
  --show-domain-delete NAME|ID|UUID
                        Show domain delete window
  --show-host-summary   Show connection details window

Also accepts standard GTK arguments like --g-fatal-warnings

Troubleshooting

virt-manager gui doesn't start or "virt-manager: command not found"

Version 4.1.0 changed USE flags, switching from gtk flag to gui. In order to (re)enable gui, the user must enable the gui flag before (re)build the package.

root #echo "app-emulation/virt-manager gui" >> /etc/portage/package.use/app-emulation

no polkit agent available to authenticate action 'org.libvirt.unix.manage'

This usually results from the user not being in the libvirt group. Add the user to the group with:

root #usermod -aG libvirt larry

QEMU/KVM not connected

Virt-manager uses libvirt as its backend to manager virtual machines. Therefore the libvirt daemon needs to be started.

root #libvirtd

Or to start libvirtd at startup, add the daemon to the OpenRC runlevel / systemd target:

OpenRC:

root #rc-update add libvirtd default

SystemD:

root #systemctl enable libvirtd

'NoneType' object has no attribute 'conn'

This is typically a result in the cursor settings being misconfigured. The simplest fix is installing x11-themes/adwaita-icon-theme and updating gsettings to use the Adwaita cursor theme.

root #emerge --ask x11-themes/adwaita-icon-theme
user $gsettings set org.gnome.desktop.interface cursor-theme "Adwaita"

Removal

root #emerge --ask --depclean --verbose app-emulation/virt-manager

See also

  • Virtualization — the concept and technique that permits running software in an environment separate from a computer operating system.
  • QEMU — a generic, open source hardware emulator and virtualization suite.
  • QEMU/QEMU front-ends
  • 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.