NFS exports get clobbered when mixing different providers
- Dominant language
- Ruby
- Stars
- 27.2k
- Forks
- 4.4k
- Avg merge
- 1m
- Merged PRs (30d)
- 1
Description
I'm using the vagrant-lxc provider in combination with vagrant-libvirt, and whenever I bring up a machine of one provider, it will clobber `/etc/exports` entries of the other provider.
### Vagrant version
Vagrant 1.9.1
### Host operating system
Debian Stretch (9) on x86_64
### Guest operating system
Debian Stretch (9) on x86_64
### Vagrantfile
This example uses 4 Vagrant files to prove the point. As you bring them up, watch `/etc/exports`. You can try it in different orders as well to see the effects.
```ruby
# /tmp/test1/Vagrantfile (uses LXC):
Vagrant.configure("2") do |config|
config.vm.box = "debian/stretch64"
config.vm.hostname = "test1-lxc"
config.vm.define "test1-lxc" do |p|
end
config.vm.synced_folder ".", "/vagrant",
id: "core",
:nfs => true,
:mount_options => ['nolock,vers=3,udp,noatime,actimeo=2']
config.vm.provider :lxc do |lxc|
lxc.container_name = "test1-lxc"
end
end
# /tmp/test2/Vagrantfile (uses LXC; identical to test1 except for the name):
Vagrant.configure("2") do |config|
config.vm.box = "debian/stretch64"
config.vm.hostname = "test2"
config.vm.define "test2" do |p|
end
config.vm.synced_folder ".", "/vagrant",
id: "core",
:nfs => true,
:mount_options => ['nolock,vers=3,udp,noatime,actimeo=2']
config.vm.provider :lxc do |lxc|
lxc.container_name = "test2"
end
end
# /tmp/test3/Vagrantfile (uses libvirt, otherwise identical to 1 and 2, except for the name):
Vagrant.configure("2") do |config|
config.vm.box = "debian/stretch64"
config.vm.hostname = "test3-libvirt"
config.vm.define "test3-libvirt" do |p|
end
config.vm.synced_folder ".", "/vagrant",
id: "core",
:nfs => true,
:mount_options => ['nolock,vers=3,udp,noatime,actimeo=2']
config.vm.provider :libvirt do |libvirt|
libvirt.driver = "kvm"
end
end
# /tmp/test4/Vagrantfile (uses libvirt; identical to test3 except for the name):
Vagrant.configure("2") do |config|
config.vm.box = "debian/stretch64"
config.vm.hostname = "test4-libvirt"
config.vm.define "test4-libvirt" do |p|
end
config.vm.synced_folder ".", "/vagrant",
id: "core",
:nfs => true,
:mount_options => ['nolock,vers=3,udp,noatime,actimeo=2']
config.vm.provider :libvirt do |libvirt|
libvirt.driver = "kvm"
end
end
```
### Debug output
https://gist.github.com/sjamaan/c5a2d5c6359fbfb1bc749188a2d25dce
### Expected behavior
After bringing up all four boxes one by one in sequence, `/etc/exports` should look like this:
```
# VAGRANT-BEGIN: 1000 test1-lxc
"/tmp/test1" 192.168.122.170(rw,no_subtree_check,all_squash,anonuid=1000,anongid=1000,fsid=3984546735)
# VAGRANT-END: 1000 test1-lxc
# VAGRANT-BEGIN: 1000 test2
"/tmp/test2" 192.168.122.85(rw,no_subtree_check,all_squash,anonuid=1000,anongid=1000,fsid=1953892885)
# VAGRANT-END: 1000 test2
# VAGRANT-BEGIN: 1000 36cc1f7b-fede-4e69-91d6-3365636e4e4a
"/tmp/test3" 192.168.121.98(rw,no_subtree_check,all_squash,anonuid=1000,anongid=1000,fsid=57752195)
# VAGRANT-END: 1000 36cc1f7b-fede-4e69-91d6-3365636e4e4a
# VAGRANT-BEGIN: 1000 b9e7fc35-ceaf-45eb-9778-6169bda57168
"/tmp/test4" 192.168.121.98(rw,no_subtree_check,all_squash,anonuid=1000,anongid=1000,fsid=2635444000)
# VAGRANT-END: 1000 b9e7fc35-ceaf-45eb-9778-6169bda57168
```
### Actual behavior
After bringing up all four boxes one by one in sequence, `/etc/exports` looks like this:
```
# VAGRANT-BEGIN: 1000 36cc1f7b-fede-4e69-91d6-3365636e4e4a
"/tmp/test3" 192.168.121.98(rw,no_subtree_check,all_squash,anonuid=1000,anongid=1000,fsid=57752195)
# VAGRANT-END: 1000 36cc1f7b-fede-4e69-91d6-3365636e4e4a
# VAGRANT-BEGIN: 1000 b9e7fc35-ceaf-45eb-9778-6169bda57168
"/tmp/test4" 192.168.121.98(rw,no_subtree_check,all_squash,anonuid=1000,anongid=1000,fsid=2635444000)
# VAGRANT-END: 1000 b9e7fc35-ceaf-45eb-9778-6169bda57168
```
### Steps to reproduce
1. Create the files `/tmp/test1/Vagrantfile`, `/tmp/test2/Vagrantfile`, `/tmp/test3/Vagrantfile`, `/tmp/test4/Vagrantfile` with the contents mentioned under the section "Vagrantfile" above.
2. `cd /tmp/test1 && vagrant up --provider=lxc`
3. `cd /tmp/test2 && vagrant up --provider=lxc`
4. `cd /tmp/test3 && vagrant up --provider=libvirt`
5. `cd /tmp/test4 && vagrant up --provider=libvirt`
6. Observe `/etc/exports` (you can also do this in between each step to watch it get clobbered as you bring up `test3`).
### References
- GH-4252
- GH-4295
Contributor guide
Research direction
Reproduce the issue using the four /tmp/test1 through /tmp/test4 Vagrantfiles and the listed provider commands, watching /etc/exports after each step. Compare the actual export blocks with the expected blocks and review the referenced GH-4252 and GH-4295 issues. Done means bringing up both LXC and libvirt machines without either provider removing the other's exports.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- linux, ruby
- Domain
- infrastructure, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100