fs

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: May 13, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package fs is the runtime attach interface for vhost-user-fs devices (typically backed by virtiofsd) on a running VM.

State semantics: attach is runtime-only. Attached devices are not persisted in the VM record and disappear when the VM stops. The user must re-attach after a restart. Cocoon does not own the virtiofsd backend.

Index

Constants

View Source
const (
	DefaultNumQueues = 1
	DefaultQueueSize = 1024
)

Variables

View Source
var (

	// ErrUnsupportedBackend signals the resolved hypervisor backend cannot
	// hot-plug vhost-user-fs (e.g. Firecracker).
	ErrUnsupportedBackend = errors.New("backend does not support fs attach")
)

Functions

func DeriveID

func DeriveID(tag string) string

DeriveID returns the deterministic CH device id for a tag. Both attach (passed to vm.add-fs) and detach (matched against vm.info) use this so concurrent attaches of the same tag fail at CH's id-uniqueness check.

Types

type Attached

type Attached struct {
	ID     string `json:"id"`
	Tag    string `json:"tag"`
	Socket string `json:"socket"`
}

Attached is the inspect-time view of one fs device read from the running VM's CH config.

type Attacher

type Attacher interface {
	FsAttach(ctx context.Context, vmRef string, spec Spec) (deviceID string, err error)
	FsDetach(ctx context.Context, vmRef, tag string) error
}

Attacher hot-plugs and removes vhost-user-fs devices.

type Lister

type Lister interface {
	FsList(ctx context.Context, vmRef string) ([]Attached, error)
}

Lister enumerates currently-attached fs devices from running VM state.

type Spec

type Spec struct {
	Socket    string
	Tag       string
	NumQueues int
	QueueSize int
}

Spec is one attach request.

func (*Spec) Normalize

func (s *Spec) Normalize() error

Normalize enforces required fields and applies queue-size defaults. Mutates the receiver — callers expect the post-call Spec to be ready for serialization. Mirror vfio.Spec.NormalizedPath in spirit (compute + validate in one call) so future Specs in extend/ converge on the same idiom rather than fan out into pure-Validate vs. mutating-Validate styles.

Jump to

Keyboard shortcuts

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