Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NFS shared directories #9

Open
tylerflint opened this issue Oct 8, 2014 · 8 comments
Open

NFS shared directories #9

tylerflint opened this issue Oct 8, 2014 · 8 comments
Labels

Comments

@tylerflint
Copy link
Contributor

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

@sax
Copy link
Contributor

sax commented Nov 8, 2014

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:

hook.after(::Vagrant::Action::Builtin::WaitForCommunicator, Vagrant::Smartos::Zones::Action.create_gz_vnic)
hook.after(Vagrant::Smartos::Zones::Action::CreateGZVnic, Vagrant::Smartos::Zones::Action.install_zone_gate)
hook.after(Vagrant::Smartos::Zones::Action::ZoneGate::Install, Vagrant::Smartos::Zones::Action.zone_create)
hook.after(Vagrant::Smartos::Zones::Action::Zone::Create, Vagrant::Smartos::Zones::Action.configure_zone_synced_folders)
hook.after(Vagrant::Smartos::Zones::Action::Zone::Create, Vagrant::Smartos::Zones::Action.zone_start)
# Currently if this runs before a zone is created, other capabilities (such as creating zone users)
# fail with the error that the machine is not ready for guest communication.
hook.after(Vagrant::Smartos::Zones::Action::Zone::Create, Vagrant::Smartos::Zones::Action.enable_zone_gate)

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
Copy link
Contributor

sax commented Nov 8, 2014

This just happened two weeks ago:
hashicorp/vagrant@7ccec33
hashicorp/vagrant#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 added a commit that referenced this issue Nov 9, 2014
NFS with VirtualBox requires that a public or private network is used. 
Because of how the Network middleware is written, the only way to run code
after it is to register middleware *before* it, but call through to later
middleware before executing code.

This change requires a bit switch in the order of our middleware, and will
likely cause problems with attempts to integrate with guest additions. The
guest additions code executes before networks are configured, so before we
can reasonably expect a local zone to exist.

[refs #9]
@sax
Copy link
Contributor

sax commented Nov 9, 2014

@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
Copy link
Contributor Author

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 [email protected] 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
Copy link
Contributor Author

@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
Copy link
Contributor Author

@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
Copy link
Contributor

sax commented Nov 11, 2014

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
Copy link
Contributor

sax commented Nov 11, 2014

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants