Parallels / vagrant-parallels

Vagrant Parallels Provider
https://parallels.github.io/vagrant-parallels
MIT License
996 stars 87 forks source link

Shared Folders not mounted after manual reboot #376

Closed romankulikov closed 3 years ago

romankulikov commented 3 years ago

In acceptance tests there's a case to check for synced folders persist after "manual" reboot, i.e. reboot initiated from the guest itself:

 37     status("Test: persists a sync folder after a manual reboot")
 38     result = execute("vagrant", "ssh", "-c", "sudo reboot")
 39     expect(result).to exit_with(255)
 40     result = execute("vagrant", "ssh", "-c", "cat /vagrant/foo")
 41     expect(result.exit_code).to eql(0)

But due to the current vagrant-parallels plugin implementation this test fails because all synced folders are mounted only from host (plugin) side which knows nothing about guest-initiated reboot.

Frankly I don't how to fix this properly: either a) we need to implement some kind of facility which notifies plugin about guest reboot or b) use auto-mount feature of Shared Folders (which is intentionally disabled by the plugin at the moment).

legal90 commented 3 years ago

Yeah, I confirm that problem. That part of acceptance test has been added to vagrant-spec recently: https://github.com/hashicorp/vagrant-spec/pull/34

They did it in the scope of the feature https://github.com/hashicorp/vagrant/pull/11570, which originally was implemented only for virtualbox provider. Until that there was no such feature in Vagrant at all. We haven't implemented the compatibility with this feature in vagrant-parallels.

But there are good news - I started looking into that couple of weeks ago and have a PoC in my local testing :) I'll do my best to complete it this week and will send a PR soon.

legal90 commented 3 years ago

Frankly I don't how to fix this properly: either a) we need to implement some kind of facility which notifies plugin about guest reboot or b) use auto-mount feature of Shared Folders (which is intentionally disabled by the plugin at the moment).

Long story short, Vagrant does that by adding an entry to guest's /etc/fstab, so we will just need to implement a certain capability for that: https://github.com/hashicorp/vagrant/blob/main/plugins/guests/linux/cap/persist_mount_shared_folder.rb

legal90 commented 3 years ago

Implemented in #377 After that the acceptance test passes fine.

P.s. Sometimes (non-deterministic) the acceptance test might still fail in the same place you've linked. The reason is that "vagrant ssh" command is executed too fast. I sent a fix to vagrant-spec for that: https://github.com/hashicorp/vagrant-spec/pull/43