Documentation
¶
Index ¶
- Constants
- type DevSource
- type DevSourceFD
- type DevSourcePath
- type DevSourceRBD
- type Device
- type DeviceNamed
- type Devices
- func (list Devices) Clone() Devices
- func (list Devices) CloneNative() map[string]map[string]string
- func (list Devices) Contains(k string, d Device) bool
- func (list Devices) Filter(filters ...func(map[string]string) bool) Devices
- func (list Devices) Reversed() DevicesSortable
- func (list Devices) Sorted() DevicesSortable
- func (list Devices) Update(newlist Devices, updateFields func(Device, Device) []string) (removedList Devices, addedList Devices, updatedList Devices, ...)
- type DevicesSortable
- type DiskLimits
- type MountEntryItem
- type NICConfig
- type ProxyAddress
- type RootFSEntryItem
- type RunConfig
- type RunConfigItem
- type USBDeviceItem
Constants ¶
const ConfigInitialPrefix = "initial."
ConfigInitialPrefix indicates the prefix used for creation time initial device config keys.
const MountOwnerShiftDynamic = "dynamic"
MountOwnerShiftDynamic use shifted mounts for dynamic owner shifting.
const MountOwnerShiftNone = ""
MountOwnerShiftNone do not use owner shifting.
const MountOwnerShiftStatic = "static"
MountOwnerShiftStatic statically modify ownership.
const NICConfigDir = "nics"
NICConfigDir shared constant used to indicate where NIC config is stored.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DevSource ¶
type DevSource any
DevSource is either: - A path on the LXD host. - A file descriptor held by the LXD process. - A Ceph RBD Image description.
type DevSourceFD ¶
DevSourceFD is a file descriptor held by the LXD process. See `deviceConfig.DevSource`.
type DevSourcePath ¶
type DevSourcePath struct {
Path string
}
DevSourcePath is a path on the LXD host. See `deviceConfig.DevSource`.
type DevSourceRBD ¶
type DevSourceRBD struct {
ClusterName string
UserName string
PoolName string
ImageName string
Snapshot string
}
DevSourceRBD describes an RBD image. See `deviceConfig.DevSource`.
This structure roughly corresponds to a qmp BlockdevOptionsRbd: https://www.qemu.org/docs/master/interop/qemu-storage-daemon-qmp-ref.html#qapidoc-708
type DeviceNamed ¶
DeviceNamed contains the name of a device and its config.
type Devices ¶
Devices represents a set of LXD container devices.
func ApplyDeviceInitialValues ¶
ApplyDeviceInitialValues applies a profile initial values to root disk devices.
func NewDevices ¶
NewDevices creates a new Devices set from a native map[string]map[string]string set.
func (Devices) CloneNative ¶
CloneNative returns a copy of the Devices set as a native map[string]map[string]string type.
func (Devices) Contains ¶
Contains checks if a given device exists in the set and if it's identical to that provided.
func (Devices) Filter ¶
Filter returns the devices matching the provided filters. The list of filters is applied using the AND operator. Combining filters using the OR operator can be done using the filters.Or function.
func (Devices) Reversed ¶
func (list Devices) Reversed() DevicesSortable
Reversed returns the name of all devices in the set, sorted reversed.
func (Devices) Sorted ¶
func (list Devices) Sorted() DevicesSortable
Sorted returns the name of all devices in the set, sorted properly.
func (Devices) Update ¶
func (list Devices) Update(newlist Devices, updateFields func(Device, Device) []string) (removedList Devices, addedList Devices, updatedList Devices, changedKeys []string)
Update returns the difference between two device sets (removed, added, updated devices) and a list of all changed keys across all devices. Accepts a function to return which keys can be live updated, which prevents them being removed and re-added if the device supports live updates of certain keys.
type DevicesSortable ¶
type DevicesSortable []DeviceNamed
DevicesSortable is a sortable slice of device names and config.
func (DevicesSortable) Len ¶
func (devices DevicesSortable) Len() int
func (DevicesSortable) Less ¶
func (devices DevicesSortable) Less(i, j int) bool
func (DevicesSortable) Swap ¶
func (devices DevicesSortable) Swap(i, j int)
type DiskLimits ¶
DiskLimits represents a set of I/O disk limits.
type MountEntryItem ¶
type MountEntryItem struct {
DevName string // The internal name for the device.
DevSource DevSource // Describes the block special device or remote filesystem to be mounted.
TargetPath string // Describes the mount point (target) for the filesystem.
FSType string // Describes the type of the filesystem.
Opts []string // Describes the mount options associated with the filesystem.
Freq int // Used by dump(8) to determine which filesystems need to be dumped. Defaults to zero (don't dump) if not present.
PassNo int // Used by fsck(8) to determine the order in which filesystem checks are done at boot time. Defaults to zero (don't fsck) if not present.
OwnerShift string // Ownership shifting mode, use constants MountOwnerShiftNone, MountOwnerShiftStatic or MountOwnerShiftDynamic.
Limits *DiskLimits // Disk limits.
}
MountEntryItem represents a single mount entry item.
type NICConfig ¶
type NICConfig struct {
DeviceName string `json:"device_name"`
NICName string `json:"nic_name"`
MACAddress string `json:"mac_address"`
MTU uint32 `json:"mtu"`
}
NICConfig contains network interface configuration to be passed into a VM and applied by the agent.
type ProxyAddress ¶
ProxyAddress represents a proxy address configuration.
type RootFSEntryItem ¶
type RootFSEntryItem struct {
Path string // Describes the root file system source.
Opts []string // Describes the mount options associated with the filesystem.
}
RootFSEntryItem represents the root filesystem options for an Instance.
type RunConfig ¶
type RunConfig struct {
BusNum uint8 // Allocated bus number for the device.
RootFS RootFSEntryItem // RootFS to setup.
NetworkInterface []RunConfigItem // Network interface configuration settings.
CGroups []RunConfigItem // Cgroup rules to setup.
Mounts []MountEntryItem // Mounts to setup/remove.
Uevents [][]string // Uevents to inject.
PostHooks []func() error // Functions to be run after device attach/detach.
GPUDevice []RunConfigItem // GPU device configuration settings.
USBDevice []USBDeviceItem // USB device configuration settings.
TPMDevice []RunConfigItem // TPM device configuration settings.
PCIDevice []RunConfigItem // PCI device configuration settings.
Revert revert.Hook // Revert setup of device on post-setup error.
}
RunConfig represents run-time config used for device setup/cleanup.
type RunConfigItem ¶
RunConfigItem represents a single config item.
type USBDeviceItem ¶
USBDeviceItem represents a single USB device matched from LXD USB device specification.