KVM Plugin For OMV6
KVM Plugin For OMV6
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 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 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 for more detailed information and support.
Prerequisites
-
The server processor must have virtualization capability → Check the characteristics on the website of your CPU manufacturer.
The virtualization feature must be enabled in the server BIOS → Consult your server's motherboard manual.
Consider the RAM needs for the guest VMs on your system.
A couple of cool beers on hand will be welcome.
Installation
In OMV6's GUI:
Under System > Plugins, find and highlight openmediavault-kvm 6.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.
|
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
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
Pools
Volumes
ISOs
Networks
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
Backup
Restore
Schedule
Settings
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.
Create the folders.
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
This is the network interface that is already configured by default in the plugin. The only thing we need to do to be able to use it in any VM is to activate it.
It gives the guest VM access to the host's resources but the IP will be in a subnet.
To activate the Default Network:
In the OMV
GUI go to
Services > KVM > Networks and select the network, click on the corresponding line.
Click on the State button in the top menu.
Press the Start button on the dropdown menu.
Right now that network interface is up. The Network State column should read Active and KVM will be able to assign it to any VM.
Configuring a Macvtap Bridge
This type of network interface is easily configurable in the openmediavault-KVM GUi.
With this network interface, the guest virtual machine's IP will be on the same network as the host and will be able to access shared resources on the network, but will not be able to access shared resources by the host.
To configure this type of network interface:
In Services > KVM > Networks click on the Add button on the top menu bar.
Click on Add macvtap network in the dropdown menu
In the Name field define a name for the interface, for example, bridge.
In the
Network Adapter field, choose the network adapter that we want to use. We can check which one is used by OMV in the
GUI in
Network > Interfaces The name will appear under the
Device column.
Press Add.
Now the network interface is created but not active, we can check it by reading the value shown in the Network State column. To be able to assign this interface in a VM we must activate it. To do it:
Select the network interface (yellow) by clicking on the corresponding line.
Click on the State button in the top bar menu.
Press the Start button on the drop down menu.
Now the network interface is already active, the Network State column shows the value Active
Configuring a br0 bridge interface on OMV
This interface is the one that offers more connectivity to the guest machine on the host. It allows access to shared resources and also the IP will be in the same network range as the host.
The procedure can be summarized by saying that we are going to create a virtual network switch in OMV. To do this, we are going to replace the network interface that the OMV server is currently using with another Bridge type interface. OMV will use the new Bridge interface from then on and will continue to receive the same IP it had, but now through the new network interface.
Once the change is made, that Bridge interface can be assigned to any VM that we configure in the KVM plugin, so that the Bridge will request another IP from the DHCP server of our network (usually the router), within the same network range, for the VM.
Since we have to remove the existing network interface and to replace it with a new one, in order not to lose the connection during the process we take advantage of the feature offered by OMV to perform several configurations before accepting the changes in the upper yellow bar. That is, we remove the current interface, without applying changes we configure the bridge, and once configured we apply changes. As soon as we accept the changes, the existing network interface will be deleted and the new one will be configured simultaneously, so that everything will continue to work normally.
To configure the bridge in OMV:
In the OMV
GUI go to
Network > Interfaces. Make a mental note of the name of the current interface that appears in the
Device column. Click on the line to select it and click on
Edit button in the top bar menu. Write down your network interface values or take a screenshot, you will need them later. Hit the
Cancel button and exit edit mode.
Select the interface by clicking on the line and click on the Delete button in the top bar menu and click on Yes, but DO NOT ACCEPT THE CHANGES IN THE YELLOW BAR YET, if you do, the interface will be deleted and you will lose the connection.
With the yellow bar pending to accept changes, we are going to configure the new bridge-type network interface.
Click on the Create button in the top bar menu.
In the dropdown menu press the Bridge button. A dialog will open to enter the configuration of the bridge type interface.
In the Interfaces field, drop down the menu and choose your old network interface, the one you mentally noted. All that remains is to enter the configuration values of the interface as if it were the one you had previously. Fill in the previously noted values.
In the IPv4 field select Static.
In the Address field, enter the current OMV IP.
In the Netmask field, enter the value you had, 255.255.255.0
In the Gateway field you had the IP of your DHCP server (probably your router), enter it.
Do not forget to fill in the
DNS servers field or you will be left without internet access. Enter the value you had. If you don't remember it, for example
1.1.1.1
will serve you.
Press the Save button.
Now the new bridge network interface is configured, when you click on Accept the changes in the upper yellow bar, the previous interface will be deleted and the bridge will be created simultaneously. Accept the changes in the top yellow bar.
Now the original interface is removed and the new bridge type interface is created and working. The name of the original interface no longer appears in the Device field, now the name of the interface is br0.
This is the network interface that we will select in the plugin if we want a VM to use the br0 bridge. We don't need to configure anything in the Network section of the plugin.
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
If you have two physical network interfaces on your server you can reserve one of them for KVM. Just don't set it to OMV.
Depending on the type of connection (USB, pcie,…) you must choose the appropriate method to attach this hardware to the VM. Once a VM is configured you can attach the hardware in the VMs tab, choosing the appropriate button in each case on the top bar.
Configuring a Virtual Machine
The first requirement is to have storage and a network interface. If you have not configured them yet, do so by following the steps in the previous point.
Download the ISO of the guest operating system you want to configure and store it in the isos folder.
To configure a VM we must go in the
GUI to
Services > KVM > VMs and click on the
Add new vm button from the menu on the top bar. A dialog box for entering the virtual machine configuration parameters will open with the following sections:
Hit the bottom Save button.
At this point the Virtual Machine is configured.
The volume will be created and should appear under Services > KVM > Volumes.
The virtual machine xml configuration file is generated and can be viewed or edited in Services > KVM > VMs before starting the VM.
If you need to make any changes to the VM before starting it, this is the moment.
For example, you might need to add a second DVD with the virtio drivers in case you are setting up a Windows VM. In this case, in Services > KVM > VMs, select the VM and press the top button Optical. Click on Add disc and select the ISO image you want to add.
To start the VM select it and click the State button from the top menu bar, then click the Start button from the dropdown menu.
Access methods for viewing the VM
Once the VM is started, we have different alternatives to access the VM and visualize its operation:
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.
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.
Spice visor.
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.
|
Configuring a Windows 11 VM
Preparation
Download virtio drivers ISO for windows. It can be downloaded on the
proxmox download page or directly from the plugin:
Go to Services > KVM > Pools and select the isos pool. The top buttons will be activated.
Press the Download virtio iso button. At that time we already have it available in the isos folder and ready to use.
Configuring VM
Windows Installation
Graphic Card
Right now we are using the virtio QXL drivers. For most users it should be enough, but if you need more graphics power you can attach a dedicated card to the vm.
The plugin does not provide this feature so you would have to do it manually. If you have the right hardware and enough patience you will be able to do it, it is a long and hard road, but it has an end.
A good starting point is here, in this
forum post Ryecoaaron published several interesting links to achieve this. This other
forum post shows links to port an integrated intel GPU to the VM.
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 you need two monitors or more in your vm with the QXL driver, you can do it by modifying the xml file of the vm as follows, depending on whether the VM is Linux or Windows (remember to shutdown the VM before the modification and restart the service after of the modification):
If it's a Linux VM
If it's a linux vm, the controller supports up to 4 monitors.
It will be necessary to edit the xml configuration file of the VM and make some modifications:
In the OMV
GUI go to
Services > KVM > VMs Select the VM line and press the
Advanced button, then press
Edit xml button.
Look for these lines:
<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>
Change the heads value to a value of 2, 3, or 4, to have up to 2, 3, or 4 monitors. For two monitors it would look like this.
<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
Source Code
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