libvirt

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 4, 2022 License: MPL-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetDomainCommunicatorAddress

func GetDomainCommunicatorAddress(state multistep.StateBag) (string, error)

Types

type Artifact

type Artifact struct {
	// contains filtered or unexported fields
}

func (*Artifact) BuilderId

func (artifact *Artifact) BuilderId() string

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

func (artifact *Artifact) Destroy() error

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) Files

func (artifact *Artifact) Files() []string

func (*Artifact) Id

func (artifact *Artifact) Id() string

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.

func (*Artifact) State

func (artifact *Artifact) State(name string) interface{}

State allows the caller to ask for builder specific state information relating to the artifact instance.

func (*Artifact) String

func (artifact *Artifact) String() string

type Builder

type Builder struct {
	// contains filtered or unexported fields
}

func (*Builder) ConfigSpec

func (b *Builder) ConfigSpec() hcldec.ObjectSpec

func (*Builder) Prepare

func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error)

func (*Builder) Run

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"`

	// 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"`

	// 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"`

	// 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"`
	// contains filtered or unexported fields
}

func (*Config) FlatMapstructure

func (*Config) FlatMapstructure() interface{ HCL2Spec() map[string]hcldec.Spec }

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.

func (*Config) Prepare

func (c *Config) Prepare(raws ...interface{}) ([]string, error)

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"`
	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"`
	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"`
	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"`
}

FlatConfig is an auto-generated flat version of Config. Where the contents of a field with a `mapstructure:,squash` tag are bubbled up.

func (*FlatConfig) HCL2Spec

func (*FlatConfig) HCL2Spec() map[string]hcldec.Spec

HCL2Spec returns the hcl spec of a Config. This spec is used by HCL to read the fields of Config. The decoded values from this spec will then be applied to a FlatConfig.

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.

func (*FlatDomainGraphic) HCL2Spec

func (*FlatDomainGraphic) HCL2Spec() map[string]hcldec.Spec

HCL2Spec returns the hcl spec of a DomainGraphic. This spec is used by HCL to read the fields of DomainGraphic. The decoded values from this spec will then be applied to a FlatDomainGraphic.

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)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL