Commit Graph

78 Commits

Author SHA1 Message Date
Stephan Wild 061dbecd61 Include Hyper-V secure boot template in box.xml 2020-07-08 18:23:19 +02:00
Rui Lopes 86ac132056
hyperv: add support for setting the boot order (#9046) 2020-04-30 13:31:41 +02:00
Megan Marsh 9c9826ee4b
Merge pull request #8714 from williamb1024/hyperv-gen1-boot-order
WIP: Add Hyper-V builder `first_boot_device` setting to allow the selection of the initial device or device class used for booting the VM.
2020-03-02 12:27:25 -08:00
Ben Brown 0936f8bc03 Fix Hyper-V compacted disk size comparison
Prior to this the code compares the length of the path, which of course
doesn't change.
2020-03-02 09:55:13 +00:00
William Brooks 7f38ce0686 test and correct gen2 SetFirstBootDeviceGen2 scripts 2020-02-21 11:09:49 -06:00
William Brooks dd8f4370c6 initial support for gen2 and fix driver_mock 2020-02-21 01:30:59 -06:00
William Brooks 5e1e4ec701 fmt && generate 2020-02-21 01:07:58 -06:00
William Brooks d7300f4635 Remove legacy_boot and replace with first_boot_device (initial) 2020-02-21 01:01:09 -06:00
William Brooks 31622b50ac applied fmt 2020-02-09 15:22:36 -06:00
William Brooks 55ae803852 Add Hyper-V support for Gen-1 boot order with ISO 2020-02-09 13:08:22 -06:00
Megan Marsh e5becfc854
Merge pull request #8248 from marcinbojko/master
hyper-v fix for compacting only .vhd|.vhdx files
2019-10-21 11:47:15 -07:00
Marcin Bojko 1b4ffe546f
hyper-v fix for compacting vhdx/vhd only 2019-10-19 12:46:34 +02:00
Vladimír d6994df188
Select first adapter attached to host OS's switch
If more than one vNic is attached to vmSwitch, use the first one only.
2019-10-15 15:14:22 +02:00
Davor Kapsa 49e4a2d9ef
Add error check 2019-10-09 15:55:07 +02:00
Megan Marsh 843986c2d4 missing bracket 2019-10-04 10:41:12 -07:00
DanHam 2b6286c31c
Fix powershell formatting. Match style for conditionals 2019-09-09 23:05:40 +01:00
Marcin Bojko d4ff29f6c5 hyper-v fix when management interface is not part of virtual switch
2


formatting fix
2019-08-22 07:54:50 +02:00
WilliamB aef77771c0 Correct HTTPIP == FALSE on HyperV builder 2019-07-17 03:41:41 -05:00
Megan Marsh 2e821da84b check to make sure a vm-name isn't already in use before trying to launch a vm with said name. 2019-06-13 14:09:45 -07:00
BobSilent 5b289f67fe Update hyperv.go
maybe also a fix for issue #5023
at least I got same error like there, incl. VM response
==> hyperv-iso: Host IP for the HyperV machine: False

although #4947 is marked as duplicate but shows different error output
==> hyperv-iso: Error getting host adapter ip address: PowerShell error: Get-VMNetworkAdapter : No network adapter is found with the given input.
2019-04-09 07:36:52 +02:00
Megan Marsh 482ba644a8 quote variables in powershell script to account for spaces 2019-02-01 13:23:17 -08:00
Adrien Delorme 19cbb9cb24
Merge pull request #7136 from hashicorp/fix_5984
Add "version" option to hyperv calls
2019-01-09 10:06:49 +01:00
Megan Marsh 93053e0488 update comments 2019-01-08 15:15:00 -08:00
Megan Marsh 9557f3eea7 use script options struct rather than passing all the variables around an extra time 2019-01-08 11:29:38 -08:00
Megan Marsh a1b3b63cb9 use golang templating logic 2019-01-08 11:17:19 -08:00
Ladar Levison e6de727c25
Fix the Hyper-V gen 1 guest boot order. 2018-12-25 16:54:26 -06:00
Megan Marsh f26051a7da code comments yo 2018-12-20 13:09:32 -08:00
Megan Marsh 24d2cc34e5 tests 2018-12-20 12:03:14 -08:00
Megan Marsh 427a35fc7e tests 2018-12-20 12:03:00 -08:00
Megan Marsh d4de89e057 move powershell templating into separate script so we can test it 2018-12-19 16:35:02 -08:00
Megan Marsh 006682a09c add version option and also refactor powershell script to use golang templates for ease of testing and variable passing. 2018-12-19 16:30:57 -08:00
Ladar Levison 348c267054 Updated support for legacy network adapters on Hyper-V. 2018-12-18 04:59:00 -06:00
Megan Marsh b95123f457 add new copy_in_compare flag so users can set the copy var to whatever they need in order to get the compatibility report to work. 2018-12-13 09:12:23 -08:00
pgrmega 2d1e3efadb
Fix a problem when calling Hyper-V\Compare-VM PowerShell cmdlet (#6726) 2018-11-20 22:10:03 +01:00
DanHam da21c25791
Convert incorrect 'vmxc' -> 'vmcx' in codebase, docs and template opts
grep -rli --exclude-dir={vendor,bin\*,\*vmware\*,\*pkg\*} vmxc . | \
xargs sed -i 's/\(vm\)\(x\)\(c\)/\1\3\2/ig'
2018-07-20 02:12:47 +01:00
DanHam 674bad0ab4
Break very long lines for readability 2018-07-20 02:12:47 +01:00
DanHam d2390f464d
Actually implement the function for the driver 2018-07-20 02:12:45 +01:00
DanHam c2437ba592
Remove the option to place the VHD files in a separate directory
The export process now exports the VM directly from the build directory
into the output directory. There are no intermediate steps or copying of
files involved. This means that there is no longer any benefit in having
a separate directory to house the VHD files - see #5206 for the
reasoning behind the introduction of this feature.

If a user wishes to house the build files on a separate disk from the
output directory (perhaps for performance reasons or due to disk space
limitations) they can still do so through the use of `temp_path`.
2018-07-20 02:12:43 +01:00
DanHam c6b9d9ce90
Add checks/error reporting to compaction process
* Report compaction results
* Failure to find any disks under the supplied path is treated as a
  'soft' error and a warning message will be printed in place of the
  compaction result. Any other failure will cause the build to fail.
2018-07-20 02:12:42 +01:00
DanHam 534fc4a473
Ensure the export directory structure matches that of previous versions
Commit 3fc2defb6 altered the directory structure associated with an
exported VM. The changes mean that the export process now stores the
exported machine files and folders under a folder with name 'vm_name' in
the output directory.
This commit restores the previous behaviour whereby the exported machine
files and folders were stored directly in the output directory. This
allows us to keep the efficiency improvements introduced with 3fc2defb6
while maintaining backward compatibility.

By default the Export-VM command creates three folders in the specified
export directory - 'Virtual Hard Disks', 'Virtual Machines' and
'Snapshots'. When a machine with no associated snapshots is exported the
'Snapshots' directory is empty.
Prior to 3fc2defb6 the Snapshots folder was not copied/incorporated into
the output directory at all. This was a bug.
This commit preserves the legacy behaviour by not including an empty
Snapshots directory in the export. However, if there *are* Snapshots
associated with the VM, they are now moved into the output directory
along with the usual directories containing disks and VM metadata. This
prevents warnings/errors on import due to missing snapshots.
2018-07-20 02:09:57 +01:00
DanHam dc46848f89
Remove now redundant function to copy exported VM files 2018-07-20 02:09:57 +01:00
DanHam 3fc2defb6d
Refactor the export step for Hyper-V ISO and VMCX builders
* Fixes a bug that caused the build to error if users did not
  explicitly set `skip_compaction:true` when setting `skip_export:
  true`. See #6392.
* Improves the efficiency of the compaction and export process by
  reordering the compaction and export steps.
* Further improves the efficiency of the compacting step through
  compacting the vmd* file directly rather than creating and then
  operating on a copy.
* The changes mean the export process now stores the exported machine
  files and folders under a folder with name 'vm_name' in the output
  directory. Previously the exported machine files and folders were
  stored directly in the output directory.
2018-07-20 02:09:54 +01:00
DanHam 297f6b85ec
Use Get-Command over Get-Help to check for SecureBootTemplate parameter 2018-06-25 23:52:01 +01:00
Simon Hulme 475e79a251 Fixed SecureBootTemplate not being passed through to PS cmdlet
Added check for SecureBootTemplate parameter for Server 2012 and below
Corrected enableSecureBootString usage
2018-06-25 14:13:43 +01:00
Jordan Borean efa9021974
Check if hyper-v addresses is an array before slicing it 2018-06-18 14:45:33 +10:00
M. Marsh edb5c1f50d
Merge pull request #6243 from camjjack/hyper-v-gui
Using vmconnect to display gui for hyper-v
2018-05-18 11:24:24 -07:00
WaaZaa666 b747877222
Fixing #6267, multiple hyper-v disks 2018-05-17 14:50:18 +02:00
Unknown 29c4b4436d Changes requested in PR #6243
- Logging error if vmconnect.exe fails.
- Using StepRun struct rather than StateBag for command Cancel function
- Better handling in Disconnect when headless is true or vmconnect failed in Start
2018-05-14 20:52:10 +10:00
Unknown fc734b6bd9 Using vmconnect to display gui for hyper-v
vmconnect.exe comes as part of Hyper-V and is the tool used by Hyper-V Manager to connect with a virtual machine. This commits sets behaviour the same as virtualbox and vmware to display the virtual machine connection unless headless is set in the template.
2018-05-14 20:52:10 +10:00
M. Marsh 5871b8242b
Merge pull request #6101 from adarobin/azurecompatible
Add use_fixed_vhd_format Hyper-V ISO option
2018-05-10 17:02:44 -07:00