News for hackers. Stuff that matters.
Re:Virtio-fs: shared file system for virtual machines by noir_lord on Wednesday February 06, 2019 @06:05PM (#19101075)
Mine as well, I have this horrible NFS setup that kinda/sorta works but this (if what you query is the case) would be awesome.

I even looked at writing my own 'vagrant' (to fit exactly my use case of Linux on Linux via KVM and deployed via ansible) because the NFS thing and VirtualBox issues mar what is otherwise a great idea.

Re:Virtio-fs: shared file system for virtual machines by jitl on Wednesday February 06, 2019 @06:23PM (#19101224)
Vagrant is quite extensible; you can plug in KVM via QEMU and Libvirt as a VM "provider", and use Ansible to provision the guest out of the box.

vagrant-libvirt (3rd party): https://github.com/vagrant-libvirt/vagrant-libvirt

ansible provisioning (built in): https://www.vagrantup.com/docs/provisioning/ansible.html

This isn't to say these will make the guest filesystem more performant than NFS; you'll probably hit the same bottlenecks with mounting host filesystems into the guest. The solution many users arrived at with Vagrant is to use a user-space synchronization program like Unison that watches for filesystem events (eg, inotify) on both the guest and the host. This is its own can of worms: O(size of files monitored) resource use on both hosts, file ignore lists, async races, etc. There's even a Unison plugin for vagrant, but I found it quite finicky and thus unsuitable for large-scale deployment

unison: https://www.cis.upenn.edu/~bcpierce/unison/

unison-vagrant2: https://github.com/dcosson/vagrant-unison2

At Airbnb, we eventually wrote our own wrapper around Unison to make it easier to use, and saw 90x better perf for filesystem-heavy loads like Webpack once we switched off of NFS in our local VMs.

Re:Virtio-fs: shared file system for virtual machines by noir_lord on Wednesday February 06, 2019 @06:47PM (#19101430)
Thanks for the info, I was aware of vagrant-libvirt and ansible (already use that to deploy vagrant guests) but unison I hadn't seen.

Funnily enough webpack is where I had the most problems (it certainly surfaces "what happens when we smack the FS in the face repeatedly" issues better than most) which is what got me thinking down the KVM route in the first place.

In terms of hacking around on vagrant, it's ruby which isn't on the list of languages I'm fluent in and its flexibility makes it more complex than what I need for my use case.

There is something to be said sometimes for rolling your own for your own itch but I'll certainly have a look at unison as part of vagrant first.

Re:Virtio-fs: shared file system for virtual machines by RussianCow on Wednesday February 06, 2019 @06:48PM (#19101435)
> At Airbnb, we eventually wrote our own wrapper around Unison to make it easier to use

Is there any chance you guys open sourced this wrapper, or have any plans to? :)

Re:Virtio-fs: shared file system for virtual machines by jitl on Wednesday February 06, 2019 @07:23PM (#19101722)
Unlikely.

1. I no longer work at Airbnb, so I can't help you there.

2. The wrapper is somewhat deeply embedded in the dev tools swiss army knife, and is written in Ruby, so (a) it's difficult to extract since its tied with other Airbnb specific concerns and support libraries, and (b) distributing perf-sensitive Ruby code to end-users is challenging so you might not want it anyways.

You might want to take a look at Mutagen, a unison replacement written in Go which seems to avoid most of what makes Unison annoying to work with. I haven't tested it, though, so I can't vouch for it.

https://github.com/havoc-io/mutagen

Re:Virtio-fs: shared file system for virtual machines by RussianCow on Wednesday February 06, 2019 @09:38PM (#19102463)
That makes sense. I hadn't heard of Mutagen before, but it seems like it would solve a lot of the issues that drove me away from Unison. Thanks for mentioning it!
Re:Virtio-fs: shared file system for virtual machines by crgwbr on Wednesday February 06, 2019 @07:34PM (#19101795)
Here’s a similar project we made for syncing stuff to remote docker hosts:

https://github.com/crgwbr/accordance

Re:Virtio-fs: shared file system for virtual machines by jitl on Wednesday February 06, 2019 @07:59PM (#19101944)
Very cool. I always thought a node/TypeScript implementation would be easier than our Ruby one because of the natural event-orientation of Node.
Re:Virtio-fs: shared file system for virtual machines by bryanlarsen on Wednesday February 06, 2019 @07:46PM (#19101874)
Vagrant-lxc works for us. File sharing is a bind mount so no problems with inotifu.
Re:Virtio-fs: shared file system for virtual machines by RussianCow on Wednesday February 06, 2019 @09:35PM (#19102448)
Did it work well for you out of the box, or did you have do some configuration early on? I haven't gotten this to work for me since I upgraded LXC to 2.0 (something about the `lxc-create` command failing IIRC), but I never spent much time digging into it, so it's entirely possible it's something to do with my setup and not vagrant-lxc.