sys

package
v0.0.0-...-54b8d16 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2024 License: AGPL-3.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetupTestCerts

func SetupTestCerts(dir string) error

SetupTestCerts populates the given test LXD directory with server certificates.

Since generating certificates is CPU intensive, they will be simply symlink'ed from the test/deps/ directory.

FIXME: this function is exported because some tests use it
	directly. Eventually we should rework those tests to use NewTestOS
	instead.

Types

type AppArmorFeaturesInfo

type AppArmorFeaturesInfo struct {
	sync.Mutex
	Map map[string]bool
}

AppArmorFeaturesInfo records the AppArmor features availability.

type InotifyInfo

type InotifyInfo struct {
	Fd int
	sync.RWMutex
	Targets map[string]*InotifyTargetInfo
}

InotifyInfo records the inotify information associated with a given inotify instance.

type InotifyTargetInfo

type InotifyTargetInfo struct {
	Mask uint32
	Wd   int
	Path string
}

InotifyTargetInfo records the inotify information associated with a given inotify target.

type OS

type OS struct {
	// Directories
	CacheDir string // Cache directory (e.g. /var/cache/lxd/).
	LogDir   string // Log directory (e.g. /var/log/lxd).
	VarDir   string // Data directory (e.g. /var/lib/lxd/).

	// Daemon environment
	Architectures   []int           // Cache of detected system architectures
	BackingFS       string          // Backing filesystem of $LXD_DIR/containers
	ExecPath        string          // Absolute path to the LXD executable
	IdmapSet        *idmap.IdmapSet // Information about user/group ID mapping
	InotifyWatch    InotifyInfo
	LxcPath         string // Path to the $LXD_DIR/containers directory
	MockMode        bool   // If true some APIs will be mocked (for testing)
	Nodev           bool
	RunningInUserNS bool

	// Privilege dropping
	UnprivUser  string
	UnprivUID   uint32
	UnprivGroup string
	UnprivGID   uint32

	// Apparmor features
	AppArmorAdmin     bool
	AppArmorAvailable bool
	AppArmorConfined  bool
	AppArmorStacked   bool
	AppArmorStacking  bool
	AppArmorFeatures  AppArmorFeaturesInfo

	// Cgroup features
	CGInfo cgroup.Info

	// Kernel features
	CloseRange              bool // CloseRange indicates support for the close_range syscall.
	ContainerCoreScheduling bool // ContainerCoreScheduling indicates LXC and kernel support for core scheduling.
	CoreScheduling          bool // CoreScheduling indicates support for core scheduling syscalls.
	IdmappedMounts          bool // IdmappedMounts indicates kernel support for VFS idmap.
	NativeTerminals         bool // NativeTerminals indicates support for TIOGPTPEER ioctl.
	NetnsGetifaddrs         bool // NetnsGetifaddrs indicates support for NETLINK_GET_STRICT_CHK.
	PidFds                  bool // PidFds indicates support for PID fds.
	PidFdSetns              bool // PidFdSetns indicates support for setns through PID fds.
	SeccompListenerAddfd    bool // SeccompListenerAddfd indicates support for passing new FD to process through seccomp notify.
	SeccompListener         bool // SeccompListener indicates support for seccomp notify.
	SeccompListenerContinue bool // SeccompListenerContinue indicates support continuing syscalls path for process through seccomp notify.
	UeventInjection         bool // UeventInjection indicates support for injecting uevents to a specific netns.
	UnprivBinfmt            bool // UnprivBinfmt indicates support for mounting binfmt_misc inside of a user namespace.
	VFS3Fscaps              bool // VFS3FScaps indicates support for v3 filesystem capabilities.

	// LXC features
	LXCFeatures map[string]bool

	// OS info
	ReleaseInfo   map[string]string
	KernelVersion version.DottedVersion
	Uname         *shared.Utsname
	BootTime      time.Time
}

OS is a high-level facade for accessing all operating-system level functionality that LXD uses.

func DefaultOS

func DefaultOS() *OS

DefaultOS returns a fresh uninitialized OS instance with default values.

func NewTestOS

func NewTestOS(t *testing.T) (*OS, func())

NewTestOS returns a new OS instance initialized with test values.

func (*OS) GlobalDatabaseDir

func (s *OS) GlobalDatabaseDir() string

GlobalDatabaseDir returns the path of the global database directory.

func (*OS) GlobalDatabasePath

func (s *OS) GlobalDatabasePath() string

GlobalDatabasePath returns the path of the global database SQLite file managed by dqlite.

func (*OS) InUbuntuCore

func (s *OS) InUbuntuCore() bool

InUbuntuCore returns true if we're running on Ubuntu Core.

func (*OS) Init

func (s *OS) Init() ([]cluster.Warning, error)

Init our internal data structures.

func (*OS) InitStorage

func (s *OS) InitStorage() error

InitStorage initialises the storage layer after it has been mounted.

func (*OS) LocalDatabasePath

func (s *OS) LocalDatabasePath() string

LocalDatabasePath returns the path of the local database file.

Jump to

Keyboard shortcuts

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