cmd

package
v0.23.0 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2023 License: Apache-2.0 Imports: 47 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultContainerOpt added in v0.14.2

func DefaultContainerOpt() mpb.ContainerOption

func DefaultProgressFormat added in v0.14.0

func DefaultProgressFormat(p *mpb.Progress) virter.ProgressOpt

func Execute

func Execute()

Execute adds all child commands to the root command and sets flags appropriately

func GetLocalImage added in v0.14.0

func GetLocalImage(ctx context.Context, imageName string, source string, v *virter.Virter, policy pullpolicy.PullPolicy, p virter.ProgressOpt) (*virter.LocalImage, error)

GetLocalImage tries to find the image in local storage.

If the image, given by the imageName is not found in local storage, it is pulled from source. Image names are resolved according to LocalImageName. It is possible to specify: * A local image name. * A name matching an alias in the legacy image registry. * A container registry reference, which will be converted into a compatible local volume name.

func InitVirter added in v0.9.0

func InitVirter() (*virter.Virter, error)

InitVirter initializes virter by connecting to the local libvirt instance and configures the ssh keystore.

func LocalImageName added in v0.14.0

func LocalImageName(img string) string

LocalImageName returns the local name for the user-supplied image name.

If supplied with an image name without any registry location, this just returns the original string.

If supplied with an image name with registry location (the registry.example.com in registry.example.com/image:foo), the registry information will be stripped. "/" and ":" will be replaced by "-".

Examples: * local-image -> local-image * image:foo -> image:foo * registry.example.com/image:foo -> image-foo * registry.example.com/namespace/image -> namespace--image-latest

Types

type DiskArg added in v0.2.0

type DiskArg struct {
	Name   string `arg:"name"`
	Size   Size   `arg:"size"`
	Format string `arg:"format,qcow2"`
	Bus    string `arg:"bus,virtio"`
}

DiskArg represents a disk that can be passed to virter via a command line argument.

func (*DiskArg) GetBus added in v0.2.0

func (d *DiskArg) GetBus() string

func (*DiskArg) GetFormat added in v0.2.0

func (d *DiskArg) GetFormat() string

func (*DiskArg) GetName added in v0.2.0

func (d *DiskArg) GetName() string

func (*DiskArg) GetSizeKiB added in v0.2.0

func (d *DiskArg) GetSizeKiB() uint64

func (*DiskArg) Set added in v0.2.0

func (d *DiskArg) Set(str string) error

Set implements flag.Value.Set.

func (*DiskArg) Type added in v0.2.0

func (d *DiskArg) Type() string

Type implements pflag.Value.Type.

type MountArg added in v0.15.0

type MountArg struct {
	HostPath string `arg:"host"`
	VmPath   string `arg:"vm"`
}

func (*MountArg) GetHostPath added in v0.15.0

func (s *MountArg) GetHostPath() string

func (*MountArg) GetVMPath added in v0.15.0

func (s *MountArg) GetVMPath() string

func (*MountArg) Set added in v0.15.0

func (s *MountArg) Set(str string) error

func (*MountArg) Type added in v0.15.0

func (s *MountArg) Type() string

type NICArg added in v0.11.0

type NICArg struct {
	NicType string `arg:"type"`
	Source  string `arg:"source"`
	Model   string `arg:"model,virtio"`
	MAC     string `arg:"mac,"`
}

func (*NICArg) GetMAC added in v0.11.0

func (n *NICArg) GetMAC() string

func (*NICArg) GetModel added in v0.11.0

func (n *NICArg) GetModel() string

func (*NICArg) GetSource added in v0.11.0

func (n *NICArg) GetSource() string

func (*NICArg) GetType added in v0.11.0

func (n *NICArg) GetType() string

func (*NICArg) Set added in v0.11.0

func (n *NICArg) Set(str string) error

func (*NICArg) Type added in v0.11.0

func (n *NICArg) Type() string

type SSHClientBuilder

type SSHClientBuilder struct {
}

SSHClientBuilder builds SSH shell clients

func (SSHClientBuilder) NewShellClient

func (SSHClientBuilder) NewShellClient(hostPort string, sshConfig ssh.ClientConfig) virter.ShellClient

NewShellClient returns an SSH shell client

type ShortFormatter added in v0.21.0

type ShortFormatter struct {
	LevelDesc []string
}

func (*ShortFormatter) Format added in v0.21.0

func (f *ShortFormatter) Format(entry *log.Entry) ([]byte, error)

type Size added in v0.11.0

type Size struct {
	KiB uint64
}

func (*Size) UnmarshalText added in v0.11.0

func (s *Size) UnmarshalText(text []byte) error

Jump to

Keyboard shortcuts

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