Documentation ¶
Index ¶
- Constants
- func AdjustQemuProcessMemoryLimits(podIsoDetector PodIsolationDetector, vmi *v1.VirtualMachineInstance, ...) error
- func GetImageInfo(imagePath string, context IsolationResult, config *v1.DiskVerification) (*containerdisk.DiskInfo, error)
- func GetNspid(vmpid int) (int, error)
- func IsBlockDevice(path *safepath.Path) (bool, error)
- func IsMounted(mountPoint *safepath.Path) (isMounted bool, err error)
- func MountInfoRoot(r IsolationResult) (mountinfo *mount.Info, err error)
- func ParentPathForMount(parent IsolationResult, child IsolationResult, source, target string) (*safepath.Path, error)
- func ParentPathForRootMount(parent IsolationResult, child IsolationResult) (*safepath.Path, error)
- func SafeJoin(res IsolationResult, elems ...string) (*safepath.Path, error)
- type IsolationResult
- type MockIsolationResult
- func (_m *MockIsolationResult) EXPECT() *_MockIsolationResultRecorder
- func (_m *MockIsolationResult) GetQEMUProcess() (go_ps.Process, error)
- func (_m *MockIsolationResult) KvmPitPid() (int, error)
- func (_m *MockIsolationResult) MountNamespace() string
- func (_m *MockIsolationResult) MountRoot() (*safepath.Path, error)
- func (_m *MockIsolationResult) Mounts(_param0 mountinfo.FilterFunc) ([]*mountinfo.Info, error)
- func (_m *MockIsolationResult) PIDNamespace() string
- func (_m *MockIsolationResult) PPid() int
- func (_m *MockIsolationResult) Pid() int
- type MockPodIsolationDetector
- func (_m *MockPodIsolationDetector) AdjustResources(vm *v1.VirtualMachineInstance, additionalOverheadRatio *string) error
- func (_m *MockPodIsolationDetector) Detect(vm *v1.VirtualMachineInstance) (IsolationResult, error)
- func (_m *MockPodIsolationDetector) DetectForSocket(vm *v1.VirtualMachineInstance, socket string) (IsolationResult, error)
- func (_m *MockPodIsolationDetector) EXPECT() *_MockPodIsolationDetectorRecorder
- type PodIsolationDetector
- type RealIsolationResult
- func (r *RealIsolationResult) GetQEMUProcess() (ps.Process, error)
- func (r *RealIsolationResult) KvmPitPid() (int, error)
- func (r *RealIsolationResult) MountNamespace() string
- func (r *RealIsolationResult) MountRoot() (*safepath.Path, error)
- func (r *RealIsolationResult) MountRootRelative(relativePath string) (*safepath.Path, error)
- func (r *RealIsolationResult) Mounts(filter mount.FilterFunc) ([]*mount.Info, error)
- func (r *RealIsolationResult) PIDNamespace() string
- func (r *RealIsolationResult) PPid() int
- func (r *RealIsolationResult) Pid() int
Constants ¶
const (
QEMUIMGPath = "/usr/bin/qemu-img"
)
Variables ¶
This section is empty.
Functions ¶
func AdjustQemuProcessMemoryLimits ¶ added in v0.42.0
func AdjustQemuProcessMemoryLimits(podIsoDetector PodIsolationDetector, vmi *v1.VirtualMachineInstance, additionalOverheadRatio *string) error
AdjustQemuProcessMemoryLimits adjusts QEMU process MEMLOCK rlimits that runs inside virt-launcher pod on the given VMI according to its spec. Only VMI's with VFIO devices (e.g: SRIOV, GPU), SEV or RealTime workloads require QEMU process MEMLOCK adjustment.
func GetImageInfo ¶ added in v0.20.0
func GetImageInfo(imagePath string, context IsolationResult, config *v1.DiskVerification) (*containerdisk.DiskInfo, error)
func GetNspid ¶ added in v0.58.2
Returns the pid of "vmpid" as seen from the first pid namespace the task belongs to.
func IsBlockDevice ¶ added in v0.49.1
IsBlockDevice checks if the given path is a block device or not.
func MountInfoRoot ¶ added in v0.42.0
func MountInfoRoot(r IsolationResult) (mountinfo *mount.Info, err error)
MountInfoRoot returns the mount information for the root mount point
func ParentPathForMount ¶ added in v0.58.0
func ParentPathForMount(parent IsolationResult, child IsolationResult, source, target string) (*safepath.Path, error)
func ParentPathForRootMount ¶ added in v0.42.0
func ParentPathForRootMount(parent IsolationResult, child IsolationResult) (*safepath.Path, error)
ParentPathForRootMount takes a container (child) and composes a path to the root mount point in the context of the parent.
Types ¶
type IsolationResult ¶
type IsolationResult interface { // process ID Pid() int // parent process ID PPid() int // full path to the process namespace PIDNamespace() string // full path to the process root mount MountRoot() (*safepath.Path, error) // full path to the mount namespace MountNamespace() string // mounts for the process Mounts(mount.FilterFunc) ([]*mount.Info, error) // returns the QEMU process GetQEMUProcess() (ps.Process, error) // returns the KVM PIT pid KvmPitPid() (int, error) }
IsolationResult is the result of a successful PodIsolationDetector.Detect
func NewIsolationResult ¶
func NewIsolationResult(pid, ppid int) IsolationResult
type MockIsolationResult ¶ added in v0.27.0
type MockIsolationResult struct {
// contains filtered or unexported fields
}
Mock of IsolationResult interface
func NewMockIsolationResult ¶ added in v0.27.0
func NewMockIsolationResult(ctrl *gomock.Controller) *MockIsolationResult
func (*MockIsolationResult) EXPECT ¶ added in v0.27.0
func (_m *MockIsolationResult) EXPECT() *_MockIsolationResultRecorder
func (*MockIsolationResult) GetQEMUProcess ¶ added in v0.58.1
func (_m *MockIsolationResult) GetQEMUProcess() (go_ps.Process, error)
func (*MockIsolationResult) KvmPitPid ¶ added in v0.58.2
func (_m *MockIsolationResult) KvmPitPid() (int, error)
func (*MockIsolationResult) MountNamespace ¶ added in v0.27.0
func (_m *MockIsolationResult) MountNamespace() string
func (*MockIsolationResult) MountRoot ¶ added in v0.27.0
func (_m *MockIsolationResult) MountRoot() (*safepath.Path, error)
func (*MockIsolationResult) Mounts ¶ added in v0.42.0
func (_m *MockIsolationResult) Mounts(_param0 mountinfo.FilterFunc) ([]*mountinfo.Info, error)
func (*MockIsolationResult) PIDNamespace ¶ added in v0.27.0
func (_m *MockIsolationResult) PIDNamespace() string
func (*MockIsolationResult) PPid ¶ added in v0.42.0
func (_m *MockIsolationResult) PPid() int
func (*MockIsolationResult) Pid ¶ added in v0.27.0
func (_m *MockIsolationResult) Pid() int
type MockPodIsolationDetector ¶
type MockPodIsolationDetector struct {
// contains filtered or unexported fields
}
Mock of PodIsolationDetector interface
func NewMockPodIsolationDetector ¶
func NewMockPodIsolationDetector(ctrl *gomock.Controller) *MockPodIsolationDetector
func (*MockPodIsolationDetector) AdjustResources ¶ added in v0.21.0
func (_m *MockPodIsolationDetector) AdjustResources(vm *v1.VirtualMachineInstance, additionalOverheadRatio *string) error
func (*MockPodIsolationDetector) Detect ¶
func (_m *MockPodIsolationDetector) Detect(vm *v1.VirtualMachineInstance) (IsolationResult, error)
func (*MockPodIsolationDetector) DetectForSocket ¶ added in v0.20.0
func (_m *MockPodIsolationDetector) DetectForSocket(vm *v1.VirtualMachineInstance, socket string) (IsolationResult, error)
func (*MockPodIsolationDetector) EXPECT ¶
func (_m *MockPodIsolationDetector) EXPECT() *_MockPodIsolationDetectorRecorder
type PodIsolationDetector ¶
type PodIsolationDetector interface { // Detect takes a vm, looks up a socket based the VM and detects pid, cgroups and namespaces of the owner of that socket. // It returns an IsolationResult containing all isolation information Detect(vm *v1.VirtualMachineInstance) (IsolationResult, error) DetectForSocket(vm *v1.VirtualMachineInstance, socket string) (IsolationResult, error) // Adjust system resources to run the passed VM AdjustResources(vm *v1.VirtualMachineInstance, additionalOverheadRatio *string) error }
PodIsolationDetector helps detecting cgroups, namespaces and PIDs of Pods from outside of them. Different strategies may be applied to do that.
func NewSocketBasedIsolationDetector ¶
func NewSocketBasedIsolationDetector(socketDir string) PodIsolationDetector
NewSocketBasedIsolationDetector takes socketDir and creates a socket based IsolationDetector It returns a PodIsolationDetector which detects pid, cgroups and namespaces of the socket owner.
type RealIsolationResult ¶ added in v0.42.0
type RealIsolationResult struct {
// contains filtered or unexported fields
}
func NodeIsolationResult ¶
func NodeIsolationResult() *RealIsolationResult
func (*RealIsolationResult) GetQEMUProcess ¶ added in v0.58.1
func (r *RealIsolationResult) GetQEMUProcess() (ps.Process, error)
GetQEMUProcess encapsulates and exposes the logic to retrieve the QEMU process ID
func (*RealIsolationResult) KvmPitPid ¶ added in v0.58.2
func (r *RealIsolationResult) KvmPitPid() (int, error)
func (*RealIsolationResult) MountNamespace ¶ added in v0.42.0
func (r *RealIsolationResult) MountNamespace() string
func (*RealIsolationResult) MountRoot ¶ added in v0.42.0
func (r *RealIsolationResult) MountRoot() (*safepath.Path, error)
func (*RealIsolationResult) MountRootRelative ¶ added in v0.49.1
func (r *RealIsolationResult) MountRootRelative(relativePath string) (*safepath.Path, error)
func (*RealIsolationResult) Mounts ¶ added in v0.42.0
func (r *RealIsolationResult) Mounts(filter mount.FilterFunc) ([]*mount.Info, error)
Mounts returns mounts for the given process based on the supplied filter
func (*RealIsolationResult) PIDNamespace ¶ added in v0.42.0
func (r *RealIsolationResult) PIDNamespace() string
func (*RealIsolationResult) PPid ¶ added in v0.42.0
func (r *RealIsolationResult) PPid() int
func (*RealIsolationResult) Pid ¶ added in v0.42.0
func (r *RealIsolationResult) Pid() int