vagrant-vmware-desktop 3.0.2 → 3.0.4
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.rb +2 -4
- data/lib/vagrant-vmware-desktop/cap/disk.rb +13 -4
- data/lib/vagrant-vmware-desktop/driver/base.rb +119 -42
- data/lib/vagrant-vmware-desktop/errors.rb +4 -0
- data/lib/vagrant-vmware-desktop/guest_cap/linux/mount_vmware_shared_folder.rb +1 -1
- data/lib/vagrant-vmware-desktop/plugin.rb +18 -20
- data/locales/en.yml +12 -0
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: faa4d46aabdc2dfaf78c6c69cf57c3fd2b447192b78495333a1f73e1190d3ddc
|
4
|
+
data.tar.gz: 9113eb7729d89bfaf3bb288f6fed490297d117ab20e196f0ea55b86c36f84211
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 061b173c5a4d767ec3e8c27144487e85f79b538fa6828443c3068564c1886d2ec750a5cfad57e8e397c41c08cc86a894092462f0e6b0443ff8d3dd5ec5d00b4b
|
7
|
+
data.tar.gz: 6e749f952549f49419af194a2e889d2c22861d254ea9cdefb0544c5450bb57f111e6f447a54427802815420875d923a4c5bebf6eb0c331dc42002eec8bac9f91
|
@@ -361,10 +361,8 @@ module HashiCorp
|
|
361
361
|
b3.use SetHostname
|
362
362
|
end
|
363
363
|
|
364
|
-
|
365
|
-
|
366
|
-
b3.use Disk
|
367
|
-
end
|
364
|
+
b3.use CleanupDisks
|
365
|
+
b3.use Disk
|
368
366
|
b3.use VMXModify
|
369
367
|
b3.use PrepareForwardedPortCollisionParams
|
370
368
|
b3.use HandleForwardedPortCollisions
|
@@ -12,7 +12,7 @@ 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"
|
@@ -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 = ["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,11 @@ 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
|
+
@@logger.debug("disk info for primary slot #{primary_slot} - #{disk_info}")
|
118
|
+
return disk_info if disk_info["present"].to_s.upcase == "TRUE"
|
119
|
+
end
|
116
120
|
else
|
117
121
|
if disk.type == :dvd
|
118
122
|
all_disks.values.detect { |v| v["filename"] == disk.file }
|
@@ -153,7 +157,12 @@ module HashiCorp
|
|
153
157
|
|
154
158
|
# disk.size is in bytes
|
155
159
|
if disk.size > machine.provider.driver.get_disk_size(disk_path)
|
156
|
-
|
160
|
+
if disk.primary && machine.provider.driver.is_linked_clone?
|
161
|
+
machine.env.ui.warn(I18n.t("hashicorp.vagrant_vmware_desktop.disk_not_growing_linked_primary"))
|
162
|
+
@@logger.warn("Not growing primary disk - guest is linked clone")
|
163
|
+
else
|
164
|
+
grow_disk(machine, disk_path, disk)
|
165
|
+
end
|
157
166
|
elsif disk.size < machine.provider.driver.get_disk_size(disk_path)
|
158
167
|
machine.env.ui.warn(I18n.t("hashicorp.vagrant_vmware_desktop.disk_not_shrinking", path: disk.name))
|
159
168
|
@@logger.warn("Not shrinking disk #{disk.name}")
|
@@ -186,17 +186,22 @@ module HashiCorp
|
|
186
186
|
def product_type
|
187
187
|
return @product_type if @product_type
|
188
188
|
|
189
|
-
|
190
|
-
if standard?
|
191
|
-
return @product_type = "player"
|
192
|
-
end
|
193
|
-
|
189
|
+
@logger.debug("determining product type")
|
194
190
|
case @product_name.downcase
|
195
191
|
when "workstation"
|
196
|
-
|
192
|
+
# If the license is standard, the type is player
|
193
|
+
if standard?
|
194
|
+
@logger.debug("workstation product with standard license: player")
|
195
|
+
@product_type = "player"
|
196
|
+
else
|
197
|
+
@logger.debug("workstation product with professional license: ws")
|
198
|
+
@product_type = "ws"
|
199
|
+
end
|
197
200
|
when "fusion"
|
201
|
+
@logger.debug("fusion product: fusion")
|
198
202
|
@product_type = "fusion"
|
199
203
|
else
|
204
|
+
@logger.debug("unknown product (#{@product_name}), defaulting: player")
|
200
205
|
@product_type = "player"
|
201
206
|
end
|
202
207
|
|
@@ -581,6 +586,43 @@ module HashiCorp
|
|
581
586
|
def read_ip(enable_vmrun_ip_lookup=true)
|
582
587
|
@logger.info("Reading an accessible IP for machine...")
|
583
588
|
|
589
|
+
if enable_vmrun_ip_lookup
|
590
|
+
# Try to read the IP using vmrun getGuestIPAddress. This
|
591
|
+
# won't work if the guest doesn't have guest tools installed or
|
592
|
+
# is using an old version of VMware.
|
593
|
+
begin
|
594
|
+
@logger.info("Trying vmrun getGuestIPAddress...")
|
595
|
+
result = vmrun("getGuestIPAddress", host_vmx_path, "-wait", {timeout: 10, retryable: true})
|
596
|
+
result = result.stdout.chomp
|
597
|
+
|
598
|
+
# If returned address ends with a ".1" do not accept address
|
599
|
+
# and allow lookup via VMX.
|
600
|
+
# see: https://github.com/vmware/open-vm-tools/issues/93
|
601
|
+
if result.end_with?(".1")
|
602
|
+
@logger.warn("vmrun getGuestIPAddress returned: #{result}. Result resembles address retrieval from wrong " \
|
603
|
+
"interface. Discarding value and proceeding with VMX based lookup.")
|
604
|
+
result = nil
|
605
|
+
else
|
606
|
+
# Try to parse the IP Address. This will raise an exception
|
607
|
+
# if it fails, which will halt our attempt to use it.
|
608
|
+
IPAddr.new(result)
|
609
|
+
@logger.info("vmrun getGuestIPAddress success: #{result}")
|
610
|
+
return result
|
611
|
+
end
|
612
|
+
rescue Errors::VMRunError
|
613
|
+
@logger.info("vmrun getGuestIPAddress failed: VMRunError")
|
614
|
+
# Ignore, try the MAC address way.
|
615
|
+
rescue Vagrant::Util::Subprocess::TimeoutExceeded
|
616
|
+
@logger.info("vmrun getGuestIPAddress failed: TimeoutExceeded")
|
617
|
+
# Ignore, try the MAC address way.
|
618
|
+
rescue IPAddr::InvalidAddressError
|
619
|
+
@logger.info("vmrun getGuestIPAddress failed: InvalidAddressError for #{result.inspect}")
|
620
|
+
# Ignore, try the MAC address way.
|
621
|
+
end
|
622
|
+
else
|
623
|
+
@logger.info("Skipping vmrun getGuestIPAddress as requested by config.")
|
624
|
+
end
|
625
|
+
|
584
626
|
# NOTE: Read from DHCP leases first so we can attempt to fetch the address
|
585
627
|
# for the vmnet8 device first. If multiple networks are defined on the guest
|
586
628
|
# it will return the address of the last device, which will fail when doing
|
@@ -623,39 +665,6 @@ module HashiCorp
|
|
623
665
|
return dhcp_ip if dhcp_ip
|
624
666
|
end
|
625
667
|
|
626
|
-
if enable_vmrun_ip_lookup
|
627
|
-
# Try to read the IP using vmrun getGuestIPAddress. This
|
628
|
-
# won't work if the guest doesn't have guest tools installed or
|
629
|
-
# is using an old version of VMware.
|
630
|
-
begin
|
631
|
-
@logger.info("Trying vmrun getGuestIPAddress...")
|
632
|
-
result = vmrun("getGuestIPAddress", host_vmx_path)
|
633
|
-
result = result.stdout.chomp
|
634
|
-
|
635
|
-
# If returned address ends with a ".1" do not accept address
|
636
|
-
# and allow lookup via VMX.
|
637
|
-
# see: https://github.com/vmware/open-vm-tools/issues/93
|
638
|
-
if result.end_with?(".1")
|
639
|
-
@logger.warn("vmrun getGuestIPAddress returned: #{result}. Result resembles address retrieval from wrong " \
|
640
|
-
"interface. Discarding value and proceeding with VMX based lookup.")
|
641
|
-
result = nil
|
642
|
-
else
|
643
|
-
# Try to parse the IP Address. This will raise an exception
|
644
|
-
# if it fails, which will halt our attempt to use it.
|
645
|
-
IPAddr.new(result)
|
646
|
-
@logger.info("vmrun getGuestIPAddress success: #{result}")
|
647
|
-
return result
|
648
|
-
end
|
649
|
-
rescue Errors::VMRunError
|
650
|
-
@logger.info("vmrun getGuestIPAddress failed: VMRunError")
|
651
|
-
# Ignore, try the MAC address way.
|
652
|
-
rescue IPAddr::InvalidAddressError
|
653
|
-
@logger.info("vmrun getGuestIPAddress failed: InvalidAddressError for #{result.inspect}")
|
654
|
-
# Ignore, try the MAC address way.
|
655
|
-
end
|
656
|
-
else
|
657
|
-
@logger.info("Skipping vmrun getGuestIPAddress as requested by config.")
|
658
|
-
end
|
659
668
|
nil
|
660
669
|
end
|
661
670
|
|
@@ -1184,6 +1193,32 @@ module HashiCorp
|
|
1184
1193
|
disk_size
|
1185
1194
|
end
|
1186
1195
|
|
1196
|
+
# @return [Boolean] Instance is a linked clone
|
1197
|
+
def is_linked_clone?
|
1198
|
+
if @vmsd_path.nil?
|
1199
|
+
@vm_dir.children(true).each do |child|
|
1200
|
+
if child.basename.to_s.match(/\.vmsd$/)
|
1201
|
+
@vmsd_path = child
|
1202
|
+
end
|
1203
|
+
end
|
1204
|
+
end
|
1205
|
+
|
1206
|
+
return false if @vmsd_path.nil?
|
1207
|
+
|
1208
|
+
if @is_clone.nil?
|
1209
|
+
@is_clone = false
|
1210
|
+
|
1211
|
+
File.readlines(@vmsd_path).each do |line|
|
1212
|
+
if line.start_with?("cloneOf")
|
1213
|
+
@is_clone = true
|
1214
|
+
break
|
1215
|
+
end
|
1216
|
+
end
|
1217
|
+
end
|
1218
|
+
|
1219
|
+
@is_clone
|
1220
|
+
end
|
1221
|
+
|
1187
1222
|
protected
|
1188
1223
|
|
1189
1224
|
# This reads the latest DHCP lease for a MAC address on the
|
@@ -1254,7 +1289,7 @@ module HashiCorp
|
|
1254
1289
|
command_opts = { :notify => [:stdout, :stderr] }
|
1255
1290
|
command_opts[:timeout] = opts[:timeout] if opts[:timeout]
|
1256
1291
|
|
1257
|
-
command = command.dup
|
1292
|
+
command = command.dup.map(&:to_s)
|
1258
1293
|
command << command_opts
|
1259
1294
|
|
1260
1295
|
|
@@ -1264,8 +1299,12 @@ module HashiCorp
|
|
1264
1299
|
if VagrantVMwareDesktop.wsl?
|
1265
1300
|
r_path = VagrantVMwareDesktop.windows_to_wsl_path(r_path)
|
1266
1301
|
end
|
1267
|
-
result = Vagrant::Util::Subprocess.execute(r_path, *command
|
1302
|
+
result = Vagrant::Util::Subprocess.execute(r_path, *command)
|
1268
1303
|
if result.exit_code != 0
|
1304
|
+
if result.stdout.include?("operation was canceled") || result.stderr.include?("operation was canceled")
|
1305
|
+
raise_canceled_error!
|
1306
|
+
end
|
1307
|
+
|
1269
1308
|
raise Errors::VMExecError,
|
1270
1309
|
:executable => executable.to_s,
|
1271
1310
|
:command => command.inspect,
|
@@ -1347,7 +1386,6 @@ module HashiCorp
|
|
1347
1386
|
end
|
1348
1387
|
end
|
1349
1388
|
|
1350
|
-
|
1351
1389
|
# This performs common cleanup tasks on a cloned machine.
|
1352
1390
|
def clone_cleanup(destination_vmx)
|
1353
1391
|
destination = destination_vmx.parent
|
@@ -1375,6 +1413,45 @@ module HashiCorp
|
|
1375
1413
|
destination_vmx
|
1376
1414
|
end
|
1377
1415
|
|
1416
|
+
# Attempts to extract cause of a vmware canceled operation
|
1417
|
+
# by inspecting the vmware.log file for failure information.
|
1418
|
+
# If found, an exception will be raised. Otherwise, nothing
|
1419
|
+
# will be raised.
|
1420
|
+
def raise_canceled_error!
|
1421
|
+
vmware_log = @vm_dir.join("vmware.log")
|
1422
|
+
return if !vmware_log.exist?
|
1423
|
+
error_lines = []
|
1424
|
+
found = false
|
1425
|
+
File.open(vmware_log.to_s) do |file|
|
1426
|
+
until file.eof?
|
1427
|
+
line = file.readline.chomp
|
1428
|
+
if found
|
1429
|
+
break if line.include?("-----------------")
|
1430
|
+
error_lines << line
|
1431
|
+
next
|
1432
|
+
end
|
1433
|
+
|
1434
|
+
if line.include?("Msg_Post: Error")
|
1435
|
+
found = true
|
1436
|
+
end
|
1437
|
+
end
|
1438
|
+
end
|
1439
|
+
|
1440
|
+
# If error content wasn't found, just return
|
1441
|
+
return if !found
|
1442
|
+
|
1443
|
+
# If the size of the content is unreasonably large, just return
|
1444
|
+
return if error_lines.size > 10
|
1445
|
+
|
1446
|
+
error_lines.map! do |line|
|
1447
|
+
line.sub(/^.*? vmx \[.*?\] /, "")
|
1448
|
+
end
|
1449
|
+
|
1450
|
+
raise Errors::VMCancelError,
|
1451
|
+
error: error_lines.join("\n"),
|
1452
|
+
vmware_log_path: vmware_log.to_s
|
1453
|
+
end
|
1454
|
+
|
1378
1455
|
# Display warning message about allowlisted VMX ethernet settings
|
1379
1456
|
def display_ethernet_allowlist_warning(vmx_key, vmx_val)
|
1380
1457
|
if VMX_ETHERNET_ALLOWLIST_ENFORCE != :quiet
|
@@ -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
|
@@ -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
|
|
data/locales/en.yml
CHANGED
@@ -16,6 +16,9 @@ en:
|
|
16
16
|
Configuring network adapters within the VM...
|
17
17
|
destroying: |-
|
18
18
|
Deleting the VM...
|
19
|
+
disk_not_growing_linked_primary: |-
|
20
|
+
Increasing the size of the primary disk is not allowed for linked
|
21
|
+
clones. Primary disk of the guest remains unchanged.
|
19
22
|
disk_not_shrinking: |-
|
20
23
|
Shrinking disks is not supported. Not shrinking disk %{path}
|
21
24
|
discarding_suspended_state: |-
|
@@ -485,6 +488,15 @@ en:
|
|
485
488
|
The VMware product does not support IPv6 in a robust way like other
|
486
489
|
Vagrant providers. This is not a bug in Vagrant - the upstream
|
487
490
|
provider does not provide robust support for IPv6.
|
491
|
+
vmcancel_error: |-
|
492
|
+
An error occurred causing VMware to cancel the current operation. Details
|
493
|
+
of the error causing the cancelation:
|
494
|
+
|
495
|
+
%{error}
|
496
|
+
|
497
|
+
The full log can be located at:
|
498
|
+
|
499
|
+
%{vmware_log_path}
|
488
500
|
vmexec_error: |-
|
489
501
|
An error occurred while executing `%{executable}`, a utility for controlling
|
490
502
|
VMware machines. The command and output are below:
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
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.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vagrant Team
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-08-13 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Enables Vagrant to power VMware Workstation/Fusion machines.
|
14
14
|
email: vagrant@hashicorp.com
|
@@ -95,8 +95,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: 1.3.6
|
97
97
|
requirements: []
|
98
|
-
|
99
|
-
rubygems_version: 2.7.6
|
98
|
+
rubygems_version: 3.5.11
|
100
99
|
signing_key:
|
101
100
|
specification_version: 4
|
102
101
|
summary: Enables Vagrant to power VMware Workstation/Fusion machines.
|