Skip to content

Commit

Permalink
Updating docs and adding comments re: multiple nics
Browse files Browse the repository at this point in the history
  • Loading branch information
PatrickLang committed Mar 16, 2017
1 parent 9d06127 commit d26e3fe
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
6 changes: 5 additions & 1 deletion plugins/providers/hyperv/action/import.rb
Expand Up @@ -86,13 +86,17 @@ def call(env)

switchToFind = opts[:bridge]

# TODO - consider moving this to config.validate()
if switchToFind
puts "Looking for switch with name: #{switchToFind}"
switch = switches.find { |s| s["Name"].downcase == switchToFind.downcase }["Name"]
puts "Found switch: #{switch}"
end

# TODO - multinic: build hash of network settings
end

# TODO - if :public_network, look for an external switch that's online. If there's only one, use it
if switch.nil?
if switches.length > 1
env[:ui].detail(I18n.t("vagrant_hyperv.choose_switch") + "\n ")
Expand Down Expand Up @@ -139,7 +143,7 @@ def call(env)
dest_path: dest_path,
data_path: env[:machine].data_dir.to_s.gsub("/", "\\")
}
options[:switchname] = switch if switch
options[:switchname] = switch if switch # TODO multinic: replace with hash of network settings
options[:memory] = memory if memory
options[:maxmemory] = maxmemory if maxmemory
options[:cpus] = cpus if cpus
Expand Down
2 changes: 2 additions & 0 deletions plugins/providers/hyperv/scripts/get_network_config.ps1
Expand Up @@ -7,6 +7,8 @@ Param(
$Dir = Split-Path $script:MyInvocation.MyCommand.Path
. ([System.IO.Path]::Combine($Dir, "utils\write_messages.ps1"))


# TODO - how to handle multiple NICs
$ip_address = ""
$vm = Get-VM -Id $VmId -ErrorAction "Stop"
$networks = Get-VMNetworkAdapter -VM $vm
Expand Down
11 changes: 10 additions & 1 deletion website/source/docs/hyperv/configuration.html.md
Expand Up @@ -31,4 +31,13 @@ you may set. A complete reference is shown below:
* `differencing_disk` (boolean) - Switch to use differencing disk intead of cloning whole VHD.
* `enable_virtualization_extensions` (boolean) - Enable virtualization extensions for the virtual CPUs.
This allows Hyper-V to be nested and run inside another Hyper-VM VM. It requires Windows 10 - 1511 (build 10586) or newer.
Default is not defined. This will be disabled if not set.
Default is not defined. This will be disabled if not set.


Most of the typical `network` configurations are not implemented. Here are the specific steps used instead:

* At least one network will always be configured.
* If `bridge` is given, it will be used for the VM switch name
* If `bridge` is not given, then the provider will prompt you to choose a VM Switch to use.
* `private_network`, `public_network`, `ip` and `gateway` are ignored
* Multiple networks in a `Vagrantfile` are ignored. However, if a box with a Hyper-V VMCX file has multiple NICs - they will still be imported.

0 comments on commit d26e3fe

Please sign in to comment.