vm

package
v0.5.5 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2022 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// ConfigDir [deprecated] is config directory name
	ConfigDir = "config"
)

Variables

This section is empty.

Functions

func FindAll added in v0.5.5

func FindAll() (map[string]Process, error)

FindAll finds all running cloud-hypervisor processes

Types

type Boot

type Boot struct {
	Kernel string `json:"kernel_image_path"`
	Initrd string `json:"initrd_path,omitempty"`
	Args   string `json:"boot_args"`
}

Boot config struct

type CPU added in v0.5.0

type CPU uint8

CPU type

func (CPU) String added in v0.5.0

func (c CPU) String() string

type Client added in v0.5.0

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

Client to a cloud hypervisor instance

func NewClient added in v0.5.0

func NewClient(unix string) *Client

NewClient creates a new instance of client

func (*Client) Inspect added in v0.5.0

func (c *Client) Inspect(ctx context.Context) (CPU, MemMib, error)

Inspect return information about the vm

func (*Client) Shutdown added in v0.5.0

func (c *Client) Shutdown(ctx context.Context) error

Shutdown shuts the machine down

type Config

type Config struct {
	CPU       CPU    `json:"vcpu_count"`
	Mem       MemMib `json:"mem_size_mib"`
	HTEnabled bool   `json:"ht_enabled"`
}

Config struct

type Disk added in v0.5.0

type Disk struct {
	ID         string `json:"drive_id"`
	Path       string `json:"path_on_host"`
	RootDevice bool   `json:"is_root_device"`
	ReadOnly   bool   `json:"is_read_only"`
}

Disk struct

func (Disk) String added in v0.5.0

func (d Disk) String() string

type Disks added in v0.5.0

type Disks []Disk

Disks is a list of vm disks

type Interface

type Interface struct {
	ID  string `json:"iface_id"`
	Tap string `json:"host_dev_name"`
	Mac string `json:"guest_mac,omitempty"`
}

Interface nic struct

type InterfaceType added in v0.5.0

type InterfaceType string

InterfaceType interface type

const (
	// InterfaceTAP tuntap type
	InterfaceTAP InterfaceType = "tuntap"
	// InterfaceMACvTAP mactap type
	InterfaceMACvTAP InterfaceType = "macvtap"
)

type Interfaces added in v0.5.0

type Interfaces []Interface

Interfaces is a list of node interfaces

type LegacyMonitor added in v0.5.0

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

LegacyMonitor has code to clean up legacy machines death

func (*LegacyMonitor) Monitor added in v0.5.0

func (m *LegacyMonitor) Monitor(ctx context.Context)

Monitor start vms monitoring

type Machine

type Machine struct {
	ID          string            `json:"id"`
	Boot        Boot              `json:"boot-source"`
	Disks       Disks             `json:"drives"`
	FS          []VirtioFS        `json:"fs"`
	Interfaces  Interfaces        `json:"network-interfaces"`
	Config      Config            `json:"machine-config"`
	Environment map[string]string `json:"environment"`
	Entrypoint  string            `json:"entrypoint"`
	// NoKeepAlive is not used by firecracker, but instead a marker
	// for the vm  mananger to not restart the machine when it stops
	NoKeepAlive bool `json:"no-keep-alive"`
}

Machine struct

func MachineFromFile added in v0.5.0

func MachineFromFile(n string) (*Machine, error)

MachineFromFile loads a vm config from file

func (*Machine) Run added in v0.5.0

func (m *Machine) Run(ctx context.Context, socket, logs string) error

Run run the machine with cloud-hypervisor

func (*Machine) Save added in v0.5.0

func (m *Machine) Save(n string) error

Save saves a machine into a file

type MemMib added in v0.5.0

type MemMib uint64

MemMib is memory size in mib

func (MemMib) String added in v0.5.0

func (m MemMib) String() string

type Module added in v0.4.9

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

Module implements the VMModule interface

func NewVMModule

func NewVMModule(cl zbus.Client, root, config string) (*Module, error)

NewVMModule creates a new instance of vm manager

func (*Module) Delete added in v0.4.9

func (m *Module) Delete(name string) error

Delete deletes a machine by name (id)

func (*Module) Exists added in v0.4.9

func (m *Module) Exists(id string) bool

Exists checks if firecracker process running for this machine

func (*Module) Inspect added in v0.4.9

func (m *Module) Inspect(name string) (pkg.VMInfo, error)

Inspect a machine by name

func (*Module) List added in v0.5.0

func (m *Module) List() ([]string, error)

List all running vms names

func (*Module) Logs added in v0.4.9

func (m *Module) Logs(name string) (string, error)

Logs returns machine logs for give machine name

func (*Module) Metrics added in v0.5.5

func (m *Module) Metrics() (pkg.MachineMetrics, error)

Metrics gets running machines network metrics

func (*Module) Monitor added in v0.4.9

func (m *Module) Monitor(ctx context.Context)

Monitor start vms monitoring

func (*Module) Run added in v0.4.9

func (m *Module) Run(vm pkg.VM) error

Run vm

type Process added in v0.5.5

type Process struct {
	Pid  int
	Args []string
}

Process struct

func Find added in v0.5.5

func Find(name string) (Process, error)

Find find CH process by vm name

func (*Process) GetParam added in v0.5.5

func (p *Process) GetParam(arg string) ([]string, bool)

GetParam gets a value for a parm passed to process cmdline

type VirtioFS added in v0.5.5

type VirtioFS struct {
	Tag  string
	Path string
}

VirtioFS represents a virtiofs mount

Jump to

Keyboard shortcuts

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