How to run QEMU KVM virtual machine on Dilos

QEMU is a generic and open source machine emulator and virtualizer. When it used as a machine emulator, QEMU can run OSes and programs made for one machine (e.g. an ARM board) on a different machine (e.g. your own PC). By using dynamic translation, it achieves very good performance.

When used as a virtualizer, QEMU achieves near native performance by executing the guest code directly on the host CPU. QEMU supports virtualization when executing under the Xen hypervisor or using the KVM kernel module in Linux. When using KVM, QEMU can virtualize x86, server and embedded PowerPC, 64-bit POWER, S390, 32-bit and 64-bit ARM, and MIPS guests.

In this article we will run virtual machine with dilos using QEMU KVM hosted hypervizor  on Dilos host. This is just an example, any guest os can be use instead (CentOS, Debian etc...). Will use noVNC console for accessing guest OS during the installation. 

Pre-requirements:

Configure noVNC e.g. as described on DilOS HowTo WiKi page: How To use noVNC on DilOS

If hosted DilOS OS installed on bare-metal hardware, ensure that CPU Virtualization instructions (VTx/VTd) are enables in BIOS: 

If virtualization platform is used for hosted DilOS VM (e.g. VMware ESXi), ensure that nested virtualization option is ON at properties of this VM. 

Installation:



We are ready to run nested QEMU/KVM virtual machine

Where:

-enable-kvm - instruct to use KVM hypervisor module

-smp 2 - swich on the multiprocessor mode with 2 vCPU

-m 2048 - amount of memory to be used with this virtual machine

-boot order=dc - sequence of using boot devices during boot process: here - try hdd fisrtly, then cd-rom.

-drive file=/dev/zvol/rdsk/rpool/kvm1,if=virtio,index=0,media=disk,boot=on,id=disk0  - parameters for the hdd device where quest OS will be installed

-drive file=/root/dilos-2.0.1.22.iso,media=cdrom,if=ide,index=1  - description of the cd-rom device and reference to mounted .iso image

-vnc 0.0.0.0:0,password -monitor stdio - description of VNC console for accessing this virtual machine: listen on all network interfaces, port 6080.

-device virtio-net-pci,mac=02:08:20:80:8e:d3,tx=timer,x-txtimer=200000,x-txburst=128,vlan=1 - instruct KVM to use virtio paravirtual driver for network card, set up port parameters and configure MAC address for ethernet port for the first interface

-net vnic,vlan=1,name=net1,ifname=vnic1 - indicates VLAN to be provided to this VM and though which interface

(assume similar description of networking for vnic2)

Virtual machine is running. To access QEMU monitor press enter in console and set up the VNC password

Open your favourite browser and connect to VM's console through noVNC service by URL https://YOUR_HOST:6080/vnc.html:

You have configured and run virtual machine using qemu kvm! Proceed with further OS installation procedure.

When you at step of configuration the network interface, choose the Manual setup of  IP addresses and enter appropriate values 

Note that we use paravirtualized driver (vioif0/1) which have been configured inside virtual machine.

Repeat configuration procedure for second network interface (data link) and proceed with installation . 

When installation is completed and VM can boot from virtual HDD, we can put cd-rom device out of command line to simplify the command . 

Done!