vagrant-parallels 2.3.0 → 2.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4cc3b37f94bef78ed214b98add9ae9814d6cad49650e5016fce26c7b7641eaaa
4
- data.tar.gz: 0e1ffee3b192374a3acc9b36438334605702e7c5b472d1e47857a31acd5c7196
3
+ metadata.gz: 340fd7bc7a4c4903ee2f67a21435abbd27d0fd3ae531e6e2f45b78d6d40749c6
4
+ data.tar.gz: ec86770f0a873be4d766e53df5a2ebbae3982924be8ee7974107cdd763a7da55
5
5
  SHA512:
6
- metadata.gz: f03a6bc1a95f28f95a736d3ce59dc52edb00bd609780e24ef26b38090ef32421ef8db5f362cd9692954aa88292e18af89cd884ea423f9a244d5932cdfff1749d
7
- data.tar.gz: 86467aba98c5870183d5da52a0b688ca28f5f06eb5160d983ea26d80a582a20108958e0b54c2c4ee14adb8f3740608ffeaf4f84debdbafb614a79da75c9f8e5b
6
+ metadata.gz: fa1430cfa50873ac14648f6d1c8269812850be959ada747366a669ca7003fbde48460b4e145ef4d193cbfe6ef47cff52bf0db20ea05b2a4fc768e914f9e1cbdc
7
+ data.tar.gz: '07178f61772a66d419117fa8bbabf953aa4d82b76e47952bba691d6b9ef38ceea92561314df94b3f13dd9712a701a2feb5480b80604785e048650be75ae212b9'
data/CHANGELOG.md CHANGED
@@ -1,4 +1,19 @@
1
- ## 2.3.0 (March 22, 2022)
1
+ ## 2.4.0 (May 22, 2023)
2
+ IMPROVEMENTS:
3
+ - Implement shared folder support for `.macvm` VMs
4
+ [[GH-448](https://github.com/Parallels/vagrant-parallels/pull/448)]
5
+
6
+ BUG FIXES:
7
+ - Fix shared folder mount error on `.macvm` VMs
8
+ [[GH-445](https://github.com/Parallels/vagrant-parallels/pull/445)]
9
+
10
+ ## 2.3.1 (March 23, 2023)
11
+ BUG FIXES:
12
+ - Fix the detection of VM IP. Wait for the IP to become available to
13
+ avoid connection issues and Vagrant warnings.
14
+ [[GH-440](https://github.com/Parallels/vagrant-parallels/issues/440)]
15
+
16
+ ## 2.3.0 (March 22, 2023)
2
17
  IMPROVEMENTS:
3
18
  - Support fetching the VM IP using prlctl
4
19
  [[GH-434](https://github.com/Parallels/vagrant-parallels/pull/434)].
@@ -4,7 +4,6 @@ module VagrantPlugins
4
4
  module Parallels
5
5
  module Action
6
6
  class Import
7
- include VagrantPlugins::Parallels::Util::Common
8
7
  @@lock = Mutex.new
9
8
 
10
9
  def initialize(app, env)
@@ -26,7 +25,7 @@ module VagrantPlugins
26
25
 
27
26
  # Linked clones are supported only for PD 11 and higher
28
27
  # Linked clones are not supported in macvms
29
- if env[:machine].provider_config.linked_clone and !is_macvm(env)
28
+ if env[:machine].provider_config.linked_clone and !Util::Common::is_macvm(env[:machine])
30
29
  # Linked clone creation should not be concurrent [GH-206]
31
30
  options[:snapshot_id] = env[:clone_snapshot_id]
32
31
  options[:linked] = true
@@ -6,7 +6,6 @@ module VagrantPlugins
6
6
  module Parallels
7
7
  module Action
8
8
  class PrepareCloneSnapshot
9
- include VagrantPlugins::Parallels::Util::Common
10
9
  @@lock = Mutex.new
11
10
 
12
11
  def initialize(app, env)
@@ -20,7 +19,7 @@ module VagrantPlugins
20
19
  return @app.call(env)
21
20
  end
22
21
 
23
- if is_macvm(env)
22
+ if Util::Common::is_macvm(env[:machine])
24
23
  #Ignore, since macvms doesn't support snapshot creation
25
24
  @logger.info('Snapshot creation is not supported yet for macOS ARM Guests, skip snapshot preparing')
26
25
  return @app.call(env)
@@ -4,7 +4,6 @@ module VagrantPlugins
4
4
  module Parallels
5
5
  module Action
6
6
  class SaneDefaults
7
- include VagrantPlugins::Parallels::Util::Common
8
7
 
9
8
  def initialize(app, env)
10
9
  @logger = Log4r::Logger.new('vagrant_parallels::action::sanedefaults')
@@ -30,7 +29,7 @@ module VagrantPlugins
30
29
 
31
30
  def default_settings
32
31
  # Options defined below are not supported for `*.macvm` VMs
33
- return {} if is_macvm(@env)
32
+ return {} if Util::Common::is_macvm(@env[:machine])
34
33
 
35
34
  {
36
35
  tools_autoupdate: 'no',
@@ -406,6 +406,7 @@ module VagrantPlugins
406
406
  # Returns an IP of the virtual machine fetched from the DHCP lease file.
407
407
  # It requires that Shared network adapter is configured for this VM
408
408
  # and it obtains an IP via DHCP.
409
+ # Returns an empty string if the IP coudn't be determined this way.
409
410
  #
410
411
  # @return [String] IP address leased by DHCP server in "Shared" network
411
412
  def read_guest_ip_dhcp
@@ -432,12 +433,13 @@ module VagrantPlugins
432
433
  end
433
434
 
434
435
  # Returns an IP of the virtual machine fetched from prlctl.
436
+ # Returns an empty string if the IP coudn't be determined this way.
435
437
  #
436
438
  # @return [String] IP address returned by `prlctl list -f` command
437
439
  def read_guest_ip_prlctl
438
440
  vm_info = json { execute_prlctl('list', @uuid, '--full', '--json') }
439
- ip = vm_info.first.fetch('ip_configured', nil)
440
- ip == '-' ? nil : ip
441
+ ip = vm_info.first.fetch('ip_configured', '')
442
+ ip == '-' ? '' : ip
441
443
  end
442
444
 
443
445
  # Returns path to the Parallels Tools ISO file.
@@ -768,13 +770,25 @@ module VagrantPlugins
768
770
  end
769
771
 
770
772
  # Reads the SSH IP of this VM from DHCP lease file or from `prlctl list`
771
- # command - whatever returns a non-empty result.
773
+ # command - whatever returns a non-empty result first.
772
774
  # The method with DHCP does not work for *.macvm VMs on Apple M-series Macs,
773
775
  # so we try both sources here.
774
776
  #
775
777
  # @return [String] IP address to use for SSH connection to the VM.
776
778
  def ssh_ip
777
- read_guest_ip_dhcp || read_guest_ip_prlctl
779
+ 5.times do
780
+ ip = read_guest_ip_dhcp
781
+ return ip unless ip.empty?
782
+
783
+ ip = read_guest_ip_prlctl
784
+ return ip unless ip.empty?
785
+
786
+ sleep 2
787
+ end
788
+
789
+ # We didn't manage to determine IP - return nil and
790
+ # expect SSH client to do a retry
791
+ return nil
778
792
  end
779
793
 
780
794
  # Reads the SSH port of this VM.
@@ -103,6 +103,16 @@ module VagrantPlugins
103
103
  SyncedFolder
104
104
  end
105
105
 
106
+ synced_folder(:parallels_macvm) do
107
+ require_relative 'synced_folder_macvm'
108
+ SyncedFolderMacVM
109
+ end
110
+
111
+ synced_folder_capability(:parallels_macvm, "mount_name") do
112
+ require_relative "cap/mount_options"
113
+ SyncedFolderCap::MountOptions
114
+ end
115
+
106
116
  synced_folder_capability(:parallels, "mount_name") do
107
117
  require_relative "cap/mount_options"
108
118
  SyncedFolderCap::MountOptions
@@ -4,9 +4,10 @@ module VagrantPlugins
4
4
  module Parallels
5
5
  class SyncedFolder < Vagrant.plugin('2', :synced_folder)
6
6
  def usable?(machine, raise_errors=false)
7
- # These synced folders only work if the provider is Parallels
7
+ # These synced folders only work if the provider is Parallels and the guest is not *.macvm
8
8
  machine.provider_name == :parallels &&
9
- machine.provider_config.functional_psf
9
+ machine.provider_config.functional_psf &&
10
+ !Util::Common::is_macvm(machine)
10
11
  end
11
12
 
12
13
  def prepare(machine, folders, _opts)
@@ -0,0 +1,50 @@
1
+ require 'vagrant/util/platform'
2
+
3
+ module VagrantPlugins
4
+ module Parallels
5
+ class SyncedFolderMacVM < Vagrant.plugin('2', :synced_folder)
6
+ def usable?(machine, raise_errors=false)
7
+ # These synced folders only work if the provider is Parallels and the guest is *.macvm
8
+ machine.provider_name == :parallels && Util::Common::is_macvm(machine)
9
+ end
10
+
11
+ def prepare(machine, folders, _opts)
12
+ # Setup shared folder definitions in the VM config.
13
+ defs = []
14
+ folders.each do |id, data|
15
+ hostpath = data[:hostpath]
16
+ if !data[:hostpath_exact]
17
+ hostpath = Vagrant::Util::Platform.cygwin_windows_path(hostpath)
18
+ end
19
+
20
+ defs << {
21
+ name: data[:plugin].capability(:mount_name, id, data),
22
+ hostpath: hostpath.to_s,
23
+ }
24
+ end
25
+
26
+ driver(machine).share_folders(defs)
27
+ end
28
+
29
+ def enable(machine, folders, _opts)
30
+ # TBD: Synced folders for *.macvm are not implemented yet
31
+ return
32
+ end
33
+
34
+ def disable(machine, folders, _opts)
35
+ # Remove the shared folders from the VM metadata
36
+ names = folders.map { |id, data| data[:plugin].capability(:mount_name, id, data) }
37
+ driver(machine).unshare_folders(names)
38
+ end
39
+
40
+ def cleanup(machine, opts)
41
+ driver(machine).clear_shared_folders if machine.id && machine.id != ''
42
+ end
43
+
44
+ # This is here so that we can stub it for tests
45
+ def driver(machine)
46
+ machine.provider.driver
47
+ end
48
+ end
49
+ end
50
+ end
@@ -5,8 +5,8 @@ module VagrantPlugins
5
5
 
6
6
  # Determines whether the VM's box contains a macOS guest for an Apple Silicon host.
7
7
  # In this case the image file ends with '.macvm' instead of '.pvm'
8
- def is_macvm(env)
9
- return !!Dir.glob(env[:machine].box.directory.join('*.macvm')).first
8
+ def self.is_macvm(machine)
9
+ return !!Dir.glob(machine.box.directory.join('*.macvm')).first
10
10
  end
11
11
 
12
12
  end
@@ -1,5 +1,5 @@
1
1
  module VagrantPlugins
2
2
  module Parallels
3
- VERSION = '2.3.0'
3
+ VERSION = '2.4.0'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vagrant-parallels
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.0
4
+ version: 2.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mikhail Zholobov
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2023-03-22 00:00:00.000000000 Z
12
+ date: 2023-05-22 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: nokogiri
@@ -142,6 +142,7 @@ files:
142
142
  - lib/vagrant-parallels/plugin.rb
143
143
  - lib/vagrant-parallels/provider.rb
144
144
  - lib/vagrant-parallels/synced_folder.rb
145
+ - lib/vagrant-parallels/synced_folder_macvm.rb
145
146
  - lib/vagrant-parallels/util/common.rb
146
147
  - lib/vagrant-parallels/util/compile_forwarded_ports.rb
147
148
  - lib/vagrant-parallels/util/unix_mount_helpers.rb