Documentation ¶
Index ¶
Constants ¶
const MinimalKeyHoldTime time.Duration = 5 * time.Millisecond
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Artifact ¶
type Artifact struct {
// contains filtered or unexported fields
}
func (*Artifact) BuilderId ¶
Returns the ID of the builder that was used to create this artifact. This is the internal ID of the builder and should be unique to every builder. This can be used to identify what the contents of the artifact actually are.
func (*Artifact) Destroy ¶
Destroy deletes the artifact. Packer calls this for various reasons, such as if a post-processor has processed this artifact and it is no longer needed.
func (*Artifact) Id ¶
The ID for the artifact, if it has one. This is not guaranteed to be unique every run (like a GUID), but simply provide an identifier for the artifact that may be meaningful in some way. For example, for Amazon EC2, this value might be the AMI ID.
type BootConfig ¶ added in v0.3.0
type BootConfig struct { bootcommand.BootConfig `mapstructure:",squash"` KeyHoldType time.Duration `mapstructure:"key_hold_time"` }
func (*BootConfig) Prepare ¶ added in v0.3.0
func (bc *BootConfig) Prepare(ctx *interpolate.Context) []error
type Builder ¶
type Builder struct {
// contains filtered or unexported fields
}
func (*Builder) ConfigSpec ¶
func (b *Builder) ConfigSpec() hcldec.ObjectSpec
type Config ¶
type Config struct { common.PackerConfig `mapstructure:",squash"` // Communicator configuration // See [Packer's documentation](https://www.packer.io/docs/communicators) for more. Communicator communicator.Config `mapstructure:"communicator"` // BootConfig BootConfig `mapstructure:",squash"` // The libvirt name of the domain (virtual machine) running your build // If not specified, a random name with the prefix `packer-` will be used DomainName string `mapstructure:"domain_name" required:"false"` // The amount of memory to use when building the VM // in megabytes. This defaults to 512 megabytes. MemorySize int `mapstructure:"memory" required:"false"` // The number of cpus to use when building the VM. // The default is `1` CPU. CpuCount int `mapstructure:"vcpu" required:"false"` // Set CPU mode, you might want to set it to "host-passthrough". // See [libvirt documentation](https://libvirt.org/formatdomain.html#cpu-model-and-topology) for more information. // If not specified, let libvirt decide. CpuMode string `mapstructure:"cpu_mode" required:"false"` // Network interface attachments. See [Network](#network) for more. NetworkInterfaces []network.NetworkInterface `mapstructure:"network_interface" required:"false"` // The alias of the network interface used for the SSH/WinRM connections // See [Communicators and network interfaces](#communicators-and-network-interfaces) CommunicatorInterface string `mapstructure:"communicator_interface" required:"false"` // See [Volumes](#volumes) Volumes []volume.Volume `mapstructure:"volume" required:"false"` // The alias of the drive designated to be the artifact. To learn more, // see [Volumes](#volumes) ArtifactVolumeAlias string `mapstructure:"artifact_volume_alias" required:"false"` // Device(s) from which to boot, defaults to hard drive (first volume) // Available boot devices are: `hd`, `network`, `cdrom` BootDevices []string `mapstructure:"boot_devices" required:"false"` // See [Graphics and video, headless domains](#graphics-and-video-headless-domains). DomainGraphics []DomainGraphic `mapstructure:"graphics" required:"false"` // The alias of the network interface designated as the communicator interface. // Can be either `agent`, `lease` or `arp`. Default value is `agent`. // To learn more, see [Communicators and network interfaces](#communicators-and-network-interfaces) // in the builder documentation. NetworkAddressSource string `mapstructure:"network_address_source" required:"false"` LibvirtURI string `mapstructure:"libvirt_uri" required:"true"` // Packer will instruct libvirt to use this mode to properly shut down the virtual machine // before it attempts to destroy it. Available modes are: `acpi`, `guest`, `initctl`, `signal` and `paravirt`. // If not set, libvirt will choose the method of shutdown it considers the best. ShutdownMode string `mapstructure:"shutdown_mode" required:"false"` // After succesfull provisioning, Packer will wait this long for the virtual machine to gracefully // stop before it destroys it. If not specified, Packer will wait for 5 minutes. ShutdownTimeout time.Duration `mapstructure:"shutdown_timeout" required:"false"` // [Expert] Domain type. It specifies the hypervisor used for running the domain. // The allowed values are driver specific, but include "xen", "kvm", "hvf", "qemu" and "lxc". // Default is kvm. // If unsure, leave it empty. DomainType string `mapstructure:"domain_type" required:"false"` // [Expert] Domain architecture. Default is x86_64 Arch string `mapstructure:"arch" required:"false"` // Libvirt Machine Type // Value for domain XML's machine type. If unsure, leave it empty Chipset string `mapstructure:"chipset" required:"false"` // [Expert] Refers to a firmware blob, which is specified by absolute path, used to assist the domain creation process. // If unsure, leave it empty. LoaderPath string `mapstructure:"loader_path" required:"false"` // [Expert] Accepts values rom and pflash. It tells the hypervisor where in the guest memory the loader(rom) should be mapped. // If unsure, leave it empty. LoaderType string `mapstructure:"loader_type" required:"false"` // [Expert] Some firmwares may implement the Secure boot feature. // This attribute can be used to tell the hypervisor that the firmware is capable of Secure Boot feature. // It cannot be used to enable or disable the feature itself in the firmware. // If unsure, leave it empty. SecureBoot bool `mapstructure:"secure_boot" required:"false"` // [Expert] Some UEFI firmwares may want to use a non-volatile memory to store some variables. // In the host, this is represented as a file and the absolute path to the file is stored in this element. // If unsure, leave it empty.` NvramPath string `mapstructure:"nvram_path" required:"false"` // [Expert] If the domain is an UEFI domain, libvirt copies a so called master NVRAM store file defined in qemu.conf. // If needed, the template attribute can be used to per domain override map of master NVRAM stores from the config file. // If unsure, leave it empty. NvramTemplate string `mapstructure:"nvram_template" required:"false"` // contains filtered or unexported fields }
func (*Config) FlatMapstructure ¶
FlatMapstructure returns a new FlatConfig. FlatConfig is an auto-generated flat version of Config. Where the contents a fields with a `mapstructure:,squash` tag are bubbled up.
type DomainGraphic ¶
type DomainGraphic struct { // Type of the graphic defined with this block. Required. Must be either `vnc` or `sdl`. Type string `mapstructure:"type" required:"true"` Sdl SdlDomainGraphic `mapstructure:",squash"` Vnc VNCDomainGraphic `mapstructure:",squash"` }
func (DomainGraphic) DomainGraphic ¶
func (dg DomainGraphic) DomainGraphic() *libvirtxml.DomainGraphic
func (*DomainGraphic) FlatMapstructure ¶
func (*DomainGraphic) FlatMapstructure() interface{ HCL2Spec() map[string]hcldec.Spec }
FlatMapstructure returns a new FlatDomainGraphic. FlatDomainGraphic is an auto-generated flat version of DomainGraphic. Where the contents a fields with a `mapstructure:,squash` tag are bubbled up.
func (*DomainGraphic) Prepare ¶
func (dg *DomainGraphic) Prepare(ctx interpolate.Context) (warnings []string, errs []error)
type FlatConfig ¶
type FlatConfig struct { PackerBuildName *string `mapstructure:"packer_build_name" cty:"packer_build_name" hcl:"packer_build_name"` PackerBuilderType *string `mapstructure:"packer_builder_type" cty:"packer_builder_type" hcl:"packer_builder_type"` PackerCoreVersion *string `mapstructure:"packer_core_version" cty:"packer_core_version" hcl:"packer_core_version"` PackerDebug *bool `mapstructure:"packer_debug" cty:"packer_debug" hcl:"packer_debug"` PackerForce *bool `mapstructure:"packer_force" cty:"packer_force" hcl:"packer_force"` PackerOnError *string `mapstructure:"packer_on_error" cty:"packer_on_error" hcl:"packer_on_error"` PackerUserVars map[string]string `mapstructure:"packer_user_variables" cty:"packer_user_variables" hcl:"packer_user_variables"` PackerSensitiveVars []string `mapstructure:"packer_sensitive_variables" cty:"packer_sensitive_variables" hcl:"packer_sensitive_variables"` Communicator *communicator.FlatConfig `mapstructure:"communicator" cty:"communicator" hcl:"communicator"` BootGroupInterval *string `mapstructure:"boot_keygroup_interval" cty:"boot_keygroup_interval" hcl:"boot_keygroup_interval"` BootWait *string `mapstructure:"boot_wait" cty:"boot_wait" hcl:"boot_wait"` BootCommand []string `mapstructure:"boot_command" cty:"boot_command" hcl:"boot_command"` KeyHoldType *string `mapstructure:"key_hold_time" cty:"key_hold_time" hcl:"key_hold_time"` DomainName *string `mapstructure:"domain_name" required:"false" cty:"domain_name" hcl:"domain_name"` MemorySize *int `mapstructure:"memory" required:"false" cty:"memory" hcl:"memory"` CpuCount *int `mapstructure:"vcpu" required:"false" cty:"vcpu" hcl:"vcpu"` CpuMode *string `mapstructure:"cpu_mode" required:"false" cty:"cpu_mode" hcl:"cpu_mode"` NetworkInterfaces []network.FlatNetworkInterface `mapstructure:"network_interface" required:"false" cty:"network_interface" hcl:"network_interface"` CommunicatorInterface *string `mapstructure:"communicator_interface" required:"false" cty:"communicator_interface" hcl:"communicator_interface"` Volumes []volume.FlatVolume `mapstructure:"volume" required:"false" cty:"volume" hcl:"volume"` ArtifactVolumeAlias *string `mapstructure:"artifact_volume_alias" required:"false" cty:"artifact_volume_alias" hcl:"artifact_volume_alias"` BootDevices []string `mapstructure:"boot_devices" required:"false" cty:"boot_devices" hcl:"boot_devices"` DomainGraphics []FlatDomainGraphic `mapstructure:"graphics" required:"false" cty:"graphics" hcl:"graphics"` NetworkAddressSource *string `mapstructure:"network_address_source" required:"false" cty:"network_address_source" hcl:"network_address_source"` LibvirtURI *string `mapstructure:"libvirt_uri" required:"true" cty:"libvirt_uri" hcl:"libvirt_uri"` ShutdownMode *string `mapstructure:"shutdown_mode" required:"false" cty:"shutdown_mode" hcl:"shutdown_mode"` ShutdownTimeout *string `mapstructure:"shutdown_timeout" required:"false" cty:"shutdown_timeout" hcl:"shutdown_timeout"` DomainType *string `mapstructure:"domain_type" required:"false" cty:"domain_type" hcl:"domain_type"` Arch *string `mapstructure:"arch" required:"false" cty:"arch" hcl:"arch"` Chipset *string `mapstructure:"chipset" required:"false" cty:"chipset" hcl:"chipset"` LoaderPath *string `mapstructure:"loader_path" required:"false" cty:"loader_path" hcl:"loader_path"` LoaderType *string `mapstructure:"loader_type" required:"false" cty:"loader_type" hcl:"loader_type"` SecureBoot *bool `mapstructure:"secure_boot" required:"false" cty:"secure_boot" hcl:"secure_boot"` NvramPath *string `mapstructure:"nvram_path" required:"false" cty:"nvram_path" hcl:"nvram_path"` NvramTemplate *string `mapstructure:"nvram_template" required:"false" cty:"nvram_template" hcl:"nvram_template"` }
FlatConfig is an auto-generated flat version of Config. Where the contents of a field with a `mapstructure:,squash` tag are bubbled up.
type FlatDomainGraphic ¶
type FlatDomainGraphic struct { Type *string `mapstructure:"type" required:"true" cty:"type" hcl:"type"` Display *string `mapstructure:"display" required:"false" cty:"display" hcl:"display"` Port *int `mapstructure:"port" required:"false" cty:"port" hcl:"port"` }
FlatDomainGraphic is an auto-generated flat version of DomainGraphic. Where the contents of a field with a `mapstructure:,squash` tag are bubbled up.
type SdlDomainGraphic ¶
type SdlDomainGraphic struct { // An X11 Display number where the SDL window will be sent. Required for type `sdl` Display string `mapstructure:"display" required:"false"` }
func (*SdlDomainGraphic) Prepare ¶
func (dg *SdlDomainGraphic) Prepare(ctx interpolate.Context) (warnings []string, errs []error)
func (*SdlDomainGraphic) UpdateDomainGraphic ¶
func (dg *SdlDomainGraphic) UpdateDomainGraphic(graphic *libvirtxml.DomainGraphic)
type VNCDomainGraphic ¶
type VNCDomainGraphic struct { // TCP port used for VNC server to listen on. // The number zero means the hypervisor will pick a free port randomly. // If not set, the autoport feature will be used. Port int `mapstructure:"port" required:"false"` }
func (*VNCDomainGraphic) Prepare ¶
func (dg *VNCDomainGraphic) Prepare(ctx interpolate.Context) (warnings []string, errs []error)
func (*VNCDomainGraphic) UpdateDomainGraphic ¶
func (dg *VNCDomainGraphic) UpdateDomainGraphic(graphic *libvirtxml.DomainGraphic)