cloudimg

package
v0.2.8 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2026 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsQcow2File

func IsQcow2File(path string) bool

IsQcow2File checks if a file starts with the qcow2 magic bytes "QFI\xfb".

Types

type CloudImg

type CloudImg struct {
	// contains filtered or unexported fields
}

CloudImg implements the images.Images interface using cloud images (qcow2/raw) downloaded from HTTP/HTTPS URLs, converted to qcow2 v3 for use with Cloud Hypervisor via UEFI boot.

func New

func New(ctx context.Context, conf *config.Config) (*CloudImg, error)

New creates a new cloud image backend.

func (*CloudImg) Config

func (c *CloudImg) Config(ctx context.Context, vms []*types.VMConfig) (result [][]*types.StorageConfig, boot []*types.BootConfig, err error)

Config generates StorageConfig and BootConfig entries for the given VMs. For cloud images: single qcow2 blob per image, UEFI boot (empty BootConfig).

func (*CloudImg) Delete

func (c *CloudImg) Delete(ctx context.Context, ids []string) ([]string, error)

Delete removes images from the index. Returns the list of actually deleted refs.

func (*CloudImg) GCModule

func (c *CloudImg) GCModule() gc.Module[images.ImageGCSnapshot]

GCModule returns a typed gc.Module for the cloud image backend.

func (*CloudImg) Import

func (c *CloudImg) Import(ctx context.Context, name string, tracker progress.Tracker, file ...string) error

Import imports local qcow2 file(s) as a cloud image. A single file uses an optimized path that hashes in place and avoids a temp copy. Multiple files are concatenated via the reader path (split file reassembly).

func (*CloudImg) ImportFromReader added in v0.2.7

func (c *CloudImg) ImportFromReader(ctx context.Context, name string, tracker progress.Tracker, r io.Reader) error

ImportFromReader imports a qcow2 image from a reader (stdin, gzip stream, etc.).

func (*CloudImg) Inspect

func (c *CloudImg) Inspect(ctx context.Context, id string) (*types.Image, error)

Inspect returns the record for a single image. Returns (nil, nil) if not found.

func (*CloudImg) List

func (c *CloudImg) List(ctx context.Context) ([]*types.Image, error)

List returns all locally stored cloud images.

func (*CloudImg) Pull

func (c *CloudImg) Pull(ctx context.Context, url string, tracker progress.Tracker) error

Pull downloads a cloud image from a URL, converts it to qcow2 v3, and stores the blob in the content-addressed cache.

func (*CloudImg) RegisterGC

func (c *CloudImg) RegisterGC(orch *gc.Orchestrator)

RegisterGC registers the cloud image GC module with the given Orchestrator.

func (*CloudImg) Type

func (c *CloudImg) Type() string

type Config

type Config struct {
	images.BaseConfig
}

Config holds cloud image backend specific configuration, embedding the shared BaseConfig.

func NewConfig

func NewConfig(conf *config.Config) *Config

NewConfig creates a Config from a global config.

func (*Config) EnsureDirs

func (c *Config) EnsureDirs() error

EnsureDirs creates all required directories for the cloudimg backend.

func (*Config) FirmwarePath

func (c *Config) FirmwarePath() string

FirmwarePath returns the path to the UEFI firmware blob (CLOUDHV.fd).

Jump to

Keyboard shortcuts

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