Documentation
¶
Index ¶
- type BackingStoreVolumeSource
- func (*BackingStoreVolumeSource) FlatMapstructure() interface{ ... }
- func (vs *BackingStoreVolumeSource) PrepareConfig(ctx *interpolate.Context, vol *Volume) (warnings []string, errs []error)
- func (vs *BackingStoreVolumeSource) PrepareVolume(pctx *PreparationContext) multistep.StepAction
- func (vs *BackingStoreVolumeSource) UpdateDomainDiskXml(domainDisk *libvirtxml.DomainDisk)
- func (vs *BackingStoreVolumeSource) UpdateStorageDefinitionXml(storageDef *libvirtxml.StorageVolume)
- type CloningVolumeSource
- func (*CloningVolumeSource) FlatMapstructure() interface{ ... }
- func (vs *CloningVolumeSource) PrepareConfig(ctx *interpolate.Context, vol *Volume) (warnings []string, errs []error)
- func (vs *CloningVolumeSource) PrepareVolume(pctx *PreparationContext) multistep.StepAction
- func (vs *CloningVolumeSource) UpdateDomainDiskXml(domainDisk *libvirtxml.DomainDisk)
- func (vs *CloningVolumeSource) UpdateStorageDefinitionXml(storageDef *libvirtxml.StorageVolume)
- type CloudInitSource
- func (*CloudInitSource) FlatMapstructure() interface{ ... }
- func (vs *CloudInitSource) PrepareConfig(ctx *interpolate.Context, vol *Volume, domainName string) (warnings []string, errs []error)
- func (vs *CloudInitSource) PrepareVolume(pctx *PreparationContext) multistep.StepAction
- func (vs *CloudInitSource) UpdateDomainDiskXml(domainDisk *libvirtxml.DomainDisk)
- func (vs *CloudInitSource) UpdateStorageDefinitionXml(storageDef *libvirtxml.StorageVolume)
- type ExternalVolumeSource
- func (*ExternalVolumeSource) FlatMapstructure() interface{ ... }
- func (vs *ExternalVolumeSource) PrepareConfig(ctx *interpolate.Context, vol *Volume) (warnings []string, errs []error)
- func (vs *ExternalVolumeSource) PrepareVolume(pctx *PreparationContext) multistep.StepAction
- func (vs *ExternalVolumeSource) UpdateDomainDiskXml(domainDisk *libvirtxml.DomainDisk)
- func (vs *ExternalVolumeSource) UpdateStorageDefinitionXml(storageDef *libvirtxml.StorageVolume)
- type FlatBackingStoreVolumeSource
- type FlatCloningVolumeSource
- type FlatCloudInitSource
- type FlatExternalVolumeSource
- type FlatVolume
- type FlatVolumeSource
- type PreparationContext
- func (pctx *PreparationContext) CloneVolumeFrom(sourcePool libvirt.StoragePool, sourceVol libvirt.StorageVol) error
- func (pctx *PreparationContext) CreateVolume() error
- func (pctx *PreparationContext) HaltOnError(err error, s string, a ...interface{}) multistep.StepAction
- func (pctx *PreparationContext) RefreshVolumeDefinition() error
- type Volume
- func (v *Volume) DomainDiskXml() *libvirtxml.DomainDisk
- func (*Volume) FlatMapstructure() interface{ ... }
- func (v *Volume) PrepareConfig(ctx *interpolate.Context, domainName string) (warnings []string, errs []error)
- func (v *Volume) PrepareVolume(pctx *PreparationContext) multistep.StepAction
- func (v *Volume) StorageDefinitionXml() (*libvirtxml.StorageVolume, error)
- type VolumeSource
- func (*VolumeSource) FlatMapstructure() interface{ ... }
- func (vs *VolumeSource) PrepareConfig(ctx *interpolate.Context, vol *Volume, domainName string) (warnings []string, errs []error)
- func (vs *VolumeSource) PrepareVolume(pctx *PreparationContext) multistep.StepAction
- func (vs *VolumeSource) UpdateDomainDiskXml(domainDisk *libvirtxml.DomainDisk)
- func (vs *VolumeSource) UpdateStorageDefinitionXml(storageDef *libvirtxml.StorageVolume)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BackingStoreVolumeSource ¶
type BackingStoreVolumeSource struct {
// Specifies the name of the storage pool (managed by libvirt) where the disk source resides
Pool string `mapstucture:"pool" required:"false"`
// Specifies the name of storage volume (managed by libvirt) used as the disk source.
Volume string `mapstructure:"volume" required:"false"`
// The file backing the volume. Mutually exclusive with pool and volume args!
Path string `mapstructure:"path" required:"false"`
}
func (*BackingStoreVolumeSource) FlatMapstructure ¶
func (*BackingStoreVolumeSource) FlatMapstructure() interface{ HCL2Spec() map[string]hcldec.Spec }
FlatMapstructure returns a new FlatBackingStoreVolumeSource. FlatBackingStoreVolumeSource is an auto-generated flat version of BackingStoreVolumeSource. Where the contents a fields with a `mapstructure:,squash` tag are bubbled up.
func (*BackingStoreVolumeSource) PrepareConfig ¶
func (vs *BackingStoreVolumeSource) PrepareConfig(ctx *interpolate.Context, vol *Volume) (warnings []string, errs []error)
func (*BackingStoreVolumeSource) PrepareVolume ¶
func (vs *BackingStoreVolumeSource) PrepareVolume(pctx *PreparationContext) multistep.StepAction
func (*BackingStoreVolumeSource) UpdateDomainDiskXml ¶
func (vs *BackingStoreVolumeSource) UpdateDomainDiskXml(domainDisk *libvirtxml.DomainDisk)
func (*BackingStoreVolumeSource) UpdateStorageDefinitionXml ¶
func (vs *BackingStoreVolumeSource) UpdateStorageDefinitionXml(storageDef *libvirtxml.StorageVolume)
type CloningVolumeSource ¶ added in v0.2.0
type CloningVolumeSource struct {
// Specifies the name of the storage pool (managed by libvirt) where the disk source resides
Pool string `mapstucture:"pool" required:"false"`
// Specifies the name of storage volume (managed by libvirt) used as the disk source.
Volume string `mapstructure:"volume" required:"false"`
}
func (*CloningVolumeSource) FlatMapstructure ¶ added in v0.2.0
func (*CloningVolumeSource) FlatMapstructure() interface{ HCL2Spec() map[string]hcldec.Spec }
FlatMapstructure returns a new FlatCloningVolumeSource. FlatCloningVolumeSource is an auto-generated flat version of CloningVolumeSource. Where the contents a fields with a `mapstructure:,squash` tag are bubbled up.
func (*CloningVolumeSource) PrepareConfig ¶ added in v0.2.0
func (vs *CloningVolumeSource) PrepareConfig(ctx *interpolate.Context, vol *Volume) (warnings []string, errs []error)
func (*CloningVolumeSource) PrepareVolume ¶ added in v0.2.0
func (vs *CloningVolumeSource) PrepareVolume(pctx *PreparationContext) multistep.StepAction
func (*CloningVolumeSource) UpdateDomainDiskXml ¶ added in v0.2.0
func (vs *CloningVolumeSource) UpdateDomainDiskXml(domainDisk *libvirtxml.DomainDisk)
func (*CloningVolumeSource) UpdateStorageDefinitionXml ¶ added in v0.2.0
func (vs *CloningVolumeSource) UpdateStorageDefinitionXml(storageDef *libvirtxml.StorageVolume)
type CloudInitSource ¶
type CloudInitSource struct {
// [optional] NoCloud instance metadata as string.
// If not present, a default one will be generated with the instance-id set to the same value as the domain name
// If you want to set network config, see the `network_config` attribute
MetaData *string `mapstructure:"meta_data"`
// [optional] CloudInit user-data as string.
// See [cloud-init documentation](https://cloudinit.readthedocs.io/en/latest/topics/format.html) for more
UserData *string `mapstructure:"user_data"`
// [optional] Network configuration for cloud-init to be picked up.
// User-data cannot change an instance’s network configuration.
// In the absence of network configuration in any sources,
// Cloud-init will write out a network configuration that will issue a DHCP request on a “first” network interface.
// Read more about the possible format and features at
// [cloud-init documentation](https://cloudinit.readthedocs.io/en/latest/topics/network-config.html).
NetworkConfig *string `mapstructure:"network_config"`
}
func (*CloudInitSource) FlatMapstructure ¶
func (*CloudInitSource) FlatMapstructure() interface{ HCL2Spec() map[string]hcldec.Spec }
FlatMapstructure returns a new FlatCloudInitSource. FlatCloudInitSource is an auto-generated flat version of CloudInitSource. Where the contents a fields with a `mapstructure:,squash` tag are bubbled up.
func (*CloudInitSource) PrepareConfig ¶
func (vs *CloudInitSource) PrepareConfig(ctx *interpolate.Context, vol *Volume, domainName string) (warnings []string, errs []error)
func (*CloudInitSource) PrepareVolume ¶
func (vs *CloudInitSource) PrepareVolume(pctx *PreparationContext) multistep.StepAction
func (*CloudInitSource) UpdateDomainDiskXml ¶
func (vs *CloudInitSource) UpdateDomainDiskXml(domainDisk *libvirtxml.DomainDisk)
func (*CloudInitSource) UpdateStorageDefinitionXml ¶
func (vs *CloudInitSource) UpdateStorageDefinitionXml(storageDef *libvirtxml.StorageVolume)
type ExternalVolumeSource ¶ added in v0.3.0
type ExternalVolumeSource struct {
// The checksum and the type of the checksum for the download
Checksum string `mapstructure:"checksum"`
// A list of URLs from where this volume can be obtained
Urls []string `mapstructure:"urls"`
}
An external volume source defines a volume source that is external (or remote) to the libvirt hypervisor. This usually means a cloud image or installation media from the web or local machine. It's using go-getter under the hood with support for HTTP, HTTPS, S3, SMB and local files. The files will be cached by Packer.
func (*ExternalVolumeSource) FlatMapstructure ¶ added in v0.3.0
func (*ExternalVolumeSource) FlatMapstructure() interface{ HCL2Spec() map[string]hcldec.Spec }
FlatMapstructure returns a new FlatExternalVolumeSource. FlatExternalVolumeSource is an auto-generated flat version of ExternalVolumeSource. Where the contents a fields with a `mapstructure:,squash` tag are bubbled up.
func (*ExternalVolumeSource) PrepareConfig ¶ added in v0.3.0
func (vs *ExternalVolumeSource) PrepareConfig(ctx *interpolate.Context, vol *Volume) (warnings []string, errs []error)
func (*ExternalVolumeSource) PrepareVolume ¶ added in v0.3.0
func (vs *ExternalVolumeSource) PrepareVolume(pctx *PreparationContext) multistep.StepAction
func (*ExternalVolumeSource) UpdateDomainDiskXml ¶ added in v0.3.0
func (vs *ExternalVolumeSource) UpdateDomainDiskXml(domainDisk *libvirtxml.DomainDisk)
func (*ExternalVolumeSource) UpdateStorageDefinitionXml ¶ added in v0.3.0
func (vs *ExternalVolumeSource) UpdateStorageDefinitionXml(storageDef *libvirtxml.StorageVolume)
type FlatBackingStoreVolumeSource ¶
type FlatBackingStoreVolumeSource struct {
Pool *string `mapstucture:"pool" required:"false" cty:"pool" hcl:"pool"`
Volume *string `mapstructure:"volume" required:"false" cty:"volume" hcl:"volume"`
Path *string `mapstructure:"path" required:"false" cty:"path" hcl:"path"`
}
FlatBackingStoreVolumeSource is an auto-generated flat version of BackingStoreVolumeSource. Where the contents of a field with a `mapstructure:,squash` tag are bubbled up.
func (*FlatBackingStoreVolumeSource) HCL2Spec ¶
func (*FlatBackingStoreVolumeSource) HCL2Spec() map[string]hcldec.Spec
HCL2Spec returns the hcl spec of a BackingStoreVolumeSource. This spec is used by HCL to read the fields of BackingStoreVolumeSource. The decoded values from this spec will then be applied to a FlatBackingStoreVolumeSource.
type FlatCloningVolumeSource ¶ added in v0.2.0
type FlatCloningVolumeSource struct {
Pool *string `mapstucture:"pool" required:"false" cty:"pool" hcl:"pool"`
Volume *string `mapstructure:"volume" required:"false" cty:"volume" hcl:"volume"`
}
FlatCloningVolumeSource is an auto-generated flat version of CloningVolumeSource. Where the contents of a field with a `mapstructure:,squash` tag are bubbled up.
func (*FlatCloningVolumeSource) HCL2Spec ¶ added in v0.2.0
func (*FlatCloningVolumeSource) HCL2Spec() map[string]hcldec.Spec
HCL2Spec returns the hcl spec of a CloningVolumeSource. This spec is used by HCL to read the fields of CloningVolumeSource. The decoded values from this spec will then be applied to a FlatCloningVolumeSource.
type FlatCloudInitSource ¶
type FlatCloudInitSource struct {
MetaData *string `mapstructure:"meta_data" cty:"meta_data" hcl:"meta_data"`
UserData *string `mapstructure:"user_data" cty:"user_data" hcl:"user_data"`
NetworkConfig *string `mapstructure:"network_config" cty:"network_config" hcl:"network_config"`
}
FlatCloudInitSource is an auto-generated flat version of CloudInitSource. Where the contents of a field with a `mapstructure:,squash` tag are bubbled up.
type FlatExternalVolumeSource ¶ added in v0.3.0
type FlatExternalVolumeSource struct {
Checksum *string `mapstructure:"checksum" cty:"checksum" hcl:"checksum"`
Urls []string `mapstructure:"urls" cty:"urls" hcl:"urls"`
}
FlatExternalVolumeSource is an auto-generated flat version of ExternalVolumeSource. Where the contents of a field with a `mapstructure:,squash` tag are bubbled up.
func (*FlatExternalVolumeSource) HCL2Spec ¶ added in v0.3.0
func (*FlatExternalVolumeSource) HCL2Spec() map[string]hcldec.Spec
HCL2Spec returns the hcl spec of a ExternalVolumeSource. This spec is used by HCL to read the fields of ExternalVolumeSource. The decoded values from this spec will then be applied to a FlatExternalVolumeSource.
type FlatVolume ¶
type FlatVolume struct {
Pool *string `mapstructure:"pool" required:"false" cty:"pool" hcl:"pool"`
Name *string `mapstructure:"name" required:"false" cty:"name" hcl:"name"`
Source *FlatVolumeSource `mapstructure:"source" required:"false" cty:"source" hcl:"source"`
Size *string `mapstructure:"size" required:"false" cty:"size" hcl:"size"`
Capacity *string `mapstructure:"capacity" required:"false" cty:"capacity" hcl:"capacity"`
ReadOnly *bool `mapstructure:"readonly" required:"false" cty:"readonly" hcl:"readonly"`
TargetDev *string `mapstructure:"target_dev" required:"false" cty:"target_dev" hcl:"target_dev"`
Bus *string `mapstructure:"bus" required:"false" cty:"bus" hcl:"bus"`
Alias *string `mapstructure:"alias" required:"false" cty:"alias" hcl:"alias"`
Format *string `mapstructure:"format" required:"false" cty:"format" hcl:"format"`
}
FlatVolume is an auto-generated flat version of Volume. Where the contents of a field with a `mapstructure:,squash` tag are bubbled up.
type FlatVolumeSource ¶
type FlatVolumeSource struct {
Type *string `mapstructure:"type" required:"true" cty:"type" hcl:"type"`
Checksum *string `mapstructure:"checksum" cty:"checksum" hcl:"checksum"`
Urls []string `mapstructure:"urls" cty:"urls" hcl:"urls"`
MetaData *string `mapstructure:"meta_data" cty:"meta_data" hcl:"meta_data"`
UserData *string `mapstructure:"user_data" cty:"user_data" hcl:"user_data"`
NetworkConfig *string `mapstructure:"network_config" cty:"network_config" hcl:"network_config"`
Pool *string `mapstucture:"pool" required:"false" cty:"pool" hcl:"pool"`
Volume *string `mapstructure:"volume" required:"false" cty:"volume" hcl:"volume"`
Path *string `mapstructure:"path" required:"false" cty:"path" hcl:"path"`
}
FlatVolumeSource is an auto-generated flat version of VolumeSource. Where the contents of a field with a `mapstructure:,squash` tag are bubbled up.
type PreparationContext ¶
type PreparationContext struct {
State multistep.StateBag
Ui packersdk.Ui
Driver *libvirt.Libvirt
VolumeConfig *Volume
VolumeRef *libvirt.StorageVol
VolumeDefinition *libvirtxml.StorageVolume
PoolRef *libvirt.StoragePool
VolumeIsCreated bool
VolumeIsArtifact bool
Context context.Context
}
func (*PreparationContext) CloneVolumeFrom ¶ added in v0.2.0
func (pctx *PreparationContext) CloneVolumeFrom(sourcePool libvirt.StoragePool, sourceVol libvirt.StorageVol) error
func (*PreparationContext) CreateVolume ¶
func (pctx *PreparationContext) CreateVolume() error
func (*PreparationContext) HaltOnError ¶
func (pctx *PreparationContext) HaltOnError(err error, s string, a ...interface{}) multistep.StepAction
func (*PreparationContext) RefreshVolumeDefinition ¶
func (pctx *PreparationContext) RefreshVolumeDefinition() error
type Volume ¶
type Volume struct {
// Specifies the name of the storage pool (managed by libvirt) where the disk resides. If not specified
// the pool named `default` will be used
Pool string `mapstructure:"pool" required:"false"`
// Providing a name for the volume which is unique to the pool. (For a disk pool, the name must be
// combination of the source device path device and next partition number to be
// created. For example, if the source device path is /dev/sdb and there are no
// partitions on the disk, then the name must be sdb1 with the next name being
// sdb2 and so on.)
// If not provided, a name will be generated in a format of `<domain_name>-<postfix>` where
// postfix will be either the alias or a random id.
// For cloudinit, the generated name will be `<domain_name>-cloudinit`
Name string `mapstructure:"name" required:"false"`
// Provides information about the underlying storage allocation of the volume.
// This may not be available for some pool types.
Source *VolumeSource `mapstructure:"source" required:"false"`
// Providing the total storage allocation for the volume.
// This may be smaller than the logical capacity if the volume is sparsely allocated.
// It may also be larger than the logical capacity if the volume has substantial metadata overhead.
// If omitted when creating a volume, the volume will be fully allocated at time of creation.
// If set to a value smaller than the capacity, the pool has the option of deciding to sparsely allocate a volume.
// It does not have to honour requests for sparse allocation though.
// Different types of pools may treat sparse volumes differently.
// For example, the logical pool will not automatically expand volume's allocation when it gets full;
Size string `mapstructure:"size" required:"false"`
// Providing the logical capacity for the volume. This value is in bytes by default,
// but a unit attribute can be specified with the same semantics as for allocation
// This is compulsory when creating a volume.
Capacity string `mapstructure:"capacity" required:"false"`
// If true, it indicates the device cannot be modified by the guest.
ReadOnly bool `mapstructure:"readonly" required:"false"`
// The target element controls the bus / device under which the disk is exposed
// to the guest OS. The dev attribute indicates the "logical" device name.
// The actual device name specified is not guaranteed to map to the device name
// in the guest OS. Treat it as a device ordering hint.
// If no `bus` and `target_dev` attribute is specified, it defaults to `target_dev = "sda"` with `bus = "scsi"`
TargetDev string `mapstructure:"target_dev" required:"false"`
// The optional bus attribute specifies the type of disk device to emulate;
// possible values are driver specific, with typical values being
// `ide`, `scsi`, `virtio`, `xen`, `usb`, `sata`, or `sd` `sd` since 1.1.2.
// If omitted, the bus type is inferred from the style of the device name
// (e.g. a device named 'sda' will typically be exported using a SCSI bus).
Bus string `mapstructure:"bus" required:"false"`
// To help users identifying devices they care about, every device can have an alias which must be unique within the domain.
// Additionally, the identifier must consist only of the following characters: `[a-zA-Z0-9_-]`.
Alias string `mapstructure:"alias" required:"false"`
// Specifies the volume format type, like `qcow`, `qcow2`, `vmdk`, `raw`. If omitted, the storage pool's default format
// will be used.
Format string `mapstructure:"format" required:"false"`
// contains filtered or unexported fields
}
func (*Volume) DomainDiskXml ¶
func (v *Volume) DomainDiskXml() *libvirtxml.DomainDisk
func (*Volume) FlatMapstructure ¶
FlatMapstructure returns a new FlatVolume. FlatVolume is an auto-generated flat version of Volume. Where the contents a fields with a `mapstructure:,squash` tag are bubbled up.
func (*Volume) PrepareConfig ¶
func (*Volume) PrepareVolume ¶
func (v *Volume) PrepareVolume(pctx *PreparationContext) multistep.StepAction
func (*Volume) StorageDefinitionXml ¶
func (v *Volume) StorageDefinitionXml() (*libvirtxml.StorageVolume, error)
type VolumeSource ¶
type VolumeSource struct {
Type string `mapstructure:"type" required:"true"`
External ExternalVolumeSource `mapstructure:",squash"`
CloudInit CloudInitSource `mapstructure:",squash"`
BackingStore BackingStoreVolumeSource `mapstructure:",squash"`
CloningVolume CloningVolumeSource `mapstructure:",squash"`
}
func (*VolumeSource) FlatMapstructure ¶
func (*VolumeSource) FlatMapstructure() interface{ HCL2Spec() map[string]hcldec.Spec }
FlatMapstructure returns a new FlatVolumeSource. FlatVolumeSource is an auto-generated flat version of VolumeSource. Where the contents a fields with a `mapstructure:,squash` tag are bubbled up.
func (*VolumeSource) PrepareConfig ¶
func (vs *VolumeSource) PrepareConfig(ctx *interpolate.Context, vol *Volume, domainName string) (warnings []string, errs []error)
func (*VolumeSource) PrepareVolume ¶
func (vs *VolumeSource) PrepareVolume(pctx *PreparationContext) multistep.StepAction
func (*VolumeSource) UpdateDomainDiskXml ¶
func (vs *VolumeSource) UpdateDomainDiskXml(domainDisk *libvirtxml.DomainDisk)
func (*VolumeSource) UpdateStorageDefinitionXml ¶
func (vs *VolumeSource) UpdateStorageDefinitionXml(storageDef *libvirtxml.StorageVolume)