Provisioning Virtual Machines on DaDesktop via Virt Manager

Introduction

When developing course materials, virtualising a server within DaDesktop is frequently advantageous. This may also involve virtualising one or two client machines in a similar fashion, using either the same operating system or a mix of Windows and Linux environments.

Operating 'Nested VMs' can be achieved through Virt Manager or VirtualBox. When using Linux, Vagrant can optionally be integrated with these tools; for DaDesktop machines running Windows 10, VirtualBox is the applicable option.

DD Machines Nested Virt

Following comprehensive testing, our preferred approach is to utilise Virt Manager. This is because VirtualBox presents a few bugs in this specific context; consequently, we currently do not recommend using VirtualBox for this purpose.

The VirtManager application leverages the libvirt library to deliver virtual machine management services. It offers a desktop interface that simplifies the creation, deletion, and management of multiple virtual machines. While it is primarily designed for KVM VMs, it also supports other hypervisors, including Xen and LXC.

Virt Manager also integrates seamlessly with Vagrant, requiring only the following setup :-         

apt install vagrant-libvirt

It is important to note that while there are fewer Vagrant boxes available for libvirt/kvm compared to VirtualBox, these can be easily converted for libvirt compatibility as demonstrated here :-

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

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

For those unfamiliar with Virt Manager, the experience is quite similar to VirtualBox, with several key differences outlined below.

A helpful guide for using virt-manager on Ubuntu Linux can be found at - https://www.debugpoint.com/virt-manager/

 

Why choose Virt Manager over VirtualBox?

Advantages
  1. Performance is significantly superior - Virt Manager utilises VirtIO drivers for storage, networking, and graphics, which yield much better performance. Virtio drivers are paravirtualized device drivers for KVM, available for both 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 already pre-installed on your Linux distribution.
  2. Greater configurability options are available
  3. Seamless integration with Vagrant
  4. Certain components of VirtualBox are not fully open source
  5. Virt Manager does not require module recompilation following kernel upgrades, a common issue with VirtualBox.
  6. VirtualBox is occasionally known to break after new kernel upgrades.
Disadvantages
  1. VirtualBox is generally considered to have a slightly gentler learning curve
  2. Configuring 'Host networking' rather than NAT is slightly simpler in VirtualBox; however, NAT handles most networking use cases effectively on both systems.
  3. While VirtualBox is available on many platforms, Virt Manager is exclusive to Linux


On balance, for running servers within a DaDesktop machine, Virt Manager is the preferred solution.

 

Installation

Given that libvirt is continuously evolving, it is always best to use the latest non-LTS version of Ubuntu or Debian.

Installation involves setting up kvm and virt-manager. The following are concise installation notes; however, please refer to an up-to-date guide for your specific DaDesktop OS. One such guide is 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 to import or convert virtual machines ? While it is straightforward to create VMs tailored to specific operating system and specification requirements, complex setups often benefit from importing an existing VM configuration for a particular server or appliance. These are frequently supplied as VMDK images, which can theoretically be added directly to Virt Manager, although this functionality is not clearly supported in current versions. VirtualBox server images cannot be imported (added) directly into Virt Manager but can be easily exported to other virtualisation formats, such as Open Virtualisation Format (.OVF), which Virt Manager handles easily. Alternatively, if available, you can use VMware Converter, or Virt-V2V 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. The best method for importing large files inside standalone. Recently, a feature to easily upload files from your local machine to your DaDesktop machine has been added.

    Alternatively, consider using a cloud file service such as Google Drive or Microsoft 365. These can be accessed by logging into the service within the DaDesktop machine.

  3. When importing virtual machines from other formats, adjustments to graphics and/or disk types are often necessary.  A significant advantage of Virt Manager is its robust support for VirtIO drivers. These are fully virtualised, open-source drivers that deliver substantially better performance compared to standard disk, network, or graphics drivers, and are available for nearly all operating systems, including excellent support for guest Windows 10 machines. If your Guest OS supports them, these are typically the preferred choice for 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 now included in almost all open-source server operating systems and can be easily installed in Windows. While virtio is generally the best driver option, other types may be required in specific cases. For most networking needs, NAT is sufficient, unless a more complex setup requires Bridged Host networking, which is generally more challenging to configure. 
    https://wiki.archlinux.org/title/Virt-manager is an excellent introductory guide.
    Running Windows  requires additional steps, including slipstreaming VirtIO drivers to ensure the Windows 10 ISO boots correctly.
    When selecting a hard disk format, .raw files are best for speed unless snapshots are required; in such cases, use qcow2 format, although this is slightly slower.
  5. Although Wayland works well in most scenarios as a display manager, we advise continuing to use X11 for now. That said, it may be worth testing Wayland in your specific setup, as distributions are improving their Wayland support continuously.
  6. There is no need to use ksm; although it works in nested environments and with Virt Manager, it offers little practical difference.
  7. Tech Support is available if required for converting disk images for Virt Manager compatibility, and for setting up Virt Manager for DaDesktop courses.
  8. Where are disk image files located within the filesystem? Virt Manager stores image files in the following location by default, though this is configurable and alternative locations can be used if preferred.

    /var/lib/libvirt/images