[How-To] Use the Openmediavault-KVM plugin

    • Official Post

    ______________________________________________________________________________________________________________

    ______________________________________________________________________________________________________________


    THIS GUIDE HAS BEEN MOVED TO THE OMV-EXTRAS WIKI.

    FOLLOW THIS LINK -> https://wiki.omv-extras.org/do…?id=omv7:omv7_plugins:kvm


    ______________________________________________________________________________________________________________

    ______________________________________________________________________________________________________________






    1. INTRODUCTION

    • The OPENMEDIAVAULT-KVM plug-in provides a virtualization tool built into the OMV GUI. We may have one or more "guest" operating systems remotely accessible on the server. Said in a "simple" way, having a server within the server.
    • The plugin uses LIBVIRT internally, so virsh commands will work if necessary. If you create a VM with the plugin, you can also make changes to that VM with virt-manager, any missing features in the plugin are probably available in virt-manager or virsh.
    • The access and visualization methods provided can be through standard viewers such as VNC, SPICE, or integrated into the web through NOVNC and spice-html5, facilitating access to the guest operating system from any browser.


    2. REQUIREMENTS

    • Have a processor with virtualization capacity. Check the characteristics on the CPU manufacturer's website.
    • Activate the virtualization feature in the server BIOS. See the manual for the server motherboard.
    • Having enough RAM to allocate to the virtual machine, and leaving enough RAM available for OMV.
    • To install the openmediavault-KVM plugin:
      • Install OMV-EXTRAS, see here
      • In the OMV GUI go to System> Plugins> Search and select the openmediavault-KVM plugin, click on Install.


    3. USE OF THE COMPLEMENT


    3.1 Previous steps

    • We need to create two folders. They can be shared folders, The libvirt-qemu user must have execute permissions on these folders (and the path to them, check the permissions of the used disk mount point). Customize the paths based on your file system.
      • /srv/dev-disk-by-uuid-........../pool. One of them we call "pool", it will be destined to store the virtual disks used in KVM.
      • /srv/dev-disk-by-uuid-........../ISOS. The second we call "ISOS", it is where we store the isos of the VMs we create.
    • Go to the download web of the operating system you want to install and download the installation ISO. Copy the ISO to the "ISOS" folder.


    3.2 Configure "pool" and "ISOS" as storage groups in KVM

    • In the OMV GUI go to Services>KVM>Pools> and click on + Add new pool
    • In the window define the following:
      • Name: pool
      • Type: Directory
      • Path: Click on the icon on the right, find and select the folder /srv/dev-disk-by-uuid-........../pool
    • While remaining in the Pools tab, repeat the process for the ISOS folder
    • You need to activate both folders. To do this, select one of the folders, press the State button in the menu, then Start. Repeat the process with the second folder. In the State column you should see running in both folders.
    • If we now go to Services>KVM>ISOs, we should see the iso previously copied, ready for use.


    3.3 Network Configuration

    • In the OMV GUI go to Services>KVM>Networks> Any network interface that we are going to use must be activated. Select the interface line and click on State then Start. In the column Network state we must see Active.
    • We will see a default network already configured. This interface will be able to access the host's resources, but it will not have an IP in our LAN, if not in a subnet.
    • If we want the VM to have an IP in our LAN we can use a Macvtap bridge. This interface will be able to access shared resources on the network, but will not be able to access shared resources on the host. To do this, press the + Add button and press Add Macvtap network button. In the window define the following:
      • Name: bridge
      • Network adapter: Select our network interface (you can see which it is in Network>Interfaces> The name of the network adapter appears in the Device column.
    • If we want a network interface that has an IP in our LAN and at the same time can access the shared resources of the host, we must create a bridge interface in OMV (in the Network>Interfaces section) as follows. Warning: This method will remove the current network interface configuration and replace it with a jumper. If you have services configured on the host with this network interface (for example, Wireguard), you will need to reconfigure them to work with the bridge:
      • Go to Network>Interfaces> Make a note of the network interface name that appears under the Device column. Select this interface and click delete, BUT do not apply changes yet.
      • Without applying the changes of the previous point, click on + Create then on Bridge. In the Interfaces field, find the name of our newly removed interface and select it. Enter the necessary data for the Ipv4 protocol with static IP, for this in Method select Static. Fill in the fields:
        • IP: Your OMV IP
        • Netmask: 255.255.255.0
        • Gateway: IP of your DHCP server (your router)
        • DNS: For example 1.1.1.1
      • Press Save and now you can apply the changes. Now your OMV network interface will have a name similar to br0. This is the bridge-type interface that you should select on your VM.
      • Add the newly created network interface (br0) to your VM. You should not create an interface in KVM, macvtap or any other.
        • If you already have a VM created:
          • stop it, remove the current interface assigned and simply select your VM and click on Network and then Add Network. In Model change virtio to bridge. In Bridge look for the network interface created in OMV, it will be br0 (or similar). Press Add.
        • If you are creating a new VM:
          • In the VM creation window, go to the Network section and change virtio to bridge. In the next field select your network interface br0.


    3.4 Configure the Virtual Machine

    • In the OMV GUI go to Services> KVM> VMs> Press the +Add button
    • In the window define the following:
      • OPTIONS:
        • VM name: The one we want. Don't use space, don't repeat VM names.
        • OS: Choose the right one for the system to install. In this case Generic Linux
        • UEFI: Can if necessary for some reason. We leave it deactivated.
        • CPUs: We assign the CPUs that we want according to our processor. In this case we have a CPU with 2 cores and 4 threads. We assign 2.
        • Memory: The one we have available depending on the case. In this case we have 8 GB and we assign 4 GB to it.
      • STORAGE VOLUME:
        • Volume: Choose to Create new disk. A dialog box opens asking for the pool for that volume.
        • Pool: We select "pool", here the virtual disk for the VM will be created.
        • Name: The name we want to identify the virtual disk. If we leave it blank it will be the same as the virtual machine.
        • Size: Size of the virtual hard disk, at least what the VM you are going to create needs. In this case 30GB.
        • Format: The format that will be given to the disk. We leave it as is if there is no reason to change it, qcow2.
      • OPTICAL DRIVE:
        • CD: In the drop-down select the ISO you want to install.
      • NET:
        • Model: We leave it as is, virtio. If we have created a bridge br0 in OMV we change this value to bridge.
        • Network: We select in the drop-down the network interface created in the previous point.
      • If there is a special reason for this, we can configure various options by clicking the Show advanced options button at the top of the window. The option to activate the sound, change the architecture, the chipset will appear, disc bus...
      • Click on Save and we should have our machine ready to boot. In the Services>KVM>Volumes we should see that the volume containing the VM has been created.
    • To start the virtual machine we select it and click on the State button, then click Start. The status will change to running and we can now access the VM.


    3.5 Access to the VM

    • Once the VM starts, we have 4 alternatives to access the VM, try the one that works best for you:
      • Access from the web noVNC and spice-html5. Press the Console button then Start, you can change the ports if you need (If the buttons are not activated try to change the value of one of the ports and leave it as it was), press Start Two links will appear in the noVNC and spice-html columns. We just have to click on one of them and a window will open in our browser with direct access to the VM.
      • Spice viewer. In the spice column we have the port to use, 5901. We need a viewer such as virt-viewer see here.
      • VNC viewer. In the VNC Port column we have the port to use, 5900. We need a VNC viewer see here.


    4. MORE INFORMATION


    • Problems with Windows VMs:
      • Download virtio drivers for VM windows see here
      • TPM2.0 emulation for Windows 11 VMs see here
      • Passing from the GPU to a Windows VM see here


    enjoy it !!

  • crashtest

    Approved the thread.
    • Official Post

    ______________________________________________________________________________________________________________

    ______________________________________________________________________________________________________________


    THIS GUIDE HAS BEEN MOVED TO THE OMV-EXTRAS WIKI.

    FOLLOW THIS LINK -> https://wiki.omv-extras.org/do…?id=omv7:omv7_plugins:kvm

    ______________________________________________________________________________________________________________

    ______________________________________________________________________________________________________________



    SPECIAL CASE: WINDOWS 11 VIRTUAL MACHINE



    1. PREPARATION

    • Download the Windows 11 ISO. At this moment it can be downloaded here https://www.microsoft.com/es-es/software-download/windows11


      • Copy the ISO to the ISOS folder we have created for the plugin.
    • Download virtio drivers ISO for windows. It can be downloaded here https://pve.proxmox.com/wiki/Windows_VirtIO_Drivers 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.
    • If we want the vm to be able to access the resources shared by the host, follow the procedure already described to create a bridge interface in OMV. (br0)


    2. VM CONFIGURATION

    • In the OMV GUI, go to Services> KVM> VMs>Press +Add new VM
    • In the window define the following:
      • SETTINGS:
        • Show advanced options: Activate if we want sound.
        • VM name: For example windows11
        • OS: Find and select Microsoft Windows 11
        • UEFI: Enable. When we activate it, another button called Secure boot will appear
        • Secure boot: Enable (Windows 11 Requirement)
        • CPUs: Allocate at least 2 CPUs (Windows 11 Requirement)
        • Memory: We allocate 4 GB minimum (Windows 11 Requirement)
        • Audio: Activate if we want sound.
        • TPM: Activate (Windows 11 Requirement)
      • STORAGE VOLUME:
        • Volume: Choose Create new disk.
        • Pool: Select “pool”, here the virtual disk for the VM will be created.
        • Name: Choose a name or leave it blank to use the same as the VM.
        • Size: 64GB minimum (Windows 11 requirement)
        • Format: qcow2 (raw if you need it)
        • Bus: virtio
      • OPTICAL DRIVE:
        • Optical disk: Select the Windows 11 ISO previously stored in the ISOS folder
      • NETWORK:
        • Model: Switch to Bridge to access the br0 bridge (If that's what we want)
        • Bridge: Select br0 (or the one we have created in OMV)
    • Press Save button
    • Before starting the VM we must add the virtio drivers for windows
      • In Services>KVM>VMs select the vm that we have created (yellow) and press the Optical button, then the Add disc button
      • In the window, open the Optical disc field and select the ISO with the virtio drivers previously downloaded.
      • Press the Add button. Now the vm has two drives, one with the Windows installation ISO and the other with the virtio drivers ISO.


    3. WINDOWS INSTALLATION

    • Start the vm.
      • Services>KVM>VMs Press the State button and then the Start button
    • Choose one of the described vms visualization systems.
    • Start Windows Setup normally. Choose the language, keyboard... until you get to...
      • Choose the installation type as custom.
      • When you get to the window to choose a hard drive to install on it will be blank.
        • Click on Load Driver.
        • Find the virtio driver for windows that we have attached to the vm and install the drivers for your version of Windows. Accept and now the virtual disk should appear. Select it and continue the installation normally.
    • When you have finished the installation you must install the complete virtio driver package to have access to all virtio devices.
      • Open the file explorer and look for the CD with the drivers. Run the file virtio-win-gt-x64 or virtio-wingt-x86 depending on your system and the drivers will be installed.
    • Now you should have everything in Device Manager working normally.


    4. 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 post Ryecoaaron published several interesting links to achieve this: RE: OMV6 - KVM GPU passthrough. How to?
    • Good luck!!


    Additions


    March 8, 2023 If you have a domain problem in your local network, read here

    • Official Post

    ______________________________________________________________________________________________________________

    ______________________________________________________________________________________________________________


    THIS GUIDE HAS BEEN MOVED TO THE OMV-EXTRAS WIKI.

    FOLLOW THIS LINK -> https://wiki.omv-extras.org/do…?id=omv7:omv7_plugins:kvm


    ______________________________________________________________________________________________________________

    ______________________________________________________________________________________________________________





    Remote connection with virt-manager to the server:


    The plugin is very complete and has practically everything you need, but if you need something else you can do it like this. Or from the command line with virsh commands.


    Install virt-manager on your PC.

    In the OMV GUI create a user, for example vmremote.

    Add the vmremote user to the libvirt libvirt-qemu and ssh groups

    Create ssh access for this user with Public Key Authentication. See here [GUIDE] Enable SSH with Public Key Authentication (Securing remote webUI access to OMV)

    Start virt-manager on your pc

    Click on File > Add connection and fill it as in the image (with the IP of your server/domain)


    Captura desde 2023-03-18 19-07-30.png


    Click on connect.

    Your vms should now appear on the dashboard.


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

    • Official Post

    ______________________________________________________________________________________________________________

    ______________________________________________________________________________________________________________


    THIS GUIDE HAS BEEN MOVED TO THE OMV-EXTRAS WIKI.

    FOLLOW THIS LINK -> https://wiki.omv-extras.org/do…?id=omv7:omv7_plugins:kvm


    ______________________________________________________________________________________________________________

    ______________________________________________________________________________________________________________



    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, the controller supports up to 4 monitors. Edit the xml configuration file of the vm and look for these lines:

    Code
    <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.

    Code
    <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 the vm is windows the QXL driver only supports one monitor. Therefore you must add a controller for each monitor up to a maximum of 4. You can try to edit the xml configuration file of the vm and look for these lines:

    Code
    <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>

    You can add another controller for each monitor you need by copying the same text below, but deleting primary='yes' For two monitors it would look like this:

    Code
    <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>

    But be careful, you must assign slot that is available and not already occupied slot=

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!