Commit Graph

159 Commits

Author SHA1 Message Date
Kun Ma
b51f3e3ae0 CP-19292: added an option for "format" to export compressed xva
Signed-off-by: Kun Ma <kun.ma@citrix.com>
2016-10-21 18:14:52 +08:00
Kun Ma
2a9073838e CP-18791: Make appliance-specs building stable
Signed-off-by: Kun Ma <kun.ma@citrix.com>
2016-10-10 17:39:52 +08:00
kunm
f79980553f CP-18743: refine type of NetworkNames & remove unused code
Signed-off-by: kunm <kun.ma@citrix.com>
2016-09-05 17:05:44 +08:00
kunm
d1de461cdb CP-18743: Make packer-build-xenserver support VIF configuration
Signed-off-by: kunm <kun.ma@citrix.com>
2016-09-02 23:15:34 +08:00
Rob Dobson
2bad924ff0 Merge pull request #44 from makunterry/master
CP-18646: Make packer-build-xenserver support other-config for vm pac…
2016-09-01 09:44:21 +01:00
Jon Ludlam
f6978fb5ae Eject floppy and installation ISO after the VM has been provisioned.
To work around an issue in the PV drivers for Windows, the floppy and
installation ISO were removed before restarting the guest. This was due
to the drivers bluescreening on a failed assert of the presence of a
floppy disk.

Now that behaviour has been fixed, the builder should behave in the
expected way, and not introduce an extra shutdown/restart.

Signed-off-by: Rob Dobson rob.dobson@citrix.com
Reapplied-by: Jon Ludlam <jonathan.ludlam@citrix.com>
2016-08-26 14:17:45 +01:00
kunm
b1f0013d8c CP-18646: Make packer-build-xenserver support other-config for vm packing
Signed-off-by: kunm <kun.ma@citrix.com>
2016-08-23 11:55:38 +08:00
Phus Lu
059707af53 gofmt -s -w .
Signed-off-by: Phus Lu <phus.lu@citrix.com>
2016-07-15 09:55:04 -07:00
Phus Lu
a850d3d4f0 Rebase and add USE_XE option to xva export
Signed-off-by: Phus Lu <phus.lu@citrix.com>
2016-07-15 09:54:23 -07:00
Rob Dobson
aa0bbcae25 Add the missing Prepare call for the SSHConfig step.
Signed-off-by: Rob Dobson <rob.dobson@citrix.com>
2015-06-22 16:49:52 +01:00
Rob Dobson
2369b76a42 Adding ssh_config.go
Signed-off-by: Rob Dobson <rob.dobson@citrix.com>
2015-06-22 11:49:48 +01:00
Rob Dobson
351fdbba9d Refactoring to work with upstream packer changes around templates and SSH connect.
Signed-off-by: Rob Dobson <rob.dobson@citrix.com>
2015-06-22 11:17:20 +01:00
Rob Dobson
437b4a3037 Passing the local_listener through to avoid a race with someone else picking up the port.
Signed-off-by: Rob Dobson <rob.dobson@citrix.com>
2015-05-21 16:52:54 +01:00
Robert Breker
52fa3fe1b5 gofmt -w -s .
Signed-off-by: Robert Breker <robert.breker@citrix.com>
2015-05-18 15:13:02 +00:00
Jonas Kongslund
82d2a412ab Added VM description field 2015-05-06 06:25:12 +04:00
Rob Dobson
a135a74946 Adding an override for selecting how we obtain an IP for the created VM. In particular this helps disable HTTP snooping where the installers IP may differ from the IP obtained on firstboot.
Signed-off-by: Rob Dobson <rob.dobson@citrix.com>
2015-04-27 18:14:20 +01:00
Rob Dobson
a0e9c97c89 Adding legacy support for exporting VDI's as VHDs using the Transfer VM.
Signed-off-by: Rob Dobson <rob.dobson@citrix.com>
2015-04-27 18:11:40 +01:00
Rob Dobson
d63518195d Re-adding support for bypassing ISO upload and just using and attaching one already present on an available SR.
Signed-off-by: Rob Dobson <rob.dobson@citrix.com>
2015-04-27 18:11:40 +01:00
Cayce Ullman
388d48cfde Some tweaks to make it work with the current version of github.com/xenserver/go-xenserver-client. 2015-04-16 15:37:46 -05:00
Rob Dobson
7f52133218 Pulling out the client library and importing it from upstream: xenserver/go-xenserver-client.
Signed-off-by: Rob Dobson <rob.dobson@citrix.com>
2015-03-13 13:23:20 +00:00
Jon Ludlam
35c4ccc7c2 Add the ability to export VHD files
Signed-off-by: Jon Ludlam <jonathan.ludlam@citrix.com>
2015-02-20 11:28:59 +00:00
Cheng Sun
fc6c922f47 Add 'none' option to 'format' 2015-01-07 10:40:01 +00:00
Cheng Sun
422028bb3c Fix Shutdown step message 2015-01-06 14:02:00 +00:00
Cheng Sun
0407989de8 Remove floppy before provision
Workaround for Windows Tools floppy BSOD
2015-01-06 14:02:00 +00:00
Cheng Sun
c2e3cc9756 Set correct boot order 2015-01-06 14:02:00 +00:00
Cheng Sun
6ef9b70500 Try getting IP if reported by PV drivers 2015-01-06 14:02:00 +00:00
Cheng Sun
176c4ad7a3 IP snooping 2015-01-05 17:28:42 +00:00
Cheng Sun
6ffa99d624 Split shutdown and export, and detach VBDs in between 2015-01-05 17:28:41 +00:00
Cheng Sun
d1e6bb66a9 Skip typing step if there is nothing to type 2015-01-05 17:28:41 +00:00
Cheng Sun
2591ae8226 Add ssh_port config 2015-01-02 18:20:54 +00:00
Cheng Sun
1539688cb8 Update tests 2015-01-02 16:55:44 +00:00
Cheng Sun
16f8c25d84 Fix shutdown_command bug
Fixes the somewhat embarrassing bug where the shutdown_command would be
run on the host rather than the guest.

This commit also rejigs things so that it is easier to do SSH commands
on either the host or the guest
2015-01-02 16:55:43 +00:00
Cheng Sun
27819cd51f Find local IP automatically 2015-01-02 16:55:43 +00:00
Cheng Sun
fc03c2010f Workaround xapi bug in Task.GetResult
xapi currently sends us an xmlrpc-encoded string via xmlrpc.
This seems to be a bug. Remove this workaround when it's fixed
2015-01-02 16:55:43 +00:00
Cheng Sun
0cb3aff4e8 Fix Task.GetErrorInfo typecast crash 2015-01-02 16:55:43 +00:00
Cheng Sun
201a9be4a8 Set default VM name to packer-BUILDNAME-TIMESTAMP 2015-01-02 16:55:43 +00:00
Cheng Sun
cd1875019d Prefix remote_ for all host config 2015-01-02 15:11:27 +00:00
Cheng Sun
462082bee8 Initial work on XVA import 2015-01-02 15:11:27 +00:00
Cheng Sun
396a8de131 Add task GetResult method 2015-01-02 15:11:23 +00:00
Cheng Sun
4efd1029a2 Abstract out http PUT 2014-12-31 16:09:23 +00:00
Cheng Sun
2ce67b0465 Rename logIteration 2014-12-31 16:09:23 +00:00
Cheng Sun
152bdee7f2 Initial work on splitting ISO and XVA builders
Compiles -- but xva create_instance is incomplete

Several changes were rolled into this commit, including:

- "export_format" is now "format", and "keep_instance" is "keep_vm"
- gox is used for building (with the intention of allowing
  cross-compilation in the future)
2014-12-31 16:09:23 +00:00
Cheng Sun
4c4ba3026b Add builder config test
Borrowed from virtualbox builder test
2014-12-29 18:12:01 +00:00
Cheng Sun
216eb2aab5 Fix enum types 2014-12-29 18:12:01 +00:00
Cheng Sun
30c4c8001f Don't explicitly remove ISOs in step_remove_devices 2014-12-19 14:10:59 +00:00
Cheng Sun
b9a7feb225 Rename instance_memory to vm_memory
Note that vm_memory is now in MB; instance_memory was in bytes
SetStaticMemoryRange now takes int64
Fixed example
2014-12-19 12:50:23 +00:00
Cheng Sun
2e1f94e831 Rename instance_name to vm_name
Fixed example
2014-12-19 12:50:22 +00:00
Cheng Sun
987a5ac55e Rename root_disk_size to disk_size
CreateVdi now takes an integer size
Note that disk_size is now in MB; root_disk_size was in bytes
Fixed example
2014-12-19 12:50:22 +00:00
Cheng Sun
e308c0759f VDI upload, floppy and tools support
This commit add new VDI steps named step_{attach,detach,find,upload}_vdi
  - attach/detach are self-explanatory; can specify CD or Floppy
  - find finds a VDI by name-label and stores the uuid
  - upload uploads a VDI from a local disk image and stores the uuid

In order to demonstrate the new VDI code, this commit trivially adds:
  - support for uploading ISOs again (dependent on unmerged XAPI patch)
  - initial floppy upload/attach support (dependent on currently-broken
    XAPI patch)
  - initial XenServer Tools support
2014-12-19 12:46:36 +00:00
Cheng Sun
313f5a7354 Add Task class to xapi client 2014-12-19 12:43:58 +00:00
Cheng Sun
5cb0a0955b Add Floppy ConnectVdi type 2014-12-18 16:08:52 +00:00
Cheng Sun
31acbe6508 Fix error message typo 2014-12-17 18:48:19 +00:00
Cheng Sun
f101aa8511 step_start_vm_paused: cleanup forces VM shutdown
This allows steps between create_instance and start_vm_paused to assume
that the VM is shut down when cleaning up
2014-12-17 18:48:19 +00:00
Cheng Sun
2a4ce52eaa Abstract out GetSR 2014-12-15 15:02:42 +00:00
Cheng Sun
b73cbc1230 Be less verbose when waiting for install to complete 2014-12-15 15:02:42 +00:00
Cheng Sun
b7081f238f Check for error in downloading exported XVA/VDI 2014-12-15 12:17:12 +00:00
Cheng Sun
dfa9d63097 Always fetch a new VM instance from UUID for consistency 2014-12-15 12:17:12 +00:00
Cheng Sun
5e87812ecf Split step_remove_devices out of step_wait 2014-12-15 12:17:12 +00:00
Cheng Sun
c392b5499e interruptible_wait: check for interruption immediately
Akin to 651274e508
2014-12-12 16:11:40 +00:00
Cheng Sun
03e3a7ad85 Fix xva export query string 2014-12-12 12:42:35 +00:00
Cheng Sun
c27e845d1a Add optional shutdown_command parameter
Allow graceful shutdown on VMs that don't support it
2014-12-12 12:42:35 +00:00
Cheng Sun
6df01a0f40 Reduce VNC typing delay 2014-12-12 12:42:35 +00:00
Cheng Sun
41c5930cde Check for empty iso name 2014-12-12 12:42:35 +00:00
Cheng Sun
c2c133c605 Add Name to template for boot command 2014-12-12 12:42:35 +00:00
Cheng Sun
971ab83376 Fix comment typo 2014-12-11 15:40:16 +00:00
Cheng Sun
13ca6ef95b export_format: allow export format to be configured
"export_format" can be one of "xva" (default), "vdi_raw"
2014-12-11 14:30:51 +00:00
Cheng Sun
322817e827 Fix export UUID 2014-12-11 14:19:28 +00:00
Cheng Sun
783eee0a39 Add user variables to template processor 2014-12-11 12:28:25 +00:00
Cheng Sun
b433754c83 Factor out common port-finding code
Fixes bug where we would infinite-loop trying to find an HTTP server
port when all ports were unavailable (e.g. range [80,80] and no root
permission)

Also fixes bug where SSH port forwarding would try ports up to but not
including HostPortMax.

Also add clarification in error messages for which port range to expand
2014-12-10 16:18:54 +00:00
Cheng Sun
602255e9c1 Add keep_instance parameter
Determines when to keep the VM instance and when to clean it up
Can be one of "always", "never" (default), "on_success"
2014-12-10 12:32:41 +00:00
Cheng Sun
97ca6d5cab Also close listener connection when port forwarding fails
Follow-up to 97df6fd283
that actually fixes the "Waiting for SSH" hang
2014-12-10 12:31:02 +00:00
Cheng Sun
649798b4ac Separate config defaults from validation 2014-12-10 11:22:31 +00:00
Cheng Sun
a9fb6532ae Improve HIMN IP-finding error handling
Previous code could dereference nil if there was no error, but an
empty IP was found
2014-12-10 10:41:59 +00:00
Cheng Sun
ca80e009db Fix typo 2014-12-10 10:15:33 +00:00
Cheng Sun
97df6fd283 Close SSH connections once we're done with them
Fixes "Waiting for SSH" hang at end of install
2014-12-09 17:44:21 +00:00
Cheng Sun
1450fd0568 Clean up VM instance and root VDI 2014-12-09 16:40:32 +00:00
Cheng Sun
acd16bb984 Make HIMN IP finding and ping interruptible 2014-12-09 16:32:37 +00:00
Cheng Sun
c75b4555cc Make boot_wait interruptible 2014-12-09 16:32:37 +00:00
Cheng Sun
ba7c5ddcd2 interruptible_wait: allow nil Predicate
Allow for the case where InterruptibleWait is used purely for the
timeout.
See the documentation string for details.
2014-12-09 16:32:37 +00:00
Cheng Sun
651274e508 interruptible_wait: evaluate Predicate immediately
Previous behaviour was to wait PredicateInterval before the first
time that the Predicate is evaluated
2014-12-09 16:32:37 +00:00
Cheng Sun
94dcf160df Don't close session twice 2014-12-09 16:32:37 +00:00
Cheng Sun
8a41cc693a Add more error handling 2014-12-09 14:02:48 +00:00
Cheng Sun
70e57a2d66 Add error handling to step_wait 2014-12-09 11:48:10 +00:00
Cheng Sun
c88168f4ba Replace all Fatal calls with Error calls 2014-12-09 11:48:07 +00:00
Cheng Sun
efbc365b6d fmt step_wait, interruptible_wait 2014-12-09 11:18:35 +00:00
Cheng Sun
cadf3a5d6a Add install_timeout to stop build if step_wait takes too long
Halts the build when the VM does not shutdown within the timeout period
Implemented with interruptible_wait, so step_wait is also interruptible
2014-12-09 10:48:34 +00:00
Cheng Sun
1dd963278f Add generic interruptible wait method 2014-12-09 10:45:52 +00:00
Cheng Sun
d9757f2c38 Revert "Add a pause to ensure SSH has a chance to start. This is a tempoary workaround for the fact that the SSH tunnel code will cause packer to halt if the destination does not exist."
This reverts commit fd35d7c984.
2014-12-09 10:45:52 +00:00
Cheng Sun
6071be1572 Don't create Artifact if there were errors
Prevents nil-dereference crash when errors occur
2014-12-09 10:45:52 +00:00
Cheng Sun
1de826270c Capitalise SSHWaitTimeout for consistency 2014-12-08 16:12:18 +00:00
Cheng Sun
ee0d6d38e0 Replace reflect with type assertion 2014-12-08 16:01:12 +00:00
Cheng Sun
e6e8855da4 Use log.Printf instead of log.Fatalf 2014-12-08 15:56:10 +00:00
Cheng Sun
91c1326bc4 Cosmetic: fix typo in log message 2014-12-08 15:37:36 +00:00
Cheng Sun
2dbe047d45 Cosmetic: go fmt 2014-12-08 15:36:38 +00:00
Rob Dobson
fd35d7c984 Add a pause to ensure SSH has a chance to start. This is a tempoary workaround for the fact that the SSH tunnel code will cause packer to halt if the destination does not exist.
Signed-off-by: Rob Dobson <rob.dobson@citrix.com>
2014-11-24 18:16:56 +00:00
Rob Dobson
8bf2609a7f Adding static memory config to the template.
Signed-off-by: Rob Dobson <rob.dobson@citrix.com>
2014-11-21 17:49:25 +00:00
Rob Dobson
4dd435dafe Adding defaults for Clone template, Network and Storage to avoid having to configure it in the packer file.
Signed-off-by: Rob Dobson <rob.dobson@citrix.com>
2014-11-21 17:49:24 +00:00
Rob Dobson
6538c248fd Add a wait for the VM to boot properly.
Signed-off-by: Rob Dobson <rob.dobson@citrix.com>
2014-11-20 18:54:23 +00:00
Rob Dobson
d64357bc71 Skip the uploading ISO step for the moment until it is fully implemented.
Signed-off-by: Rob Dobson <rob.dobson@citrix.com>
2014-11-20 18:53:05 +00:00
Rob Dobson
d0dd202829 Remove old file.
Signed-off-by: Rob Dobson <rob.dobson@citrix.com>
2014-11-18 18:49:22 +00:00