Commit Graph

77 Commits

Author SHA1 Message Date
Chris Roberts 101fc447ec Add Hyper-V access check on data directory 2018-06-18 15:36:45 -07:00
Chris Roberts a8abb6898c Fix PowerShell cmdlet name for clones 2018-06-18 09:09:01 -07:00
Chris Roberts 8fbf27772a Always ensure full path to configuration file on import 2018-06-15 07:48:14 -07:00
Chris Roberts 694104b005 Attempt to provide helper error message on failed VM import
When importing a Hyper-V VM fails, attempt to manually build
a system definition and inspect the result to determine cause
of the failure.
2018-06-14 16:40:37 -07:00
Chris Roberts 3919455f08
Merge pull request #9932 from chrisroberts/e-hyperv-maxmem-chk
Validate maxmemory setting within Hyper-V provider
2018-06-13 14:52:09 -07:00
Chris Roberts 4d3f5d33c6
Merge pull request #9925 from chrisroberts/u-powershelling
Misc. PowerShell cleanup
2018-06-13 14:51:43 -07:00
Chris Roberts 9482f351fc Validate maxmemory setting within Hyper-V provider
Forces an error if maxmemory value is less than the configured
minimum or startup memory.

Fixes #9477
2018-06-13 13:27:11 -07:00
Chris Roberts 1554f447f2 Disconnect all configured network adapters
When importing a Hyper-V VM ensure all adapters are disconnected from
switches that were used when the box was built.
2018-06-13 07:59:56 -07:00
Chris Roberts 57842d7269 Update powershell messaging functions to not include second `-` character. 2018-06-12 16:47:47 -07:00
Tony Apuzzo 5ac8bb8620 Correct typo, $Enable instead of $enabled. 2018-06-07 15:00:09 -06:00
Chris Roberts 52bae21933 Remove unused PowerShell scripts 2018-05-24 15:33:36 -07:00
Chris Roberts e6457d5061 Overhaul the Hyper-V provider 2018-05-24 14:43:44 -07:00
Chris Roberts fbcd86993b
Merge pull request #9737 from chrisroberts/e-hyper-v-addr
Check neighbors for valid guest address when default lookup fails
2018-05-02 08:54:57 -07:00
Chris Roberts 9f08337ce1 Ignore errors on neighbor lookup and validate result 2018-04-30 17:39:27 -07:00
Chris Roberts e47e1df228 Reference Hyper-V switch by ID instead of name
Keep track of selected Hyper-V switch using the ID instead of name
to prevent any encoding issues that may occur switching between
PowerShell and Ruby. With the IDs staying consistent, the switch
name can be fetched from the provided ID.

Fixes #9679 #8794 #9451
2018-04-27 16:52:16 -07:00
Chris Roberts d15ff38d5c Check neighbors for valid guest address when default lookup fails
If the guest address is unavailable via Hyper-V inspection, extract
MAC address of network adapters and check neighbor information for
any currently matching known address.
2018-04-26 12:53:52 -07:00
Michael T Lombardi 9e1d05641f Ensure Hyper-V cmdlets are fully qualified
+ This disambuguates calls to the Hyper-V functions for the Hyper-V provider.
The ambiguity of some commands - such as `Get-VM` - causes the Hyper-V provider
to fail on systems where VMware PowerCLI is installed. This change ensures that
all calls to Hyper-V specific cmdlets or functions are prepended by `Hyper-V\`.
This ensures the correct cmdlet calls are being made.
+ Resolves  #8862.
2017-12-15 08:30:38 -06:00
Björn Brala 0f743d0731 Auto stop action is configured through auto start action. 2017-09-26 16:03:35 +02:00
Chris Roberts 38fed54697 Update guest IP address discovery for hyper-v guests.
Powershell helper script now returns error when guest IP address
cannot be discovered. When reading addresses from a network
device both IPv4 and IPv6 are stored and the IPv4 address has
precedence on returned address.
2017-07-28 10:18:26 -07:00
Chris Roberts 9452e7cc38 Update conditional check to use equality check
Fixes #8444
2017-05-05 14:07:52 -07:00
Arjan Weurding 399789467a Fix crash when using HyperV
Fix the error 
```homestead-7: Creating and registering the VM...
An error occurred while executing a PowerShell script. This error
is shown below. Please read the error message and see if this is
a configuration error with your system. If it is not, then please
report a bug.

Script: import_vm_vmcx.ps1
Error:

At C:\Program Files
(x86)\HashiCorp\Vagrant\embedded\gems\gems\vagrant-1.9.4\plugins\providers\hyper                    v\scripts\import_vm_vmcx.ps1:18 char:37
+     [string]$differencing_disk=$null
+                                     ~
Missing ')' in function parameter list.
At C:\Program Files
(x86)\HashiCorp\Vagrant\embedded\gems\gems\vagrant-1.9.4\plugins\providers\hyper                    v\scripts\import_vm_vmcx.ps1:20 char:1
+ )
+ ~
Unexpected token ')' in expression or statement.
    + CategoryInfo          : ParserError: (:) [], ParseException
    + FullyQualifiedErrorId : MissingEndParenthesisInFunctionParameterList
```
2017-04-26 08:15:06 -07:00
Bjorn Brala 2f7e0d3a1f Virtualization extensions wern't enabled for vmcx file format, so it didn't work for Windows 10 and up. Fixes #8402 2017-03-23 07:54:41 +01:00
Bjorn Brala 0534ebf895 Merge remote-tracking branch 'mitchellh/master' into feature-hyperv-integration-services-fresh
# Conflicts:
#	plugins/providers/hyperv/action/import.rb
#	plugins/providers/hyperv/config.rb
#	website/source/docs/hyperv/configuration.html.md
2017-03-23 07:49:57 +01:00
Bjorn Brala e2dd23b06c First implementation for Integration services for Hyper-V as discussed in https://github.com/mitchellh/vagrant/pull/6321 #6321 2017-03-15 22:12:19 +01:00
Patrick Lang 8cf2240383 Finish hooking up hv.enable_virtualization_extensions 2017-03-02 14:06:39 -08:00
Patrick Lang 6900fc3904 Starting support for Hyper-V nested virtualization 2017-03-02 14:06:21 -08:00
Bjorn Brala f808f74009 Harden VMCX support. Vagrant now checks if your Windows version has support for vmcx and then uses the VMCX file. 2016-12-14 15:14:56 +01:00
Chris Roberts 23c41f4461 Merge pull request #7867 from bbrala/hyperv-package
Package Hyper-V boxes
2016-12-07 13:37:47 -08:00
Bjorn Brala 10181f7c8a When you set the memory of a HyperV machine to something lower than the original range it fails. 2016-11-23 08:39:49 +01:00
Bjorn Brala 37a525fbbc Little bit of cleanup. 2016-10-20 22:43:00 +02:00
Bjorn Brala e6093dd709 The virtual machine doesnt need 'Virtual Machines' in its path, this is created when importing. 2016-10-19 21:03:48 +02:00
Bjorn Brala c075c026be Keyboard language setting made my comment bad 2016-10-19 20:56:52 +02:00
Bjorn Brala 055bed5918 removed an extra echo and added proper error message when there is incompatibilities. Appearantly importing into a compressed folder wont work and will result in an error. 2016-10-19 20:55:56 +02:00
Brian Retford 418064519d Move dynamic memory settings into conditional block 2016-10-14 18:53:44 -07:00
Jake Ballard 803fff7f03 Fix issue with missing slash in paths
It was failing to create files below the machines\default\hyperv folder, rather it was creating folders named 'hypervSnapshots', 'hypervVirtual Hard Disks', and 'hypervVirtual Machines'. This was causing the files to not be removed when destroying the vm, and an error when subsequently bringing it up again.
2016-10-11 15:31:28 -05:00
Bjorn Brala debe50957b Refactor the import script to fully use Compare-VM for creating the new VM.
Implemented the differencing disk for vmcx.
This means the disk is now copied by Hyper-V (Powershell) instead of Ruby for new machines.
This does mean EFI Firmware now does work for machines since it is quite a feep copy. Compare-VM will report incompatibilities should they be found.
2016-10-08 16:38:42 +02:00
Bjorn Brala be2e9e79aa FIrst draft of packaging of Hyper-V boxes. Need to refactor the package_* files since right now they are copies of the virtualbox versions, might just put them in general. 2016-10-05 13:48:48 +02:00
Bjorn Brala 133e2a7b0f Broke Path argument in mini refactor. 2016-10-04 20:06:10 +02:00
Bjorn Brala 2fc93277fd change argument to vm_config_file so it isn't the same as variable in powershell script. 2016-10-02 18:45:51 +02:00
Bjorn Brala 1ec1cf8177 Update Hyper-V import command and the driver to check for configuration type and call the correct import script. 2016-10-02 16:10:58 +02:00
Bjorn Brala b041c1955c Add support for vmcx files, new binary format for Hyper-V configurations. 2016-10-02 16:10:16 +02:00
tfanning d350fd0d28 Resolve whitespace 2016-07-26 13:56:20 +01:00
tfanning 344fc0ea7b Implement auto_start_action and auto_stop_action 2016-07-26 13:41:01 +01:00
Rory Plaire d3859a33aa Fixing version check and catch statement in get_vm_status
Use the version of Hyper-V instead of Powershell to determine which
exception is thrown by Get-VM. Also fixing an invalid catch statement,
since Powershell can not use variables to match thrown exceptions in
catch.
2016-06-18 17:13:24 -07:00
Seth Vargo 08550b6888 Merge pull request #7108 from jtopper/fix_hyperv_status_exception
HyperV: Reinstate compatibility with PowerShell 4
2016-05-20 10:46:01 -04:00
Jon Topper 0a7c20a93a Determine status behaviour based on PS version 2016-05-13 17:50:24 +01:00
Jon Topper df4caf0757 Add snapshots to Hyper-V driver 2016-05-13 16:58:08 +01:00
Seth Vargo 6c01aaf6ab Merge pull request #7090 from mac2000/master
hyperv differencing disk
2016-04-17 23:14:29 +05:30
Matt Wrock 508492faae fixes #7098 only specifying Hyper-V generation if the parameter is supported 2016-03-04 23:42:17 -08:00
Marchenko Alexandr 51d7c98d49 hyperv differencing disk 2016-03-01 17:23:38 +02:00