Documentation
¶
Index ¶
- func AddFormatFlag(cmd *cobra.Command)
- func AddOutputFlag(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 EnsureImage(ctx context.Context, backends []imagebackend.Images, vmCfg *types.VMConfig)
- 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 MaybeOutputJSON(cmd *cobra.Command, v any) (bool, 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)
- func WantJSON(cmd *cobra.Command) bool
- type BaseHandler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddFormatFlag ¶
func AddOutputFlag ¶ added in v0.3.7
AddOutputFlag adds --output/-o for lifecycle commands. Empty default keeps the human-readable log output; "json" emits a parseable result on stdout.
func CloneVMConfigFromFlags ¶
func CloneVMConfigFromFlags(cmd *cobra.Command, snapCfg *types.SnapshotConfig) (*types.VMConfig, error)
CloneVMConfigFromFlags builds VMConfig for clone (inherits from snapshot).
func CommandContext ¶
CommandContext returns command context, fallback to Background.
func EnsureFirmwarePath ¶
func EnsureFirmwarePath(conf *config.Config, bootCfg *types.BootConfig)
func EnsureImage ¶ added in v0.3.6
EnsureImage checks whether the exact base image (by digest) required by vmCfg exists locally and pulls it if missing. Inspect uses ImageDigest to match the exact version recorded at snapshot time; Pull uses Image (tag/URL) as the registry reference, then verifies the pulled digest.
For imported images (not pullable from a registry), a warning is logged and the caller proceeds — VerifyBaseFiles will catch the actual error.
func FindHypervisor ¶ added in v0.2.9
func FindHypervisor(ctx context.Context, conf *config.Config, ref string) (hypervisor.Hypervisor, error)
func FormatSize ¶
func InitAllHypervisors ¶ added in v0.2.9
func InitAllHypervisors(conf *config.Config) ([]hypervisor.Hypervisor, error)
func InitBackends ¶
func InitBackends(ctx context.Context, conf *config.Config) ([]imagebackend.Images, hypervisor.Hypervisor, error)
func InitBridgeNetwork ¶ added in v0.3.2
func InitHypervisor ¶
func InitHypervisor(conf *config.Config) (hypervisor.Hypervisor, error)
func InitImageBackends ¶
func ListAllVMs ¶ added in v0.2.9
func ListAllVMs(ctx context.Context, hypers []hypervisor.Hypervisor) ([]*types.VM, error)
func MaybeOutputJSON ¶ added in v0.3.7
MaybeOutputJSON emits v as JSON iff --output=json is set. Returns (true, encodeErr) when JSON was emitted — caller should return the error without falling through to human-readable logging. Returns (false, nil) otherwise so the caller proceeds with normal log output.
func OutputFormatted ¶
OutputFormatted outputs as JSON or table based on --format flag.
func OutputJSON ¶
func ReconcileState ¶
ReconcileState detects stale running records via process liveness.
func ResolveImage ¶
func ResolveImage(ctx context.Context, backends []imagebackend.Images, vmCfg *types.VMConfig) ([]*types.StorageConfig, *types.BootConfig, error)
func ResolveImageOwner ¶ added in v0.3.1
func ResolveImageOwner(ctx context.Context, backends []imagebackend.Images, ref string) (imagebackend.Images, error)
func RestoreVMConfigFromFlags ¶
func RestoreVMConfigFromFlags(cmd *cobra.Command, vm *types.VM, snapCfg *types.SnapshotConfig) (*types.VMConfig, error)
RestoreVMConfigFromFlags builds VMConfig for restore (allows overrides).
func RouteRefs ¶ added in v0.2.9
func RouteRefs(ctx context.Context, hypers []hypervisor.Hypervisor, refs []string) (map[hypervisor.Hypervisor][]string, error)
func VMConfigFromFlags ¶
Types ¶
type BaseHandler ¶
BaseHandler provides shared config access for all command handlers.
func NewBaseHandler ¶
func NewBaseHandler(conf *config.Config) BaseHandler