Commit Graph

264 Commits

Author SHA1 Message Date
Jayson Cofell 37e15ec854 Add AdditionalDiskSizes test 2019-06-24 18:11:14 -06:00
Jayson Cofell c9b693080a Add additional disk support for QEMU builder. 2019-06-24 17:35:06 -06:00
Adrien Delorme 926c8bbaa6 refactor ShutdownConfig into a single struct 2019-06-14 12:17:28 +02:00
Adrien Delorme 76f50619b1 builder/qemu/builder.go: Document from Config file 2019-06-14 11:52:38 +02:00
Adrien Delorme 4399684372 make fmt autogenerated docs 2019-06-06 16:29:25 +02:00
Adrien Delorme e6cbb013ba add // go:generate struct-markdown to all previously edited files 2019-06-05 16:42:18 +02:00
Adrien Delorme f1917edd34 generate the comments for config struct of builders scraping doc website 2019-06-05 16:42:17 +02:00
Adrien Delorme a6bb06c04e
Merge pull request #7615 from hashicorp/fix_7607
fix copypasta mistake switching ssh port mix/max for vnc port min/max
2019-05-07 12:17:45 +02:00
Radek Simko b4d35eceff
builder/qemu: Fix typo in version comparison 2019-05-07 08:37:57 +01:00
Megan Marsh bf59f01ba2 fix copypasta mistake switching ssh port mix/max for vnc port min/max 2019-05-06 15:01:09 -07:00
Radek Simko c7cf39808d
builder/qemu: Replace dot-based parsing with hashicorp/go-version 2019-05-06 22:28:27 +01:00
Adrien Delorme d72040f4fa move retry code into the common/retry pkg and make retry context aware 2019-04-09 17:46:38 +02:00
Adrien Delorme f555e7a9f2 allow a provisioner to timeout
* I had to contextualise Communicator.Start and RemoteCmd.StartWithUi
NOTE: Communicator.Start starts a RemoteCmd but RemoteCmd.StartWithUi will run the cmd and wait for a return, so I renamed StartWithUi to RunWithUi so that the intent is clearer.
Ideally in the future RunWithUi will be named back to StartWithUi and the exit status or wait funcs of the command will allow to wait for a return. If you do so please read carrefully https://golang.org/pkg/os/exec/#Cmd.Stdout to avoid a deadlock
* cmd.ExitStatus to cmd.ExitStatus() is now blocking to avoid race conditions
* also had to simplify StartWithUi
2019-04-08 20:09:21 +02:00
Adrien Delorme c4f3dccc14 rename interpolation context from ctx to ictx and contexts to ctx to avoid conflicts 2019-04-03 15:56:15 +02:00
Adrien Delorme a4bf94dd3c change Builder to be passed a context for cancellation
we have to to give it to our hook
2019-04-03 15:55:55 +02:00
Adrien Delorme a3838ecfad error on negative ports 2019-03-19 15:21:09 +01:00
Adrien Delorme 5a6dffde9a use port as ints 2019-03-19 15:01:12 +01:00
Adrien Delorme c214f6735b make everything a uint 2019-03-19 12:54:15 +01:00
Adrien Delorme ae182a7c20 qemu stepForwardSSH: use common/net pkg to find open port 2019-03-19 12:54:15 +01:00
Adrien Delorme 446105e384 quemu stepConfigureVNC: use common/net pkg to find open port 2019-03-19 12:54:15 +01:00
Adrien Delorme 9f82b75e57 Use the hashicorp/go-getter to download files
* removed packer.Cache and references since packer.Cache is never used except in the download step. The download step now uses the new func packer.CachePath(targetPath) for this, the behavior is the same.
* removed download code from packer that was reimplemented into the go-getter library: progress bar, http download restart, checksuming from file, skip already downloaded files, symlinking, make a download cancellable by context.
* on windows if packer is running without symlinking rights and we are getting a local file, the file will be copied instead to avoid errors.
* added unit tests for step_download that are now CI tested on windows, mac & linux.
* files are now downloaded under cache dir `sha1(filename + "?checksum=" + checksum) + file_extension`
* since the output dir is based on the source url and the checksum, when the checksum fails, the file is auto deleted.
* a download file is protected and locked by a file lock,
* updated docs
* updated go modules and vendors
2019-03-13 12:11:58 +01:00
Megan Marsh c63b54a1e7 move http with proxy call into a helper function 2019-01-25 12:32:52 -08:00
Megan Marsh e4dca0016c
Merge pull request #7156 from vtolstov/qemu
qemu: Add configuration options to specify cpu count and memory size
2019-01-23 15:19:08 -08:00
Vasiliy Tolstov b6ebe00249 provide memory and cpus like other builders does
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2019-01-23 13:21:52 +03:00
Nelson Chen b39f398fda Add support for whpx accelerator to qemu builder
Windows Hypervisor Platform (WHPX) is the Windows counterpart to HVF and
KVM. It's an operating system provided component that provides
virtualization acceleration support.

This is kind of the missing counterpart to https://github.com/hashicorp/packer/pull/6193.
QEMU 2.12 also added support for WHPX.

There's no support for libvirt on Windows so nothing was added in those
areas.

The popular QEMU for Windows distribution does not have WHPX support
built-in for legal reasons as the maintainer does not wish to use or
obtain any part of Microsoft's SDK to compile the distribution.
2019-01-03 15:20:37 -08:00
Megan Marsh 65124985d1 don't set DetectZeroes if it's off, because some versions of QEMU don't support this option 2018-12-03 15:52:13 -08:00
PORTE Loïc bf97557abf Backport VNC log from vmware to qemu 2018-11-28 19:13:29 +01:00
Megan Marsh 3175dcdf81
Merge pull request #6807 from dev-rowbot/qemu-net-device-6804
Fix for #6804 - KVM/QEMU Network "has no peer"
2018-10-18 14:09:22 -07:00
Konstantin Shloma fe341e2bd0 fix go source formatting
add description to documentation page
2018-10-10 16:16:23 +03:00
Konstantin Shloma 1155347b55 add qemu disk detect-zeroes= option 2018-10-10 14:38:59 +03:00
Rowan Potgieter 65db6be6b9 Fix for #6804
The user QEMU args may overwrite the default -device.
This results in no network
2018-10-06 14:40:43 +02:00
Megan Marsh 38cc525ec7 new option allowing user to clean up the ephemeral ssh key from the authorized_keys file 2018-09-14 11:06:38 -07:00
Megan Marsh 340363a649
Merge pull request #6613 from hashicorp/merge_ssh_config_funcs
Merge ssh config funcs from builders
2018-08-23 16:03:36 -07:00
Megan Marsh 918db58604 added new template variables to replace PACKER_KEY_INTERVAL with tunable key and keygroup intervals depending on driver used 2018-08-22 11:37:56 -07:00
Adrien Delorme 41f6e0334d refactor all copy pasted sshConfig with into communicator.Config.SSHConfigFunc
* still need to append the auth methods into an array for gracefullness
2018-08-22 17:02:23 +02:00
rsclarke 887e694534 add ssh agent support for qemu builder 2018-07-27 20:24:06 +08:00
Megan Marsh d2823622e5
Merge pull request #6249 from iammattcoleman/add-use_backing_file
qemu builder: add the 'use_backing_file' setting for QCOW2 images
2018-07-23 13:40:04 -07:00
Michael Gibson 7e4fb9adb5
vnc_bind_address not getting passed through to qemu
This was mostly addressed in commit
hashicorp/packer@fa273f3

Just missing vncIP from step_type_boot_command.go
2018-07-09 14:05:39 -06:00
Megan Marsh 2b2c860df8 make the convert retryable in case it takes a bit to release a lock 2018-06-28 14:21:28 -07:00
Matt Coleman 3192f5e0da qemu builder: add the 'use_backing_file' setting for QCOW2 images 2018-05-16 10:22:50 -04:00
Matthew Hooker 4f1395e0f6
builder/qemu: properly prepare boot command. 2018-05-01 12:40:00 -07:00
Adam Robinson 29b89e63b8 add support for hvf accelerator to qemu builder 2018-04-27 10:11:20 -04:00
Matthew Hooker 024fac4b4f
Merge pull request #6129 from hashicorp/bc_replace
Replace boot command parser with PEG parser.
2018-04-20 12:21:20 -07:00
Evgeni Golov 5a10e5a038
fix invalid disc_discard setting error message 2018-04-20 13:17:40 +02:00
Matthew Hooker c8e76ce298
implement config struct for qemu 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 bf0a320125
Implement new parser for qemu boot command 2018-04-19 14:26:29 -07:00
Omer Katz 56af885212
Avoid warning when using raw format.
When using the raw image format and attempting to resize it we get the following error message:
```
WARNING: Image format was not specified for 'test.raw' and probing guessed raw.
         Automatically detecting the format is dangerous for raw images, write operations on block 0 will be restricted.
         Specify the 'raw' format explicitly to remove the restrictions.
```
Specifying the format will remove this warning.
2018-03-29 14:51:02 +03:00
Matthew Hooker baf8d30ad2
Merge pull request #5738 from testworksau/intel-haxm-support
Add Intel HAXM support to QEMU builder
2018-01-31 12:41:15 -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
Glenn McDonald 7250c4f7f0 Add Intel HAXM support to QEMU builder 2017-12-29 11:51:57 +11:00
Ammar Ansari b8bd66d10d Align virtual disk size for qemu builder
When booting from a disk image, the Qemu builder resizes the disk to 40000
which is not a multiple of 1kB. This causes problems while booting from the image.
Updating the default disk size to 40960 fixes this issue
2017-11-15 15:00:13 -05:00
JD Friedrikson a0052fdb68
Specify InsecureIgnoreHostKey for HostKeyCallback
[A recent breaking change upstream in Golang's crypto
library](e4e2799dd7)
has broken SSH connectivity for a few builders:

```
==> qemu: Waiting for SSH to become available...
2017/05/20 16:23:58 ui: ==> qemu: Waiting for SSH to become available...
2017/05/20 16:23:58 packer: 2017/05/20 16:23:58 [INFO] Attempting SSH connection...
2017/05/20 16:23:58 packer: 2017/05/20 16:23:58 reconnecting to TCP connection for SSH
2017/05/20 16:23:58 packer: 2017/05/20 16:23:58 handshaking with SSH
2017/05/20 16:23:58 packer: 2017/05/20 16:23:58 handshake error: ssh: must specify HostKeyCallback
2017/05/20 16:23:58 packer: 2017/05/20 16:23:58 [DEBUG] SSH handshake err: ssh: must specify HostKeyCallback
2017/05/20 16:24:05 packer: 2017/05/20 16:24:05 [INFO] Attempting SSH connection...
2017/05/20 16:24:05 packer: 2017/05/20 16:24:05 reconnecting to TCP connection for SSH
2017/05/20 16:24:05 packer: 2017/05/20 16:24:05 handshaking with SSH
2017/05/20 16:24:05 packer: 2017/05/20 16:24:05 handshake error: ssh: must specify HostKeyCallback
2017/05/20 16:24:05 packer: 2017/05/20 16:24:05 [DEBUG] SSH handshake err: ssh: must specify HostKeyCallback
```

Specifying HostKeyCallback as insecure should make things work again
and would make sense for packer's use case.
2017-05-20 16:17:04 -04:00
Matthew Hooker 81522dced0
move packer to hashicorp 2017-04-04 13:39:01 -07:00
Matthew Hooker 4fcbf75da9
s/non existent/nonexistent/ 2017-03-29 12:38:33 -07:00
Matthew Hooker 0149f679de
Print instead of Printf with no dynamic first variable. 2017-03-28 20:36:20 -07:00
Matthew Hooker d1b20b3d9c
remove a bunch of dead code.
https://github.com/dominikh/go-tools/tree/master/cmd/unused
2017-03-28 20:36:20 -07:00
Matthew Hooker 230079f73a
spell fixes 2017-03-28 20:36:19 -07:00
Matthew Hooker 70af3d8148 Merge pull request #4497 from mitchellh/f-clickable-links
Make rdp and vnc links clickable by adding the protocol
2017-02-02 12:41:59 -08:00
Chris Bednarski facf27ceeb Make rdp and vnc links clickable by adding the protocol 2017-02-02 01:55:28 -08:00
Matthew Hooker 22d1322bd9
always check for an error first when walking a path 2017-01-26 16:32:21 -08:00
Matthew Hooker 2a7c84e9ff Merge pull request #4343 from vtolstov/qemu_convert
builder/qemu: allow to convert from any supported format
2017-01-24 01:12:31 -08:00
Matthew Hooker d2e59e4e92
set PACKER_HTTP_ADDR env var when available.
If using a builder that has an http server set up for file transfer,
expose the connection info to the shell provisioner through the environment
variable PACKER_HTTP_ADDR.

Closes #2869
2017-01-16 23:19:52 -08:00
Chris Bednarski 6ad702ad74 Update comments to reflect current implementation 2017-01-14 20:11:51 -08:00
Chris Bednarski ee2d636840 Improve delay between key events
- Can now tune delay using PACKER_KEY_INTERVAL
- Added implementation to all of VMware and QEMU
- Removed double delay for QEMU
- Default key delay of 100ms (as before)
- Added docs to QEMU and VMware pages
2017-01-14 17:56:04 -08:00
Rickard von Essen 85cf00069f Merge pull request #4294 from legal90/iso-target-extension
Add "iso_target_extension" option for all local *-iso builders
2017-01-04 13:48:28 +01:00
Vasiliy Tolstov 20349f750d builder/qemu: allow to convert from any supported format
In case of disk_image: true user can have raw image, but in packer
template specify qcow2 image format.

Signed-off-by: Vasiliy Tolstov <v.tolstov@selfip.ru>
2016-12-30 17:19:14 +03:00
DanHam 13bb4d153a
qemu builder now needs to explicitly set WinRMPort for StepConnect
Same as vbox builders, aligns qemu with changes to
helper/communicator/step_connect.go introduced by PR #2576
2016-12-23 23:15:51 +00:00
Mikhail Zholobov 57d07f227a
Add "iso_target_extension" option for all local *-iso builders
This option allows to set the extension of the ISO file after download.
Defaults to "iso". It makes sense for building Mac OS X guests, where the
bootable image is actually a DMG, not an ISO.
In particular, it is important for "parallels-iso" builder to set the right extension.
2016-12-17 12:50:30 +02:00
Matthew Hooker 0339fcc442
builder/qemu: add use_default_display option
If set, won't set `-display dsl` as a default argument. Useful for osx
compatibility.
2016-12-16 17:44:54 -08:00
Matthew Hooker a46c071143
fix regex. need to account of XXhYYm etc 2016-12-08 15:12:48 -08:00
Matthew Hooker 1e96aa845b
fix wait boot_command regex.
Resolves #4268
2016-12-08 15:12:40 -08:00
Rickard von Essen 96e9a8e6e9 Removed default value for ssh_username 2016-11-17 22:30:34 +01:00
febc.yamamoto 6088c1887c Fix keycodes for ctrl,shift and alt key when sending over VNC 2016-11-04 19:26:14 +09:00
Matthew Hooker d920b3fbf4 run gofmt 2016-11-01 14:08:04 -07:00
Rickard von Essen 3c8dabba9e Fixed formatting 2016-10-11 23:43:50 +02:00
Rickard von Essen 5e96709ee9 Merge pull request #2919 from arizvisa/floppy-recurse
Added an option for copying entire subdirectories via floppy_dirs (supplants floppy_files)
2016-10-08 16:51:16 +02:00
Rickard von Essen 3ad7f067ab Merge pull request #2784 from orivej/fix-ssh-port-max
Make ssh_host_port_max an inclusive bound to agree with documentation
2016-10-02 00:12:37 +02:00
Ali Rizvi-Santiago 86c00490e9 Renamed any and all instances of the word "FloppyContents" to "FloppyDirectories".
Ensure that all builders include FloppyDirectories in the StepCreateFloppy options.
Changed the way the unit-tests in common/step_create_floppy_test work to use the static test-fixtures directory instead of creating the paths dynamically.
Removed a duplicate line of documentation from parallels-pvm.html.md that occurred during rebasing.
2016-09-27 23:31:42 -05:00
Rickard von Essen c95aab5e0e Merge pull request #3888 from yoctocloud/qemu
builder/qemu: specify disk format to avoid errors
2016-09-22 08:43:40 +02:00
Rickard von Essen 06e3539ffa Merge pull request #3767 from taliesins/ExtendScanCodes
Add support for ctrl, shift and alt keys and using them as key modifier.
2016-09-20 21:36:46 +02:00
Rickard von Essen 13c9db5dd5 Merge pull request #3885 from orivej/on-error
Add -on-error command line argument to allow preserving artifacts on builder errors
2016-09-20 12:28:14 +02:00
Matthew Hooker 7cbb98f2d5 QemuArggs -> QemuArgs
Avast ye, resolves #3901
2016-09-19 14:34:13 -07:00
Orivej Desh 6762965696 Add -on-error command line argument to allow preserving artifacts on builder errors
Resolves #409
2016-09-16 12:15:00 +00:00
Vasiliy Tolstov 4986ef39b2 builder/qemu: specify disk format to avoid errors
Image format was not specified for XXX and probing
guessed raw.
Automatically detecting the format is dangerous for raw images, write
operations on block 0 will be restricted.
Specify the 'raw' format explicitly to remove the restrictions.

Signed-off-by: Vasiliy Tolstov <v.tolstov@selfip.ru>
2016-09-15 17:59:05 +03:00
Rickard von Essen 3ab49595e6 Merge pull request #3681 from yoctocloud/communicator
builder/qemu: dont fail on communicator set to none
2016-09-13 22:45:12 +02:00
Ali Rizvi-Santiago a3f0308e92 Re-implemented the support for the floppy_files keyword in order to remain backwards-compatible with templates using the old syntax.
Moved the support for recursive paths from the floppy_files keyword to the new floppy_contents keyword.
Shifted some of the code around to add better logging of what's actually being copied.
Added a couple of unit-tests for the new floppy_contents implementation.
Ensured that all files that were being added were also being included in state.FilesAdded so that the older unit-tests will work.
2016-09-12 11:56:25 -05:00
Taliesin Sisson 1155c6d4d6 Use the correct fmt verb for log output 2016-07-31 19:46:38 +01:00
Taliesin Sisson a87ad05866 Add support for ctrl, shift and alt keys.
Add support for using ctrl, shift and alt as key modifiers. So you can now achieve ctrl+c by using "<leftCtrlOn>c<leftCtrlOff>".

Updated documentation for new key stroke tokens.
2016-07-31 19:05:10 +01:00
Ricard Clau acededfc6e tests actually test the floppies 2016-07-27 21:59:21 +01:00
Vasiliy Tolstov 83f175cac7 builder/qemu: dont fail on communicator - none
Signed-off-by: Vasiliy Tolstov <v.tolstov@selfip.ru>
2016-07-07 00:49:23 +03:00
Isa 8e86308cb4 don't use invalid -q flag for qemu-img
fix lacking coma
2016-06-23 14:49:56 -07:00
Ian Duffy fa273f3bea Allow configurable VNC bind IP for QEMU
This commit allows for a user configurable VNC bind IP to be used for
QEMU.

By default this will be 127.0.0.1, alternatively, a user can use
0.0.0.0 which will bind to all interfaces.

This pull request should satisfy concerns of #3570 and #3559. It is
also in-line with the functionality provided by #3566 and #3565

Signed-off-by: Ian Duffy <ian@ianduffy.ie>
2016-05-25 10:10:12 +01:00
Brian Candler 873760e69e Clarify how to run with logs if qemu fails to start (#3561) 2016-05-20 14:25:52 -07:00
Chris Bednarski 24cf28d4b6 Merge branch 'yoctocloud-accelerator' 2016-05-19 22:54:19 -07:00
Chris Bednarski bff939b373 Added comment on why we need to open /dev/kvm before using it 2016-05-19 22:53:53 -07:00
Vasiliy Tolstov 0f638f9111 builder/qemu: add simple kvm/tcg autodetection
Signed-off-by: Vasiliy Tolstov <v.tolstov@selfip.ru>
2016-05-18 15:38:38 +03:00