Page MenuHomePhabricator

Support using libvirt (KVM/QEMU) VM provider
Closed, ResolvedPublic


Add configuration support for libvirt (KVM/QEMU) as a virtual machine provider.


Related Gerrit Patches:
mediawiki/vagrant : masterRestore libvirt support
mediawiki/vagrant : masterAdd support for libvirt (KVM/QEMU)

Event Timeline

bzimport raised the priority of this task from to Needs Triage.Nov 22 2014, 3:41 AM
bzimport added a project: MediaWiki-Vagrant.
bzimport set Reference to bz69223.
bzimport added a subscriber: Unknown Object (MLST).

Working with a volunteer in this at the hackathon.

Some things we are trying:

$ vagrant plugin install vagrant-kvm
$ vagrant plugin install vagrant-mutate
$ vagrant mutate trusty-cloud kvm
$ vagrant up --provider=kvm

You may need things like:
$ apt-get install redir

$ apt-get install apparmor-utils
$ sudo aa-complain /usr/lib/libvert/virt-aa-helper

We added a config block for the kvm provider that was basically a copy of the vagrant provider block.

Bulk unassigning bugs from Ori.

bd808 triaged this task as Lowest priority.Nov 24 2014, 5:17 PM
scfc renamed this task from Support using KVM/QEMU vm provider to Support using libvirt (KVM/QEMU) VM provider.Nov 7 2015, 11:47 PM
scfc updated the task description. (Show Details)
scfc set Security to None.
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptNov 7 2015, 11:47 PM
scfc added a subscriber: scfc.EditedNov 8 2015, 1:21 AM

I'm interested in this because using KVM and VirtualBox is mutually exclusive and for my distribution (Fedora) libvirt seems to be the preferred virtualization solution. I added:

# libvirt (KVM/QEMU) provider
config.vm.provider :libvirt do |_libvirt, override| = 'trusty-cloud' :private_network, ip: settings[:static_ip]


config.vm.provider :libvirt do |libvirt|
  libvirt.driver = 'qemu'

to Vagrantfile. I then converted the trusty-cloud box that VirtualBox is downloading with vagrant mutate to a libvirt box (it would be nice if in the long run there would be an official/trustable source for an already-converted box).

After that, a vagrant up (Vagrant 1.7.4, vagrant-libvirt 0.0.30) times out on my system when trying to mount NFS. If I vagrant ssh afterwards and try to repeat the mount:

vagrant@mediawiki-vagrant:~$ sudo mount -o 'vers=3,udp''/home/tim/src/mediawiki-vagrant/libvirt-test' /vagrant
mount.nfs: Connection timed out

(A NFS server with /etc/exports set up by vagrant is running on the host.)

As I had trouble with NFS with VirtualBox as well, I also tried 9p by adding type: '9p' to config.vm.synced_folder calls. This will fail first – as shown by sudo dmesg | tail on the guest – because it doesn't understand the mount option access=vagrant. If I remove that option, the mount "succeeds", but any access (sudo ls -l /vagrant) fails with access denied.

The last resort type: 'rsync' worked (AFAICT; Puppet is still running), but as its functionality is severely limited compared to NFS and 9p, that's not a real-life option.

scfc added a comment.Nov 8 2015, 4:56 AM

9p failed due to owner being set to vagrant in synced_folder which produces the access=vagrant option for the mount call; I have filed that upstream. To work around that/fix that on mediawiki/vagrant's side, owner would need not to be set when nfs_shares is false.

But I've run into general permission problems on my host then (the VM not being allowed to read/write my directory), so I couldn't test so far that that will indeed work.

scfc added a comment.Nov 17 2015, 3:14 AM

(NFS failed first because the firewall blocked it and, after I fixed that, because it requires vers=3 as a mount option from a Trusty client to a Fedora 23 server. I will submit a patch that introduces a nfs_force_v3 option for that.)

Change 280785 had a related patch set uploaded (by Tim Landscheidt):
Add support for libvirt (KVM/QEMU)

scfc added a comment.Mar 31 2016, 11:32 PM, and are a snapshot of my current progess. It's still abysmally slow, and commenting out shared_apt_cache is just one case where the VM failed when trying to write as root to the shared folder. The POC in T128304#2081875 is much better for libvirt on my machine.

Change 280785 merged by jenkins-bot:
Add support for libvirt (KVM/QEMU)

hashar closed this task as Resolved.Dec 22 2017, 9:28 PM
hashar assigned this task to scfc.
hashar added a subscriber: hashar.

That was working at some point for sure thanks to

As part of bumping it to Jessie (T154296) I managed to provision a vagrant box based on Jessie :]

Change 399945 had a related patch set uploaded (by Hashar; owner: Hashar):
[mediawiki/vagrant@master] Restore libvirt support

Change 399945 merged by jenkins-bot:
[mediawiki/vagrant@master] Restore libvirt support