vagrant-parallels 2.3.1 → 2.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +28 -2
- data/lib/vagrant-parallels/action/import.rb +1 -2
- data/lib/vagrant-parallels/action/prepare_clone_snapshot.rb +1 -2
- data/lib/vagrant-parallels/action/sane_defaults.rb +1 -2
- data/lib/vagrant-parallels/driver/base.rb +54 -1
- data/lib/vagrant-parallels/plugin.rb +10 -0
- data/lib/vagrant-parallels/synced_folder.rb +3 -2
- data/lib/vagrant-parallels/synced_folder_macvm.rb +50 -0
- data/lib/vagrant-parallels/util/common.rb +21 -2
- data/lib/vagrant-parallels/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5316a81fe9c64de94bb88a2db7b9efcc015325d4b95bd4ec6302f7441334e0c3
|
4
|
+
data.tar.gz: d493a896f4b9776f2755038d333046c6fa920f7e1fdd45de96dee0ae4cf33ef4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 874be6069e0cf9ec4ee115d75b7979bd68a1c007d04f0552dae2a808d7025c8659926a906ce37814ee19c7c2e04ef7b753d2c5b1d2121f8670092a40b77b5248
|
7
|
+
data.tar.gz: 53435b75213e446b68d679f2600d47e70cc4d5fec8141d9be6e9eba270030cfa9f3d48cf398d5ce07311503de8a053802fb1629408bd49e5f49d25cbf40d0562
|
data/CHANGELOG.md
CHANGED
@@ -1,10 +1,36 @@
|
|
1
|
-
## 2.
|
1
|
+
## 2.4.0 (May 22, 2023)
|
2
|
+
IMPROVEMENTS:
|
3
|
+
- use clonefile copy for macvm boxes
|
4
|
+
[[GH-459](https://github.com/Parallels/vagrant-parallels/pull/459)]
|
5
|
+
|
6
|
+
BUG FIXES:
|
7
|
+
- Bump activesupport from 6.1.7.3 to 6.1.7.5
|
8
|
+
[[GH-457](https://github.com/Parallels/vagrant-parallels/pull/457)]
|
9
|
+
- Don't try to call methdods on Nil
|
10
|
+
[[GH-456](https://github.com/Parallels/vagrant-parallels/pull/456)]
|
11
|
+
- Add a doc note for releasing a new provider version
|
12
|
+
[[GH-452](https://github.com/Parallels/vagrant-parallels/pull/452)]
|
13
|
+
- website: Remove unused images
|
14
|
+
[[GH-450](https://github.com/Parallels/vagrant-parallels/pull/450)]
|
15
|
+
- adding macos
|
16
|
+
[[GH-447](https://github.com/Parallels/vagrant-parallels/pull/447)]
|
17
|
+
|
18
|
+
## 2.4.0 (May 22, 2023)
|
19
|
+
IMPROVEMENTS:
|
20
|
+
- Implement shared folder support for `.macvm` VMs
|
21
|
+
[[GH-448](https://github.com/Parallels/vagrant-parallels/pull/448)]
|
22
|
+
|
23
|
+
BUG FIXES:
|
24
|
+
- Fix shared folder mount error on `.macvm` VMs
|
25
|
+
[[GH-445](https://github.com/Parallels/vagrant-parallels/pull/445)]
|
26
|
+
|
27
|
+
## 2.3.1 (March 23, 2023)
|
2
28
|
BUG FIXES:
|
3
29
|
- Fix the detection of VM IP. Wait for the IP to become available to
|
4
30
|
avoid connection issues and Vagrant warnings.
|
5
31
|
[[GH-440](https://github.com/Parallels/vagrant-parallels/issues/440)]
|
6
32
|
|
7
|
-
## 2.3.0 (March 22,
|
33
|
+
## 2.3.0 (March 22, 2023)
|
8
34
|
IMPROVEMENTS:
|
9
35
|
- Support fetching the VM IP using prlctl
|
10
36
|
[[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',
|
@@ -78,7 +78,26 @@ module VagrantPlugins
|
|
78
78
|
# @return [String] UUID of the new VM.
|
79
79
|
def clone_vm(src_name, options = {})
|
80
80
|
dst_name = "vagrant_temp_#{(Time.now.to_f * 1000.0).to_i}_#{rand(100000)}"
|
81
|
+
src_vm = json { execute_prlctl('list', '--json', '-i', src_name) }.first
|
81
82
|
|
83
|
+
if options[:linked] || !Util::Common.is_apfs?(src_vm.fetch('Home'))
|
84
|
+
# If linked clone is an option, or path to src is not on APFS, then do the normal clone.
|
85
|
+
prlctl_clone_vm(src_name, dst_name, options)
|
86
|
+
else
|
87
|
+
# We can use clonefile on APFS to do a fast CoW clone of the VM source and then register
|
88
|
+
copy_clone_vm(src_name, dst_name, options)
|
89
|
+
end
|
90
|
+
read_vms[dst_name]
|
91
|
+
end
|
92
|
+
|
93
|
+
# Uses prlctl to clone an existing registered VM
|
94
|
+
#
|
95
|
+
# @param [String] src_name Name or UUID of the source VM or template.
|
96
|
+
# @param [String] dst_name Name of the destination VM.
|
97
|
+
# @param [<String => String>] options Options to clone virtual machine.
|
98
|
+
def prlctl_clone_vm(src_name, dst_name, options = {})
|
99
|
+
list_args = ['list', '--json', '-i', src_name]
|
100
|
+
src_vm = json { execute_prlctl(*list_args) }.first
|
82
101
|
args = ['clone', src_name, '--name', dst_name]
|
83
102
|
args.concat(['--dst', options[:dst]]) if options[:dst]
|
84
103
|
|
@@ -97,7 +116,41 @@ module VagrantPlugins
|
|
97
116
|
yield $1.to_i if block_given?
|
98
117
|
end
|
99
118
|
end
|
100
|
-
|
119
|
+
end
|
120
|
+
|
121
|
+
# Uses cp with clonefile flag to clone an existing registered VM
|
122
|
+
#
|
123
|
+
# @param [String] src_name Name or UUID of the source VM or template.
|
124
|
+
# @param [String] dst_name Name of the destination VM.
|
125
|
+
# @param [<String => String>] options Options to clone virtual machine.
|
126
|
+
def copy_clone_vm(src_name, dst_name, options = {})
|
127
|
+
list_args = ['list', '--json', '-i', src_name]
|
128
|
+
src_vm = json { execute_prlctl(*list_args) }.first
|
129
|
+
basepath = File.dirname(src_vm.fetch('Home')).delete_suffix('/')
|
130
|
+
extension = File.basename(src_vm.fetch('Home')).delete_suffix('/').split('.').last
|
131
|
+
clonepath = File.join(ENV['HOME'], "Parallels", "#{dst_name}.#{extension}")
|
132
|
+
execute('cp', '-c', '-R', '-p', src_vm.fetch('Home'), clonepath)
|
133
|
+
|
134
|
+
# Update config.pvs with dst_name as this is what Parallels uses when registering
|
135
|
+
update_vm_name(File.join(clonepath, 'config.pvs'), dst_name)
|
136
|
+
|
137
|
+
# Register the cloned path as a new VM
|
138
|
+
args = ['register', clonepath]
|
139
|
+
# Regenerate SourceVmUuid of the cloned VM
|
140
|
+
args << '--regenerate-src-uuid' if options[:regenerate_src_uuid]
|
141
|
+
|
142
|
+
# Regenerate SourceVmUuid of the cloned VM
|
143
|
+
execute_prlctl(*args)
|
144
|
+
|
145
|
+
# Don't need the box hanging around in Parallels
|
146
|
+
execute_prlctl('unregister', src_name)
|
147
|
+
end
|
148
|
+
|
149
|
+
def update_vm_name(config_pvs_path, name)
|
150
|
+
xml = Nokogiri::XML(File.read(config_pvs_path))
|
151
|
+
elem = xml.at_xpath('//ParallelsVirtualMachine/Identification/VmName')
|
152
|
+
elem.content = name
|
153
|
+
File.write(config_pvs_path, xml.to_xml)
|
101
154
|
end
|
102
155
|
|
103
156
|
# Compacts the specified virtual disk image
|
@@ -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
|
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'shellwords'
|
2
|
+
|
1
3
|
module VagrantPlugins
|
2
4
|
module Parallels
|
3
5
|
module Util
|
@@ -5,10 +7,27 @@ module VagrantPlugins
|
|
5
7
|
|
6
8
|
# Determines whether the VM's box contains a macOS guest for an Apple Silicon host.
|
7
9
|
# In this case the image file ends with '.macvm' instead of '.pvm'
|
8
|
-
def is_macvm(
|
9
|
-
return !!Dir.glob(
|
10
|
+
def self.is_macvm(machine)
|
11
|
+
return !machine.box.nil? && !!Dir.glob(machine.box.directory.join('*.macvm')).first
|
12
|
+
end
|
13
|
+
|
14
|
+
# Determines if the box directory is on an APFS filesystem
|
15
|
+
def self.is_apfs?(path, &block)
|
16
|
+
output = {stdout: '', stderr: ''}
|
17
|
+
df_command = %w[df -T apfs]
|
18
|
+
df_command << Shellwords.escape(path)
|
19
|
+
execute(*df_command, &block).exit_code == 0
|
10
20
|
end
|
11
21
|
|
22
|
+
private
|
23
|
+
|
24
|
+
def self.execute(*command, &block)
|
25
|
+
command << { notify: [:stdout, :stderr] }
|
26
|
+
|
27
|
+
Vagrant::Util::Busy.busy(lambda {}) do
|
28
|
+
Vagrant::Util::Subprocess.execute(*command, &block)
|
29
|
+
end
|
30
|
+
end
|
12
31
|
end
|
13
32
|
end
|
14
33
|
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.
|
4
|
+
version: 2.4.1
|
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-
|
12
|
+
date: 2023-10-16 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
|
@@ -166,7 +167,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
166
167
|
- !ruby/object:Gem::Version
|
167
168
|
version: 1.3.6
|
168
169
|
requirements: []
|
169
|
-
rubygems_version: 3.
|
170
|
+
rubygems_version: 3.4.10
|
170
171
|
signing_key:
|
171
172
|
specification_version: 4
|
172
173
|
summary: Parallels provider for Vagrant.
|