virter

package
v0.13.2 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2021 License: Apache-2.0 Imports: 43 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RootFSType      = "application/vnd.com.linbit.virter.image.v1.rootfs"
	ImageMediaType  = "application/vnd.com.linbit.virter.image.v1"
	TagVolumePrefix = "virter:tag:"
)
View Source
const (
	// LayerMediaType is the media type used when upload a layer to a container registry.
	LayerMediaType = "application/vnd.com.linbit.virter.layer.v1.qcow2.gzip"
	// LayerVolumePrefix is the prefix for all VolumeLayer storage volumes in libvirt.
	LayerVolumePrefix = "virter:layer:"
	// WorkingLayerNamePrefix is the prefix for all layers that are actively attached to a libvirt VM.
	WorkingLayerNamePrefix = "virter:work:"
)
View Source
const (
	VMDiskDeviceDisk  = "disk"
	VMDiskDeviceCDROM = "cdrom"
)
View Source
const (
	NICTypeNetwork = "network"
	NICTypeBridge  = "bridge"
)

Variables

This section is empty.

Functions

func AddToIP added in v0.12.0

func AddToIP(ip net.IP, addend uint) net.IP

func AddToMAC added in v0.12.0

func AddToMAC(mac net.HardwareAddr, addend uint) (net.HardwareAddr, error)

func DynamicLayerName added in v0.14.0

func DynamicLayerName(name string) string

DynamicLayerName returns the prefixed raw volume name for the given dynamic layer.

func EnvmapToSlice

func EnvmapToSlice(envMap map[string]string) []string

func GenerateISO

func GenerateISO(files map[string][]byte) ([]byte, error)

GenerateISO generates a "CD-ROM" filesystem

func QemuBaseMAC added in v0.12.0

func QemuBaseMAC() net.HardwareAddr

func QemuMAC added in v0.5.0

func QemuMAC(id uint) string

QemuMAC calculates a MAC address for a given id

Types

type AfterNotifier

type AfterNotifier interface {
	After(d time.Duration) <-chan time.Time
}

AfterNotifier wait for a duration to elapse

type Disk added in v0.2.0

type Disk interface {
	GetName() string
	GetSizeKiB() uint64
	GetFormat() string
	GetBus() string
}

type HTTPClient

type HTTPClient interface {
	Do(req *http.Request) (resp *http.Response, err error)
}

HTTPClient contains required HTTP methods.

type ImageBuildConfig

type ImageBuildConfig struct {
	ImageName       string
	ContainerName   string
	ShutdownTimeout time.Duration
	ProvisionConfig ProvisionConfig
	ResetMachineID  bool
}

ImageBuildConfig contains the configuration for building an image

type ImageBuildTools

type ImageBuildTools struct {
	ShellClientBuilder ShellClientBuilder
	ContainerProvider  containerapi.ContainerProvider
	AfterNotifier      AfterNotifier
}

ImageBuildTools includes the dependencies for building an image

type LayerOperationOption added in v0.14.0

type LayerOperationOption = func(o *layerOperatorOpts)

func WithProgress added in v0.14.0

func WithProgress(p ProgressOpt) LayerOperationOption

type LibvirtConnection

type LibvirtConnection interface {
	ConnectListAllDomains(NeedResults int32, Flags libvirt.ConnectListAllDomainsFlags) (rDomains []libvirt.Domain, rRet uint32, err error)
	StoragePoolLookupByName(Name string) (rPool libvirt.StoragePool, err error)
	StoragePoolListAllVolumes(Pool libvirt.StoragePool, NeedResults int32, Flags uint32) (rVols []libvirt.StorageVol, rRet uint32, err error)
	StorageVolCreateXML(Pool libvirt.StoragePool, XML string, Flags libvirt.StorageVolCreateFlags) (rVol libvirt.StorageVol, err error)
	StorageVolCreateXMLFrom(Pool libvirt.StoragePool, XML string, original libvirt.StorageVol, Flags libvirt.StorageVolCreateFlags) (rVol libvirt.StorageVol, err error)
	StorageVolDelete(Vol libvirt.StorageVol, Flags libvirt.StorageVolDeleteFlags) (err error)
	StorageVolLookupByName(Pool libvirt.StoragePool, Name string) (rVol libvirt.StorageVol, err error)
	StorageVolUpload(Vol libvirt.StorageVol, outStream io.Reader, Offset, Length uint64, Flags libvirt.StorageVolUploadFlags) (err error)
	StorageVolGetXMLDesc(Vol libvirt.StorageVol, Flags uint32) (rXML string, err error)
	StorageVolDownload(Vol libvirt.StorageVol, inStream io.Writer, Offset, Length uint64, Flags libvirt.StorageVolDownloadFlags) (err error)
	StorageVolGetInfo(Vol libvirt.StorageVol) (rType int8, rCapacity, rAllocation uint64, err error)
	ConnectListAllNetworks(NeedResults int32, Flags libvirt.ConnectListAllNetworksFlags) (rNets []libvirt.Network, rRet uint32, err error)
	NetworkGetDhcpLeases(Net libvirt.Network, Mac libvirt.OptString, NeedResults int32, Flags uint32) (rLeases []libvirt.NetworkDhcpLease, rRet uint32, err error)
	NetworkDefineXML(XML string) (rNet libvirt.Network, err error)
	NetworkSetAutostart(Net libvirt.Network, Autostart int32) (err error)
	NetworkCreate(Net libvirt.Network) (err error)
	NetworkDestroy(Net libvirt.Network) (err error)
	NetworkUndefine(Net libvirt.Network) (err error)
	NetworkLookupByName(Name string) (rNet libvirt.Network, err error)
	NetworkGetXMLDesc(Net libvirt.Network, Flags uint32) (rXML string, err error)
	NetworkUpdate(Net libvirt.Network, Command, Section uint32, ParentIndex int32, XML string, Flags libvirt.NetworkUpdateFlags) (err error)
	DomainLookupByName(Name string) (rDom libvirt.Domain, err error)
	DomainGetXMLDesc(Dom libvirt.Domain, Flags libvirt.DomainXMLFlags) (rXML string, err error)
	DomainDefineXML(XML string) (rDom libvirt.Domain, err error)
	DomainCreate(Dom libvirt.Domain) (err error)
	DomainIsActive(Dom libvirt.Domain) (rActive int32, err error)
	DomainIsPersistent(Dom libvirt.Domain) (rPersistent int32, err error)
	DomainShutdown(Dom libvirt.Domain) (err error)
	DomainDestroy(Dom libvirt.Domain) (err error)
	DomainUndefine(Dom libvirt.Domain) (err error)
	DomainListAllSnapshots(Dom libvirt.Domain, NeedResults int32, Flags uint32) (rSnapshots []libvirt.DomainSnapshot, rRet int32, err error)
	DomainSnapshotDelete(Snap libvirt.DomainSnapshot, Flags libvirt.DomainSnapshotDeleteFlags) (err error)
	Disconnect() error
	ConnectGetLibVersion() (uint64, error)
}

LibvirtConnection contains required libvirt connection methods.

type LibvirtGetError added in v0.5.0

type LibvirtGetError struct {
	Message  string
	Err      error
	NotFound bool
}

func (*LibvirtGetError) Error added in v0.5.0

func (e *LibvirtGetError) Error() string

func (*LibvirtGetError) Unwrap added in v0.5.0

func (e *LibvirtGetError) Unwrap() error

type LocalImage added in v0.14.0

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

LocalImage represents a list of local layers addressable by a human readable name.

An image is stored in libvirt as an empty volume prefixed by TagVolumePrefix. This volume has the actual VolumeLayer as backing store. This type implements the regv1.Image interface, i.e. it can be pushed to a container registry.

func (*LocalImage) ConfigFile added in v0.14.0

func (l *LocalImage) ConfigFile() (*regv1.ConfigFile, error)

ConfigFile returns this image's config file.

For containers this specifies metadata like which command to run and permissions. For us this simply carries the list layers by their uncompressed id.

func (*LocalImage) ConfigName added in v0.14.0

func (l *LocalImage) ConfigName() (regv1.Hash, error)

ConfigName returns the hash of the image's config file, also known as the Image ID.

func (*LocalImage) Digest added in v0.14.0

func (l *LocalImage) Digest() (regv1.Hash, error)

Digest returns the sha256 of this image's manifest.

func (*LocalImage) LayerByDiffID added in v0.14.0

func (l *LocalImage) LayerByDiffID(hash regv1.Hash) (regv1.Layer, error)

LayerByDiffID is an analog to LayerByDigest, looking up by "diff id" (the uncompressed hash).

func (*LocalImage) LayerByDigest added in v0.14.0

func (l *LocalImage) LayerByDigest(hash regv1.Hash) (regv1.Layer, error)

LayerByDigest returns a Layer for interacting with a particular layer of the image, looking it up by "digest" (the compressed hash).

func (*LocalImage) Layers added in v0.14.0

func (l *LocalImage) Layers() ([]regv1.Layer, error)

Layers returns the ordered list of layers that make up this image.

The order of layers is oldest/base layer first, most recent/top layer last. Since VolumeLayer are not directly suitable for pushing to a registry, this method pre-computes the compatible layers and caches the result for later use.

func (*LocalImage) Manifest added in v0.14.0

func (l *LocalImage) Manifest() (*regv1.Manifest, error)

Manifest returns this image's Manifest object.

The manifest ties a tag to layers. When fetching an image from a registry, first the matching manifest is fetched. The manifest references the layers to fetch and the (container) configuration. For our purpose, only the layers are of interest.

func (*LocalImage) MediaType added in v0.14.0

func (l *LocalImage) MediaType() (types.MediaType, error)

MediaType of this image's manifest.

func (*LocalImage) Name added in v0.14.0

func (l *LocalImage) Name() string

Name returns the local name of the image.

func (*LocalImage) RawConfigFile added in v0.14.0

func (l *LocalImage) RawConfigFile() ([]byte, error)

RawConfigFile returns the serialized bytes of ConfigFile().

func (*LocalImage) RawManifest added in v0.14.0

func (l *LocalImage) RawManifest() ([]byte, error)

RawManifest returns the serialized bytes of Manifest()

func (*LocalImage) Size added in v0.14.0

func (l *LocalImage) Size() (int64, error)

Size returns the size of the manifest.

func (*LocalImage) TopLayer added in v0.14.0

func (l *LocalImage) TopLayer() *VolumeLayer

TopLayer returns the top most VolumeLayer.

The returned volume layer can be used as backing volume when starting a new VM based on this image.

type NIC added in v0.11.0

type NIC interface {
	GetType() string
	GetSource() string
	GetModel() string
	GetMAC() string
}

type NICType added in v0.11.0

type NICType string

type NewLayerOption added in v0.14.0

type NewLayerOption = func(volume *lx.StorageVolume)

NewLayerOption can be passed when creating a new layer to make changes on the libvirt storage volume object.

func WithBackingLayer added in v0.14.0

func WithBackingLayer(layer *VolumeLayer) NewLayerOption

WithBackingLayer sets the backing layer.

func WithCapacity added in v0.14.0

func WithCapacity(minCapKib uint64) NewLayerOption

WithCapacity sets the minimal capacity of the new layer in KibiByte.

func WithFormat added in v0.14.0

func WithFormat(fmt string) NewLayerOption

WithFormat sets the format used by the storage volume.

Supported values are "qcow2" and "raw".

type ProgressOpt added in v0.14.0

type ProgressOpt interface {
	NewBar(name, operation string, total int64) *mpb.Bar
}

type ProvisionConfig

type ProvisionConfig struct {
	Values map[string]string `toml:"values"`
	Env    map[string]string `toml:"env"`
	Steps  []ProvisionStep   `toml:"steps"`
}

ProvisionConfig holds the configuration of the whole provisioning

func NewProvisionConfig

func NewProvisionConfig(provOpt ProvisionOption) (ProvisionConfig, error)

NewProvisionConfig returns a ProvisionConfig from a ProvisionOption

func (*ProvisionConfig) NeedsContainers added in v0.4.2

func (p *ProvisionConfig) NeedsContainers() bool

NeedsContainers checks if there is a provision step that requires a docker client

type ProvisionDockerCopyStep added in v0.6.0

type ProvisionDockerCopyStep struct {
	Source string `toml:"source"`
	Dest   string `toml:"dest"`
}

type ProvisionDockerStep

type ProvisionDockerStep struct {
	Image   string                   `toml:"image"`
	Env     map[string]string        `toml:"env"`
	Command []string                 `toml:"command"`
	Copy    *ProvisionDockerCopyStep `toml:"copy"`
}

ProvisionDockerStep is a single provisioniong step executed in a docker container

type ProvisionOption

type ProvisionOption struct {
	FilePath  string
	Overrides []string
}

ProvisionOption sumarizes all the options used for generating the final ProvisionConfig

type ProvisionRsyncStep

type ProvisionRsyncStep struct {
	Source string `toml:"source"`
	Dest   string `toml:"dest"`
}

ProvisionRsyncStep is used to copy files to the target via the rsync utility

type ProvisionShellStep

type ProvisionShellStep struct {
	Script string            `toml:"script"`
	Env    map[string]string `toml:"env"`
}

ProvisionShellStep is a single provisioniong step executed in a shell (via ssh)

type ProvisionStep

type ProvisionStep struct {
	Docker *ProvisionDockerStep `toml:"docker,omitempty"`
	Shell  *ProvisionShellStep  `toml:"shell,omitempty"`
	Rsync  *ProvisionRsyncStep  `toml:"rsync,omitempty"`
}

ProvisionStep is a single provisioniong step

type RawLayer added in v0.14.0

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

RawLayer represents and wraps a libvirt storage volume.

func (*RawLayer) CloneAs added in v0.14.0

func (rl *RawLayer) CloneAs(name string, opts ...LayerOperationOption) (*RawLayer, error)

CloneAs creates a copy of this layer under the given name.

func (*RawLayer) Delete added in v0.14.0

func (rl *RawLayer) Delete() error

Delete deletes this layer.

There are no checks that prevent deletion of an in-use layer (either directly attached, or part of a layer chain). A layer that did not exist in the backend will still delete successfully.

func (*RawLayer) DeleteAllIfUnused added in v0.14.0

func (rl *RawLayer) DeleteAllIfUnused() error

func (*RawLayer) DeleteIfUnused added in v0.14.0

func (rl *RawLayer) DeleteIfUnused() (bool, error)

DeleteIfUnused deletes the layer if it not referenced as a backing layer of other layers.

This method assumes that only VolumeLayer can have child layers, i.e. if a non VolumeLayer layer depends on another non VolumeLayer layer, it will still be deleted. This should not be an issue, as only the top-most layers should be mutable (i.e. a non VolumeLayer layer).

func (*RawLayer) Dependency added in v0.14.0

func (rl *RawLayer) Dependency() (*VolumeLayer, error)

Dependency returns a reference to a backing VolumeLayer, if any.

Returns nil if no backing layer was found. Returns an error if the backing layer is not a VolumeLayer.

func (*RawLayer) Descriptor added in v0.14.0

func (rl *RawLayer) Descriptor() (lx.StorageVolume, error)

Descriptor returns the libvirt descriptor of the storage volume backing this layer.

func (*RawLayer) DiffID added in v0.14.0

func (rl *RawLayer) DiffID() (regv1.Hash, error)

DiffID computes a digest of the Uncompressed layer content.

func (*RawLayer) Name added in v0.14.0

func (rl *RawLayer) Name() string

Name returns the raw volume name

func (*RawLayer) ToVolumeLayer added in v0.14.0

func (rl *RawLayer) ToVolumeLayer(diffID *regv1.Hash, opts ...LayerOperationOption) (*VolumeLayer, error)

ToVolumeLayer converts this layer into a VolumeLayer.

First, computes the DiffID of the given layer, creates a new VolumeLayer compatible volume and copies the content of this layer over to the new volume. Afterwards, deletes this layer in the libvirt backend. If diffID is nil, it will be computed from the volume content.

func (*RawLayer) Uncompressed added in v0.14.0

func (rl *RawLayer) Uncompressed() (io.ReadCloser, error)

Uncompressed returns a reader that yields the raw volume.

If the RawLayer is in qcow2 format, this will read the raw qcow2 file, without any backing store.

func (*RawLayer) Upload added in v0.14.0

func (rl *RawLayer) Upload(reader io.Reader) error

Upload copies the content of the given reader to the storage volume

type SSHPingConfig added in v0.6.0

type SSHPingConfig struct {
	SSHPingCount  int
	SSHPingPeriod time.Duration
}

SSHPingConfig contains the configuration for pinging a VM via SSH

type ShellClient

type ShellClient interface {
	DialContext(ctx context.Context) error
	Close() error
	StdoutPipe() (io.Reader, error)
	StderrPipe() (io.Reader, error)
	ExecScript(script string) error
	Shell() error
}

ShellClient executes shell commands

type ShellClientBuilder

type ShellClientBuilder interface {
	NewShellClient(hostPort string, sshconfig ssh.ClientConfig) ShellClient
}

ShellClientBuilder provides SSH connections

type VMConfig

type VMConfig struct {
	Image              *LocalImage
	Name               string
	MemoryKiB          uint64
	BootCapacityKiB    uint64
	VCPUs              uint
	ID                 uint
	StaticDHCP         bool
	ExtraSSHPublicKeys []string
	ConsolePath        string
	Disks              []Disk
	ExtraNics          []NIC
	GDBPort            uint
}

VMConfig contains the configuration for starting a VM

func CheckVMConfig

func CheckVMConfig(vmConfig VMConfig) (VMConfig, error)

CheckVMConfig takes a VMConfig, does basic checks, and returns it back.

type VMDisk added in v0.2.0

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

type VMDiskDevice added in v0.2.0

type VMDiskDevice string

type VMMeta added in v0.9.0

type VMMeta struct {
	HostKey string `xml:"hostkey"`
}

VMMeta is additional metadata stored with each VM

type VMNic added in v0.11.0

type VMNic struct {
	VMName     string
	MAC        string
	IP         string
	HostName   string
	HostDevice string
}

type Virter

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

Virter manipulates libvirt for virter.

func New

func New(libvirtConnection LibvirtConnection,
	storagePoolName string,
	networkName string,
	store sshkeys.KeyStore) *Virter

New configures a new Virter.

func (*Virter) AddDHCPHost added in v0.6.0

func (v *Virter) AddDHCPHost(mac string, id uint) error

AddDHCPHost determines the IP for an ID and adds a DHCP mapping from a MAC address to it. The same MAC address should always be paired with a given IP so that DHCP entries do not need to be released between removing a VM and creating another with the same ID.

func (*Virter) Disconnect

func (v *Virter) Disconnect() error

Disconnect disconnects virter's connection to libvirt

func (*Virter) FindDynamicLayer added in v0.14.0

func (v *Virter) FindDynamicLayer(name string) (*RawLayer, error)

FindDynamicLayer searches the default storage pool for the given dynamic layer, suitable for attaching to a VM.

If no matching layer could be found, returns (nil, nil).

func (*Virter) FindImage added in v0.14.0

func (v *Virter) FindImage(image string, opts ...LayerOperationOption) (*LocalImage, error)

FindImage searches the default storage pool for a LocalImage of the given name.

If no matching image could be found, returns (nil, nil).

func (*Virter) FindRawLayer added in v0.14.0

func (v *Virter) FindRawLayer(name string) (*RawLayer, error)

FindRawLayer searches the default storage pool for the given volume and returns a RawLayer.

If the layer could not be found, will return (nil, nil).

func (*Virter) FindVolumeLayer added in v0.14.0

func (v *Virter) FindVolumeLayer(name string) (*VolumeLayer, error)

FindVolumeLayer searches the default storage pool for the given volume layer and returns a VolumeLayer.

The name is the raw layer name, i.e. "sha256:xxxx". If no matching volume is found, returns (nil, nil).

func (*Virter) ForceDisconnect added in v0.3.0

func (v *Virter) ForceDisconnect()

ForceDisconnect disconnects virter's connection to libvirt

It behaves like Disconnect(), except it does not return an error. If an error would be returned, the error will be logged and the program will terminate. Note: this is useful for `defer` statements

func (*Virter) GetVMID added in v0.5.0

func (v *Virter) GetVMID(wantedID uint, expectDHCPEntry bool) (uint, error)

GetVMID returns wantedID if it is not 0 and free. If wantedID is 0 GetVMID searches for an unused ID and returns the first it can find. For searching it uses the set libvirt network and already reserved DHCP entries.

func (*Virter) ImageBuild

func (v *Virter) ImageBuild(ctx context.Context, tools ImageBuildTools, vmConfig VMConfig, pingConfig SSHPingConfig, buildConfig ImageBuildConfig, opts ...LayerOperationOption) error

ImageBuild builds an image by running a VM and provisioning it.

func (*Virter) ImageImport added in v0.14.0

func (v *Virter) ImageImport(name string, image regv1.Image, opts ...LayerOperationOption) (*LocalImage, error)

ImageImport imports the given registry image into the local storage pool

func (*Virter) ImageImportFromReader added in v0.14.0

func (v *Virter) ImageImportFromReader(image string, reader io.ReadCloser, opts ...LayerOperationOption) (*LocalImage, error)

ImageImportFromReader imports a new image into the local storage pool from a basic reader.

func (*Virter) ImageList added in v0.14.0

func (v *Virter) ImageList() ([]*LocalImage, error)

ImageList returns the list of images in the local storage pool.

func (*Virter) ImageRm added in v0.3.0

func (v *Virter) ImageRm(name string) error

ImageRm removes an image from the local storage pool.

If no image of the given name is present, returns nil. This will recursively delete any layers that are not referenced by other images or currently in use by a VM.

func (*Virter) ImageSpawn added in v0.14.0

func (v *Virter) ImageSpawn(name string, image *LocalImage, capacityKib uint64) (*RawLayer, error)

ImageSpawn creates a new rw volume backed by this image.

The returned RawLayer can be attached to a VM.

func (*Virter) LayerList added in v0.14.0

func (v *Virter) LayerList() ([]*VolumeLayer, error)

LayerList returns all known VolumeLayer in the default storage pool

func (*Virter) MakeImage added in v0.14.0

func (v *Virter) MakeImage(image string, topLayer *VolumeLayer, opts ...LayerOperationOption) (*LocalImage, error)

MakeImage creates a new LocalImage of the given name, pointing to the given VolumeLayer.

If an image of the given name already exists it will be deleted first.

func (*Virter) NetworkAdd added in v0.11.0

func (v *Virter) NetworkAdd(desc libvirtxml.Network) error

func (*Virter) NetworkList added in v0.11.0

func (v *Virter) NetworkList() ([]libvirtxml.Network, error)

func (*Virter) NetworkListAttached added in v0.11.0

func (v *Virter) NetworkListAttached(netname string) ([]VMNic, error)

func (*Virter) NetworkRemove added in v0.11.0

func (v *Virter) NetworkRemove(netname string) error

func (*Virter) NewDynamicLayer added in v0.14.0

func (v *Virter) NewDynamicLayer(name string, opts ...NewLayerOption) (*RawLayer, error)

NewDynamicLayer create a new (empty) layer suitable for attaching to a VM.

The volume name is prefix with WorkingLayerNamePrefix. To set a backing layer, set the minimum capacity and more, pass in one or more NewLayerOption.

func (*Virter) PingSSH added in v0.6.0

func (v *Virter) PingSSH(ctx context.Context, shellClientBuilder ShellClientBuilder, vmName string, pingConfig SSHPingConfig) error

PingSSH repeatedly tries to connect to a VM via SSH until it succeeds

func (*Virter) RemoveMACDHCPEntries added in v0.5.0

func (v *Virter) RemoveMACDHCPEntries(mac string) error

RemoveMACDHCPEntries removes DHCP host entries associated with the given MAC address

func (*Virter) VMCommit

func (v *Virter) VMCommit(ctx context.Context, afterNotifier AfterNotifier, vmName, imageName string, shutdown bool, shutdownTimeout time.Duration, staticDHCP bool, opts ...LayerOperationOption) error

VMCommit commits a VM to an image. If shutdown is true, the VM is shut down before committing. If shutdown is false, the caller is responsible for ensuring that the VM is not running.

func (*Virter) VMExecCopy added in v0.3.0

func (v *Virter) VMExecCopy(ctx context.Context, copier netcopy.NetworkCopier, sourceSpecs []string, destSpec string) error

func (*Virter) VMExecDocker

func (v *Virter) VMExecDocker(ctx context.Context, containerProvider containerapi.ContainerProvider, vmNames []string, containerCfg *containerapi.ContainerConfig, copyStep *ProvisionDockerCopyStep) error

VMExecDocker runs a docker container against some VMs.

func (*Virter) VMExecRsync

func (v *Virter) VMExecRsync(ctx context.Context, copier netcopy.NetworkCopier, vmNames []string, rsyncStep *ProvisionRsyncStep) error

func (*Virter) VMExecShell

func (v *Virter) VMExecShell(ctx context.Context, vmNames []string, shellStep *ProvisionShellStep) error

VMExecShell runs a simple shell command against some VMs.

func (*Virter) VMRm

func (v *Virter) VMRm(vmName string, staticDHCP bool) error

VMRm removes a VM.

func (*Virter) VMRun

func (v *Virter) VMRun(vmConfig VMConfig) error

VMRun starts a VM.

func (*Virter) VMSSHSession

func (v *Virter) VMSSHSession(ctx context.Context, vmName string) error

VMSSHSession runs an interactive shell session in a VM

type VolumeLayer added in v0.14.0

type VolumeLayer struct {
	RawLayer
}

VolumeLayer is an immutable RawLayer with additional restrictions.

A VolumeLayer is immutable. Since this is not enforceable on the libvirt level, enforcement is best-effort only. A VolumeLayer is always addressed by its content, i.e. the backing volume is named "virter:layer:sha256:<content-digest>".

func (*VolumeLayer) DiffID added in v0.14.0

func (vl *VolumeLayer) DiffID() (regv1.Hash, error)

DiffID computes a digest of the Uncompressed layer content.

Since a VolumeLayer is immutable and named after its content digest, this doesn't do any computation. Instead it uses its own name to determine the digest.

func (*VolumeLayer) MediaType added in v0.14.0

func (vl *VolumeLayer) MediaType() (types.MediaType, error)

MediaType returns the media type for the compressed Layer

func (*VolumeLayer) Squashed added in v0.14.0

func (vl *VolumeLayer) Squashed() (*RawLayer, error)

Squashed creates a squashed copy of this layer.

All backing layers are squashed into a single layer, the returned layer will not depend on any other layers.

func (*VolumeLayer) ToRegistryLayer added in v0.14.0

func (vl *VolumeLayer) ToRegistryLayer(opts ...LayerOperationOption) (regv1.Layer, error)

ToRegistryLayer wraps this VolumeLayer for pushing to a container registry.

A layer in a container registry is a compressed (gzipped) blob. To push a VolumeLayer to a registry, we need 1. the digest of the _uncompressed_ layer content 2. the compressed layer content 3. the digest of the _compressed_ layer content 4. the size of the _compressed_ layer content Points 2-4 are easily computed based on the uncompressed content. For efficiency we only compute it once, as the layers can be quite large.

func (*VolumeLayer) ToVolumeLayer added in v0.14.0

func (vl *VolumeLayer) ToVolumeLayer() (*VolumeLayer, error)

ToVolumeLayer converts this layer into a VolumeLayer.

Since VolumeLayer are immutable, this is a no-op.

func (*VolumeLayer) Upload added in v0.14.0

func (vl *VolumeLayer) Upload(io.Reader) error

Upload copies the content of the given reader to the storage volume

Since a VolumeLayer is immutable, this always results in an error.

Jump to

Keyboard shortcuts

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