Sunday, 1 July 2012

Hypervisor: KVM

In my college days, I used to install VirtualBox on my Windows OS and run Linux inside it. Frankly speaking at that time I didn't know what is a hypervisor and what exactly a hypervisor does! :)

Hypervisor (VirtualBox was my college-days' hypervisor) is used to manage the guest operating systems (Linux was the guest operating system). Wikipedia defines it as:
In computing, a hypervisor, also called virtual machine manager (VMM), is one of many hardware virtualization techniques allowing multiple operating systems, termed guests, to run concurrently on a host computer.

There are two types of hypervisors:
1. Native or bare metal- It runs directly on the host's hardware. Examples: Hyper-V, KVM, XenServer.
2. Hosted- It runs within an OS. Examples: VirtualBox, VMware Workstation.

I recently used KVM(Kernel-based Virtual Machine) while working with OpenStack and it worked fine without any issues.

If you want to work with KVM, first thing you need to check is whether your processor supports hardware virtualization or not. Just run the following command : 

If you get the following output that means your processor supports it.
INFO: /dev/kvm exists
KVM acceleration can be used

From whatever I have read, it looks like even if your CPU does not support KVM extensions you can still run virtual machine but it will be very slow.

To install KVM run the following command:
apt-get install qemu-kvm libvirt-bin ubuntu-vm-builder bridge-utils

You need to add your user to the libvirtd group. To do so run the following command:
adduser 'id -un' libvirtd

And then relogin to make your user an effective member of the libvirtd group.

Check if the installation was successful by running the following command:

virsh -c qemu:///system list

I get the following output:

 Id Name                         State
 24 instance-0000001f     running
 31 win-server-1              running
 34 instance-00000020    running

Initially you will not have any instance running; so you should get the following output:

 Id Name                 State

I will cover how OpenStack works with KVM in my next post.

No comments:

Post a Comment