vagrant-smartos / vagrant-smartos-zones

Manage SmartOS local zones in Vagrant
MIT License
54 stars 9 forks source link

NFS shared directories #9

Open tylerflint opened 9 years ago

tylerflint commented 9 years ago

This probably works, I think it just needs thorough testing and some documentation in the README.

sax commented 9 years ago

Documenting issues that @tylerflint explained to me today:

The Network middleware configures network adapters AFTER it called through to the other middleware. https://github.com/mitchellh/vagrant/blob/master/plugins/providers/virtualbox/action/network.rb#L121

ZoneGate is currently enabled just after zones are created, which is just after the global zone becomes available: https://github.com/vagrant-smartos/vagrant-smartos-zones/blob/85f866f55876954014c2eae93512b2ff258dff51/lib/vagrant/smartos/zones/hooks.rb#L10-L19

Yet in order for NFS to work, a private ip must be provisioned in the global zone. By the time Network does its work, ZoneGate is already active and all of the commands go to the local zone.

sax commented 9 years ago

This just happened two weeks ago: https://github.com/mitchellh/vagrant/commit/7ccec334606bb6a306bcecc6c9a7e2562be3a694 https://github.com/mitchellh/vagrant/issues/4344

It looks as if Docker suffers from a similar problem. I can't quite wrap my head around that commit at the moment, but it will likely change the understanding we gained today about code execution ordering.

sax commented 9 years ago

@tylerflint try pulling the latest code from github when you get a chance. At the very least, vm public and private networks should now get installed in the global zone before the zone is created.

tylerflint commented 9 years ago

That actually did work! I’m not sure what issues we might run into by deferring the zone configuration until the end of the stack, but at the very least it seems to have worked for the current set of functionality.

The only thing that didn’t seem to run was the actual ifs mount. For some reason vagrant didn’t even try to setup nfs. I’m wondering if they’ve recently changed the dsl and I’m simply using it wrong. Either way, this is good progress!

On Nov 9, 2014, at 11:35 AM, Eric Saxby notifications@github.com wrote:

@tylerflint try pulling the latest code from github when you get a chance. At the very least, vm public and private networks should now get installed in the global zone before the zone is created.

— Reply to this email directly or view it on GitHub.

tylerflint commented 9 years ago

@sax Actually, I was just being silly. When I configure the Vagrantfile correctly, nfs works perfectly. As soon as I can I'll update the README with an example of how to enable nfs and then we can consider this complete.

Pretty cool!

FYI there is no proprietary config here at all, just added this to the Vagrantfile:

  config.vm.network "private_network", ip: "33.33.33.10"
  config.vm.synced_folder ".", "/vagrant", type: 'nfs'
tylerflint commented 9 years ago

@sax as a side note, it might be worth discussing any issues that we may be causing down the road by deferring the action stack. I actually can't think of any right off, since we'll likely be installing guest plugins with a custom action within this plugin. As I think about it, I'm really not sure that we'll have any issues with this at all. Still, worth thinking about in advance.

fwiw I'm really glad you looked at it from a different angle. I couldn't think about how we were going to get around this issue and the approach I was about to take probably would have worked eventually, but would have been a lot of work and likely a race condition.

sax commented 9 years ago

Ditto! I think this has been a really good collaboration.

Thank you for spending so much time deconstructing the NFS middleware. It was really spinning around in my head until you pointed out the Network middleware.

sax commented 9 years ago

Oh, awesome! I thought there was going to need to be changes in the zone provisioning. This is fantastic!=