buki

package module
v0.0.0-...-6a3c31e Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2016 License: MIT Imports: 13 Imported by: 0

README

buki

Easy VM Manager

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildConnection

func BuildConnection() libvirt.VirConnection

BuildConnection builds a local libvirt connection to qemu

func CopyFile

func CopyFile(src, dst string) error

CopyFile copies the given file to destination

func CopyImage

func CopyImage(imgName, vmName, size string) error

CopyImage copies the given image to output directory, with given resize option

func CreateCloudConfig

func CreateCloudConfig(vmName, userData string) (string, error)

CreateCloudConfig generates valid cloud-init images for vms

func DeleteNetwork

func DeleteNetwork(uuid string)

func DownloadImage

func DownloadImage(path, name string) error

func GenerateMAC

func GenerateMAC() string

GenerateMAC generates valid MAC addresses for the VMs

func GetAvailableImages

func GetAvailableImages() []string

func GetImagePath

func GetImagePath(name string) string

func GetVMPrimaryDiskName

func GetVMPrimaryDiskName(vmName string) string

func InitStorage

func InitStorage()

func StartVM

func StartVM(name string)

func StopVM

func StopVM(name string)

Types

type Bridge

type Bridge struct {
	Name string `xml:"name,attr" json:"name"`
}

type DHCPRange

type DHCPRange struct {
	Start string `xml:"start,attr" json:"start"`
	End   string `xml:"end,attr" json:"end"`
}

type Disk

type Disk struct {
	Type   string `xml:"type,attr" json:"type"`
	Source Source `xml:"source" json:"source"`
	Target Target `xml:"target" json:"target"`
}

type Forward

type Forward struct {
	Mode string `xml:"mode,attr" json:"mode"`
}

type Graphics

type Graphics struct {
	Type   string `xml:"type,attr" json:"type"`
	Port   string `xml:"port,attr" json:"port"`
	Listen string `xml:"listen,attr" json:"listen"`
}

type IPAddress

type IPAddress struct {
	Address string    `xml:"address,attr" json:"address"`
	Netmask string    `xml:"netmask,attr" json:"netmask"`
	IPRange DHCPRange `xml:"dhcp>range" json:"range"`
}

type Interface

type Interface struct {
	Type   string `xml:"type,attr" json:"type"`
	Source Source `xml:"source" json:"source"`
	Target Target `xml:"target" json:"target"`
	MAC    MAC    `xml:"mac" json:"mac"`
	Model  Model  `xml:"model" json:"model"`
}

type MAC

type MAC struct {
	Address string `xml:"address,attr" json:"address"`
}

type Model

type Model struct {
	Type string `xml:"type,attr" json:"type"`
}

type Network

type Network struct {
	XMLName xml.Name    `xml:"network" json:"-"`
	Name    string      `xml:"name" json:"name"`
	UUID    string      `xml:"uuid" json:"uuid"`
	Forward Forward     `xml:"forward" json:"forward"`
	Bridge  Bridge      `xml:"bridge" json:"bridge"`
	IPs     []IPAddress `xml:"ip" json:"ip"`
	Active  bool        `json:"active"`
}

func CreateBridgedNetwork

func CreateBridgedNetwork(name, interfaceName string) (*Network, error)

func CreateNATNetwork

func CreateNATNetwork(name, address, netmask, start, end string) (*Network, error)

CreateNATNetwork creates a new NAT network

func GetNetworks

func GetNetworks() []Network

GetNetworks allows the tools

type Source

type Source struct {
	// Add more for supporting others
	File    string `xml:"file,attr" json:"file,omitempty"`
	Network string `xml:"network,attr" json:"network,omitempty"`
}

type Target

type Target struct {
	Dev string `xml:"dev,attr" json:"dev"`
	Bus string `xml:"bus,attr" json:"bus,omitempty"`
}

type VM

type VM struct {
	XMLName   xml.Name    `xml:"domain" json:"-"`
	Name      string      `xml:"name" json:"name"`
	UUID      string      `xml:"uuid" json:"uuid"`
	Memory    int         `xml:"memory" json:"memory"`
	Cpus      int         `xml:"vcpu" json:"cpus"`
	Active    bool        `json:"active"`
	Disks     []Disk      `xml:"devices>disk" json:"disks"`
	Interface []Interface `xml:"devices>interface" json:"interfaces"`
	Graphics  Graphics    `xml:"devices>graphics" json:"graphics"`
}

func CreateBasicVM

func CreateBasicVM(image string, name string, cpus, ram int, diskSize, network, cloudConfig string) (*VM, error)

CreateBasicVM creates a basic VM with given parameters

func GetVM

func GetVM(name string) *VM

func ListVM

func ListVM() []VM

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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