Documentation ¶
Index ¶
- Variables
- func IsBimaContainer(bundle string) bool
- func SendIPCMessage(socketAddress string, message IPCMessage) error
- func SockAddrExists(sockAddr string) bool
- type IPCMessage
- type RootFs
- type UnikernelConfig
- type Unikontainer
- func (u *Unikontainer) AwaitAckReexec() error
- func (u *Unikontainer) AwaitReexecStarted() error
- func (u *Unikontainer) AwaitStartExecve() error
- func (u *Unikontainer) Create(pid int) error
- func (u *Unikontainer) Delete() error
- func (u *Unikontainer) Exec() error
- func (u *Unikontainer) ExecuteHooks(name string) error
- func (u *Unikontainer) InitialSetup() error
- func (u *Unikontainer) Kill() error
- func (u *Unikontainer) SendAckReexec() error
- func (u *Unikontainer) SendReexecStarted() error
- func (u *Unikontainer) SendStartExecve() error
Constants ¶
This section is empty.
Variables ¶
var ErrEmptyAnnotations = errors.New("spec annotations are empty")
var Log = logrus.WithField("subsystem", "unikontainers")
Functions ¶
func IsBimaContainer ¶
isBimaContainer attempts to find any bima related annotations in the given bundle to verify the image is compatible with urunc
func SendIPCMessage ¶
func SendIPCMessage(socketAddress string, message IPCMessage) error
SendIPCMessage creates a new connection to socketAddress, sends the message and closes the connection
func SockAddrExists ¶
sockAddrExists returns true if if given sock address exists returns false if any error is encountered
Types ¶
type IPCMessage ¶
type IPCMessage string
const ( ReexecStarted IPCMessage = "BOOTED" AckReexec IPCMessage = "ACK" StartExecve IPCMessage = "START" )
type RootFs ¶
type RootFs struct { Path string // The path of the root file system. IsBlock bool // Indicates if it's a block device. BlkDevice disk.PartitionStat // Information about the block device. }
RootFs represents a root file system and its properties.
type UnikernelConfig ¶
type UnikernelConfig struct { UnikernelType string `json:"com.urunc.unikernel.unikernelType"` UnikernelCmd string `json:"com.urunc.unikernel.cmdline,omitempty"` UnikernelBinary string `json:"com.urunc.unikernel.binary"` Hypervisor string `json:"com.urunc.unikernel.hypervisor"` }
A UnikernelConfig struct holds the info provided by bima image on how to execute our unikernel
func GetUnikernelConfig ¶
func GetUnikernelConfig(bundleDir string, spec *specs.Spec) (*UnikernelConfig, error)
GetUnikernelConfig tries to get the Unikernel config from the bundle annotations. If that fails, it gets the Unikernel config from the urunc.json file inside the rootfs. FIXME: custom annotations are unreachable, we nned to investigate why to skip adding the urunc.json file For more details, see: https://github.com/nubificus/urunc/issues/12
func (*UnikernelConfig) Map ¶
func (c *UnikernelConfig) Map() map[string]string
Map returns a map containing the Unikernel config data
type Unikontainer ¶
type Unikontainer struct { State *specs.State Spec *specs.Spec BaseDir string }
Unikontainer holds the data necessary to create, manage and delete unikernel containers
func Get ¶
func Get(containerID string, rootDir string) (*Unikontainer, error)
Get retrieves unikernel data from disk to create a Unikontainer object
func New ¶
func New(bundlePath string, containerID string, rootDir string) (*Unikontainer, error)
New parses the bundle and creates a new Unikontainer object
func (*Unikontainer) AwaitAckReexec ¶
func (u *Unikontainer) AwaitAckReexec() error
AwaitAckReexec opens a new connection to UruncSock and waits for a AckReexec message
func (*Unikontainer) AwaitReexecStarted ¶
func (u *Unikontainer) AwaitReexecStarted() error
AwaitReexecStarted opens a new connection to InitSock and waits for a ReexecStarted message
func (*Unikontainer) AwaitStartExecve ¶
func (u *Unikontainer) AwaitStartExecve() error
AwaitStartExecve opens a new connection to UruncSock and waits for a StartExecve message
func (*Unikontainer) Create ¶
func (u *Unikontainer) Create(pid int) error
Create sets the Unikernel status as created, and saves the given PID in init.pid
func (*Unikontainer) Delete ¶
func (u *Unikontainer) Delete() error
Delete removes the containers base directory and its contents
func (*Unikontainer) Exec ¶
func (u *Unikontainer) Exec() error
func (*Unikontainer) ExecuteHooks ¶
func (u *Unikontainer) ExecuteHooks(name string) error
ExecuteHooks executes any hooks found in spec based on name:
func (*Unikontainer) InitialSetup ¶
func (u *Unikontainer) InitialSetup() error
InitialSetup sets the Unikernel status as creating, creates the Unikernel base directory and saves the state.json file with the current Unikernel state
func (*Unikontainer) Kill ¶
func (u *Unikontainer) Kill() error
Kill stops the VMM process, first by asking the VMM struct to stop and consequently by killing the process described in u.State.Pid
func (*Unikontainer) SendAckReexec ¶
func (u *Unikontainer) SendAckReexec() error
SendAckReexec sends an AckReexec message to UruncSock
func (*Unikontainer) SendReexecStarted ¶
func (u *Unikontainer) SendReexecStarted() error
SendReexecStarted sends an ReexecStarted message to InitSock
func (*Unikontainer) SendStartExecve ¶
func (u *Unikontainer) SendStartExecve() error
SendStartExecve sends an StartExecve message to UruncSock