kvm

package
v1.0.0 Latest Latest
Warning

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

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

README

Example

Supported image urls

  • nbd[+tcp]://host[:port][/name]
    • default port is 10809
  • nbd+unix://[/name]?socket=/path/to/unix.socket

Documentation

Index

Constants

View Source
const (
	DomainTypeKVM = "kvm"

	OSTypeTypeHVM OSTypeType = "hvm"

	ArchI686   = "i686"
	ArchX86_64 = "x86_64"
)
View Source
const (
	DiskTypeFile    DiskType = "file"
	DiskTypeDir     DiskType = "dir"
	DiskTypeVolume  DiskType = "volume"
	DiskTypeNetwork DiskType = "network"

	DiskDeviceTypeDisk  DiskDeviceType = "disk"
	DiskDeviceTypeCDROM DiskDeviceType = "cdrom"
)
View Source
const (
	BaseMACAddress = "00:28:06:82:%x:%x"

	BaseIPAddr = "172.19.%d.%d"
)
View Source
const (
	DefaultBridgeName = "kvm-0"
)

Variables

View Source
var (
	ReservedSequences = []uint16{0x0, 0x1, 0xffff}
	BridgeIP          = []byte{172, 19, 0, 1}
	IPRangeStart      = fmt.Sprintf("%d.%d.%d.%d", BridgeIP[0], BridgeIP[1], 0, 2)
	IPRangeEnd        = fmt.Sprintf("%d.%d.%d.%d", BridgeIP[0], BridgeIP[1], 255, 254)
	DefaultBridgeIP   = fmt.Sprintf("%d.%d.%d.%d", BridgeIP[0], BridgeIP[1], BridgeIP[2], BridgeIP[3])
	DefaultBridgeCIDR = fmt.Sprintf("%s/16", DefaultBridgeIP)
)

Functions

func KVMSubsystem added in v1.0.0

func KVMSubsystem() error

Types

type ConsoleDevice added in v1.0.0

type ConsoleDevice struct {
	XMLName xml.Name         `xml:"console"`
	Type    SerialDeviceType `xml:"type,attr"`
	TTY     string           `xml:"tty,attr"`
	Source  SerialSource     `xml:"source"`
	Target  ConsoleTarget    `xml:"target"`
	Alias   SerialAlias      `xml:"alias"`
}

type ConsoleTarget added in v1.0.0

type ConsoleTarget struct {
	XMLName xml.Name `xml:"target"`
	Port    int      `xml:"port,attr"`
	Type    string   `xml:"type,attr"`
}

type CreateParams

type CreateParams struct {
	Name   string      `json:"name"`
	CPU    int         `json:"cpu"`
	Memory int         `json:"memory"`
	Media  []Media     `json:"media"`
	Bridge []string    `json:"bridge"`
	Port   map[int]int `json:"port"`
}

type DestroyParams

type DestroyParams struct {
	Name string `json:"name"`
}

type Device

type Device interface{}

type Devices

type Devices struct {
	Emulator string `xml:"emulator"`
	Devices  []Device
}

type DiskDevice

type DiskDevice struct {
	XMLName xml.Name       `xml:"disk"`
	Type    DiskType       `xml:"type,attr"`
	Device  DiskDeviceType `xml:"device,attr"`
	Source  DiskSource     `xml:"source"`
	Target  DiskTarget     `xml:"target"`
}

type DiskDeviceType

type DiskDeviceType string

type DiskSource

type DiskSource interface{}

type DiskSourceBlock

type DiskSourceBlock struct {
	Dev string `xml:"dev,attr"`
}

type DiskSourceFile

type DiskSourceFile struct {
	File string `xml:"file,attr"`
}

type DiskSourceNetwork added in v1.0.0

type DiskSourceNetwork struct {
	Protocol string                `xml:"protocol,attr"`
	Host     DiskSourceNetworkHost `xml:"host"`
	Name     string                `xml:"name,attr,omitempty"`
}

type DiskSourceNetworkHost added in v1.0.0

type DiskSourceNetworkHost struct {
	Transport string `xml:"transport,attr"`
	Socket    string `xml:"socket,attr,omitempty"`
	Port      string `xml:"port,attr,omitempty"`
	Name      string `xml:"name,attr,omitempty"`
}

type DiskTarget

type DiskTarget struct {
	Dev string `xml:"dev,attr"`
	Bus string `xml:"bus,attr"`
}

type DiskType

type DiskType string

type Domain

type Domain struct {
	XMLName xml.Name   `xml:"domain"`
	Type    DomainType `xml:"type,attr"`
	Name    string     `xml:"name"`
	UUID    string     `xml:"uuid"`
	Memory  Memory     `xml:"memory"`
	VCPU    int        `xml:"vcpu"`
	OS      OS         `xml:"os"`
	Devices Devices    `xml:"devices"`
}

type DomainType

type DomainType string

type GraphicsDevice

type GraphicsDevice struct {
	XMLName xml.Name           `xml:"graphics"`
	Type    GraphicsDeviceType `xml:"type,attr"`
	Port    int                `xml:"port,attr"`
	KeyMap  string             `xml:"keymap,attr"`
	Listen  Listen             `xml:"listen"`
}

type GraphicsDeviceType

type GraphicsDeviceType string
const (
	GraphicsDeviceTypeVNC GraphicsDeviceType = "vnc"
)

type InterfaceDevice

type InterfaceDevice struct {
	XMLName xml.Name              `xml:"interface"`
	Type    InterfaceDeviceType   `xml:"type,attr"`
	Source  InterfaceDeviceSource `xml:"source"`
	Model   InterfaceDeviceModel  `xml:"model"`
	Mac     *InterfaceDeviceMac   `xml:"mac,omitempty"`
}

type InterfaceDeviceMac added in v1.0.0

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

type InterfaceDeviceModel added in v1.0.0

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

type InterfaceDeviceSource

type InterfaceDeviceSource interface{}

type InterfaceDeviceSourceBridge

type InterfaceDeviceSourceBridge struct {
	Bridge string `xml:"bridge,attr"`
}

type InterfaceDeviceType

type InterfaceDeviceType string
const (
	InterfaceDeviceTypeBridge InterfaceDeviceType = "bridge"
)

type Listen

type Listen struct {
	Type    string `xml:"type,attr"`
	Address string `xml:"address,attr"`
}

type Machine

type Machine struct {
	ID    int    `json:"id"`
	Name  string `json:"name"`
	State string `json:"state"`
}

type Media added in v1.0.0

type Media struct {
	URL  string         `json:"url"`
	Type DiskDeviceType `json:"type"`
	Bus  string         `json:"bus"`
}

type Memory

type Memory struct {
	Capacity int    `xml:",chardata"`
	Unit     string `xml:"unit,attr,omitempty"`
}

type OS

type OS struct {
	Type OSType `xml:"type"`
}

type OSType

type OSType struct {
	Type OSTypeType `xml:",chardata"`
	Arch string     `xml:"arch,attr"`
}

type OSTypeType

type OSTypeType string

type SerialAlias added in v1.0.0

type SerialAlias struct {
	XMLName xml.Name `xml:"alias"`
	Name    string   `xml:"name,attr"`
}

type SerialDevice added in v1.0.0

type SerialDevice struct {
	XMLName xml.Name         `xml:"serial"`
	Type    SerialDeviceType `xml:"type,attr"`
	Source  SerialSource     `xml:"source"`
	Target  SerialTarget     `xml:"target"`
	Alias   SerialAlias      `xml:"alias"`
}

type SerialDeviceType added in v1.0.0

type SerialDeviceType string
const (
	SerialDeviceTypePTY SerialDeviceType = "pty"
)

type SerialSource added in v1.0.0

type SerialSource struct {
	XMLName xml.Name `xml:"source"`
	Path    string   `xml:"path,attr"`
}

type SerialTarget added in v1.0.0

type SerialTarget struct {
	XMLName xml.Name `xml:"target"`
	Port    int      `xml:"port,attr"`
}

Jump to

Keyboard shortcuts

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