Class: VagrantPlugins::Parallels::Driver::PD_12
- Defined in:
- lib/vagrant-parallels/driver/pd_12.rb
Overview
Driver for Parallels Desktop 12 and later.
Instance Method Summary collapse
- #create_host_only_network(options) ⇒ Object
-
#initialize(uuid) ⇒ PD_12
constructor
A new instance of PD_12.
Methods inherited from PD_11
Methods inherited from Base
#clear_forwarded_ports, #clear_shared_folders, #clone_vm, #compact_hdd, #connect_network_interface, #create_snapshot, #delete, #delete_disabled_adapters, #delete_snapshot, #delete_unused_host_only_networks, #disable_password_restrictions, #enable_adapters, #execute_prlctl, #forward_ports, #halt, #list_snapshots, #read_bridged_interfaces, #read_forwarded_ports, #read_guest_ip_dhcp, #read_guest_ip_prlctl, #read_guest_tools_iso_path, #read_guest_tools_state, #read_host_info, #read_host_only_interfaces, #read_mac_address, #read_mac_addresses, #read_network_interfaces, #read_settings, #read_shared_folders, #read_shared_interface, #read_shared_network_id, #read_state, #read_used_ports, #read_virtual_networks, #read_vm_option, #read_vms, #read_vms_info, #register, #restore_snapshot, #resume, #set_name, #set_power_consumption_mode, #share_folders, #ssh_ip, #ssh_port, #start, #suspend, #unregister, #unshare_folders, #vm_exists?
Constructor Details
#initialize(uuid) ⇒ PD_12
Returns a new instance of PD_12.
12 13 14 15 16 |
# File 'lib/vagrant-parallels/driver/pd_12.rb', line 12 def initialize(uuid) super(uuid) @logger = Log4r::Logger.new('vagrant_parallels::driver::pd_12') end |
Instance Method Details
#create_host_only_network(options) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/vagrant-parallels/driver/pd_12.rb', line 18 def create_host_only_network() # Create the interface execute_prlsrvctl('net', 'add', [:network_id], '--type', 'host-only') # Get the IP so we can determine v4 vs v6 ip = IPAddr.new([:adapter_ip]) if ip.ipv4? args = ['--ip', "#{[:adapter_ip]}/#{[:netmask]}"] if [:dhcp] args.concat(['--dhcp-ip', [:dhcp][:ip], '--ip-scope-start', [:dhcp][:lower], '--ip-scope-end', [:dhcp][:upper]]) end elsif ip.ipv6? # Convert prefix length to netmask ("32" -> "ffff:ffff::") [:netmask] = IPAddr.new(IPAddr::IN6MASK, Socket::AF_INET6) .mask([:netmask]).to_s args = ['--host-assign-ip6', 'on', '--ip6', "#{[:adapter_ip]}/#{[:netmask]}"] # DHCPv6 setting is not supported by Vagrant yet. else raise IPAddr::AddressFamilyError, 'BUG: unknown address family' end execute_prlsrvctl('net', 'set', [:network_id], *args) # Return the details { name: [:network_id], ip: [:adapter_ip], netmask: [:netmask], dhcp: [:dhcp] } end |