vagrant-vmware-desktop 3.0.3 → 3.0.5
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/lib/vagrant-vmware-desktop/action/base_mac_config_warning.rb +72 -0
- data/lib/vagrant-vmware-desktop/action.rb +6 -5
- data/lib/vagrant-vmware-desktop/cap/disk.rb +27 -12
- data/lib/vagrant-vmware-desktop/cap.rb +12 -0
- data/lib/vagrant-vmware-desktop/driver/base.rb +112 -36
- data/lib/vagrant-vmware-desktop/driver.rb +2 -4
- data/lib/vagrant-vmware-desktop/errors.rb +8 -0
- data/lib/vagrant-vmware-desktop/guest_cap/linux/mount_vmware_shared_folder.rb +1 -1
- data/lib/vagrant-vmware-desktop/guest_cap/linux.rb +13 -0
- data/lib/vagrant-vmware-desktop/guest_cap.rb +10 -0
- data/lib/vagrant-vmware-desktop/helper/vagrant_utility.rb +1 -0
- data/lib/vagrant-vmware-desktop/plugin.rb +18 -20
- data/lib/vagrant-vmware-desktop.rb +9 -5
- data/locales/en.yml +30 -0
- metadata +77 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9dd285ae1a9f79d6f50dd355d0c60754a313a78b37e3043da5ab92798a83d6d5
|
4
|
+
data.tar.gz: 9adb28da0c78efbd6b568354b576970cd4345674335525cd3018c3bc34299286
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7ae03876f39b3d05f9aac2e1c1a6c1def94a8bb43a125c0352addb4883aa26efa1400d82066949c70bb781ab833cface015bd784a497e94c0f6256623f137a66
|
7
|
+
data.tar.gz: 66f3645377f66995c29354efb70876b8f78732ad530d8d6eaac1cdf4a02ce7d3a9e4d0d26f3e74e77ef41f899c3388c4909e21eef005698c942fbc2175b19cab
|
@@ -0,0 +1,72 @@
|
|
1
|
+
# Copyright (c) HashiCorp, Inc.
|
2
|
+
# SPDX-License-Identifier: MPL-2.0
|
3
|
+
|
4
|
+
module HashiCorp
|
5
|
+
module VagrantVMwareDesktop
|
6
|
+
module Action
|
7
|
+
# This inspects the Vagrantfile provided by the
|
8
|
+
# box (if one was provided) and checks if it
|
9
|
+
# set the `base_mac` value. If it did, a warning
|
10
|
+
# will be generated to the user.
|
11
|
+
#
|
12
|
+
# NOTE: This action is merely a "best effort" at
|
13
|
+
# providing the warning. It is using non-public
|
14
|
+
# Vagrant internals to inspect box Vagrantfile.
|
15
|
+
# As such, any errors encountered will be ignored
|
16
|
+
# with only a debug log.
|
17
|
+
class BaseMacConfigWarning
|
18
|
+
include Common
|
19
|
+
|
20
|
+
def initialize(app, env)
|
21
|
+
@app = app
|
22
|
+
@logger = Log4r::Logger.new("hashicorp::provider::vmware::basemacwarning")
|
23
|
+
end
|
24
|
+
|
25
|
+
def call(env)
|
26
|
+
catch(:complete) do
|
27
|
+
begin
|
28
|
+
# Attempt to extract the vagrantfile loader
|
29
|
+
loader = env[:machine].vagrantfile.instance_variable_get(:@loader)
|
30
|
+
if !loader
|
31
|
+
@logger.debug("base_mac check in box vagrantfile failed - cannot access loader")
|
32
|
+
throw :complete
|
33
|
+
end
|
34
|
+
|
35
|
+
# Attempt to get the Vagrantfile source for the box
|
36
|
+
# provided Vagrantfile
|
37
|
+
source = loader.instance_variable_get(:@sources)&.keys&.last
|
38
|
+
if !source
|
39
|
+
@logger.debug("base_mac check in box vagrantfile failed - cannot get box source")
|
40
|
+
throw :complete
|
41
|
+
end
|
42
|
+
|
43
|
+
begin
|
44
|
+
# Attempt to load the partial config
|
45
|
+
partial = loader.partial_load(source)
|
46
|
+
|
47
|
+
# Only proceed to display warning if the base_mac value
|
48
|
+
# in the partial load matches the base_mac in the final
|
49
|
+
# config
|
50
|
+
throw :complete if partial.vm.base_mac != env[:machine].config.vm.base_mac
|
51
|
+
|
52
|
+
# Display the warning message
|
53
|
+
env[:ui].warn(
|
54
|
+
I18n.t(
|
55
|
+
"hashicorp.vagrant_vmware_desktop.box_base_mac_warning",
|
56
|
+
base_mac: env[:machine].config.vm.base_mac
|
57
|
+
)
|
58
|
+
)
|
59
|
+
rescue KeyError => err
|
60
|
+
@logger.debug("base_mac check in box vagrantfile failed - partial load failure #{err.class}: #{err}")
|
61
|
+
end
|
62
|
+
rescue => err
|
63
|
+
@logger.debug("base_mac check in box vagrantfile failed - #{err.class}: #{err}")
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
@app.call(env)
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
@@ -16,6 +16,7 @@ module HashiCorp
|
|
16
16
|
include Vagrant::Action::Builtin
|
17
17
|
include Vagrant::Action::General
|
18
18
|
|
19
|
+
autoload :BaseMacConfigWarning, "vagrant-vmware-desktop/action/base_mac_config_warning"
|
19
20
|
autoload :BaseMacToIp, "vagrant-vmware-desktop/action/base_mac_to_ip"
|
20
21
|
autoload :Boot, "vagrant-vmware-desktop/action/boot"
|
21
22
|
autoload :CheckExistingNetwork, "vagrant-vmware-desktop/action/check_existing_network"
|
@@ -329,7 +330,7 @@ module HashiCorp
|
|
329
330
|
|
330
331
|
b.use Call, Running do |env, b2|
|
331
332
|
if env[:result]
|
332
|
-
b2.use
|
333
|
+
b2.use action_provision
|
333
334
|
next
|
334
335
|
end
|
335
336
|
|
@@ -361,10 +362,8 @@ module HashiCorp
|
|
361
362
|
b3.use SetHostname
|
362
363
|
end
|
363
364
|
|
364
|
-
|
365
|
-
|
366
|
-
b3.use Disk
|
367
|
-
end
|
365
|
+
b3.use CleanupDisks
|
366
|
+
b3.use Disk
|
368
367
|
b3.use VMXModify
|
369
368
|
b3.use PrepareForwardedPortCollisionParams
|
370
369
|
b3.use HandleForwardedPortCollisions
|
@@ -435,6 +434,8 @@ module HashiCorp
|
|
435
434
|
b2.use SetDisplayName
|
436
435
|
end
|
437
436
|
|
437
|
+
b2.use BaseMacConfigWarning
|
438
|
+
|
438
439
|
b2.use action_start
|
439
440
|
end
|
440
441
|
b.use Checkpoint
|
@@ -12,12 +12,12 @@ module HashiCorp
|
|
12
12
|
@@logger = Log4r::Logger.new("hashicorp::provider::vmware::cap::disk")
|
13
13
|
|
14
14
|
DEFAULT_DISK_EXT = "vmdk".freeze
|
15
|
-
BUS_TYPES = ["sata", "ide", "scsi"].map(&:freeze).freeze
|
15
|
+
BUS_TYPES = ["nvme", "sata", "ide", "scsi"].map(&:freeze).freeze
|
16
16
|
DEFAULT_BUS = "scsi".freeze
|
17
17
|
DEFAULT_DVD_BUS = "ide".freeze
|
18
18
|
DEFAULT_DVD_DEVICE_TYPE = "cdrom-image"
|
19
19
|
# Adapter types (from vmware-vdiskmanager -h)
|
20
|
-
DISK_ADAPTER_TYPES = ["ide", "buslogic", "lsilogic"].map(&:freeze).freeze
|
20
|
+
DISK_ADAPTER_TYPES = ["ide", "buslogic", "lsilogic", "pvscsi"].map(&:freeze).freeze
|
21
21
|
DEFAULT_ADAPTER_TYPE = "lsilogic".freeze
|
22
22
|
# Disk types (from vmware-vdiskmanager -h)
|
23
23
|
# 0 : single growable virtual disk
|
@@ -28,7 +28,7 @@ module HashiCorp
|
|
28
28
|
# 5 : compressed disk optimized for streaming
|
29
29
|
# 6 : thin provisioned virtual disk - ESX 3.x and above
|
30
30
|
DEFAULT_DISK_TYPE = 0.freeze
|
31
|
-
|
31
|
+
PRIMARY_DISK_SLOTS = ["nvme0:0", "scsi0:0", "sata0:0", "ide0:0"].map(&:freeze).freeze
|
32
32
|
|
33
33
|
def self.set_default_disk_ext(machine)
|
34
34
|
DEFAULT_DISK_EXT
|
@@ -112,7 +112,15 @@ module HashiCorp
|
|
112
112
|
# @return [Hash, nil] - A hash of the current disk, nil if not found
|
113
113
|
def self.get_disk(disk, all_disks)
|
114
114
|
if disk.primary
|
115
|
-
|
115
|
+
PRIMARY_DISK_SLOTS.each do |primary_slot|
|
116
|
+
disk_info = all_disks[primary_slot]
|
117
|
+
if disk_info
|
118
|
+
@@logger.debug("disk info for primary slot #{primary_slot} - #{disk_info}")
|
119
|
+
return disk_info if disk_info["present"].to_s.upcase == "TRUE"
|
120
|
+
end
|
121
|
+
end
|
122
|
+
|
123
|
+
nil
|
116
124
|
else
|
117
125
|
if disk.type == :dvd
|
118
126
|
all_disks.values.detect { |v| v["filename"] == disk.file }
|
@@ -138,6 +146,8 @@ module HashiCorp
|
|
138
146
|
current_disk = get_disk(disk, attached_disks)
|
139
147
|
|
140
148
|
if current_disk.nil?
|
149
|
+
raise Errors::DiskPrimaryMissing if disk.primary
|
150
|
+
|
141
151
|
disk_path = create_disk(machine, disk, attached_disks)
|
142
152
|
else
|
143
153
|
# If the path matches the disk name + some extra characters then
|
@@ -153,7 +163,12 @@ module HashiCorp
|
|
153
163
|
|
154
164
|
# disk.size is in bytes
|
155
165
|
if disk.size > machine.provider.driver.get_disk_size(disk_path)
|
156
|
-
|
166
|
+
if disk.primary && machine.provider.driver.is_linked_clone?
|
167
|
+
machine.env.ui.warn(I18n.t("hashicorp.vagrant_vmware_desktop.disk_not_growing_linked_primary"))
|
168
|
+
@@logger.warn("Not growing primary disk - guest is linked clone")
|
169
|
+
else
|
170
|
+
grow_disk(machine, disk_path, disk)
|
171
|
+
end
|
157
172
|
elsif disk.size < machine.provider.driver.get_disk_size(disk_path)
|
158
173
|
machine.env.ui.warn(I18n.t("hashicorp.vagrant_vmware_desktop.disk_not_shrinking", path: disk.name))
|
159
174
|
@@logger.warn("Not shrinking disk #{disk.name}")
|
@@ -175,9 +190,9 @@ module HashiCorp
|
|
175
190
|
if disk.provider_config && disk.provider_config.key?(:vmware_desktop)
|
176
191
|
disk_provider_config = disk.provider_config[:vmware_desktop]
|
177
192
|
if !BUS_TYPES.include?(disk_provider_config[:bus_type])
|
193
|
+
@@logger.warn("#{disk_provider_config[:bus_type]} is not valid. Should be one of " \
|
194
|
+
"#{BUS_TYPES.join(', ')}. Setting bus type to #{DEFAULT_DVD_BUS}")
|
178
195
|
disk_provider_config[:bus_type] = DEFAULT_DVD_BUS
|
179
|
-
@@logger.warn("#{disk_provider_config[:bus_type]} is not a valid. Should be one of " \
|
180
|
-
"#{BUS_TYPES.join(', ')}! Setting adapter type to #{DEFAULT_DVD_BUS}")
|
181
196
|
end
|
182
197
|
end
|
183
198
|
|
@@ -204,18 +219,18 @@ module HashiCorp
|
|
204
219
|
# Create a new disk if a file is not provided, or that path does not exist
|
205
220
|
disk_filename = "#{disk_config.name}.#{disk_config.disk_ext}"
|
206
221
|
disk_provider_config = {}
|
207
|
-
|
208
222
|
if disk_config.provider_config && disk_config.provider_config.key?(:vmware_desktop)
|
209
223
|
disk_provider_config = disk_config.provider_config[:vmware_desktop]
|
224
|
+
|
210
225
|
if !DISK_ADAPTER_TYPES.include?(disk_provider_config[:adapter_type])
|
226
|
+
@@logger.warn("#{disk_provider_config[:adapter_type]} is not valid. Should be one " \
|
227
|
+
"of #{DISK_ADAPTER_TYPES.join(', ')}. Setting adapter type to #{DEFAULT_ADAPTER_TYPE}")
|
211
228
|
disk_provider_config[:adapter_type] = DEFAULT_ADAPTER_TYPE
|
212
|
-
@@logger.warn("#{disk_provider_config[:adapter_type]} is not a valid. Should be one " \
|
213
|
-
"of #{DISK_ADAPTER_TYPES.join(', ')}! Setting adapter type to #{DEFAULT_ADAPTER_TYPE}")
|
214
229
|
end
|
215
230
|
if !BUS_TYPES.include?(disk_provider_config[:bus_type])
|
231
|
+
@@logger.warn("#{disk_provider_config[:bus_type]} is not valid. Should be one of " \
|
232
|
+
"#{BUS_TYPES.join(', ')}. Setting bus type to #{DEFAULT_BUS}")
|
216
233
|
disk_provider_config[:bus_type] = DEFAULT_BUS
|
217
|
-
@@logger.warn("#{disk_provider_config[:bus_type]} is not a valid. Should be one of " \
|
218
|
-
"#{BUS_TYPES.join(', ')}! Setting adapter type to #{DEFAULT_BUS}")
|
219
234
|
end
|
220
235
|
end
|
221
236
|
disk_type = DEFAULT_DISK_TYPE
|
@@ -0,0 +1,12 @@
|
|
1
|
+
# Copyright (c) HashiCorp, Inc.
|
2
|
+
# SPDX-License-Identifier: MPL-2.0
|
3
|
+
|
4
|
+
module HashiCorp
|
5
|
+
module VagrantVMwareDesktop
|
6
|
+
module Cap
|
7
|
+
autoload :Disk, "vagrant-vmware-desktop/cap/disk"
|
8
|
+
autoload :Provider, "vagrant-vmware-desktop/cap/provider"
|
9
|
+
autoload :Snapshot, "vagrant-vmware-desktop/cap/snapshot"
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
@@ -33,6 +33,10 @@ module HashiCorp
|
|
33
33
|
# Number of bytes in disk sector
|
34
34
|
SECTOR_TO_BYTES = 512.freeze
|
35
35
|
|
36
|
+
# Number of seconds to allow the vmrun start command
|
37
|
+
# to complete
|
38
|
+
VMRUN_START_TIMEOUT = 300.freeze
|
39
|
+
|
36
40
|
# Vagrant utility version requirement which must be satisfied to properly
|
37
41
|
# work with this version of the plugin. This should be used when new API
|
38
42
|
# end points are added to the utility to ensure expected functionality.
|
@@ -586,6 +590,43 @@ module HashiCorp
|
|
586
590
|
def read_ip(enable_vmrun_ip_lookup=true)
|
587
591
|
@logger.info("Reading an accessible IP for machine...")
|
588
592
|
|
593
|
+
if enable_vmrun_ip_lookup
|
594
|
+
# Try to read the IP using vmrun getGuestIPAddress. This
|
595
|
+
# won't work if the guest doesn't have guest tools installed or
|
596
|
+
# is using an old version of VMware.
|
597
|
+
begin
|
598
|
+
@logger.info("Trying vmrun getGuestIPAddress...")
|
599
|
+
result = vmrun("getGuestIPAddress", host_vmx_path, "-wait", {timeout: 10, retryable: true})
|
600
|
+
result = result.stdout.chomp
|
601
|
+
|
602
|
+
# If returned address ends with a ".1" do not accept address
|
603
|
+
# and allow lookup via VMX.
|
604
|
+
# see: https://github.com/vmware/open-vm-tools/issues/93
|
605
|
+
if result.end_with?(".1")
|
606
|
+
@logger.warn("vmrun getGuestIPAddress returned: #{result}. Result resembles address retrieval from wrong " \
|
607
|
+
"interface. Discarding value and proceeding with VMX based lookup.")
|
608
|
+
result = nil
|
609
|
+
else
|
610
|
+
# Try to parse the IP Address. This will raise an exception
|
611
|
+
# if it fails, which will halt our attempt to use it.
|
612
|
+
IPAddr.new(result)
|
613
|
+
@logger.info("vmrun getGuestIPAddress success: #{result}")
|
614
|
+
return result
|
615
|
+
end
|
616
|
+
rescue Errors::VMRunError
|
617
|
+
@logger.info("vmrun getGuestIPAddress failed: VMRunError")
|
618
|
+
# Ignore, try the MAC address way.
|
619
|
+
rescue Vagrant::Util::Subprocess::TimeoutExceeded
|
620
|
+
@logger.info("vmrun getGuestIPAddress failed: TimeoutExceeded")
|
621
|
+
# Ignore, try the MAC address way.
|
622
|
+
rescue IPAddr::InvalidAddressError
|
623
|
+
@logger.info("vmrun getGuestIPAddress failed: InvalidAddressError for #{result.inspect}")
|
624
|
+
# Ignore, try the MAC address way.
|
625
|
+
end
|
626
|
+
else
|
627
|
+
@logger.info("Skipping vmrun getGuestIPAddress as requested by config.")
|
628
|
+
end
|
629
|
+
|
589
630
|
# NOTE: Read from DHCP leases first so we can attempt to fetch the address
|
590
631
|
# for the vmnet8 device first. If multiple networks are defined on the guest
|
591
632
|
# it will return the address of the last device, which will fail when doing
|
@@ -628,39 +669,6 @@ module HashiCorp
|
|
628
669
|
return dhcp_ip if dhcp_ip
|
629
670
|
end
|
630
671
|
|
631
|
-
if enable_vmrun_ip_lookup
|
632
|
-
# Try to read the IP using vmrun getGuestIPAddress. This
|
633
|
-
# won't work if the guest doesn't have guest tools installed or
|
634
|
-
# is using an old version of VMware.
|
635
|
-
begin
|
636
|
-
@logger.info("Trying vmrun getGuestIPAddress...")
|
637
|
-
result = vmrun("getGuestIPAddress", host_vmx_path)
|
638
|
-
result = result.stdout.chomp
|
639
|
-
|
640
|
-
# If returned address ends with a ".1" do not accept address
|
641
|
-
# and allow lookup via VMX.
|
642
|
-
# see: https://github.com/vmware/open-vm-tools/issues/93
|
643
|
-
if result.end_with?(".1")
|
644
|
-
@logger.warn("vmrun getGuestIPAddress returned: #{result}. Result resembles address retrieval from wrong " \
|
645
|
-
"interface. Discarding value and proceeding with VMX based lookup.")
|
646
|
-
result = nil
|
647
|
-
else
|
648
|
-
# Try to parse the IP Address. This will raise an exception
|
649
|
-
# if it fails, which will halt our attempt to use it.
|
650
|
-
IPAddr.new(result)
|
651
|
-
@logger.info("vmrun getGuestIPAddress success: #{result}")
|
652
|
-
return result
|
653
|
-
end
|
654
|
-
rescue Errors::VMRunError
|
655
|
-
@logger.info("vmrun getGuestIPAddress failed: VMRunError")
|
656
|
-
# Ignore, try the MAC address way.
|
657
|
-
rescue IPAddr::InvalidAddressError
|
658
|
-
@logger.info("vmrun getGuestIPAddress failed: InvalidAddressError for #{result.inspect}")
|
659
|
-
# Ignore, try the MAC address way.
|
660
|
-
end
|
661
|
-
else
|
662
|
-
@logger.info("Skipping vmrun getGuestIPAddress as requested by config.")
|
663
|
-
end
|
664
672
|
nil
|
665
673
|
end
|
666
674
|
|
@@ -940,10 +948,10 @@ module HashiCorp
|
|
940
948
|
# This will start the VMware machine.
|
941
949
|
def start(gui=false)
|
942
950
|
gui_arg = gui ? "gui" : "nogui"
|
943
|
-
vmrun("start", host_vmx_path, gui_arg, retryable: true, timeout:
|
951
|
+
vmrun("start", host_vmx_path, gui_arg, retryable: true, timeout: VMRUN_START_TIMEOUT)
|
944
952
|
rescue Vagrant::Util::Subprocess::TimeoutExceeded
|
945
953
|
# Sometimes vmrun just hangs. We give it a generous timeout
|
946
|
-
#
|
954
|
+
# and then throw this.
|
947
955
|
raise Errors::StartTimeout
|
948
956
|
end
|
949
957
|
|
@@ -1189,6 +1197,32 @@ module HashiCorp
|
|
1189
1197
|
disk_size
|
1190
1198
|
end
|
1191
1199
|
|
1200
|
+
# @return [Boolean] Instance is a linked clone
|
1201
|
+
def is_linked_clone?
|
1202
|
+
if @vmsd_path.nil?
|
1203
|
+
@vm_dir.children(true).each do |child|
|
1204
|
+
if child.basename.to_s.match(/\.vmsd$/)
|
1205
|
+
@vmsd_path = child
|
1206
|
+
end
|
1207
|
+
end
|
1208
|
+
end
|
1209
|
+
|
1210
|
+
return false if @vmsd_path.nil?
|
1211
|
+
|
1212
|
+
if @is_clone.nil?
|
1213
|
+
@is_clone = false
|
1214
|
+
|
1215
|
+
File.readlines(@vmsd_path).each do |line|
|
1216
|
+
if line.start_with?("cloneOf")
|
1217
|
+
@is_clone = true
|
1218
|
+
break
|
1219
|
+
end
|
1220
|
+
end
|
1221
|
+
end
|
1222
|
+
|
1223
|
+
@is_clone
|
1224
|
+
end
|
1225
|
+
|
1192
1226
|
protected
|
1193
1227
|
|
1194
1228
|
# This reads the latest DHCP lease for a MAC address on the
|
@@ -1271,6 +1305,10 @@ module HashiCorp
|
|
1271
1305
|
end
|
1272
1306
|
result = Vagrant::Util::Subprocess.execute(r_path, *command)
|
1273
1307
|
if result.exit_code != 0
|
1308
|
+
if result.stdout.include?("operation was canceled") || result.stderr.include?("operation was canceled")
|
1309
|
+
raise_canceled_error!
|
1310
|
+
end
|
1311
|
+
|
1274
1312
|
raise Errors::VMExecError,
|
1275
1313
|
:executable => executable.to_s,
|
1276
1314
|
:command => command.inspect,
|
@@ -1352,7 +1390,6 @@ module HashiCorp
|
|
1352
1390
|
end
|
1353
1391
|
end
|
1354
1392
|
|
1355
|
-
|
1356
1393
|
# This performs common cleanup tasks on a cloned machine.
|
1357
1394
|
def clone_cleanup(destination_vmx)
|
1358
1395
|
destination = destination_vmx.parent
|
@@ -1380,6 +1417,45 @@ module HashiCorp
|
|
1380
1417
|
destination_vmx
|
1381
1418
|
end
|
1382
1419
|
|
1420
|
+
# Attempts to extract cause of a vmware canceled operation
|
1421
|
+
# by inspecting the vmware.log file for failure information.
|
1422
|
+
# If found, an exception will be raised. Otherwise, nothing
|
1423
|
+
# will be raised.
|
1424
|
+
def raise_canceled_error!
|
1425
|
+
vmware_log = @vm_dir.join("vmware.log")
|
1426
|
+
return if !vmware_log.exist?
|
1427
|
+
error_lines = []
|
1428
|
+
found = false
|
1429
|
+
File.open(vmware_log.to_s) do |file|
|
1430
|
+
until file.eof?
|
1431
|
+
line = file.readline.chomp
|
1432
|
+
if found
|
1433
|
+
break if line.include?("-----------------")
|
1434
|
+
error_lines << line
|
1435
|
+
next
|
1436
|
+
end
|
1437
|
+
|
1438
|
+
if line.include?("Msg_Post: Error")
|
1439
|
+
found = true
|
1440
|
+
end
|
1441
|
+
end
|
1442
|
+
end
|
1443
|
+
|
1444
|
+
# If error content wasn't found, just return
|
1445
|
+
return if !found
|
1446
|
+
|
1447
|
+
# If the size of the content is unreasonably large, just return
|
1448
|
+
return if error_lines.size > 10
|
1449
|
+
|
1450
|
+
error_lines.map! do |line|
|
1451
|
+
line.sub(/^.*? vmx \[.*?\] /, "")
|
1452
|
+
end
|
1453
|
+
|
1454
|
+
raise Errors::VMCancelError,
|
1455
|
+
error: error_lines.join("\n"),
|
1456
|
+
vmware_log_path: vmware_log.to_s
|
1457
|
+
end
|
1458
|
+
|
1383
1459
|
# Display warning message about allowlisted VMX ethernet settings
|
1384
1460
|
def display_ethernet_allowlist_warning(vmx_key, vmx_val)
|
1385
1461
|
if VMX_ETHERNET_ALLOWLIST_ENFORCE != :quiet
|
@@ -1,13 +1,11 @@
|
|
1
1
|
# Copyright (c) HashiCorp, Inc.
|
2
2
|
# SPDX-License-Identifier: MPL-2.0
|
3
3
|
|
4
|
-
require "vagrant/util/platform"
|
5
|
-
|
6
|
-
require "vagrant-vmware-desktop/driver/base"
|
7
|
-
|
8
4
|
module HashiCorp
|
9
5
|
module VagrantVMwareDesktop
|
10
6
|
module Driver
|
7
|
+
autoload :Base, "vagrant-vmware-desktop/driver/base"
|
8
|
+
|
11
9
|
# This returns a new driver for the given VM directory, using the
|
12
10
|
# proper underlying platform driver.
|
13
11
|
def self.create(vm_dir, config)
|
@@ -47,6 +47,10 @@ module HashiCorp
|
|
47
47
|
error_key(:disk_not_resized_snapshot)
|
48
48
|
end
|
49
49
|
|
50
|
+
class DiskPrimaryMissing < Base
|
51
|
+
error_key(:disk_primary_missing)
|
52
|
+
end
|
53
|
+
|
50
54
|
class MissingNATDevice < Base
|
51
55
|
error_key(:missing_nat_device)
|
52
56
|
end
|
@@ -263,6 +267,10 @@ module HashiCorp
|
|
263
267
|
error_key(:vmnet_no_ipv6)
|
264
268
|
end
|
265
269
|
|
270
|
+
class VMCancelError < Base
|
271
|
+
error_key(:vmcancel_error)
|
272
|
+
end
|
273
|
+
|
266
274
|
class VMExecError < Base
|
267
275
|
error_key(:vmexec_error)
|
268
276
|
end
|
@@ -119,7 +119,7 @@ module HashiCorp
|
|
119
119
|
current_mount_point = "#{VAGRANT_ROOT_MOUNT_POINT}/#{uid}-#{gid}"
|
120
120
|
hgfs_mount_options = "allow_other,default_permissions,uid=#{uid},gid=#{gid}"
|
121
121
|
hgfs_mount_options << ",#{options[:extra]}" if options[:extra]
|
122
|
-
hgfs_mount_options << ",#{options[:mount_options].join(',')}" if options[:mount_options]
|
122
|
+
hgfs_mount_options << ",#{Array(options[:mount_options]).join(',')}" if !Array(options[:mount_options]).empty?
|
123
123
|
hgfs_mount = "vmhgfs-fuse -o #{hgfs_mount_options} .host:/ '#{current_mount_point}'"
|
124
124
|
|
125
125
|
# Allow user to disable unmounting of default vmhgfs-fuse mount point at /mnt/hgfs
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# Copyright (c) HashiCorp, Inc.
|
2
|
+
# SPDX-License-Identifier: MPL-2.0
|
3
|
+
|
4
|
+
module HashiCorp
|
5
|
+
module VagrantVMwareDesktop
|
6
|
+
module GuestCap
|
7
|
+
module Linux
|
8
|
+
autoload :VerifyVMwareHGFS, "vagrant-vmware-desktop/guest_cap/linux/verify_vmware_hgfs"
|
9
|
+
autoload :MountVMwareSharedFolder, "vagrant-vmware-desktop/guest_cap/linux/mount_vmware_shared_folder"
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -179,6 +179,7 @@ module HashiCorp
|
|
179
179
|
rescue Net::HTTPServiceUnavailable
|
180
180
|
raise Errors::DriverAPIConnectionFailed
|
181
181
|
rescue => err
|
182
|
+
@logger.debug("unexpected error - #{err.class}: #{err}")
|
182
183
|
raise Errors::DriverAPIRequestUnexpectedError, error: err
|
183
184
|
end
|
184
185
|
end
|
@@ -99,26 +99,24 @@ module HashiCorp
|
|
99
99
|
Cap::Provider
|
100
100
|
end
|
101
101
|
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
Cap::Disk
|
121
|
-
end
|
102
|
+
provider_capability(p_name, :set_default_disk_ext) do
|
103
|
+
require File.expand_path("../cap/disk", __FILE__)
|
104
|
+
Cap::Disk
|
105
|
+
end
|
106
|
+
|
107
|
+
provider_capability(p_name, :default_disk_exts) do
|
108
|
+
require File.expand_path("../cap/disk", __FILE__)
|
109
|
+
Cap::Disk
|
110
|
+
end
|
111
|
+
|
112
|
+
provider_capability(p_name, :configure_disks) do
|
113
|
+
require File.expand_path("../cap/disk", __FILE__)
|
114
|
+
Cap::Disk
|
115
|
+
end
|
116
|
+
|
117
|
+
provider_capability(p_name, :cleanup_disks) do
|
118
|
+
require File.expand_path("../cap/disk", __FILE__)
|
119
|
+
Cap::Disk
|
122
120
|
end
|
123
121
|
end
|
124
122
|
|
@@ -19,11 +19,15 @@ module HashiCorp
|
|
19
19
|
"vagrant-vmware-workstation"
|
20
20
|
].map(&:freeze).freeze
|
21
21
|
|
22
|
-
|
23
|
-
autoload :
|
24
|
-
autoload :
|
25
|
-
autoload :
|
26
|
-
autoload :
|
22
|
+
autoload :Action, "vagrant-vmware-desktop/action"
|
23
|
+
autoload :Cap, "vagrant-vmware-desktop/cap"
|
24
|
+
autoload :CheckpointClient, "vagrant-vmware-desktop/checkpoint_client"
|
25
|
+
autoload :Config, "vagrant-vmware-desktop/config"
|
26
|
+
autoload :Driver, "vagrant-vmware-desktop/driver"
|
27
|
+
autoload :Errors, "vagrant-vmware-desktop/errors"
|
28
|
+
autoload :Provider, "vagrant-vmware-desktop/provider"
|
29
|
+
autoload :SetupPlugin, "vagrant-vmware-desktop/setup_plugin"
|
30
|
+
autoload :SyncedFolder, "vagrant-vmware-desktop/synced_folder"
|
27
31
|
|
28
32
|
# This initializes the i18n load path so that the plugin-specific
|
29
33
|
# translations work.
|
data/locales/en.yml
CHANGED
@@ -4,6 +4,20 @@
|
|
4
4
|
en:
|
5
5
|
hashicorp:
|
6
6
|
vagrant_vmware_desktop:
|
7
|
+
box_base_mac_warning: |-
|
8
|
+
Detected guest `base_mac` value set within the Vagrantfile
|
9
|
+
included with this box. Having the `base_mac` value set
|
10
|
+
for VMware guests may cause issues properly identifying
|
11
|
+
the guest IP address due to MAC collisions.
|
12
|
+
|
13
|
+
Current value: %{base_mac}
|
14
|
+
|
15
|
+
To disable the `base_mac` value so it will be randomly
|
16
|
+
generated, set the value to nil in the Vagrantfile:
|
17
|
+
|
18
|
+
config.vm.base_mac = nil
|
19
|
+
|
20
|
+
https://www.vagrantup.com/docs/vagrantfile/machine_settings#config-vm-base_mac
|
7
21
|
already_running: |-
|
8
22
|
Machine is already running.
|
9
23
|
booted_and_ready: |-
|
@@ -16,6 +30,9 @@ en:
|
|
16
30
|
Configuring network adapters within the VM...
|
17
31
|
destroying: |-
|
18
32
|
Deleting the VM...
|
33
|
+
disk_not_growing_linked_primary: |-
|
34
|
+
Increasing the size of the primary disk is not allowed for linked
|
35
|
+
clones. Primary disk of the guest remains unchanged.
|
19
36
|
disk_not_shrinking: |-
|
20
37
|
Shrinking disks is not supported. Not shrinking disk %{path}
|
21
38
|
discarding_suspended_state: |-
|
@@ -189,6 +206,8 @@ en:
|
|
189
206
|
disk please remove snapshots associated with the VM.
|
190
207
|
|
191
208
|
Path: %{path}
|
209
|
+
disk_primary_missing: |-
|
210
|
+
Failed to locate the primary disk for the guest.
|
192
211
|
destroy_invalid_state: |-
|
193
212
|
The VMware machine cannot be destroyed beacuse it is still
|
194
213
|
running. Please make sure the machine is properly halted before
|
@@ -485,6 +504,15 @@ en:
|
|
485
504
|
The VMware product does not support IPv6 in a robust way like other
|
486
505
|
Vagrant providers. This is not a bug in Vagrant - the upstream
|
487
506
|
provider does not provide robust support for IPv6.
|
507
|
+
vmcancel_error: |-
|
508
|
+
An error occurred causing VMware to cancel the current operation. Details
|
509
|
+
of the error causing the cancelation:
|
510
|
+
|
511
|
+
%{error}
|
512
|
+
|
513
|
+
The full log can be located at:
|
514
|
+
|
515
|
+
%{vmware_log_path}
|
488
516
|
vmexec_error: |-
|
489
517
|
An error occurred while executing `%{executable}`, a utility for controlling
|
490
518
|
VMware machines. The command and output are below:
|
@@ -597,6 +625,8 @@ en:
|
|
597
625
|
again. If this error persists, please open a new issue at:
|
598
626
|
|
599
627
|
https://github.com/hashicorp/vagrant-vmware-desktop/issues
|
628
|
+
|
629
|
+
Encountered error: %{error}
|
600
630
|
driver_api_invalid_response: |-
|
601
631
|
Vagrant failed to properly process a result from the Vagrant VMware
|
602
632
|
Utility driver. Please try to run the command again. If this error
|
metadata
CHANGED
@@ -1,15 +1,71 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vagrant-vmware-desktop
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.
|
4
|
+
version: 3.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vagrant Team
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
12
|
-
dependencies:
|
11
|
+
date: 2025-04-18 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rake
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rspec
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '3.13'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '3.13'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec-its
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '2.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '2.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: webmock
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '3.25'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '3.25'
|
13
69
|
description: Enables Vagrant to power VMware Workstation/Fusion machines.
|
14
70
|
email: vagrant@hashicorp.com
|
15
71
|
executables: []
|
@@ -18,6 +74,7 @@ extra_rdoc_files: []
|
|
18
74
|
files:
|
19
75
|
- lib/vagrant-vmware-desktop.rb
|
20
76
|
- lib/vagrant-vmware-desktop/action.rb
|
77
|
+
- lib/vagrant-vmware-desktop/action/base_mac_config_warning.rb
|
21
78
|
- lib/vagrant-vmware-desktop/action/base_mac_to_ip.rb
|
22
79
|
- lib/vagrant-vmware-desktop/action/boot.rb
|
23
80
|
- lib/vagrant-vmware-desktop/action/check_existing_network.rb
|
@@ -57,6 +114,7 @@ files:
|
|
57
114
|
- lib/vagrant-vmware-desktop/action/wait_for_address.rb
|
58
115
|
- lib/vagrant-vmware-desktop/action/wait_for_communicator_compat.rb
|
59
116
|
- lib/vagrant-vmware-desktop/action/wait_for_vmx_halt.rb
|
117
|
+
- lib/vagrant-vmware-desktop/cap.rb
|
60
118
|
- lib/vagrant-vmware-desktop/cap/disk.rb
|
61
119
|
- lib/vagrant-vmware-desktop/cap/provider.rb
|
62
120
|
- lib/vagrant-vmware-desktop/cap/snapshot.rb
|
@@ -66,6 +124,8 @@ files:
|
|
66
124
|
- lib/vagrant-vmware-desktop/driver.rb
|
67
125
|
- lib/vagrant-vmware-desktop/driver/base.rb
|
68
126
|
- lib/vagrant-vmware-desktop/errors.rb
|
127
|
+
- lib/vagrant-vmware-desktop/guest_cap.rb
|
128
|
+
- lib/vagrant-vmware-desktop/guest_cap/linux.rb
|
69
129
|
- lib/vagrant-vmware-desktop/guest_cap/linux/mount_vmware_shared_folder.rb
|
70
130
|
- lib/vagrant-vmware-desktop/guest_cap/linux/verify_vmware_hgfs.rb
|
71
131
|
- lib/vagrant-vmware-desktop/helper/lock.rb
|
@@ -80,7 +140,19 @@ homepage: http://www.vagrantup.com
|
|
80
140
|
licenses:
|
81
141
|
- MPL-2.0
|
82
142
|
metadata: {}
|
83
|
-
post_install_message:
|
143
|
+
post_install_message: |
|
144
|
+
Thank you for installing the Vagrant VMware Desktop
|
145
|
+
plugin. This plugin requires the Vagrant VMware
|
146
|
+
Utility to be installed. To learn more about the
|
147
|
+
Vagrant VMware Utility, please visit:
|
148
|
+
|
149
|
+
https://www.vagrantup.com/docs/providers/vmware/vagrant-vmware-utility
|
150
|
+
|
151
|
+
To install the Vagrant VMware Utility, please
|
152
|
+
download the appropriate installer for your
|
153
|
+
system from:
|
154
|
+
|
155
|
+
https://www.vagrantup.com/downloads/vmware
|
84
156
|
rdoc_options: []
|
85
157
|
require_paths:
|
86
158
|
- lib
|
@@ -95,8 +167,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
95
167
|
- !ruby/object:Gem::Version
|
96
168
|
version: 1.3.6
|
97
169
|
requirements: []
|
98
|
-
|
99
|
-
rubygems_version: 2.7.6
|
170
|
+
rubygems_version: 3.5.11
|
100
171
|
signing_key:
|
101
172
|
specification_version: 4
|
102
173
|
summary: Enables Vagrant to power VMware Workstation/Fusion machines.
|