Parallels / vagrant-parallels

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

Fix shared folder mount on the VM reboot #391

Closed legal90 closed 3 years ago

legal90 commented 3 years ago

This PR fixes a critical bag introduced in vagrant-parallels v2.2.0 (Linux guests only): https://github.com/Parallels/vagrant-parallels/issues/389

Changes:

  1. Move shared folder setup from enable stage to prepare. In this case shared folders will be setup in the VM (via prlctl) before the VM is booted, so the filesystem will be available in the guest OS on early stage. In virtualbox provider it is done similarly: https://github.com/hashicorp/vagrant/blob/22795b161bf67a4c0ebbe32c9ce8777cb888c4a7/plugins/providers/virtualbox/synced_folder.rb#L17-L19

  2. Add _netdev mount option by default to all prl_fs filesystems. That will prevent VM from boot failure if the shared folder (filesystem) is not available. virtualbox provider does the same for vboxfs: https://github.com/hashicorp/vagrant/blob/5b501a3fb05ed0ab16cf10991b3df9d231edb5cf/plugins/providers/virtualbox/cap/mount_options.rb#L25

From man mount:

_netdev The filesystem resides on a device that requires network access (used to prevent the system from attempting to mount these filesystems until the network has been enabled on the system).

legal90 commented 3 years ago

Acceptance tests are passing successfully.

@romankulikov Could you please confirm if that's OK to use _netdev mount option for prl_fs filesystems on Linux guests? Code snippets in this blog post describe how exactly this option works, and it looks fine to me: http://codingberg.com/linux/systemd_when_to_use_netdev_mount_option So far it works good in my local tests.

romankulikov commented 3 years ago

Sorry for being late here. Frankly speaking prl_fs has nothing to do with networking. So it doesn't look nice for me to bound prl_fs with _netdev mount option. nofail option looks saner.