vagrant-parallels 1.1.0 → 1.2.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (39) hide show
  1. checksums.yaml +4 -4
  2. data/CONTRIBUTING.md +61 -0
  3. data/README.md +2 -57
  4. data/lib/vagrant-parallels/action/clear_forwarded_ports.rb +25 -0
  5. data/lib/vagrant-parallels/action/customize.rb +2 -2
  6. data/lib/vagrant-parallels/action/export.rb +1 -1
  7. data/lib/vagrant-parallels/action/forward_ports.rb +78 -0
  8. data/lib/vagrant-parallels/action/handle_guest_tools.rb +1 -1
  9. data/lib/vagrant-parallels/action/import.rb +1 -1
  10. data/lib/vagrant-parallels/action/network.rb +47 -47
  11. data/lib/vagrant-parallels/action/prepare_forwarded_port_collision_params.rb +41 -0
  12. data/lib/vagrant-parallels/action/prepare_nfs_settings.rb +1 -1
  13. data/lib/vagrant-parallels/action/prepare_nfs_valid_ids.rb +1 -1
  14. data/lib/vagrant-parallels/action/sane_defaults.rb +55 -0
  15. data/lib/vagrant-parallels/action/set_name.rb +1 -1
  16. data/lib/vagrant-parallels/action/setup_package_files.rb +0 -1
  17. data/lib/vagrant-parallels/action.rb +16 -7
  18. data/lib/vagrant-parallels/cap/forwarded_ports.rb +22 -0
  19. data/lib/vagrant-parallels/driver/base.rb +8 -16
  20. data/lib/vagrant-parallels/driver/meta.rb +7 -7
  21. data/lib/vagrant-parallels/driver/pd_10.rb +279 -0
  22. data/lib/vagrant-parallels/driver/pd_8.rb +23 -15
  23. data/lib/vagrant-parallels/driver/pd_9.rb +1 -1
  24. data/lib/vagrant-parallels/guest_cap/linux/mount_parallels_shared_folder.rb +78 -22
  25. data/lib/vagrant-parallels/model/forwarded_port.rb +52 -0
  26. data/lib/vagrant-parallels/plugin.rb +14 -0
  27. data/lib/vagrant-parallels/provider.rb +12 -3
  28. data/lib/vagrant-parallels/synced_folder.rb +6 -1
  29. data/lib/vagrant-parallels/util/compile_forwarded_ports.rb +35 -0
  30. data/lib/vagrant-parallels/version.rb +1 -1
  31. data/locales/en.yml +3 -0
  32. data/test/unit/driver/pd_10_test.rb +228 -0
  33. data/test/unit/driver/pd_8_test.rb +27 -7
  34. data/test/unit/driver/pd_9_test.rb +28 -7
  35. data/test/unit/support/shared/parallels_context.rb +5 -4
  36. data/test/unit/support/shared/pd_driver_examples.rb +16 -37
  37. metadata +35 -27
  38. data/lib/vagrant-parallels/action/is_driver_version.rb +0 -28
  39. data/lib/vagrant-parallels/action/set_power_consumption.rb +0 -34
@@ -12,19 +12,20 @@ module VagrantPlugins
12
12
  def self.action_boot
13
13
  Vagrant::Action::Builder.new.tap do |b|
14
14
  b.use SetName
15
+ b.use ClearForwardedPorts
15
16
  b.use Provision
17
+ b.use EnvSet, port_collision_repair: true
18
+ b.use PrepareForwardedPortCollisionParams
19
+ b.use HandleForwardedPortCollisions
16
20
  b.use PrepareNFSValidIds
17
21
  b.use SyncedFolderCleanup
18
22
  b.use SyncedFolders
19
23
  b.use PrepareNFSSettings
20
24
  b.use Network
21
25
  b.use ClearNetworkInterfaces
26
+ b.use ForwardPorts
22
27
  b.use SetHostname
23
- b.use Call, IsDriverVersion, '>= 9' do |env1, b1|
24
- if env1[:result]
25
- b1.use SetPowerConsumption
26
- end
27
- end
28
+ b.use SaneDefaults
28
29
  b.use Customize, "pre-boot"
29
30
  b.use Boot
30
31
  b.use Customize, "post-boot"
@@ -85,6 +86,8 @@ module VagrantPlugins
85
86
  b2.use ForcedHalt
86
87
  end
87
88
  end
89
+
90
+ b1.use ClearForwardedPorts
88
91
  end
89
92
  end
90
93
  end
@@ -101,6 +104,7 @@ module VagrantPlugins
101
104
 
102
105
  b1.use SetupPackageFiles
103
106
  b1.use action_halt
107
+ b1.use ClearForwardedPorts
104
108
  b1.use PrepareNFSValidIds
105
109
  b1.use SyncedFolderCleanup
106
110
  b1.use Package
@@ -161,6 +165,9 @@ module VagrantPlugins
161
165
  next
162
166
  end
163
167
 
168
+ b1.use EnvSet, port_collision_repair: false
169
+ b1.use PrepareForwardedPortCollisionParams
170
+ b1.use HandleForwardedPortCollisions
164
171
  b1.use Resume
165
172
  b1.use WaitForCommunicator, [:resuming, :running]
166
173
  end
@@ -282,22 +289,24 @@ module VagrantPlugins
282
289
  autoload :Boot, File.expand_path("../action/boot", __FILE__)
283
290
  autoload :HandleGuestTools, File.expand_path("../action/handle_guest_tools", __FILE__)
284
291
  autoload :ClearNetworkInterfaces, File.expand_path("../action/clear_network_interfaces", __FILE__)
292
+ autoload :ClearForwardedPorts, File.expand_path("../action/clear_forwarded_ports", __FILE__)
285
293
  autoload :Customize, File.expand_path("../action/customize", __FILE__)
286
294
  autoload :Destroy, File.expand_path("../action/destroy", __FILE__)
287
295
  autoload :DestroyUnusedNetworkInterfaces, File.expand_path("../action/destroy_unused_network_interfaces", __FILE__)
288
296
  autoload :Export, File.expand_path("../action/export", __FILE__)
289
297
  autoload :ForcedHalt, File.expand_path("../action/forced_halt", __FILE__)
298
+ autoload :ForwardPorts, File.expand_path("../action/forward_ports", __FILE__)
290
299
  autoload :Import, File.expand_path("../action/import", __FILE__)
291
- autoload :IsDriverVersion, File.expand_path("../action/is_driver_version", __FILE__)
292
300
  autoload :Network, File.expand_path("../action/network", __FILE__)
293
301
  autoload :Package, File.expand_path("../action/package", __FILE__)
294
302
  autoload :PackageConfigFiles, File.expand_path("../action/package_config_files", __FILE__)
303
+ autoload :PrepareForwardedPortCollisionParams, File.expand_path("../action/prepare_forwarded_port_collision_params", __FILE__)
295
304
  autoload :PrepareNFSSettings, File.expand_path("../action/prepare_nfs_settings", __FILE__)
296
305
  autoload :PrepareNFSValidIds, File.expand_path("../action/prepare_nfs_valid_ids", __FILE__)
297
306
  autoload :Resume, File.expand_path("../action/resume", __FILE__)
307
+ autoload :SaneDefaults, File.expand_path("../action/sane_defaults",__FILE__)
298
308
  autoload :SetupPackageFiles, File.expand_path("../action/setup_package_files", __FILE__)
299
309
  autoload :SetName, File.expand_path("../action/set_name", __FILE__)
300
- autoload :SetPowerConsumption, File.expand_path("../action/set_power_consumption", __FILE__)
301
310
  autoload :Suspend, File.expand_path("../action/suspend", __FILE__)
302
311
  end
303
312
  end
@@ -0,0 +1,22 @@
1
+ module VagrantPlugins
2
+ module Parallels
3
+ module Cap
4
+ module ForwardedPorts
5
+ # Reads the forwarded ports that currently exist on the machine
6
+ # itself.
7
+ #
8
+ # This also may not match up with configured forwarded ports, because
9
+ # Vagrant auto port collision fixing may have taken place.
10
+ #
11
+ # @return [Hash<Integer, Integer>] Host => Guest port mappings.
12
+ def self.forwarded_ports(machine)
13
+ {}.tap do |result|
14
+ machine.provider.driver.read_forwarded_ports.each do |_, _, h, g|
15
+ result[h] = g
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
@@ -18,7 +18,7 @@ module VagrantPlugins
18
18
  include Vagrant::Util::NetworkIP
19
19
 
20
20
  def initialize
21
- @logger = Log4r::Logger.new("vagrant::provider::parallels::base")
21
+ @logger = Log4r::Logger.new('vagrant_parallels::driver::base')
22
22
 
23
23
  # This flag is used to keep track of interrupted state (SIGINT)
24
24
  @interrupted = false
@@ -58,6 +58,12 @@ module VagrantPlugins
58
58
  def delete_unused_host_only_networks
59
59
  end
60
60
 
61
+ # Disables requiring password on such operations as creating, adding,
62
+ # removing or cloning the virtual machine.
63
+ #
64
+ def disable_password_restrictions
65
+ end
66
+
61
67
  # Enables network adapters on the VM.
62
68
  #
63
69
  # The format of each adapter specification should be like so:
@@ -75,20 +81,6 @@ module VagrantPlugins
75
81
  def enable_adapters(adapters)
76
82
  end
77
83
 
78
- # Execute a raw command straight through to 'prlctl' utility
79
- #
80
- # Accepts a :prlsrvctl as a first element of command if the command
81
- # should be executed through to 'prlsrvctl' utility
82
- #
83
- # Accepts a :retryable => true option if the command should be retried
84
- # upon failure.
85
- #
86
- # Raises a prlctl error if it fails.
87
- #
88
- # @param [Array] command Command to execute.
89
- def execute_prlctl(command)
90
- end
91
-
92
84
  # Exports the virtual machine to the given path.
93
85
  #
94
86
  # @param [String] path Path to the OVF file.
@@ -296,7 +288,7 @@ module VagrantPlugins
296
288
  end
297
289
 
298
290
  # Append in the options for subprocess
299
- command << { :notify => [:stdout, :stderr] }
291
+ command << {notify: [:stdout, :stderr]}
300
292
 
301
293
  Vagrant::Util::Busy.busy(int_callback) do
302
294
  Vagrant::Util::Subprocess.execute(*command, &block)
@@ -25,7 +25,7 @@ module VagrantPlugins
25
25
  # Setup the base
26
26
  super()
27
27
 
28
- @logger = Log4r::Logger.new("vagrant::provider::parallels::meta")
28
+ @logger = Log4r::Logger.new('vagrant_parallels::driver::meta')
29
29
  @uuid = uuid
30
30
 
31
31
  # Read and assign the version of Parallels Desktop we know which
@@ -44,7 +44,7 @@ module VagrantPlugins
44
44
  driver_map = {
45
45
  "8" => PD_8,
46
46
  "9" => PD_9,
47
- "10" => PD_9
47
+ "10" => PD_10
48
48
  }
49
49
 
50
50
  driver_klass = nil
@@ -58,10 +58,6 @@ module VagrantPlugins
58
58
  if !driver_klass
59
59
  supported_versions = driver_map.keys.sort
60
60
 
61
- # TODO: Remove this after PD 10 release
62
- # Don't show unreleased version in the error message
63
- supported_versions.delete("10")
64
-
65
61
  raise VagrantPlugins::Parallels::Errors::ParallelsInvalidVersion,
66
62
  supported_versions: supported_versions.join(", ")
67
63
  end
@@ -77,21 +73,24 @@ module VagrantPlugins
77
73
  end
78
74
 
79
75
  def_delegators :@driver,
76
+ :clear_forwarded_ports,
80
77
  :clear_shared_folders,
81
78
  :compact,
82
79
  :create_host_only_network,
83
80
  :delete,
84
81
  :delete_disabled_adapters,
85
82
  :delete_unused_host_only_networks,
83
+ :disable_password_restrictions,
86
84
  :enable_adapters,
87
85
  :execute_prlctl,
88
86
  :export,
87
+ :forward_ports,
89
88
  :halt,
90
89
  :import,
91
90
  :read_bridged_interfaces,
91
+ :read_forwarded_ports,
92
92
  :read_guest_tools_state,
93
93
  :read_guest_tools_iso_path,
94
- :read_guest_ip,
95
94
  :read_host_only_interfaces,
96
95
  :read_mac_address,
97
96
  :read_mac_addresses,
@@ -112,6 +111,7 @@ module VagrantPlugins
112
111
  :set_mac_address,
113
112
  :set_name,
114
113
  :share_folders,
114
+ :ssh_ip,
115
115
  :ssh_port,
116
116
  :start,
117
117
  :suspend,
@@ -0,0 +1,279 @@
1
+ require 'log4r'
2
+
3
+ require 'vagrant/util/platform'
4
+
5
+ require File.expand_path('../pd_9', __FILE__)
6
+
7
+ module VagrantPlugins
8
+ module Parallels
9
+ module Driver
10
+ # Driver for Parallels Desktop 10.
11
+ class PD_10 < PD_9
12
+ def initialize(uuid)
13
+ super(uuid)
14
+
15
+ @logger = Log4r::Logger.new('vagrant_parallels::driver::pd_10')
16
+ end
17
+
18
+ def clear_forwarded_ports
19
+ args = []
20
+ read_forwarded_ports.each do |r|
21
+ args.concat(["--nat-#{r[:protocol]}-del", r[:rule_name]])
22
+ end
23
+
24
+ if !args.empty?
25
+ execute_prlsrvctl('net', 'set', read_shared_network_id, *args)
26
+ end
27
+ end
28
+
29
+ def create_host_only_network(options)
30
+ # Create the interface
31
+ execute_prlsrvctl('net', 'add', options[:network_id], '--type', 'host-only')
32
+
33
+ # Configure it
34
+ args = ["--ip", "#{options[:adapter_ip]}/#{options[:netmask]}"]
35
+ if options[:dhcp]
36
+ args.concat(["--dhcp-ip", options[:dhcp][:ip],
37
+ "--ip-scope-start", options[:dhcp][:lower],
38
+ "--ip-scope-end", options[:dhcp][:upper]])
39
+ end
40
+
41
+ execute_prlsrvctl('net', 'set', options[:network_id], *args)
42
+
43
+ # Return the details
44
+ {
45
+ name: options[:network_id],
46
+ ip: options[:adapter_ip],
47
+ netmask: options[:netmask],
48
+ dhcp: options[:dhcp]
49
+ }
50
+ end
51
+
52
+ def delete_unused_host_only_networks
53
+ networks = read_virtual_networks
54
+ # 'Shared'(vnic0) and 'Host-Only'(vnic1) are default in Parallels Desktop
55
+ # They should not be deleted anyway.
56
+ networks.keep_if do |net|
57
+ net['Type'] == "host-only" &&
58
+ net['Bound To'].match(/^(?>vnic|Parallels Host-Only #)(\d+)$/)[1].to_i >= 2
59
+ end
60
+
61
+ read_vms_info.each do |vm|
62
+ used_nets = vm.fetch('Hardware', {}).select { |name, _| name.start_with? 'net' }
63
+ used_nets.each_value do |net_params|
64
+ networks.delete_if { |net| net['Network ID'] == net_params.fetch('iface', nil) }
65
+ end
66
+ end
67
+
68
+ networks.each do |net|
69
+ # Delete the actual host only network interface.
70
+ execute_prlsrvctl('net', 'del', net['Network ID'])
71
+ end
72
+ end
73
+
74
+ def disable_password_restrictions
75
+ server_info = json { execute_prlsrvctl('info', '--json') }
76
+ server_info.fetch('Require password to',[]).each do |act|
77
+ execute_prlsrvctl('set', '--require-pwd', "#{act}:off")
78
+ end
79
+ end
80
+
81
+ def enable_adapters(adapters)
82
+ # Get adapters which have already configured for this VM
83
+ # Such adapters will be just overridden
84
+ existing_adapters = read_settings.fetch('Hardware', {}).keys.select do |name|
85
+ name.start_with? 'net'
86
+ end
87
+
88
+ # Disable all previously existing adapters (except shared 'vnet0')
89
+ existing_adapters.each do |adapter|
90
+ if adapter != 'vnet0'
91
+ execute_prlctl('set', @uuid, '--device-set', adapter, '--disable')
92
+ end
93
+ end
94
+
95
+ adapters.each do |adapter|
96
+ args = []
97
+ if existing_adapters.include? "net#{adapter[:adapter]}"
98
+ args.concat(["--device-set","net#{adapter[:adapter]}", "--enable"])
99
+ else
100
+ args.concat(["--device-add", "net"])
101
+ end
102
+
103
+ if adapter[:type] == :hostonly
104
+ args.concat(["--type", "host", "--iface", adapter[:hostonly]])
105
+ elsif adapter[:type] == :bridged
106
+ args.concat(["--type", "bridged", "--iface", adapter[:bridge]])
107
+ elsif adapter[:type] == :shared
108
+ args.concat(["--type", "shared"])
109
+ end
110
+
111
+ if adapter[:mac_address]
112
+ args.concat(["--mac", adapter[:mac_address]])
113
+ end
114
+
115
+ if adapter[:nic_type]
116
+ args.concat(["--adapter-type", adapter[:nic_type].to_s])
117
+ end
118
+
119
+ execute_prlctl("set", @uuid, *args)
120
+ end
121
+ end
122
+
123
+ def forward_ports(ports)
124
+ args = []
125
+ ports.each do |options|
126
+ protocol = options[:protocol] || 'tcp'
127
+ pf_builder = [
128
+ options[:name],
129
+ options[:hostport],
130
+ @uuid,
131
+ options[:guestport]
132
+ ]
133
+
134
+ args.concat(["--nat-#{protocol}-add", pf_builder.join(',')])
135
+ end
136
+
137
+ execute_prlsrvctl('net', 'set', read_shared_network_id, *args)
138
+ end
139
+
140
+ def read_forwarded_ports(global=false)
141
+ all_rules = read_shared_interface[:nat]
142
+
143
+ if global
144
+ all_rules
145
+ else
146
+ all_rules.select { |r| r[:guest].include?(@uuid) }
147
+ end
148
+ end
149
+
150
+ def read_host_only_interfaces
151
+ net_list = read_virtual_networks
152
+ net_list.keep_if { |net| net['Type'] == "host-only" }
153
+
154
+ hostonly_ifaces = []
155
+ net_list.each do |iface|
156
+ info = {}
157
+ net_info = json { execute_prlsrvctl('net', 'info', iface['Network ID'], '--json') }
158
+ # Really we need to work with bounded virtual interface
159
+ info[:name] = net_info['Network ID']
160
+ info[:ip] = net_info['Parallels adapter']['IP address']
161
+ info[:netmask] = net_info['Parallels adapter']['Subnet mask']
162
+ # Such interfaces are always in 'Up'
163
+ info[:status] = "Up"
164
+
165
+ # There may be a fake DHCPv4 parameters
166
+ # We can trust them only if adapter IP and DHCP IP are in the same subnet
167
+ dhcp_ip = net_info['DHCPv4 server']['Server address']
168
+ if network_address(info[:ip], info[:netmask]) ==
169
+ network_address(dhcp_ip, info[:netmask])
170
+ info[:dhcp] = {
171
+ ip: dhcp_ip,
172
+ lower: net_info['DHCPv4 server']['IP scope start address'],
173
+ upper: net_info['DHCPv4 server']['IP scope end address']
174
+ }
175
+ end
176
+ hostonly_ifaces << info
177
+ end
178
+ hostonly_ifaces
179
+ end
180
+
181
+ def read_network_interfaces
182
+ nics = {}
183
+
184
+ # Get enabled VM's network interfaces
185
+ ifaces = read_settings.fetch('Hardware', {}).keep_if do |dev, params|
186
+ dev.start_with?('net') and params.fetch("enabled", true)
187
+ end
188
+ ifaces.each do |name, params|
189
+ adapter = name.match(/^net(\d+)$/)[1].to_i
190
+ nics[adapter] ||= {}
191
+
192
+ if params['type'] == "shared"
193
+ nics[adapter][:type] = :shared
194
+ elsif params['type'] == "host"
195
+ nics[adapter][:type] = :hostonly
196
+ nics[adapter][:hostonly] = params.fetch('iface','')
197
+ elsif params['type'] == "bridged"
198
+ nics[adapter][:type] = :bridged
199
+ nics[adapter][:bridge] = params.fetch('iface','')
200
+ end
201
+ end
202
+ nics
203
+ end
204
+
205
+ def read_shared_interface
206
+ net_info = json do
207
+ execute_prlsrvctl('net', 'info', read_shared_network_id, '--json')
208
+ end
209
+ info = {
210
+ name: net_info['Bound To'],
211
+ ip: net_info['Parallels adapter']['IP address'],
212
+ netmask: net_info['Parallels adapter']['Subnet mask'],
213
+ status: 'Up',
214
+ nat: []
215
+ }
216
+
217
+ if net_info.key?('DHCPv4 server')
218
+ info[:dhcp] = {
219
+ ip: net_info['DHCPv4 server']['Server address'],
220
+ lower: net_info['DHCPv4 server']['IP scope start address'],
221
+ upper: net_info['DHCPv4 server']['IP scope end address']
222
+ }
223
+ end
224
+
225
+ net_info['NAT server'].each do |group, rules|
226
+ rules.each do |name, params|
227
+ info[:nat] << {
228
+ rule_name: name,
229
+ protocol: group == 'TCP rules' ? 'tcp' : 'udp',
230
+ guest: params['destination IP/VM id'],
231
+ hostport: params['source port'],
232
+ guestport: params['destination port']
233
+ }
234
+ end
235
+ end
236
+
237
+ info
238
+ end
239
+
240
+ # Parse the JSON from *all* VMs and templates.
241
+ # Then return an array of objects (without duplicates)
242
+ def read_vms_info
243
+ vms_arr = json([]) do
244
+ execute_prlctl('list', '--all','--info', '--json')
245
+ end
246
+ templates_arr = json([]) do
247
+ execute_prlctl('list', '--all','--info', '--json', '--template')
248
+ end
249
+ vms_arr | templates_arr
250
+ end
251
+
252
+ def read_used_ports
253
+ # Ignore our own used ports
254
+ read_forwarded_ports(true).reject { |r| r[:guest].include?(@uuid) }
255
+ end
256
+
257
+ def set_power_consumption_mode(optimized)
258
+ state = optimized ? 'on' : 'off'
259
+ execute_prlctl('set', @uuid, '--longer-battery-life', state)
260
+ end
261
+
262
+ def ssh_ip
263
+ '127.0.0.1'
264
+ end
265
+
266
+ def ssh_port(expected_port)
267
+ @logger.debug("Searching for SSH port: #{expected_port.inspect}")
268
+
269
+ # Look for the forwarded port only by comparing the guest port
270
+ read_forwarded_ports.each do |r|
271
+ return r[:hostport] if r[:guestport] == expected_port
272
+ end
273
+
274
+ nil
275
+ end
276
+ end
277
+ end
278
+ end
279
+ end
@@ -12,7 +12,7 @@ module VagrantPlugins
12
12
  def initialize(uuid)
13
13
  super()
14
14
 
15
- @logger = Log4r::Logger.new("vagrant::provider::parallels::pd_8")
15
+ @logger = Log4r::Logger.new('vagrant_parallels::driver::pd_8')
16
16
  @uuid = uuid
17
17
  end
18
18
 
@@ -60,10 +60,10 @@ module VagrantPlugins
60
60
 
61
61
  # Return the details
62
62
  return {
63
- :name => iface_name,
64
- :ip => options[:adapter_ip],
65
- :netmask => options[:netmask],
66
- :dhcp => options[:dhcp]
63
+ name: iface_name,
64
+ ip: options[:adapter_ip],
65
+ netmask: options[:netmask],
66
+ dhcp: options[:dhcp]
67
67
  }
68
68
  end
69
69
 
@@ -240,9 +240,9 @@ module VagrantPlugins
240
240
  def read_guest_tools_iso_path(guest_os)
241
241
  guest_os = guest_os.to_sym
242
242
  iso_name ={
243
- :linux => "prl-tools-lin.iso",
244
- :darwin => "prl-tools-mac.iso",
245
- :windows => "prl-tools-win.iso"
243
+ linux: "prl-tools-lin.iso",
244
+ darwin: "prl-tools-mac.iso",
245
+ windows: "prl-tools-win.iso"
246
246
  }
247
247
  return nil if !iso_name[guest_os]
248
248
 
@@ -289,9 +289,9 @@ module VagrantPlugins
289
289
  if network_address(info[:ip], info[:netmask]) ==
290
290
  network_address(dhcp_ip, info[:netmask])
291
291
  info[:dhcp] = {
292
- :ip => dhcp_ip,
293
- :lower => net_info['DHCPv4 server']['IP scope start address'],
294
- :upper => net_info['DHCPv4 server']['IP scope end address']
292
+ ip: dhcp_ip,
293
+ lower: net_info['DHCPv4 server']['IP scope start address'],
294
+ upper: net_info['DHCPv4 server']['IP scope end address']
295
295
  }
296
296
  end
297
297
  hostonly_ifaces << info
@@ -349,13 +349,17 @@ module VagrantPlugins
349
349
  vm.last
350
350
  end
351
351
 
352
- def read_shared_interface
352
+ def read_shared_network_id
353
353
  # There should be only one Shared interface
354
- shared_net = read_virtual_networks.detect { |net| net['Type'] == 'shared' }
355
- return nil if !shared_net
354
+ shared_net = read_virtual_networks.detect do |net|
355
+ net['Type'] == 'shared'
356
+ end
357
+ shared_net.fetch('Network ID')
358
+ end
356
359
 
360
+ def read_shared_interface
357
361
  net_info = json do
358
- execute_prlsrvctl('net', 'info', shared_net['Network ID'], '--json')
362
+ execute_prlsrvctl('net', 'info', read_shared_network_id, '--json')
359
363
  end
360
364
  info = {
361
365
  name: net_info['Bound To'],
@@ -468,6 +472,10 @@ module VagrantPlugins
468
472
  end
469
473
  end
470
474
 
475
+ def ssh_ip
476
+ read_guest_ip
477
+ end
478
+
471
479
  def ssh_port(expected_port)
472
480
  expected_port
473
481
  end
@@ -12,7 +12,7 @@ module VagrantPlugins
12
12
  def initialize(uuid)
13
13
  super(uuid)
14
14
 
15
- @logger = Log4r::Logger.new("vagrant::provider::parallels::pd_9")
15
+ @logger = Log4r::Logger.new('vagrant_parallels::driver::pd_9')
16
16
  end
17
17
 
18
18
  def read_settings