Documentation
¶
Index ¶
- func AddFormatFlag(cmd *cobra.Command)
- func CloneVMConfigFromFlags(cmd *cobra.Command, snapCfg *types.SnapshotConfig) (*types.VMConfig, error)
- func CommandContext(cmd *cobra.Command) context.Context
- func EnsureFirmwarePath(conf *config.Config, bootCfg *types.BootConfig)
- func FindHypervisor(ctx context.Context, conf *config.Config, ref string) (hypervisor.Hypervisor, error)
- func FormatSize(bytes int64) string
- func InitAllHypervisors(conf *config.Config) ([]hypervisor.Hypervisor, error)
- func InitBackends(ctx context.Context, conf *config.Config) ([]imagebackend.Images, hypervisor.Hypervisor, error)
- func InitHypervisor(conf *config.Config) (hypervisor.Hypervisor, error)
- func InitImageBackends(ctx context.Context, conf *config.Config) ([]imagebackend.Images, error)
- func InitImageBackendsForPull(ctx context.Context, conf *config.Config) (*oci.OCI, *cloudimg.CloudImg, error)
- func InitNetwork(conf *config.Config) (network.Network, error)
- func InitSnapshot(conf *config.Config) (snapshot.Snapshot, error)
- func IsURL(ref string) bool
- func ListAllVMs(ctx context.Context, hypers []hypervisor.Hypervisor) ([]*types.VM, error)
- func OutputFormatted(cmd *cobra.Command, data any, tableFn func(w *tabwriter.Writer)) error
- func OutputJSON(v any) error
- func ReconcileState(vm *types.VM) string
- func ResolveImage(ctx context.Context, backends []imagebackend.Images, vmCfg *types.VMConfig) ([]*types.StorageConfig, *types.BootConfig, error)
- func RestoreVMConfigFromFlags(cmd *cobra.Command, vm *types.VM, snapCfg *types.SnapshotConfig) (*types.VMConfig, error)
- func RouteRefs(ctx context.Context, hypers []hypervisor.Hypervisor, refs []string) (map[hypervisor.Hypervisor][]string, error)
- func VMConfigFromFlags(cmd *cobra.Command, image string) (*types.VMConfig, error)
- type BaseHandler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddFormatFlag ¶
AddFormatFlag registers the --format / -o flag on a command.
func CloneVMConfigFromFlags ¶
func CloneVMConfigFromFlags(cmd *cobra.Command, snapCfg *types.SnapshotConfig) (*types.VMConfig, error)
CloneVMConfigFromFlags builds VMConfig for clone commands. Zero-value flags inherit from the snapshot config; explicit values are validated against the snapshot minimums (clone resources must be >= snapshot's).
func CommandContext ¶
CommandContext returns command context, falling back to Background.
func EnsureFirmwarePath ¶
func EnsureFirmwarePath(conf *config.Config, bootCfg *types.BootConfig)
EnsureFirmwarePath sets default firmware path for cloudimg boot.
func FindHypervisor ¶ added in v0.2.9
func FindHypervisor(ctx context.Context, conf *config.Config, ref string) (hypervisor.Hypervisor, error)
FindHypervisor returns the backend that owns the given VM ref. Tries all registered backends; returns ErrNotFound if no backend has it.
func FormatSize ¶
func InitAllHypervisors ¶ added in v0.2.9
func InitAllHypervisors(conf *config.Config) ([]hypervisor.Hypervisor, error)
InitAllHypervisors initializes all registered backends for GC. Returns error if any backend fails — GC must not proceed without full blob pinning or it risks deleting referenced layers.
func InitBackends ¶
func InitBackends(ctx context.Context, conf *config.Config) ([]imagebackend.Images, hypervisor.Hypervisor, error)
InitBackends initializes all image backends and the hypervisor.
func InitHypervisor ¶
func InitHypervisor(conf *config.Config) (hypervisor.Hypervisor, error)
InitHypervisor initializes the selected hypervisor backend.
func InitImageBackends ¶
InitImageBackends initializes only image backends (no hypervisor needed).
func InitImageBackendsForPull ¶
func InitImageBackendsForPull(ctx context.Context, conf *config.Config) (*oci.OCI, *cloudimg.CloudImg, error)
InitImageBackendsForPull returns concrete backend types needed by Pull.
func InitNetwork ¶
InitNetwork creates the CNI network provider.
func InitSnapshot ¶
InitSnapshot initializes the snapshot backend.
func ListAllVMs ¶ added in v0.2.9
func ListAllVMs(ctx context.Context, hypers []hypervisor.Hypervisor) ([]*types.VM, error)
ListAllVMs returns VMs from all registered backends, merged.
func OutputFormatted ¶
OutputFormatted checks --format flag: "json" → JSON, otherwise calls tableFn.
func ReconcileState ¶
ReconcileState checks actual process liveness to detect stale "running" records.
func ResolveImage ¶
func ResolveImage(ctx context.Context, backends []imagebackend.Images, vmCfg *types.VMConfig) ([]*types.StorageConfig, *types.BootConfig, error)
ResolveImage resolves an image reference to StorageConfigs + BootConfig.
func RestoreVMConfigFromFlags ¶
func RestoreVMConfigFromFlags(cmd *cobra.Command, vm *types.VM, snapCfg *types.SnapshotConfig) (*types.VMConfig, error)
RestoreVMConfigFromFlags builds VMConfig for restore commands. Keeps VM's current values by default; CLI flags override. Validates that final values are >= snapshot minimums.
func RouteRefs ¶ added in v0.2.9
func RouteRefs(ctx context.Context, hypers []hypervisor.Hypervisor, refs []string) (map[hypervisor.Hypervisor][]string, error)
RouteRefs groups VM refs by their owning backend. Returns a map from hypervisor to refs it owns, or error if any ref is unresolvable.
Types ¶
type BaseHandler ¶
BaseHandler provides shared config access for all command handlers.
func NewBaseHandler ¶
func NewBaseHandler(conf *config.Config) BaseHandler
NewBaseHandler creates a BaseHandler that returns the given config pointer.