Provisioning VMs within DaDesktop via Virt Manager

Introduction

When preparing course materials, it is often beneficial to virtualize a server within DaDesktop. You may also choose to virtualize one or two client machines, using either a matching operating system or a hybrid Windows/Linux environment.

Managing 'Nested VMs' can be achieved through Virt Manager or VirtualBox. If using Linux, Vagrant is an optional companion tool, while VirtualBox is the recommended solution for Windows 10 DaDesktop environments.

DD Machines Nested Virt

Based on extensive testing, we recommend Virt Manager as the primary solution. This is due to certain issues identified with VirtualBox in this specific context; consequently, we do not currently advise using VirtualBox for this purpose.

The VirtManager application leverages the libvirt library to deliver comprehensive virtual machine management services. Its desktop interface simplifies the creation, deletion, and management of multiple virtual machines. While primarily designed for KVM VMs, it also supports other hypervisors such as Xen and LXC.

Virt Manager also integrates seamlessly with Vagrant, simply :-

apt install vagrant-libvirt

It is worth noting that fewer Vagrant boxes are natively available for libvirt/kvm compared to VirtualBox. However, existing boxes can be easily adapted for libvirt usage, as demonstrated here :-

https://medium.com/@gamunu/use-vagrant-with-libvirt-unsupported-boxes-12e719d71e8e

The user interface offers a comprehensive overview of all VMs, including their status, CPU usage, live performance graphs for running instances, and detailed resource utilization statistics.

If you are new to Virt Manager, it shares many similarities with VirtualBox, but with key distinctions outlined below.

This is a helpful guide on using virt-manager on Ubuntu Linux - https://www.debugpoint.com/virt-manager/

Why should I use Virt Manager instead of Virtualbox?

Advantages
  1. Superior performance - Virt Manager utilizes VirtIO drivers for storage, networking, and graphics, resulting in significantly enhanced performance. Virtio drivers are KVM's paravirtualized device drivers, compatible with Linux and Windows guest virtual machines running on KVM hosts. The virtio package supports block (storage) devices, network interface controllers, and graphics. As VirtIO drivers are open source, they are easily installed if not pre-installed on your Linux distribution.
  2. Greater configurability options
  3. Strong compatibility with Vagrant
  4. VirtualBox components are not fully open source
  5. Virt Manager eliminates the need for module recompilation after kernel upgrades, a requirement for VirtualBox.
  6. VirtualBox is occasionally prone to breaking following kernel upgrades.
Disadvantages
  1. VirtualBox generally offers a slightly shorter learning curve
  2. Configuring 'Host networking' is more straightforward in VirtualBox than in Virt Manager, although NAT functions effectively for most networking scenarios on both systems.
  3. VirtualBox supports multiple platforms, whereas Virt Manager is exclusively available on Linux


Overall, for running servers within a DaDesktop machine, Virt Manager is the preferred choice.

Installation

Given the continuous improvements in libvirt, it is best to use the latest non-LTS Ubuntu or Debian version.

Installation of kvm and virt-manager involves brief steps; however, please follow a current guide tailored to your preferred DaDesktop OS. Here is a recommended guide https://www.debugpoint.com/virt-manager/

sudo apt install virt-manager
sudo adduser student libvirt
sudo systemctl restart libvirtd

Reboot the DaDesktop machine, then launch Virt Manager from the Applications menu

Configuration

  1. How do I import or convert virtual machines While creating VMs with specific OS and hardware requirements is straightforward, complex setups often benefit from importing an existing VM configuration for a specific server or appliance. These are frequently provided as VMDK images, which can be added directly to Virt Manager, although this functionality is not always clear in the current version. Virtual Box server images cannot be imported directly but can be easily exported to other virtualization formats such as open Virtualisation Format (.OVF), which Virt Manager can ingest. Alternatively, you may use VmWare Convertor if available, or Virt-V2V instead https://www.redhat.com/en/blog/importing-vms-kvm-virt-v2v. Qemu-convert is also an excellent open-source tool that facilitates easy conversion between different virtual machine formats.
    To Convert from VirtualBox to Virt Manager KVM format follow these instructions https://ostechnix.com/how-to-migrate-virtualbox-vms-into-kvm-vms-in-linux/
  2. Best way to import large files inside standalone. A recent addition allows users to easily upload files from their local machine into the DaDesktop environment.

    Alternatively, consider using cloud file storage tools such as Google Drive or Microsoft 365. These services can be accessed by logging in directly within the DaDesktop machine.

  3. When importing virtual machines from other formats, you will often need to adjust graphics and/or disk types. A key advantage of Virt Manager is its robust support for VirtIO drivers. These open-source, fully virtualized drivers deliver superior performance compared to legacy disk, network, or graphic drivers and are available for nearly all operating systems, including excellent support for Windows 10 guests. If your Guest OS supports them, VirtIO drivers are generally the preferred choice for both compatibility and performance when using VIrt Manager (KVM). https://wiki.archlinux.org/title/Libvirt
  4. Optimal settings for virtual machines using Virt Manager VirtIO drivers are included in most open-source server operating systems today and can be easily installed on Windows. While virtio is generally the best driver option, other types may be necessary in specific cases. NAT is sufficient for most networking needs unless a more complex configuration requires Bridged Host networking, which is typically more challenging to implement.
    https://wiki.manjaro.org/index.php?title=Virt-manager Is an excellent starter guide.
    Running Windows requires additional steps, specifically slipstreaming VirtIO drivers to enable the Windows 10 ISO to boot successfully.
    Regarding hard disk format, .raw files offer the best speed unless snapshots are required, in which case qcow2 format is recommended, albeit with slightly reduced performance.
  5. Although Wayland functions well as a display manager in most scenarios, we advise continuing to use X11 for the time being. That said, it may be worthwhile to test Wayland in your specific setup, as distributions are increasingly improving their Wayland support.
  6. Do not use ksm, as although it operates in nested and Virt Manager environments, it provides minimal practical benefit.
  7. Tech Support is available for assistance with converting disk images for Virt Manager compatibility, as well as for setting up Virt Manager for DaDesktop courses.
  8. Where are disk image files located within the filesystem? Virt Manager defaults to the following location for storing image files, though this is configurable to suit other preferred locations.

    /var/lib/libvirt/images