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 InitBridgeNetwork(conf *config.Config, bridgeDev string) (network.Network, 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 ResolveImageOwner(ctx context.Context, backends []imagebackend.Images, ref string) (imagebackend.Images, 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 unique backend that owns ref.
func FormatSize ¶
FormatSize formats a byte count as a human-readable size string.
func InitAllHypervisors ¶ added in v0.2.9
func InitAllHypervisors(conf *config.Config) ([]hypervisor.Hypervisor, error)
InitAllHypervisors initializes every backend in deterministic order.
func InitBackends ¶
func InitBackends(ctx context.Context, conf *config.Config) ([]imagebackend.Images, hypervisor.Hypervisor, error)
InitBackends initializes all image backends and the hypervisor.
func InitBridgeNetwork ¶ added in v0.3.2
InitBridgeNetwork creates a TAP-on-bridge network provider.
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 merged VM lists from all backends.
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 vmCfg.Image across image backends.
func ResolveImageOwner ¶ added in v0.3.1
func ResolveImageOwner(ctx context.Context, backends []imagebackend.Images, ref string) (imagebackend.Images, error)
ResolveImageOwner returns the single backend that owns ref.
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 owning backend.
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.