209 Commits

Author SHA1 Message Date
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
Unknown
5710c0aca1 Making log output clearer for hyper-v gui connection 2018-05-14 20:53:51 +10: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
Stefan Henseler
6f00596053 Adds config option to specify hyper-v secure boot template 2018-05-10 19:00:35 +02:00
Adam Robinson
3aebd5f462 Add use_fixed_vhd_format Hyper-V ISO option 2018-04-26 13:35:19 -04:00
Matthew Hooker
1d36ef038c
implement boot config struct for hyperv 2018-04-19 14:26:31 -07:00
Matthew Hooker
c6299972b9
s/boot_command/bootcommand/ 2018-04-19 14:26:31 -07:00
Matthew Hooker
94129b7fe3
we're using PC-XT (set1) not PC-AT 2018-04-19 14:26:30 -07:00
Matthew Hooker
bdb1eee7d8
Implement new parser for HyperV boot command 2018-04-19 14:26:29 -07:00
M. Marsh
f5c031baf9
Merge pull request #5941 from synax/hyper-v-disk-block-size
Adds Support to configure hyper-v disk block size
2018-04-19 11:27:52 -07:00
Josh Soref
62f59662a3 spelling: installation 2018-03-13 08:04:40 +00:00
Josh Soref
60ef3c3374 spelling: directories 2018-03-13 07:37:32 +00:00
Josh Soref
efb525f03d spelling: creating 2018-03-13 07:22:37 +00:00
Stefan Henseler
103186af86 Adds Support to configure hyper-v disk block size 2018-02-23 20:19:26 +01:00
Ben Phegan
3c88e787df
Merge branch 'master' into hyperv_mac_address 2018-02-02 09:26:52 +11:00
SwampDragons
6d14eb6ea4
Merge pull request #5631 from vijayinvites/diffdisks
[Hyper-V] Use differential disks and Inline disk creation to improve build time (a lot) and to reduce disk usage(a lot)
2018-01-31 16:51:27 -08:00
Matthew Hooker
7a189a83a1
fix imports
`find . -type f -name '*.go' -not -path "./vendor/*" -exec goimports -w {} \;`
2018-01-24 17:09:17 -08:00
Matthew Hooker
a831d522be
change run signatures
Run now takes a context as well as a statebag. We'll assign the context
to the blank identifier to prevent namespace collisions. We'll let the
step authors opt-in to using the context.

`find . -iname "step_*.go" -exec gsed -i'' 's/func \(.*\)Run(/func \1Run(_ context.Context, /' {} \;`
2018-01-24 17:09:17 -08:00
Matthew Hooker
366dc3da0a
move multistep imports to helper.
gomvpkg -from "github.com/mitchellh/multistep" -to "github.com/hashicorp/packer/helper/multistep"
2018-01-24 17:09:15 -08:00
Matthew Hooker
ebe995c0ff
run goimports 2018-01-22 17:21:10 -08:00
Ben Phegan
c338cb79d0 Initial commit of feature to allow MAC address specification for HyperV builders 2017-12-15 13:24:15 +11:00
Vijaya Bhaskar Reddy Kondreddi
54f059d3d4 Add support for skip export 2017-12-11 11:24:59 +05:30
Vijaya Bhaskar Reddy Kondreddi
3d5303c60d Fix tests 2017-11-24 13:24:44 +05:30
Vijaya Bhaskar Reddy Kondreddi
b7e3f37b44 Add support for differential disk 2017-11-24 12:44:53 +05:30
Erlend Graff
27fc72c137 fix formatting errors 2017-11-05 15:16:47 +01:00
Erlend Graff
d890051940 hyper-v: implement driver mock 2017-11-05 14:51:18 +01:00
Matthew Hooker
19e6049f17
style fixes 2017-10-31 08:48:17 -07:00
Matthew Hooker
f64fa7b5ba
Merge pull request #5491 from BenPhegan/hyperv-disk_additional_size
Hyper-V disk_additional_size capability
2017-10-31 08:42:07 -07:00
Matthew Hooker
794e518eb7
use hyper-v admin group, not admin 2017-10-25 13:29:03 -07:00
Matthew Hooker
812fd12a0b
move trimspace to powershell exit check 2017-10-25 13:28:59 -07:00
Matthew Hooker
0be02ab217
hyper-v: Don't error while checking for admin permissions. 2017-10-25 09:18:40 -07:00
Ben Phegan
12fc928e1d Initial commit of Hyper-V disk_additional_size capability. Support a
maximum of 64 disks added to the SCSI controller.  Implement #4823.
2017-10-23 08:26:35 +11:00
Vijaya Bhaskar Reddy Kondreddi
4f6a207441 go fmt 2017-10-11 22:10:39 +05:30
Taliesin Sisson
2fbe0b4a7f Don't try to mount vhd and vhdx files as dvd drive. Hard drives are mounted in the create vm step 2017-10-11 22:05:52 +05:30
Taliesin Sisson
8232759397 If vhd or vhdx extension is specified for ISOUrls, we want to use an existing hard drive which means that we don't need to specify hard drive size
Filepath.ext includes the dot
2017-10-11 22:05:51 +05:30
Taliesin Sisson
efa62e1550 Can specify an iso, vhd or vhdx for download. If it is a vhd or vhdx it is used as the hard drive for spinning up a new machine, importing an exported virtual machine or cloning a virtual machine.
Can import a virtual machine from a folder
Can clone an existing virtual machine
2017-10-11 22:05:45 +05:30
Taliesin Sisson
452fcbd9a1 Only attach dvd drive if there is one
Fix debug messages for cloning

Add hyperv-vmcx as a builder from command line
2017-10-11 21:42:32 +05:30
Taliesin Sisson
6fd7f0877d Initial check in to add a builder that can clone existing hyper v machines 2017-10-11 21:42:32 +05:30
Matthew Hooker
eb64920e80 Merge pull request #5206 from sandersaares/hyperv-second-temp-dir
(Hyper-V) Enable a separate directory to be used for temporary VHDs
2017-10-09 10:08:00 -07:00
Bastian Schmidt
c1aba87b39 Fixes #4880 by always using EnableDynamicMemory
This was needed because the default in Hyper-V on Windows 10 changed from "false" to "true".
2017-09-20 14:53:37 +02:00
Sander Saares
2a1a9a55f8 Clean up both VHD and regular temp dir 2017-09-02 14:55:00 +03:00
Sander Saares
028c941b77 Enable use of separate temp path for Hyper-V VHD 2017-09-02 14:55:00 +03:00
Taliesin Sisson
2325c1ee58 Merge pull request #5085 from Lee303/builder-hyperv-temppath
Hyper-V Builder - Add support for temp_path directive to override system %temp%
2017-07-01 06:58:01 +01:00
Taliesin Sisson
d569a1b879 Merge pull request #5014 from Lee303/builder-hyperv-floppydirs
Add support for floppy_dirs with hyperv-iso builder
2017-07-01 06:52:36 +01:00
Lee
0680cb08e5 Add support for temp_path directive to override systemp %temp% 2017-07-01 00:19:27 +01:00
Wojciech Sciesinski
7bacc22825 Verify membership in the group Hyper-V Administrators by SID not name - fix #5022 2017-06-28 01:44:04 +02:00