config

package
v0.0.0-...-22ca86b Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2026 License: AGPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultMetadataVersion = api.BackupMetadataVersion2

DefaultMetadataVersion represents the current default version of the format used when writing a backup's metadata. The metadata is used both for exporting backups and for migration. Starting from LXD 6.x onwards version 2 of the format is used.

View Source
const MaxMetadataVersion = api.BackupMetadataVersion2

MaxMetadataVersion represents the latest supported metadata version.

View Source
const TypeContainer = Type("container")

TypeContainer defines the backup type value for a container.

View Source
const TypeCustom = Type("custom")

TypeCustom defines the backup type value for a custom volume.

View Source
const TypeUnknown = Type("")

TypeUnknown defines the backup type value for unknown backups.

View Source
const TypeVM = Type("virtual-machine")

TypeVM defines the backup type value for a virtual-machine.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bucket

type Bucket struct {
	// Make sure to have the embedded structs fields inline to avoid nesting.
	*api.StorageBucket `yaml:",inline"` //nolint:musttag
}

Bucket represents the config of a bucket including its snapshots.

type Config

type Config struct {

	// The JSON representation of the fields does not use lowercase (and omitempty) to stay backwards compatible
	// across all versions of LXD as the Config struct is also used throughout the migration.
	Version   uint32                  `json:"Version" yaml:"version,omitempty"`
	Instance  *api.Instance           `json:"Instance" yaml:"instance,omitempty"`
	Snapshots []*api.InstanceSnapshot `json:"Snapshots" yaml:"snapshots,omitempty"`
	Pools     []*api.StoragePool      `json:"Pools" yaml:"pools,omitempty"`
	Profiles  []*api.Profile          `json:"Profiles" yaml:"profiles,omitempty"`
	Volumes   []*Volume               `json:"Volumes" yaml:"volumes,omitempty"`
	Bucket    *Bucket                 `json:"Bucket" yaml:"bucket,omitempty"`
	// Deprecated: Use Instance instead.
	Container *api.Instance `json:"Container" yaml:"container,omitempty"`
	// Deprecated: Use Pools instead.
	Pool *api.StoragePool `json:"Pool" yaml:"pool,omitempty"`
	// Deprecated: Use Volumes instead.
	Volume *api.StorageVolume `json:"Volume" yaml:"volume,omitempty"`
	// Deprecated: Use the list of Snapshots under Volumes.
	VolumeSnapshots []*api.StorageVolumeSnapshot `json:"VolumeSnapshots" yaml:"volume_snapshots,omitempty"`
	// contains filtered or unexported fields
}

Config represents the config of a backup that can be stored in a backup.yaml file (or embedded in index.yaml).

func NewConfig

func NewConfig(lastModified time.Time) *Config

NewConfig returns a new Config instance initialized with an immutable last modified time.

func (*Config) CustomVolume

func (c *Config) CustomVolume() (*Volume, error)

CustomVolume returns the single custom volume. Unlike RootVolume, CustomVolume always returns the first and only volume in the list.

func (*Config) CustomVolumePool

func (c *Config) CustomVolumePool() (*api.StoragePool, error)

CustomVolumePool returns the pool of the custom volume.

func (*Config) LastModified

func (c *Config) LastModified() time.Time

LastModified returns the backup config's immutable last modification time.

func (*Config) RootVolume

func (c *Config) RootVolume() (*Volume, error)

RootVolume returns an instance's root volume from the list of volumes. The volume's name matches the one of the instance.

func (*Config) RootVolumePool

func (c *Config) RootVolumePool() (*api.StoragePool, error)

RootVolumePool returns the pool of the root volume. The pool is derived from the volume whose name matches the one of the instance.

func (*Config) UpdateRootVolumePool

func (c *Config) UpdateRootVolumePool(pool *api.StoragePool) error

UpdateRootVolumePool updates the root volume's storage pool.

type Type

type Type string

Type indicates the type of backup.

type Volume

type Volume struct {
	// Make sure to have the embedded structs fields inline to avoid nesting.
	api.StorageVolume `yaml:",inline"` //nolint:musttag

	// Use the uppercase representation of the field to follow the same format as the root Config struct.
	Snapshots []*api.StorageVolumeSnapshot `json:"Snapshots" yaml:"snapshots,omitempty"`
}

Volume represents the config of a volume including its snapshots.

Jump to

Keyboard shortcuts

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