Checking if LibtVirt works on a given hardware

Posted: December 13, 2012 in Uncategorized

The libvirt library (http://www.libvirt.org) creates a virtual machine abstraction layer between hypervisor interfaces and the software applications that use them. With libvirt, developers and system administrators can focus on a common management framework, common API, and common shell interface (i.e., virsh) to many different hypervisors, including:

  • QEMU/KVM
  • XEN
  • LXC
  • VirtualBox

 

Check if libvirt is installed. In my case I have already installed the libvirt-bin package that comes with Ubuntu 12.04.

root@cluster:/etc/apt/sources.list.d# dpkg -l | grep libvirt
ii  libvirt-bin                           0.9.8-2ubuntu17.4                programs for the libvirt library
ii  libvirt-dev                           0.9.8-2ubuntu17.4                development files for the libvirt library
ii  libvirt-glib-1.0-0                    0.0.4-1                          libvirt glib mainloop integration
ii  libvirt0                              0.9.8-2ubuntu17.4                library for interfacing with different virtualization systems
ii  libvirt0-dbg                          0.9.8-2ubuntu17.4                library for interfacing with different virtualization systems
ii  libvirtodbc0                          6.1.4+dfsg1-0ubuntu1             high-performance database – ODBC libraries
ii  python-libvirt                        0.9.8-2ubuntu17.4                libvirt Python bindings

As you can see the libvirt packages have been installed.

Now install qemu and/or kvm. Though qemu or kvm is not necessary for libvirt to function, I am using it to launch a VM and check if LibVirt can connect to the instance.

root@cluster:~# apt-get install qemu qemu-kvm-extras qemu-kvm-extras-static qemu-kvm-spice
Reading package lists… Done
Building dependency tree       
Reading state information… Done
The following extra packages will be installed:
  binfmt-support libbluetooth3 libbrlapi0.5 libfdt1 libjpeg-turbo8 libjpeg8 libpixman-1-0
  libspice-server1 libvde0 libvdeplug2 qemu-keymaps qemu-system qemu-user qemu-user-static vde2
Suggested packages:
  samba vde2-cryptcab
The following NEW packages will be installed:
  binfmt-support libbluetooth3 libbrlapi0.5 libfdt1 libjpeg-turbo8 libjpeg8 libpixman-1-0
  libspice-server1 libvde0 libvdeplug2 qemu qemu-keymaps qemu-kvm-extras qemu-kvm-extras-static
  qemu-kvm-spice qemu-system qemu-user qemu-user-static vde2
0 upgraded, 19 newly installed, 0 to remove and 3 not upgraded.
Need to get 41.1 MB of archives.
After this operation, 160 MB of additional disk space will be used.
Do you want to continue [Y/n]?

 

Now check of KVM hardware acceleration can be possible 

root@cluster:~# kvm-ok
INFO: Your CPU does not support KVM extensions
KVM acceleration can NOT be used
root@cluster:~#

In my case the hardware is non VT enabled hence KVM acceleration cannot be used. I can still use qemu to launch virtual machines.

 

Once KVM is installed check if you can connect directly to libvirt using the virsh console.

root@cluster:~# virsh -c qemu:///system list
 Id Name                 State
———————————-

Create a domain with the instructions found at http://wiki.libvirt.org/page/VM_lifecycle#Creating_a_domain

root@cluster:~# virt-install  –connect qemu:///system –virt-type qemu –name cluster-test-vm –ram 512 –disk path=/home/cssoss/rhel6.img,size=8 –vnc –cdrom /home/cssoss/rhel-server-6.0-x86_64-dvd.iso –network network=default,mac=52:54:00:9c:94:3b –os-variant rhel6

 

root@cluster:~# virsh
Welcome to virsh, the virtualization interactive terminal.

Type:  ‘help’ for help with commands
       ‘quit’ to quit

 

Now list the VM with virsh.

virsh # list
 Id Name                 State
———————————-
  1 cluster-test-vm      running

virsh #

 

Now try connecting to the VM from virsh.

virsh # console cluster-test-vm
Connected to domain cluster-test-vm
Escape character is ^]

There you go libvirt is installed and works on the hardware.

 

 

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s