Documentation
¶
Index ¶
- Variables
- type CleanupResult
- type Phase
- type ReconcileReport
- type Reconciler
- type Record
- type Resources
- type Store
- func (s *Store) Exists() bool
- func (s *Store) History() ([]Record, error)
- func (s *Store) Init(vmID, backend, stateDir string) error
- func (s *Store) Load() (*Record, error)
- func (s *Store) MarkCleanup(name string, opErr error) error
- func (s *Store) Path() string
- func (s *Store) SetLastError(err error) error
- func (s *Store) SetPhase(phase Phase) error
- func (s *Store) SetResource(updateFn func(*Resources)) error
- func (s *Store) Update(updateFn func(*Record) error) error
- type VMManager
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrCreateRecordDir = errors.New("create lifecycle record directory") ErrReadRecord = errors.New("read lifecycle record") ErrDecodeRecord = errors.New("decode lifecycle record") ErrEncodeRecord = errors.New("encode lifecycle record") ErrWriteRecord = errors.New("write lifecycle record") ErrRenameRecord = errors.New("rename lifecycle record") ErrVMRunning = errors.New("VM is running") ErrInvalidPhase = errors.New("invalid lifecycle phase transition") ErrReconcileTable = errors.New("reconcile nftables table") ErrReconcileTap = errors.New("reconcile TAP interface") )
Functions ¶
This section is empty.
Types ¶
type CleanupResult ¶
type Phase ¶
type Phase string
const ( PhaseCreating Phase = "creating" PhaseCreated Phase = "created" PhaseStarting Phase = "starting" PhaseRunning Phase = "running" PhaseStopping Phase = "stopping" PhaseStopped Phase = "stopped" PhaseCleaning Phase = "cleaning" PhaseCleaned Phase = "cleaned" PhaseCreateFailed Phase = "create_failed" PhaseStartFailed Phase = "start_failed" PhaseStopFailed Phase = "stop_failed" PhaseCleanupFailed Phase = "cleanup_failed" )
type ReconcileReport ¶
type Reconciler ¶
type Reconciler struct {
// contains filtered or unexported fields
}
func NewReconciler ¶
func NewReconciler() *Reconciler
func NewReconcilerWithManagers ¶
func NewReconcilerWithManagers(stateMgr *state.Manager, subnetAlloc *state.SubnetAllocator) *Reconciler
func (*Reconciler) ReconcileAll ¶
func (r *Reconciler) ReconcileAll(forceRunning bool) ([]ReconcileReport, error)
func (*Reconciler) ReconcileVM ¶
func (r *Reconciler) ReconcileVM(vmID string, forceRunning bool) (ReconcileReport, error)
type Record ¶
type Record struct {
Version int `json:"version"`
VMID string `json:"vm_id"`
Backend string `json:"backend,omitempty"`
Phase Phase `json:"phase"`
UpdatedAt time.Time `json:"updated_at"`
LastError string `json:"last_error,omitempty"`
Resources Resources `json:"resources,omitempty"`
Cleanup map[string]CleanupResult `json:"cleanup,omitempty"`
}
type Resources ¶
type Resources struct {
StateDir string `json:"state_dir,omitempty"`
Workspace string `json:"workspace,omitempty"`
KernelRef string `json:"kernel_ref,omitempty"`
KernelPath string `json:"kernel_path,omitempty"`
RootfsPath string `json:"rootfs_path,omitempty"`
SubnetFile string `json:"subnet_file,omitempty"`
GatewayIP string `json:"gateway_ip,omitempty"`
GuestIP string `json:"guest_ip,omitempty"`
SubnetCIDR string `json:"subnet_cidr,omitempty"`
VsockPath string `json:"vsock_path,omitempty"`
TAPName string `json:"tap_name,omitempty"`
FirewallTable string `json:"firewall_table,omitempty"`
NATTable string `json:"nat_table,omitempty"`
}
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
func (*Store) SetLastError ¶
func (*Store) SetResource ¶
type VMManager ¶
type VMManager struct {
// contains filtered or unexported fields
}
VMManager wraps state lifecycle operations and ensures host resources are reconciled before metadata removal.
func NewVMManager ¶
func NewVMManager() *VMManager
func NewVMManagerWithDeps ¶
func NewVMManagerWithDeps(stateMgr *state.Manager, subnetAlloc *state.SubnetAllocator) *VMManager
Click to show internal directories.
Click to hide internal directories.