vm

package
v0.0.0-...-f7323e1 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2020 License: LGPL-3.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const VIRTSYSPREP = "virt-sysprep"

virt-sysprep

Variables

View Source
var FormatStr = map[string]string{
	"qcow2": ".qcow2",
	"raw":   ".img",
}

FormatStr Format image termination

View Source
var QEMU_IMG = "qemu-img"

QEMU_IMG qemu-img binary

View Source
var VirtInfo virtInfo

Functions

func AddDisk

func AddDisk(dom libvirt.Domain, diskSize, format, bus string) (rsvirt.Disk, error)

AddDisk Creates and attach disk device to the given domain

func CreateImage

func CreateImage(diskInfo *Disk) error

CreateImage Creates a new backed image using qemu-img utility

func CreateVm

func CreateVm(vm *VM) error

func DeleteDisk

func DeleteDisk(path string)

func DownloadFile

func DownloadFile(filepath string, url string) error

func GenericError

func GenericError(msg string)

func GetDiskFormat

func GetDiskFormat(format string) (string, error)

GetDiskFormat Return file termination for disks formats

func NewCmdAddDisk

func NewCmdAddDisk() *cobra.Command

func NewCmdListVM

func NewCmdListVM() *cobra.Command

func NewCmdNewVM

func NewCmdNewVM() *cobra.Command

NewCmdNewVM Creates a new libvirt domain

func NewCmdSSH

func NewCmdSSH() *cobra.Command

func NewCmdStartVM

func NewCmdStartVM() *cobra.Command

func NewCmdStopVM

func NewCmdStopVM() *cobra.Command

func NewCmdVmInfo

func NewCmdVmInfo() *cobra.Command

func NewCmddeleteVM

func NewCmddeleteVM() *cobra.Command

NewCmddeleteVM Deletes libvirt domains

func SSH

func SSH(vm, user, sshOpts string) error

Types

type Disk

type Disk struct {
	BaseImage   string
	PoolName    string
	Pool        Pool
	Path        string
	Device      string
	Format      string
	VirtualSize int
}

type Pool

type Pool struct {
	Name string
	Path string
}

type VM

type VM struct {
	Name            string
	Cpus            int
	Memory          int
	Interfaces      []string
	Disks           []Disk
	CloudInit       bool
	RootPassword    string
	SSHUser         string
	PublicKey       string
	FirstBootScript string
}

type WriteCounter

type WriteCounter struct {
	Downloaded int64
	TotalSize  int64
}

func (WriteCounter) PrintProgress

func (wc WriteCounter) PrintProgress()

func (*WriteCounter) Write

func (wc *WriteCounter) Write(p []byte) (int, error)

Jump to

Keyboard shortcuts

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