Table of Contents


KVM Plugin For OMV7

KVM Plugin For OMV7

KVM Plugin For OMV7



Summary

Kernel-based Virtual Machine (KVM) is an open source virtualization technology built into Linux. Specifically, KVM lets users turn Linux into a hypervisor that allows a host machine to run multiple, isolated virtual environments called “Guests” or “Virtual Machines” (VMs).

KVM converts Linux into a bare-metal “hypervisor”. All hypervisors need some operating system level processes such as a memory manager, a process scheduler, an input/output (I/O) stack, device drivers, a security manager, a network stack, etc., to run VMs. KVM has all these components because they're integrated into the Linux kernel. Every VM is implemented as a regular Linux process, scheduled by the standard Linux scheduler, with dedicated virtual hardware like a network card, graphics adapter, CPU(s), memory, and disks.

When used with the appropriate hardware (X86 and AMD64 with virtualization enabled in BIOS or UEFI), the OMV KVM plugin brings control of the necessary resources for virtualization into OMV's GUI. While so OS's can be a bit more involved, OMV's KVM plugin makes “spinning up” a guest OS a simple process when compared to the command line.

The plugin uses LIBVIRT internally, so virsh commands will work if needed. It is possible to connect to KVM from another machine on the network running virt-manager, providing yet another means of making modifications to a VM.

The plugin provides several methods of viewing a working VM. A Spice or VNC-like viewer can be installed on any machine on the network and access a VM. In addition, the plugin allows, from the GUI, to create integrated consoles accessible from any web browser using NOVNC or Spice-html5.

The ability to clone VMs, create snapshots, backups, restore, scheduled tasks, LXC configuration, etc. is provided.

Parts of the document:


Third Party Software Note

This OMV plugin uses KVM, which was created by a third party. See the project web page → KVM project web page KVM project web page for more detailed information and support.

This OMV plugin uses Qemu, which was created by a third party. See the project web page → Qemu project web page Qemu project web page for more detailed information and support.

This OMV plugin uses libvirt, which was created by a third party. See the project web page → libvirt project web page libvirt project web page for more detailed information and support.


Prerequisites


Installation

In OMV7's GUI:
Under System > Plugins, find and highlight openmediavault-kvm 7.X, and click the install button.

  Note
Depending on the development state of Debian at any given time, you may need to activate backports for the installation of this plugin.
To do this go to the omv-extras tab in the OMV GUI and click the Activate Backports button. Once the installation is done you can disable backports again if you want.

  Warning
Do not uninstall the openmediavault-sharerootfs plugin. It is a dependency of the openmediavault-kvm plugin. Uninstalling openmediavault-sharerootfs when the openmediavault-kvm plugin is installed will cause the openmediavault-kvm plugin to be uninstalled.


Overview of the plugin's operation

The plugin is divided into several tabs, which, for a better understanding, could be grouped as follows:

Creation and management of VMs

Services > KVM > VMs

VMs is the main tab of the plugin, the main dashboard of the plugin when we need to perform any action on a VM.

This tab will allow us to generate the VMs and manage them later. From here we can configure a VM from scratch or delete it, start or stop it, create a snapshot or a clone, add or remove virtual hardware from an already configured VM, etc. In short, any management related to the configuration and operation of a VM.

Creation and management of storage and networks

Services > KVM > Pools

This group of tabs are what manage and define storage and networking in the plugin. From the VMs tab we will decide which storage or which network interface to assign to each VM, but in order to do so, we must previously configure it from this group of tabs.

The procedure followed by the plugin is to generate one or more pools where we can store the virtual disk drives, and one or more pools where we can store the ISO images to be able to assign them to a VM in the form of a virtual DVD drive.

From the Pools tab we can generate and activate or delete the different pools.

From the Volumes tab we can manage, create and delete virtual drives that will be stored in one of the pools created in the previous tab.

The ISOS tab does the same as the Pools tab but with DVD ISO images.

As for the networks, they are generated and activated or deleted from the Networks tab.

Once we have created and activated at least one pool for storage volumes, at least another pool for DVDs, and at least one network interface, we will be able to go to the VMs tab to create a vm.

Various utilities for vms

Services > KVM > Schedule > Create

The rest of the tabs simply group various added vms management utilities, such as making and/or restoring backups, scheduling tasks, and configuring LXC containers.

The Backup tab shows the actual backups performed and logged in /etc/omv-backup-vm.list. You can delete backups if needed here as well. The fact that the buttons are there gives you a quick way to run an identical backup to the one selected. Much faster than setting up a scheduled backup, especially if you just want a one off backup.

The Restore tab lists the same backups from the Backups tab and allows you to restore that backup to the same or different VM name.

The Schedule tab allows you to schedule backups and run ad hoc backups from that scheduled item.

So while you can create backups from two tabs, they accomplish the goal in different ways.

The Settings tab allows you to configure LXC containers.


Preconfiguring the plugin → Storage and Network interface

Storage

Prior to configuring any virtual machine, it is necessary to enable in the add-on the storage where to locate the virtual drives for the VMs and the storage where to locate the DVD ISO images.

For this the plugin provides a tool to define the necessary pools and use each one for different purposes.

Therefore it will be necessary to define two pools, one for virtual drives and another for ISO images. When they are created it will be necessary to activate them so that KVM recognizes them. The necessary steps for this are first Create the folders and second Configure and activate the pools that the plugin will use in the previously created folders.

  1. Create the folders.
    • We create two folders that we will call volumes and isos.
      • In Storage > Shared Folders create a folder called volumes.
        • Click on Create in the top menu.
        • In the Name field write volumes
        • In the File system field choose the appropriate one. It is suggested to use a separate disk of the operating system formatted in EXT4 to avoid problems.
        • In the Relative path field type volumes/
        • Press Save
      • Follow the same to create the isos folder.
      •   Warning
        These folders are now owned by the root user and the users group and have 2775 permissions, that's enough for it to work.
        The libvirt-qemu user (id=64055) must have path access to these folders, make sure of this if you choose another way to create those folders.
  2. Configure and activate the pools that the plugin will use in the previously created folders.
    • To create the virtual drive storage pool in the OMV GUI go to the Services > KVM > Pools and click Add new pool.
      • In the Name field assign the same name as the created folder, in this case volumes.
      • In the Type field choose Directory.
        •   Note
          The Directory option will determine a folder on your server. If you want to define another type of storage, you can display the Type field and choose the required option for each case. You can check the different configurations at https://libvirt.org/storage.html
      • In the Path field, search for the folder in the tree (button on the right) and select it. Disk mount folders are usually in the /srv folder.
      • Press Add
      • Now the pool is created, it only remains to activate it so that KVM can use it. To do it:
        • Press the line corresponding to the pool.
        • Press State in the top bar.
        • Click Start on the dropdown menu options.
        • Now the pool is active, the State column shows the value Running, otherwise there is something wrong.
    • Now it is necessary to create and activate the other pool for DVD ISO images. To do so, repeat the steps you followed to create and activate the pool volumes, simply choose the isos folder created previously and name it isos.

You should now have two active pools, volumes and isos. You lack the network.

  Note
If we want to create a Windows virtual machine, in the Pools tab we can download the ISO image with the Virtio drivers for Windows.
To do this, select the isos pool and then press the top button Download virtio iso. It will be downloaded and available in our isos pool.


Network interface

To configure a VM it is necessary to have a network interface on the system that can be assigned to that VM. For this we have different options, depending on what we need the VM to do once it is up and running. Basically, the differences between the different methods are whether or not we want the guest virtual machine to be able to access the host's shares and whether we want it to be on the same network. The following table illustrates these differences.

Access to host resources IP on the same LAN as the server
Virtual interface Default Network Yes No
Macvtap Bridge No Yes
br0 Bridge interface on OMV Yes Yes
Physical interface Separate physical interface on the system Yes Yes


Configuring a Default Network


Configuring a Macvtap Bridge

Services > KVM > Networks


Configuring a br0 bridge interface on OMV

Network > Interfaces > Create

  Note
The br0 bridge will affect the entire server, once configured all services will need to use this network interface. This implies that if you already have a service running, it will be affected and you may have to reconfigure it.
An example of this is openmediavault-wireguard plugin, if it is already configured and working you will have to modify the network adapter so that Wireguard also uses it.

Configuring a Separate physical interface on the system

Configuring a Virtual Machine

Services > KVM > VMs > Create VM


Access methods for viewing the VM

Services >KVM > VMs > Create Consoles

Once the VM is started, we have different alternatives to access the VM and visualize its operation:

  1. Access from a browser by creating noVNC and spice-html5 consoles.
    • With the VM running and from Services > KVM > VMs select the VM and press the Console button on the top menu bar.
    • Press the Start button on the dropdown menu.
      • In this dialog you can change the access ports if you need to.
    • Press the Start button to create the consoles (Note: If the Start button is not available modify any of the ports and it will be activated, you can leave the port again as it was before pressing Start).
    • In the VM line, two links should have appeared in the Spice-html5 URL and noVNC URL columns. If you click any of the two links, a window will open in the browser with access to the VM.
  2. Spice visor.
    • In the Spice Port column, the port that we must use to access the VM with Spice appears → 5901.
    • We need a viewer such as virt-viewer.
      • Tip: This viewer can be installed on Windows and works well, but it has a small drawback that has not been resolved for years and that makes it uncomfortable to use, it does not store the access addresses and it is necessary to write them each time. You can solve it in part as follows:
        • Edit the shortcut with which the application starts (right click > properties)
          • In the Destination field you will have something similar to this:
            • "C:\Program Files\VirtViewer v11.0-256\bin\remote-viewer.exe"
          • Add at the end a space and the path you want to connect to, for example:
            • "C:\Program Files\VirtViewer v11.0-256\bin\remote-viewer.exe" spice://192.168.1.50:5901
          • Accept changes.
          • From now on, when you start virt-viewer, the connection window will not appear, but you will be automatically logged in at the address spice://192.168.1.50:5901
        • If you need to connect to multiple IP addresses, you can create multiple shortcuts each with a different IP. You can leave a shortcut to bring up the login window, so you can always enter new addresses.
  3. VNC viewer.
    • In the VNC Port column, the port that we must use to access the VM with VNC appears → 5900.
    • We need a viewer such as VNC viewer.

  Note
Depending on the language of your keyboard and other variables, one method may work better than another.
Try and decide the one that works best for you.


Maintenance. Editing a virtual machine. Using the plugin GUI.


Configuring a Windows 11 VM

Preparation

Windows software download page

Windows_VirtIO_Drivers


Configuring VM


Windows Installation


Graphic Card


Remote connection with virt-manager to KVM

  Warning
Use this only to make minor modifications, creating a VM from virt-manager or making certain modifications may have unexpected effects on performance.


Increase the number of monitors in the VM with QXL


If it's a Linux VM

<video>
<model type='qxl' ram='65536' vram='65536' vgamem='16384' heads='1' primary='yes'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/>
</video>
<video>
<model type='qxl' ram='65536' vram='65536' vgamem='16384' heads='2' primary='yes'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/>
</video>


If it's a Windows VM

<video>
<model type='qxl' ram='65536' vram='65536' vgamem='16384' heads='1' primary='yes'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/>
</video>
<video>
<model type='qxl' ram='65536' vram='65536' vgamem='16384' heads='1' primary='yes'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/>
</video>
<video>
<model type='qxl' ram='65536' vram='65536' vgamem='16384' heads='1'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/>
</video>

Support

If you need support on this plugin you can post your problem in this dedicated forum thread.


Source Code

openmediavault-KVM


A Closing Note

We, who support the openmediavault project, hope that you’ll find your openmediavault server to be enjoyable, efficient, and easy to use.

If you found this guide to be helpful, please consider a modest donation to support the hosting costs of this server (OMV-Extras) and the project (Openmediavault).

OMV-Extras.org



www.openmediavault.org