Documentation ¶
Index ¶
- Constants
- Variables
- func BindDevicetoHost(bdf, hostDriver, vendorDeviceID string) error
- func BindDevicetoVFIO(bdf, hostDriver, vendorDeviceID string) error
- func GetVFIODeviceType(deviceFileName string) config.VFIODeviceType
- type BlockDevice
- func (device *BlockDevice) Attach(devReceiver api.DeviceReceiver) (err error)
- func (device *BlockDevice) Detach(devReceiver api.DeviceReceiver) error
- func (device *BlockDevice) DeviceType() config.DeviceType
- func (device *BlockDevice) GetDeviceInfo() interface{}
- func (device *BlockDevice) Load(ds persistapi.DeviceState)
- func (device *BlockDevice) Save() persistapi.DeviceState
- type GenericDevice
- func (device *GenericDevice) Attach(devReceiver api.DeviceReceiver) error
- func (device *GenericDevice) Dereference() uint
- func (device *GenericDevice) Detach(devReceiver api.DeviceReceiver) error
- func (device *GenericDevice) DeviceID() string
- func (device *GenericDevice) DeviceType() config.DeviceType
- func (device *GenericDevice) GetAttachCount() uint
- func (device *GenericDevice) GetDeviceInfo() interface{}
- func (device *GenericDevice) GetHostPath() string
- func (device *GenericDevice) GetMajorMinor() (int64, int64)
- func (device *GenericDevice) Load(ds persistapi.DeviceState)
- func (device *GenericDevice) Reference() uint
- func (device *GenericDevice) Save() persistapi.DeviceState
- type PCISysFsProperty
- type PCISysFsType
- type VFIODevice
- func (device *VFIODevice) Attach(devReceiver api.DeviceReceiver) (retErr error)
- func (device *VFIODevice) Detach(devReceiver api.DeviceReceiver) (retErr error)
- func (device *VFIODevice) DeviceType() config.DeviceType
- func (device *VFIODevice) GetDeviceInfo() interface{}
- func (device *VFIODevice) Load(ds persistapi.DeviceState)
- func (device *VFIODevice) Save() persistapi.DeviceState
- type VhostUserBlkDevice
- func (device *VhostUserBlkDevice) Attach(devReceiver api.DeviceReceiver) (err error)
- func (device *VhostUserBlkDevice) Detach(devReceiver api.DeviceReceiver) error
- func (device *VhostUserBlkDevice) DeviceType() config.DeviceType
- func (device *VhostUserBlkDevice) GetDeviceInfo() interface{}
- func (device *VhostUserBlkDevice) Load(ds persistapi.DeviceState)
- func (device *VhostUserBlkDevice) Save() persistapi.DeviceState
- type VhostUserFSDevice
- type VhostUserNetDevice
- func (device *VhostUserNetDevice) Attach(devReceiver api.DeviceReceiver) (err error)
- func (device *VhostUserNetDevice) Detach(devReceiver api.DeviceReceiver) error
- func (device *VhostUserNetDevice) DeviceType() config.DeviceType
- func (device *VhostUserNetDevice) GetDeviceInfo() interface{}
- func (device *VhostUserNetDevice) Load(ds persistapi.DeviceState)
- func (device *VhostUserNetDevice) Save() persistapi.DeviceState
- type VhostUserSCSIDevice
- func (device *VhostUserSCSIDevice) Attach(devReceiver api.DeviceReceiver) (err error)
- func (device *VhostUserSCSIDevice) Detach(devReceiver api.DeviceReceiver) error
- func (device *VhostUserSCSIDevice) DeviceType() config.DeviceType
- func (device *VhostUserSCSIDevice) GetDeviceInfo() interface{}
- func (device *VhostUserSCSIDevice) Load(ds persistapi.DeviceState)
- func (device *VhostUserSCSIDevice) Save() persistapi.DeviceState
Constants ¶
const ( PCIDomain = "0000" PCIeKeyword = "PCIe" )
Variables ¶
var (
AllPCIeDevs = map[string]bool{}
)
Functions ¶
func BindDevicetoHost ¶
BindDevicetoHost binds the device to the host driver driver after unbinding from vfio-pci.
func BindDevicetoVFIO ¶
BindDevicetoVFIO binds the device to vfio driver after unbinding from host. Will be called by a network interface or a generic pcie device.
func GetVFIODeviceType ¶
func GetVFIODeviceType(deviceFileName string) config.VFIODeviceType
Types ¶
type BlockDevice ¶
type BlockDevice struct { *GenericDevice BlockDrive *config.BlockDrive }
BlockDevice refers to a block storage device implementation.
func NewBlockDevice ¶
func NewBlockDevice(devInfo *config.DeviceInfo) *BlockDevice
NewBlockDevice creates a new block device based on DeviceInfo
func (*BlockDevice) Attach ¶
func (device *BlockDevice) Attach(devReceiver api.DeviceReceiver) (err error)
Attach is standard interface of api.Device, it's used to add device to some DeviceReceiver
func (*BlockDevice) Detach ¶
func (device *BlockDevice) Detach(devReceiver api.DeviceReceiver) error
Detach is standard interface of api.Device, it's used to remove device from some DeviceReceiver
func (*BlockDevice) DeviceType ¶
func (device *BlockDevice) DeviceType() config.DeviceType
DeviceType is standard interface of api.Device, it returns device type
func (*BlockDevice) GetDeviceInfo ¶
func (device *BlockDevice) GetDeviceInfo() interface{}
GetDeviceInfo returns device information used for creating
func (*BlockDevice) Load ¶
func (device *BlockDevice) Load(ds persistapi.DeviceState)
Load loads DeviceState and converts it to specific device
func (*BlockDevice) Save ¶
func (device *BlockDevice) Save() persistapi.DeviceState
Save converts Device to DeviceState
type GenericDevice ¶
type GenericDevice struct { ID string DeviceInfo *config.DeviceInfo RefCount uint AttachCount uint }
GenericDevice refers to a device that is neither a VFIO device, block device or VhostUserDevice.
func NewGenericDevice ¶
func NewGenericDevice(devInfo *config.DeviceInfo) *GenericDevice
NewGenericDevice creates a new GenericDevice
func (*GenericDevice) Attach ¶
func (device *GenericDevice) Attach(devReceiver api.DeviceReceiver) error
Attach is standard interface of api.Device
func (*GenericDevice) Dereference ¶
func (device *GenericDevice) Dereference() uint
Dereference remove one reference from device
func (*GenericDevice) Detach ¶
func (device *GenericDevice) Detach(devReceiver api.DeviceReceiver) error
Detach is standard interface of api.Device
func (*GenericDevice) DeviceID ¶
func (device *GenericDevice) DeviceID() string
DeviceID returns device ID
func (*GenericDevice) DeviceType ¶
func (device *GenericDevice) DeviceType() config.DeviceType
DeviceType is standard interface of api.Device, it returns device type
func (*GenericDevice) GetAttachCount ¶
func (device *GenericDevice) GetAttachCount() uint
GetAttachCount returns how many times the device has been attached
func (*GenericDevice) GetDeviceInfo ¶
func (device *GenericDevice) GetDeviceInfo() interface{}
GetDeviceInfo returns device information used for creating
func (*GenericDevice) GetHostPath ¶
func (device *GenericDevice) GetHostPath() string
GetHostPath return the device path in the host
func (*GenericDevice) GetMajorMinor ¶
func (device *GenericDevice) GetMajorMinor() (int64, int64)
GetMajorMinor returns device major and minor numbers
func (*GenericDevice) Load ¶
func (device *GenericDevice) Load(ds persistapi.DeviceState)
Load loads DeviceState and converts it to specific device
func (*GenericDevice) Reference ¶
func (device *GenericDevice) Reference() uint
Reference adds one reference to device
func (*GenericDevice) Save ¶
func (device *GenericDevice) Save() persistapi.DeviceState
Save converts Device to DeviceState
type PCISysFsProperty ¶
type PCISysFsProperty string
var ( PCISysFsDevicesClass PCISysFsProperty = "class" // /sys/bus/pci/devices/xxx/class PCISysFsSlotsAddress PCISysFsProperty = "address" // /sys/bus/pci/slots/xxx/address PCISysFsSlotsMaxBusSpeed PCISysFsProperty = "max_bus_speed" // /sys/bus/pci/slots/xxx/max_bus_speed )
type PCISysFsType ¶
type PCISysFsType string
var ( PCISysFsDevices PCISysFsType = "devices" // /sys/bus/pci/devices PCISysFsSlots PCISysFsType = "slots" // /sys/bus/pci/slots )
type VFIODevice ¶
type VFIODevice struct { *GenericDevice VfioDevs []*config.VFIODev }
VFIODevice is a vfio device meant to be passed to the hypervisor to be used by the Virtual Machine.
func NewVFIODevice ¶
func NewVFIODevice(devInfo *config.DeviceInfo) *VFIODevice
NewVFIODevice create a new VFIO device
func (*VFIODevice) Attach ¶
func (device *VFIODevice) Attach(devReceiver api.DeviceReceiver) (retErr error)
Attach is standard interface of api.Device, it's used to add device to some DeviceReceiver
func (*VFIODevice) Detach ¶
func (device *VFIODevice) Detach(devReceiver api.DeviceReceiver) (retErr error)
Detach is standard interface of api.Device, it's used to remove device from some DeviceReceiver
func (*VFIODevice) DeviceType ¶
func (device *VFIODevice) DeviceType() config.DeviceType
DeviceType is standard interface of api.Device, it returns device type
func (*VFIODevice) GetDeviceInfo ¶
func (device *VFIODevice) GetDeviceInfo() interface{}
GetDeviceInfo returns device information used for creating
func (*VFIODevice) Load ¶
func (device *VFIODevice) Load(ds persistapi.DeviceState)
Load loads DeviceState and converts it to specific device
func (*VFIODevice) Save ¶
func (device *VFIODevice) Save() persistapi.DeviceState
Save converts Device to DeviceState
type VhostUserBlkDevice ¶
type VhostUserBlkDevice struct { *GenericDevice VhostUserDeviceAttrs *config.VhostUserDeviceAttrs }
VhostUserBlkDevice is a block vhost-user based device
func NewVhostUserBlkDevice ¶
func NewVhostUserBlkDevice(devInfo *config.DeviceInfo) *VhostUserBlkDevice
NewVhostUserBlkDevice creates a new vhost-user block device based on DeviceInfo
func (*VhostUserBlkDevice) Attach ¶
func (device *VhostUserBlkDevice) Attach(devReceiver api.DeviceReceiver) (err error)
Attach is standard interface of api.Device, it's used to add device to some DeviceReceiver
func (*VhostUserBlkDevice) Detach ¶
func (device *VhostUserBlkDevice) Detach(devReceiver api.DeviceReceiver) error
Detach is standard interface of api.Device, it's used to remove device from some DeviceReceiver
func (*VhostUserBlkDevice) DeviceType ¶
func (device *VhostUserBlkDevice) DeviceType() config.DeviceType
DeviceType is standard interface of api.Device, it returns device type
func (*VhostUserBlkDevice) GetDeviceInfo ¶
func (device *VhostUserBlkDevice) GetDeviceInfo() interface{}
GetDeviceInfo returns device information used for creating
func (*VhostUserBlkDevice) Load ¶
func (device *VhostUserBlkDevice) Load(ds persistapi.DeviceState)
Load loads DeviceState and converts it to specific device
func (*VhostUserBlkDevice) Save ¶
func (device *VhostUserBlkDevice) Save() persistapi.DeviceState
Save converts Device to DeviceState
type VhostUserFSDevice ¶
type VhostUserFSDevice struct { *GenericDevice config.VhostUserDeviceAttrs }
VhostUserFSDevice is a virtio-fs vhost-user device
func (*VhostUserFSDevice) Attach ¶
func (device *VhostUserFSDevice) Attach(devReceiver api.DeviceReceiver) (err error)
func (*VhostUserFSDevice) Detach ¶
func (device *VhostUserFSDevice) Detach(devReceiver api.DeviceReceiver) error
func (*VhostUserFSDevice) DeviceType ¶
func (device *VhostUserFSDevice) DeviceType() config.DeviceType
func (*VhostUserFSDevice) GetDeviceInfo ¶
func (device *VhostUserFSDevice) GetDeviceInfo() interface{}
GetDeviceInfo returns device information that the device is created based on
type VhostUserNetDevice ¶
type VhostUserNetDevice struct { *GenericDevice config.VhostUserDeviceAttrs }
VhostUserNetDevice is a network vhost-user based device
func (*VhostUserNetDevice) Attach ¶
func (device *VhostUserNetDevice) Attach(devReceiver api.DeviceReceiver) (err error)
Attach is standard interface of api.Device, it's used to add device to some DeviceReceiver
func (*VhostUserNetDevice) Detach ¶
func (device *VhostUserNetDevice) Detach(devReceiver api.DeviceReceiver) error
Detach is standard interface of api.Device, it's used to remove device from some DeviceReceiver
func (*VhostUserNetDevice) DeviceType ¶
func (device *VhostUserNetDevice) DeviceType() config.DeviceType
DeviceType is standard interface of api.Device, it returns device type
func (*VhostUserNetDevice) GetDeviceInfo ¶
func (device *VhostUserNetDevice) GetDeviceInfo() interface{}
GetDeviceInfo returns device information used for creating
func (*VhostUserNetDevice) Load ¶
func (device *VhostUserNetDevice) Load(ds persistapi.DeviceState)
Load loads DeviceState and converts it to specific device
func (*VhostUserNetDevice) Save ¶
func (device *VhostUserNetDevice) Save() persistapi.DeviceState
Save converts Device to DeviceState
type VhostUserSCSIDevice ¶
type VhostUserSCSIDevice struct { *GenericDevice config.VhostUserDeviceAttrs }
VhostUserSCSIDevice is a SCSI vhost-user based device
func (*VhostUserSCSIDevice) Attach ¶
func (device *VhostUserSCSIDevice) Attach(devReceiver api.DeviceReceiver) (err error)
Attach is standard interface of api.Device, it's used to add device to some DeviceReceiver
func (*VhostUserSCSIDevice) Detach ¶
func (device *VhostUserSCSIDevice) Detach(devReceiver api.DeviceReceiver) error
Detach is standard interface of api.Device, it's used to remove device from some DeviceReceiver
func (*VhostUserSCSIDevice) DeviceType ¶
func (device *VhostUserSCSIDevice) DeviceType() config.DeviceType
DeviceType is standard interface of api.Device, it returns device type
func (*VhostUserSCSIDevice) GetDeviceInfo ¶
func (device *VhostUserSCSIDevice) GetDeviceInfo() interface{}
GetDeviceInfo returns device information used for creating
func (*VhostUserSCSIDevice) Load ¶
func (device *VhostUserSCSIDevice) Load(ds persistapi.DeviceState)
Load loads DeviceState and converts it to specific device
func (*VhostUserSCSIDevice) Save ¶
func (device *VhostUserSCSIDevice) Save() persistapi.DeviceState
Save converts Device to DeviceState