Ubuntu Trusty: virt-manager performance over WAN… 40+ secs freezes

kvm-virtualizationlatencylibvirtperformancevirt-manager

I'm using the virt-manager GUI 0.9.5-1ubuntu3 on my laptop running Ubuntu 14.04 against a server located some distance away (same OS) and getting rather unpleasant performance.

Laptop-server pings are ~50ms, not great but certainly sufficient for SSH access and even ok-ish running Firefox over X/ssh. Both server & laptop have plenty of spare CPU cycles, RAM and disks. My local ADSL is 8Mbps down 800Kbps upstream and exceptionally, the wife isn't streaming some soap 😉

I'm creating a fresh VM and selecting 'customize config before install'. Clicking the 'Add Hardware' button freezes virt-manager for about 40 secs, during which little network activity occurs (117 kB sent, 151 kB rec'd, with peaks of 5kBps down, 11kBps up); CPU/RAM are absolutely fine on both boxes.

Pressing 'Finish' on the 'Add New Virtual Hardware' dialog to add a NIC takes 50s with similar bandwidth stats.

By contrast, the actual VM creation (35GB QCOW2 img) takes about 15 secs and console access performance via virt-manager is great – not significantly slower than SSH.

I must be doing smth wrong but what?

Best Answer

Having upgraded to a more recent version, I can confirm that the slow performance previously experienced is a thing of the past. The version packaged for Ubuntu 'Trusty' is over two years old (0.9.5 vs 1.2.0).

Upgrading isn't too difficult except maybe for figuring out which dependencies are required (the newer version seems to have quite a few more than the old one). Here's how:

  1. Grab the tarball for a recent version (I have tested this with 1.2.0) and uncompress somewhere handy
  2. Review the dependencies that may need to be installed: grep '^Requires:' virt-manager.spec.in
  3. For each identified dependency, check if you need to install it; below is a list (I believe complete but YMMV) of the packages I needed to install. As pointed out in the README file, the name of most of the dependencies have to be prefixed with 'gir-1.2':

    sudo apt-get install python-ipaddr
    sudo apt-get install gir1.2-libvirt-glib
    sudo apt-get install gir1.2-libosinfo
    sudo apt-get install gir1.2-gtk-vnc
    sudo apt-get install gir1.2-spice-client-gtk-3.0
    
  4. You should now be able to run virt-manager from the current directory; try it: ./virt-manager and confirm your previous performance issues are gone. If it fails, it's likely due to a missing dependency so go back to the previous step.
  5. The rest is optional as you could simply continue to run the fast version from you temp directory but if you'd like to install under /usr to replace the sluggish packaged version system-wide, run this:

    sudo python setup.py install --prefix=/usr
    
  6. If you try to run the installed version, it may not work out of the box. A bit of debugging with python -d -v /usr/share/virt-manager/virt-manager --debug --no-fork revealed the root cause as (virt-manager:8484): GLib-GIO-ERROR **: Settings schema 'org.virt-manager.virt-manager' is not installed. Google finally led me to this bug report; in short the cure was to run:

    sudo glib-compile-schemas /usr/share/glib-2.0/schemas/
    
  7. Don't forget to check that you're running the right version by clicking Help->About