Floppy directories are provided by default with common.floppydrives

This commit is contained in:
Taliesin Sisson 2017-06-19 21:22:55 +01:00 committed by Vijaya Bhaskar Reddy Kondreddi
parent 2fbe0b4a7f
commit 5f2c71f7d7
4 changed files with 66 additions and 65 deletions

View File

@ -325,6 +325,7 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe
&common.StepCreateFloppy{
Files: b.config.FloppyConfig.FloppyFiles,
Directories: b.config.FloppyConfig.FloppyDirectories,
Directories: b.config.FloppyConfig.FloppyDirectories,
},
&common.StepHTTPServer{
HTTPDir: b.config.HTTPDir,

View File

@ -50,16 +50,7 @@ type Config struct {
// The size, in megabytes, of the computer memory in the VM.
// By default, this is 1024 (about 1 GB).
RamSize uint `mapstructure:"ram_size"`
// A list of files to place onto a floppy disk that is attached when the
// VM is booted. This is most useful for unattended Windows installs,
// which look for an Autounattend.xml file on removable media. By default,
// no floppy will be attached. All files listed in this setting get
// placed into the root directory of the floppy and the floppy is attached
// as the first floppy device. Currently, no support exists for creating
// sub-directories on the floppy. Wildcard characters (*, ?, and [])
// are allowed. Directory names are also allowed, which will add all
// the files found in the directory to the floppy.
FloppyFiles []string `mapstructure:"floppy_files"`
//
SecondaryDvdImages []string `mapstructure:"secondary_iso_images"`
@ -214,7 +205,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, error) {
}
if b.config.Generation == 2 {
if len(b.config.FloppyFiles) > 0 {
if len(b.config.FloppyFiles) > 0 || len(b.config.FloppyDirectories) > 0 {
err = errors.New("Generation 2 vms don't support floppy drives. Use ISO image instead.")
errs = packer.MultiErrorAppend(errs, err)
}
@ -385,6 +376,7 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe
steps = append(steps,
&common.StepCreateFloppy{
Files: b.config.FloppyFiles,
Directories: b.config.FloppyConfig.FloppyDirectories,
},
&common.StepHTTPServer{
HTTPDir: b.config.HTTPDir,

View File

@ -63,7 +63,7 @@ can be configured for this builder.
`iso_checksum`. Valid values are "none", "md5", "sha1", "sha256", or
"sha512" currently. While "none" will skip checksumming, this is not
recommended since ISO files and virtual harddrive files are generally large
and corruption does happen from time to time.
and corruption does happen from time to time.
- `iso_url` (string) - A URL to the ISO containing the installation image or
virtual harddrive vhd or vhdx file to clone. This URL can be either an HTTP
@ -114,7 +114,7 @@ can be configured for this builder.
characters (`*`, `?`, and `[]`) are allowed. Directory names are also allowed,
which will add all the files found in the directory to the floppy.
- `floppy_dirs` (array of strings) - A list of directories to place onto
- `floppy_dirs` (array of strings) - A list of directories to place onto
the floppy disk recursively. This is similar to the `floppy_files` option
except that the directory structure is preserved. This is useful for when
your floppy disk includes drivers or if you just want to organize it's

View File

@ -61,49 +61,49 @@ In addition to the options listed here, a
can be configured for this builder.
### Required for virtual machine import:
- `clone_from_vmxc_path` (string) - The path to the exported
- `clone_from_vmxc_path` (string) - The path to the exported
virtual machine folder.
### Required for virtual machine clone:
- `clone_from_vm_name` (string) - The name of the vm to clone from.
- `clone_from_vm_name` (string) - The name of the vm to clone from.
Ideally the machine to clone from should be shutdown.
### Optional:
- `clone_from_snapshot_name` (string) - The name of the snapshot
- `clone_from_snapshot_name` (string) - The name of the snapshot
- `clone_all_snapshots` (boolean) - Should all snapshots be cloned
- `clone_all_snapshots` (boolean) - Should all snapshots be cloned
when the machine is cloned.
- `boot_command` (array of strings) - This is an array of commands to type
- `boot_command` (array of strings) - This is an array of commands to type
when the virtual machine is first booted. The goal of these commands should
be to type just enough to initialize the operating system installer. Special
keys can be typed as well, and are covered in the section below on the boot
command. If this is not specified, it is assumed the installer will start
itself.
- `boot_wait` (string) - The time to wait after booting the initial virtual
- `boot_wait` (string) - The time to wait after booting the initial virtual
machine before typing the `boot_command`. The value of this should be
a duration. Examples are "5s" and "1m30s" which will cause Packer to wait
five seconds and one minute 30 seconds, respectively. If this isn't specified,
the default is 10 seconds.
- `cpu` (integer) - The number of cpus the virtual machine should use. If this isn't specified,
- `cpu` (integer) - The number of cpus the virtual machine should use. If this isn't specified,
the default is 1 cpu.
- `enable_dynamic_memory` (bool) - If true enable dynamic memory for virtual machine.
- `enable_dynamic_memory` (bool) - If true enable dynamic memory for virtual machine.
This defaults to false.
- `enable_mac_spoofing` (bool) - If true enable mac spoofing for virtual machine.
- `enable_mac_spoofing` (bool) - If true enable mac spoofing for virtual machine.
This defaults to false.
- `enable_secure_boot` (bool) - If true enable secure boot for virtual machine.
- `enable_secure_boot` (bool) - If true enable secure boot for virtual machine.
This defaults to false.
- `enable_virtualization_extensions` (bool) - If true enable virtualization extensions for virtual machine.
- `enable_virtualization_extensions` (bool) - If true enable virtualization extensions for virtual machine.
This defaults to false. For nested virtualization you need to enable mac spoofing, disable dynamic memory
and have at least 4GB of RAM for virtual machine.
- `floppy_files` (array of strings) - A list of files to place onto a floppy
- `floppy_files` (array of strings) - A list of files to place onto a floppy
disk that is attached when the VM is booted. This is most useful
for unattended Windows installs, which look for an `Autounattend.xml` file
on removable media. By default, no floppy will be attached. All files
@ -113,13 +113,21 @@ can be configured for this builder.
characters (*, ?, and []) are allowed. Directory names are also allowed,
which will add all the files found in the directory to the floppy.
- `guest_additions_mode` (string) - How should guest additions be installed.
- `floppy_dirs` (array of strings) - A list of directories to place onto
the floppy disk recursively. This is similar to the `floppy_files` option
except that the directory structure is preserved. This is useful for when
your floppy disk includes drivers or if you just want to organize it's
contents as a hierarchy. Wildcard characters (\*, ?, and \[\]) are allowed.
The maximum summary size of all files in the listed directories are the
same as in `floppy_files`.
- `guest_additions_mode` (string) - How should guest additions be installed.
If value `attach` then attach iso image with by specified by `guest_additions_path`.
Otherwise guest additions is not installed.
- `guest_additions_path` (string) - The path to the iso image for guest additions.
- `guest_additions_path` (string) - The path to the iso image for guest additions.
- `http_directory` (string) - Path to a directory to serve using an HTTP
- `http_directory` (string) - Path to a directory to serve using an HTTP
server. The files in this directory will be available over HTTP that will
be requestable from the virtual machine. This is useful for hosting
kickstart files and so on. By default this is "", which means no HTTP
@ -127,50 +135,50 @@ can be configured for this builder.
available as variables in `boot_command`. This is covered in more detail
below.
- `http_port_min` and `http_port_max` (integer) - These are the minimum and
- `http_port_min` and `http_port_max` (integer) - These are the minimum and
maximum port to use for the HTTP server started to serve the `http_directory`.
Because Packer often runs in parallel, Packer will choose a randomly available
port in this range to run the HTTP server. If you want to force the HTTP
server to be on one port, make this minimum and maximum port the same.
By default the values are 8000 and 9000, respectively.
- `iso_checksum` (string) - The checksum for the OS ISO file. Because ISO
- `iso_checksum` (string) - The checksum for the OS ISO file. Because ISO
files are so large, this is required and Packer will verify it prior
to booting a virtual machine with the ISO attached. The type of the
checksum is specified with `iso_checksum_type`, documented below.
- `iso_checksum_type` (string) - The type of the checksum specified in
- `iso_checksum_type` (string) - The type of the checksum specified in
`iso_checksum`. Valid values are "none", "md5", "sha1", "sha256", or
"sha512" currently. While "none" will skip checksumming, this is not
recommended since ISO files are generally large and corruption does happen
from time to time.
- `iso_url` (string) - A URL to the ISO containing the installation image.
- `iso_url` (string) - A URL to the ISO containing the installation image.
This URL can be either an HTTP URL or a file URL (or path to a file).
If this is an HTTP URL, Packer will download iso and cache it between
runs.
- `iso_urls` (array of strings) - Multiple URLs for the ISO to download.
- `iso_urls` (array of strings) - Multiple URLs for the ISO to download.
Packer will try these in order. If anything goes wrong attempting to download
or while downloading a single URL, it will move on to the next. All URLs
must point to the same file (same checksum). By default this is empty
and `iso_url` is used. Only one of `iso_url` or `iso_urls` can be specified.
- `iso_target_extension` (string) - The extension of the iso file after
- `iso_target_extension` (string) - The extension of the iso file after
download. This defaults to "iso".
- `iso_target_path` (string) - The path where the iso should be saved after
- `iso_target_path` (string) - The path where the iso should be saved after
download. By default will go in the packer cache, with a hash of the
original filename as its name.
- `output_directory` (string) - This is the path to the directory where the
- `output_directory` (string) - This is the path to the directory where the
resulting virtual machine will be created. This may be relative or absolute.
If relative, the path is relative to the working directory when `packer`
is executed. This directory must not exist or be empty prior to running the builder.
By default this is "output-BUILDNAME" where "BUILDNAME" is the name
of the build.
- `ram_size` (integer) - The size, in megabytes, of the ram to create
- `ram_size` (integer) - The size, in megabytes, of the ram to create
for the VM. By default, this is 1 GB.
* `secondary_iso_images` (array of strings) - A list of iso paths to attached to a
@ -178,33 +186,33 @@ can be configured for this builder.
look for an `Autounattend.xml` file on removable media. By default, no
secondary iso will be attached.
- `shutdown_command` (string) - The command to use to gracefully shut down the machine once all
- `shutdown_command` (string) - The command to use to gracefully shut down the machine once all
the provisioning is done. By default this is an empty string, which tells Packer to just
forcefully shut down the machine unless a shutdown command takes place inside script so this may
safely be omitted. If one or more scripts require a reboot it is suggested to leave this blank
since reboots may fail and specify the final shutdown command in your last script.
- `shutdown_timeout` (string) - The amount of time to wait after executing
- `shutdown_timeout` (string) - The amount of time to wait after executing
the `shutdown_command` for the virtual machine to actually shut down.
If it doesn't shut down in this time, it is an error. By default, the timeout
is "5m", or five minutes.
- `skip_compaction` (bool) - If true skip compacting the hard disk for virtual machine when
- `skip_compaction` (bool) - If true skip compacting the hard disk for virtual machine when
exporting. This defaults to false.
- `switch_name` (string) - The name of the switch to connect the virtual machine to. Be defaulting
- `switch_name` (string) - The name of the switch to connect the virtual machine to. Be defaulting
this to an empty string, Packer will try to determine the switch to use by looking for
external switch that is up and running.
- `switch_vlan_id` (string) - This is the vlan of the virtual switch's network card.
- switch_vlan_id` (string) - This is the vlan of the virtual switch's network card.
By default none is set. If none is set then a vlan is not set on the switch's network card.
If this value is set it should match the vlan specified in by `vlan_id`.
- `vlan_id` (string) - This is the vlan of the virtual machine's network card for the new virtual
- `vlan_id` (string) - This is the vlan of the virtual machine's network card for the new virtual
machine. By default none is set. If none is set then vlans are not set on the virtual machine's
network card.
- `vm_name` (string) - This is the name of the virtual machine for the new virtual
- `vm_name` (string) - This is the name of the virtual machine for the new virtual
machine, without the file extension. By default this is "packer-BUILDNAME",
where "BUILDNAME" is the name of the build.
@ -224,47 +232,47 @@ to the machine, simulating a human actually typing the keyboard. There are
a set of special keys available. If these are in your boot command, they
will be replaced by the proper key:
- `<bs>` - Backspace
- `<bs>` - Backspace
- `<del>` - Delete
- `<del>` - Delete
- `<enter>` and `<return>` - Simulates an actual "enter" or "return" keypress.
- `<enter>` and `<return>` - Simulates an actual "enter" or "return" keypress.
- `<esc>` - Simulates pressing the escape key.
- `<esc>` - Simulates pressing the escape key.
- `<tab>` - Simulates pressing the tab key.
- `<tab>` - Simulates pressing the tab key.
- `<f1>` - `<f12>` - Simulates pressing a function key.
- `<f1>` - `<f12>` - Simulates pressing a function key.
- `<up>` `<down>` `<left>` `<right>` - Simulates pressing an arrow key.
- `<up>` `<down>` `<left>` `<right>` - Simulates pressing an arrow key.
- `<spacebar>` - Simulates pressing the spacebar.
- `<spacebar>` - Simulates pressing the spacebar.
- `<insert>` - Simulates pressing the insert key.
- `<insert>` - Simulates pressing the insert key.
- `<home>` `<end>` - Simulates pressing the home and end keys.
- `<home>` `<end>` - Simulates pressing the home and end keys.
- `<pageUp>` `<pageDown>` - Simulates pressing the page up and page down keys.
- `<pageUp>` `<pageDown>` - Simulates pressing the page up and page down keys.
- `<leftAlt>` `<rightAlt>` - Simulates pressing the alt key.
- `<leftAlt>` `<rightAlt>` - Simulates pressing the alt key.
- `<leftCtrl>` `<rightCtrl>` - Simulates pressing the ctrl key.
- `<leftCtrl>` `<rightCtrl>` - Simulates pressing the ctrl key.
- `<leftShift>` `<rightShift>` - Simulates pressing the shift key.
- `<leftShift>` `<rightShift>` - Simulates pressing the shift key.
- `<leftAltOn>` `<rightAltOn>` - Simulates pressing and holding the alt key.
- `<leftAltOn>` `<rightAltOn>` - Simulates pressing and holding the alt key.
- `<leftCtrlOn>` `<rightCtrlOn>` - Simulates pressing and holding the ctrl key.
- `<leftCtrlOn>` `<rightCtrlOn>` - Simulates pressing and holding the ctrl key.
- `<leftShiftOn>` `<rightShiftOn>` - Simulates pressing and holding the shift key.
- `<leftShiftOn>` `<rightShiftOn>` - Simulates pressing and holding the shift key.
- `<leftAltOff>` `<rightAltOff>` - Simulates releasing a held alt key.
- `<leftAltOff>` `<rightAltOff>` - Simulates releasing a held alt key.
- `<leftCtrlOff>` `<rightCtrlOff>` - Simulates releasing a held ctrl key.
- `<leftCtrlOff>` `<rightCtrlOff>` - Simulates releasing a held ctrl key.
- `<leftShiftOff>` `<rightShiftOff>` - Simulates releasing a held shift key.
- `<leftShiftOff>` `<rightShiftOff>` - Simulates releasing a held shift key.
- `<wait>` `<wait5>` `<wait10>` - Adds a 1, 5 or 10 second pause before
- `<wait>` `<wait5>` `<wait10>` - Adds a 1, 5 or 10 second pause before
sending any additional keys. This is useful if you have to generally wait
for the UI to update before typing more.