News for hackers. Stuff that matters.
Re:Virtio-fs: shared file system for virtual machines by RussianCow on Wednesday February 06, 2019 @06:01PM (#19101046)
The email mostly talks about performance, but could this technique finally give us VM shared folders with proper inotify support (at least on Linux hosts)? That has always been my number one gripe with using Vagrant for local development.
Re:Virtio-fs: shared file system for virtual machines by bbeausej on Wednesday February 06, 2019 @06:15PM (#19101160)
I sure hope so! I'm encouraged to see a project potentially tackling this need. The current "best practice" to use a unison synched directory between the host and your VM (and even then maybe to a docker volume bind mount) is very error prone and comes with many pitfalls.
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.
Re:Virtio-fs: shared file system for virtual machines by mayli on Wednesday February 06, 2019 @06:07PM (#19101093)
Same here, near-native performance is quite critical for certain use cases, including kernel compiling. If you ever tried to compile from source over NFS, that's almost 10~30 times slower than compile from a native/local filesystem.
Re:Virtio-fs: shared file system for virtual machines by fulafel on Thursday February 07, 2019 @01:01AM (#19103364)
Does Vagrant have its own file sharing system, or does it use whatever the backends (mount for lxd, 9p for kvm, proprietary kernel module for virtualbox etc) happen to provide?
Re:Virtio-fs: shared file system for virtual machines by ofrzeta on Thursday February 07, 2019 @02:01AM (#19103556)
It uses different technologies depending on the used provider. For instance Virtualbox shared folders, NFS, SMB or rsync'd folders.