hostdevice

package
v1.0.0-beta.0 Latest Latest
Warning

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

Go to latest
Published: May 15, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MaxConcurrentHotPlugDevicesEvents = 32
)

Variables

This section is empty.

Functions

func AttachHostDevices added in v0.49.0

func AttachHostDevices(dom deviceAttacher, hostDevices []api.HostDevice) error

func CreateMDEVHostDevices

func CreateMDEVHostDevices(hostDevicesData []HostDeviceMetaData, mdevAddrPool AddressPooler, enableDefaultDisplay bool) ([]api.HostDevice, error)

func CreatePCIHostDevices

func CreatePCIHostDevices(hostDevicesData []HostDeviceMetaData, pciAddrPool AddressPooler) ([]api.HostDevice, error)

func DifferenceHostDevicesByAlias added in v0.49.0

func DifferenceHostDevicesByAlias(desiredHostDevices, actualHostDevices []api.HostDevice) []api.HostDevice

DifferenceHostDevicesByAlias given two slices of host-devices, according to Alias.Name, it returns a slice with host-devices that exists on the first slice and not exists on the second.

func FilterHostDevicesByAlias added in v0.49.0

func FilterHostDevicesByAlias(hostDevices []api.HostDevice, prefix string) []api.HostDevice

func SafelyDetachHostDevices added in v0.49.0

func SafelyDetachHostDevices(hostDevices []api.HostDevice, eventDetach EventRegistrar, dom DeviceDetacher, timeout time.Duration) error

Types

type AddressPool

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

func NewAddressPool

func NewAddressPool(resourcePrefix string, resources []string) *AddressPool

NewAddressPool creates an address pool based on the provided list of resources and the environment variables that correspond to it.

func (*AddressPool) Pop

func (p *AddressPool) Pop(resource string) (string, error)

Pop gets the next address available to a particular resource. The function makes sure that the allocated address is not allocated to next callers, whether they request an address for the same resource or another resource (covering cases of addresses that are share by multiple resources).

type AddressPooler

type AddressPooler interface {
	Pop(key string) (value string, err error)
}

type BestEffortAddressPool

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

func NewBestEffortAddressPool

func NewBestEffortAddressPool(pool AddressPooler) *BestEffortAddressPool

NewBestEffortAddressPool creates a pool that wraps a provided pool and allows `Pop` calls to always succeed (even when a resource is missing).

func (*BestEffortAddressPool) Pop

func (p *BestEffortAddressPool) Pop(resource string) (string, error)

type DeviceDetacher added in v0.49.0

type DeviceDetacher interface {
	DetachDeviceFlags(xml string, flags libvirt.DomainDeviceModifyFlags) error
}

type EventRegistrar added in v0.49.0

type EventRegistrar interface {
	Register() error
	Deregister() error
	EventChannel() <-chan interface{}
}

type HostDeviceMetaData

type HostDeviceMetaData struct {
	AliasPrefix       string
	Name              string
	ResourceName      string
	VirtualGPUOptions *v1.VGPUOptions
	// DecorateHook is a function pointer that may be used to mutate the domain host-device
	// with additional specific parameters. E.g. guest PCI address.
	DecorateHook func(hostDevice *api.HostDevice) error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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