Documentation
¶
Index ¶
- Constants
- func DefaultKernelCmdLine() config.KernelCmdLine
- func New(cfg *Config, networkSvc ports.NetworkService, fs afero.Fs) ports.MicroVMService
- type BalloonDeviceConfig
- type BlockDeviceConfig
- type BootSourceConfig
- type CacheType
- type Config
- type ConfigOption
- type FileEngineType
- type InstanceState
- type LogLevel
- type LoggerConfig
- type MMDSConfig
- type MMDSVersion
- type MachineConfig
- type Metadata
- type MetricsConfig
- type NetworkInterfaceConfig
- type State
- type VmmConfig
- type VsockDeviceConfig
Constants ¶
const ( // FileEngineTypeSync specifies using a synchronous engine based on blocking system calls. FileEngineTypeSync = FileEngineType("Sync") // FileEngineTypeAsync specifies using a asynchronous engine based on io_uring. FileEngineTypeAsync = FileEngineType("Async") )
const ( MMDSVersion1 = MMDSVersion("V1") MMDSVersion2 = MMDSVersion("V2") )
const (
ProviderName = "firecracker"
)
Variables ¶
This section is empty.
Functions ¶
func DefaultKernelCmdLine ¶
func DefaultKernelCmdLine() config.KernelCmdLine
DefaultKernelCmdLine is the default recommended kernel parameter list.
console=ttyS0 [KLN] Output console device and options reboot=k [KNL] reboot_type=kbd panic=1 [KNL] Kernel behaviour on panic: delay <timeout>
timeout > 0: seconds before rebooting timeout = 0: wait forever timeout < 0: reboot immediately
pci=off [X86] don't probe for the PCI bus i8042.noaux [HW] Don't check for auxiliary (== mouse) port i8042.nomux [HW] Don't check presence of an active multiplexing
controller
i8042.nopnp [HW] Don't use ACPIPnP / PnPBIOS to discover KBD/AUX
controllers
i8042.dumbkbd [HW] Pretend that controller can only read data from
keyboard and cannot control its state (Don't attempt to blink the leds)
Read more: https://www.kernel.org/doc/html/v5.15/admin-guide/kernel-parameters.html
func New ¶
func New(cfg *Config, networkSvc ports.NetworkService, fs afero.Fs) ports.MicroVMService
New creates a new instance of the firecracker microvm provider.
Types ¶
type BalloonDeviceConfig ¶
type BalloonDeviceConfig struct { // AmountMib is the target balloon size in MiB. AmountMib int64 `json:"amount_mib"` // DeflateOnOOM when set to true will deflate the balloon in case the guest is out of memory. DeflateOnOOM bool `json:"deflate_on_oom"` // StatsPollingInterval is the interval in seconds between refreshing statistics. StatsPollingInterval int64 `json:"stats_polling_interval_s"` }
BalloonDeviceConfig holds the configuration for the memory balloon device.
type BlockDeviceConfig ¶
type BlockDeviceConfig struct { // ID is the unique identifier of the drive. ID string `json:"drive_id"` // PathOnHost is the path of the drive on the host machine. PathOnHost string `json:"path_on_host"` // IsRootDevice when true makes the current device the root block device. // Setting this flag to true will mount the block device in the // guest under /dev/vda unless the partuuid is present. IsRootDevice bool `json:"is_root_device"` // PartUUID represents the unique id of the boot partition of this device. It is // optional and it will be used only if the `IsRootDevice` field is true. PartUUID string `json:"partuuid,omitempty"` // IsReadOnly when true the drive is opened in read-only mode. Otherwise, the // drive is opened as read-write. IsReadOnly bool `json:"is_read_only"` // CacheType indicates whether the drive will ignore flush requests coming from // the guest driver. CacheType CacheType `json:"cache_type"` }
BlockDeviceConfig contains the configuration for a microvm block device.
type BootSourceConfig ¶
type BootSourceConfig struct { // KernelImagePage is the path of the kernel image. KernelImagePage string `json:"kernel_image_path"` // InitrdPath is the path of the initrd, if there is one. InitrdPath *string `json:"initrd_path,omitempty"` // BootArgs contains the boot arguments to pass to the kernel. If this field is uninitialized, the default // kernel command line is used: `reboot=k panic=1 pci=off nomodules 8250.nr_uarts=0`. BootArgs *string `json:"boot_args,omitempty"` }
BootSourceConfig holds the configuration for the boot source of a microvm.
type CacheType ¶
type CacheType string
const ( // CacheTypeUnsafe indovates the flushing mechanic will be advertised to // the guest driver, but the operation will be a noop. CacheTypeUnsafe CacheType = "Unsafe" // CacheTypeWriteBack indicates the flushing mechanic will be advertised // to the guest driver and flush requests coming from the guest will be // performed using `fsync`. CacheTypeWriteBack CacheType = "WriteBack" )
type Config ¶
type Config struct { // FirecrackerBin is the firecracker binary to use. FirecrackerBin string // StateRoot is the folder to store any required firecracker state (i.e. socks, pid, log files). StateRoot string // RunDetached indicates that the firecracker processes should be run detached (a.k.a daemon) from the parent process. RunDetached bool // DeleteVMTimeout is the timeout to wait for the microvm to be deleted. DeleteVMTimeout time.Duration }
Config represents the configuration options for the Firecracker infrastructure.
type ConfigOption ¶
func WithMicroVM ¶
func WithMicroVM(vm *models.MicroVM) ConfigOption
func WithState ¶
func WithState(vmState State) ConfigOption
type FileEngineType ¶
type FileEngineType string
type InstanceState ¶
type InstanceState string
InstanceState is a type that represents the running state of a Firecracker instance.
const ( // InstanceStateNotStarted the instance hasn't started running yet. InstanceStateNotStarted InstanceState = "Not started" // InstanceStateRunning the instance is running. InstanceStateRunning InstanceState = "Running" // InstanceStatePaused the instance is currently paused. InstanceStatePaused InstanceState = "Paused" )
type LoggerConfig ¶
type LoggerConfig struct { // LogPath is the named pipe or file used as output for logs. LogPath string `json:"log_path"` // Level is the level of the logger. Level LogLevel `json:"level"` // ShowLevel when set to true the logger will append to the output the severity of the log entry. ShowLevel bool `json:"show_level"` // ShowLogOrigin when set to true the logger will append the origin of the log entry. ShowLogOrigin bool `json:"show_log_origin"` }
LoggerConfig holds the configuration for the logger.
type MMDSConfig ¶
type MMDSConfig struct { // Version specifies the MMDS version to use. If not specified it will default to V1. Supported values are V1 & V2. Version MMDSVersion `json:"version,omitempty"` // NetworkInterfaces specifies the interfaces that allow forwarding packets to MMDS. NetworkInterfaces []string `json:"network_interfaces,omitempty"` // IPV4Address is the MMDS IPv4 configured address. IPV4Address *string `json:"ipv4_address,omitempty"` }
MMDSConfig is the config related to the mmds.
type MMDSVersion ¶
type MMDSVersion string
type MachineConfig ¶
type MachineConfig struct { // VcpuCount is the number of vcpu to start. VcpuCount int64 `json:"vcpu_count"` // MemSizeMib is the memory size in MiB. MemSizeMib int64 `json:"mem_size_mib"` // SMT enables or disabled hyperthreading. SMT bool `json:"smt"` // CPUTemplate is a CPU template that it is used to filter the CPU features exposed to the guest. CPUTemplate *string `json:"cpu_template,omitempty"` // TrackDirtyPages enables or disables dirty page tracking. Enabling allows incremental snapshots. TrackDirtyPages bool `json:"track_dirty_pages"` }
type MetricsConfig ¶
type MetricsConfig struct { // Path is the named pipe or file used as output for metrics. Path string `json:"metrics_path"` }
MetrcsConfig contains the configuration for the microvm metrics.
type NetworkInterfaceConfig ¶
type NetworkInterfaceConfig struct { // IfaceID is the ID of the guest network interface. IfaceID string `json:"iface_id"` // HostDevName is the host level path for the guest network interface. HostDevName string `json:"host_dev_name"` // GuestMAC is the mac address to use. GuestMAC string `json:"guest_mac,omitempty"` }
NetworkInterfaceConfig is the configuration for a network interface of a microvm.
type State ¶
type State interface { Root() string PID() (int, error) PIDPath() string SetPid(pid int) error LogPath() string MetricsPath() string StdoutPath() string StderrPath() string ConfigPath() string Config() (VmmConfig, error) SetConfig(cfg *VmmConfig) error MetadataPath() string Metadata() (Metadata, error) SetMetadata(meta *Metadata) error }
type VmmConfig ¶
type VmmConfig struct { // Balloon hols the balloon device configuration. Balloon *BalloonDeviceConfig `json:"balloon,omitempty"` // BlockDevices is the configuration for the drives. BlockDevices []BlockDeviceConfig `json:"drives"` // BootSourec is the boot source configuration for the microvm. BootSource BootSourceConfig `json:"boot-source"` // Logger is the logger configuration. Logger *LoggerConfig `json:"logger,omitempty"` // MachineConfig contains the microvm machine config. MachineConfig MachineConfig `json:"machine-config"` // Metrics is the metrics configuration. Metrics *MetricsConfig `json:"metrics,omitempty"` // Mmds is the configuration for the metadata service Mmds *MMDSConfig `json:"mmds-config,omitempty"` // NetDevices is the configuration for the microvm network devices. NetDevices []NetworkInterfaceConfig `json:"network-interfaces"` // VsockDevice is the configuration for the vsock device. VsockDevice *VsockDeviceConfig `json:"vsock,omitempty"` }
VmmConfig contains the configuration of the microvm. Based on the rust structure from firecracker: https://github.com/firecracker-microvm/firecracker/blob/0690010524001b606f67c1a65c67f3c27883183f/src/vmm/src/resources.rs#L51.
func CreateConfig ¶
func CreateConfig(opts ...ConfigOption) (*VmmConfig, error)