volume

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: May 6, 2022 License: MPL-2.0 Imports: 14 Imported by: 1 module, 1 package

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

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 (*BackingStoreVolumeSource) UpdateDomainDiskXml

func (vs *BackingStoreVolumeSource) UpdateDomainDiskXml(domainDisk *libvirtxml.DomainDisk)

func (*BackingStoreVolumeSource) UpdateStorageDefinitionXml

func (vs *BackingStoreVolumeSource) 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, domain_name 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 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

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 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.

func (*FlatCloudInitSource) HCL2Spec

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

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

type FlatHttpVolumeSource

type FlatHttpVolumeSource struct {
	Url    *string `mapstructure:"url" required:"false" cty:"url" hcl:"url"`
	Format *string `mapstructure:"format" required:"false" cty:"format" hcl:"format"`
}

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

func (*FlatHttpVolumeSource) HCL2Spec

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

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

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

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

func (*FlatVolume) HCL2Spec

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

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

type FlatVolumeSource

type FlatVolumeSource struct {
	Type          *string `mapstructure:"type" required:"true" cty:"type" hcl:"type"`
	Url           *string `mapstructure:"url" required:"false" cty:"url" hcl:"url"`
	Format        *string `mapstructure:"format" required:"false" cty:"format" hcl:"format"`
	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.

func (*FlatVolumeSource) HCL2Spec

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

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

type HttpVolumeSource

type HttpVolumeSource struct {
	// [required] An URL for installation image
	Url string `mapstructure:"url" required:"false"`
	// [required] The storage format type, eg `cow`, `qcow`, `qcow2`, `vmdk`, `raw`.
	Format string `mapstructure:"format" required:"false"`
}

func (*HttpVolumeSource) FlatMapstructure

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

FlatMapstructure returns a new FlatHttpVolumeSource. FlatHttpVolumeSource is an auto-generated flat version of HttpVolumeSource. Where the contents a fields with a `mapstructure:,squash` tag are bubbled up.

func (*HttpVolumeSource) PrepareConfig

func (vs *HttpVolumeSource) PrepareConfig(ctx *interpolate.Context, vol *Volume) (warnings []string, errs []error)

func (*HttpVolumeSource) PrepareVolume

func (vs *HttpVolumeSource) PrepareVolume(pctx *PreparationContext) multistep.StepAction

func (*HttpVolumeSource) UpdateDomainDiskXml

func (vs *HttpVolumeSource) UpdateDomainDiskXml(domainDisk *libvirtxml.DomainDisk)

func (*HttpVolumeSource) UpdateStorageDefinitionXml

func (vs *HttpVolumeSource) UpdateStorageDefinitionXml(storageDef *libvirtxml.StorageVolume)

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

func (*Volume) DomainDiskXml

func (v *Volume) DomainDiskXml() *libvirtxml.DomainDisk

func (*Volume) FlatMapstructure

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

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 (v *Volume) PrepareConfig(ctx *interpolate.Context, domain_name string) (warnings []string, errs []error)

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"`
	// BackingStore BackingStoreVolumeSource `mapstructure:",squash"`
	Http         HttpVolumeSource         `mapstructure:",squash"`
	CloudInit    CloudInitSource          `mapstructure:",squash"`
	BackingStore BackingStoreVolumeSource `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, domain_name 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)

Jump to

Keyboard shortcuts

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