In the past for running virtual machines on my laptop, I had just used a command line using the kvm tool. It worked pretty well, although it had some quirks and limitations. With the recent re-install of my laptop, I decided to check out libvirt and see how easy it was to get working.
Turns out it works quite nicely… read on for more info on my libvirt adventures…
First I checked out the Fedora8VirtQuickStart guide. It some good info, but much of it (all the parts talking about xen in particular) were not useful for my case.
Getting things setup was easy: “yum install libvirtd virt-manager kvm” then “/etc/sysconfig/modules/kvm.modules” and “service libvirtd start”. Everything installed cleanly and nicely and started up fine.
The GUI for managing your virtuals is 'virt-manager'. It's a pygtk app, nothing fancy, but it seems to work pretty well. You click on the 'localhost' line, select 'connect' and then you can make new virtuals or start/stop/change existing ones. Consoles launched from the tool seem to work fine, although using control-alt to ungrab focus on the window is annoying as that's what Xfce uses for desktop switching. The new virtual install wizard is pretty nice. It's nifty that you can have your virtuals use sparse files, and only take up as much space as the files contained in the image, and not the entire image size pre-allocated.
libvirt also comes with a very very good command line tool called 'virsh'. The documentation wasn't all too clear on how to connect it to a local kvm/qemu libvirtd, but after some digging it became clear it was: “virsh -c qemu:///system”. After connecting a 'help' shows you that you can do all manner of things from virsh. Many more than you can from the GUI above. You can suspend/resume/save/migrate/create etc. Very handy.
One nice feature over my previous setup of just running kvm command lines for various virtuals when I wanted them is that with libvirt you get a nice bridged network setup automatically with dnsmasq on it. That allows you to easily DNAT traffic into a virtual or otherwise reach it without having to hop on the host machine. libvirtd handles all that transparently in the background.
I have done some playing around with the vmware versions of these type of tools: vmware-server-console and vmware-cmd. vmware-server-console is similar to virt-manager, it does had a bit more in the way of features, but otherwise it's very similar. vmware-cmd is very very primitive when stacked up against virsh. When managing a large number of guests a GUI just doesn't scale. It's much better to have a good command line tool.
I'm quite impressed with libvirt. I am using it for all my testing virtual needs on my laptop and hope to see it more on customer sites, which I imagine will be when CentOS/RHEL start shipping more recent versions of the libvirt tools.comments powered by Disqus