Documentation ¶
Index ¶
- type Address
- type CPU
- type Console
- type ConsoleSource
- type ConsoleTarget
- type CurrentMemory
- type Disk
- type DiskDriver
- type DiskInfo
- type DiskSource
- type DiskTarget
- type Domain
- type Features
- type GIC
- type Interface
- type InterfaceGuest
- type InterfaceInfo
- type InterfaceMAC
- type InterfaceSource
- type InterfaceVirtualPort
- type Memory
- type Model
- type NVRAMCode
- type OS
- type OSType
- type Serial
- type SerialSource
- type SerialTarget
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Address ¶
type Address struct { Type string `xml:"type,attr,omitepmty"` Domain string `xml:"domain,attr,omitempty"` Bus string `xml:"bus,attr,omitempty"` Slot string `xml:"slot,attr,omitempty"` Function string `xml:"function,attr,omitempty"` }
Address is static. We generate a default value for it. See: Controller, Video
type CPU ¶
type CPU struct { Mode string `xml:"mode,attr,omitempty"` Match string `xml:"match,attr,omitempty"` Model Model `xml:"model,omitempty"` }
CPU defines CPU topology and model requirements. See: https://libvirt.org/formatdomain.html#elementsCPU
type Console ¶
type Console struct { Type string `xml:"type,attr"` TTY string `xml:"tty,attr,omitempty"` Source ConsoleSource `xml:"source,omitempty"` Target ConsoleTarget `xml:"target,omitempty"` }
Console is static. We generate a default value for it. See: https://libvirt.org/formatdomain.html#elementsConsole
type ConsoleSource ¶
type ConsoleSource struct {
Path string `xml:"path,attr,omitempty"`
}
ConsoleSource is static. We generate a default value for it. See: Console
type ConsoleTarget ¶
type ConsoleTarget struct { Type string `xml:"type,attr,omitempty"` Port int `xml:"port,attr"` Path string `xml:"path,attr,omitempty"` }
ConsoleTarget is static. We generate a default value for it. See: Console
type CurrentMemory ¶
CurrentMemory is the actual allocation of memory for the guest. It appears we historically set this the same as Memory, which is also the default behavior of libvirt. Constraints.Value.Mem documents this as "megabytes". Interpreting that here as MiB. See: Memory, github.com/juju/juju/core/constraints/constraints.Value.Mem
type Disk ¶
type Disk struct { Device string `xml:"device,attr"` Type string `xml:"type,attr"` Driver DiskDriver `xml:"driver"` Source DiskSource `xml:"source"` Target DiskTarget `xml:"target"` }
Disk is dynamic. We create it with paths to the user data source and disk. See: https://libvirt.org/formatdomain.html#elementsDisks
type DiskDriver ¶
DiskDriver is the type of virtual disk. We generate it dynamically. See: Disk
type DiskInfo ¶
type DiskInfo interface { // Source is the path to the disk image. Source() string // Driver is the type of disk, qcow, vkmd, raw, etc... Driver() string }
DiskInfo represents the type and location of a libvirt pool image.
type DiskSource ¶
type DiskSource struct {
File string `xml:"file,attr"`
}
DiskSource is the location of the disk image. In our case the path to the necessary images. See: Disk
type DiskTarget ¶
type DiskTarget struct {
Dev string `xml:"dev,attr"`
}
DiskTarget is the target device on the guest. We generate these.
type Domain ¶
type Domain struct { XMLName xml.Name `xml:"domain"` Type string `xml:"type,attr"` Name string `xml:"name"` VCPU uint64 `xml:"vcpu"` CurrentMemory Memory `xml:"currentMemory"` Memory Memory `xml:"memory"` OS OS `xml:"os"` Features *Features `xml:"features,omitempty"` CPU *CPU `xml:"cpu,omitempty"` Disk []Disk `xml:"devices>disk"` Interface []Interface `xml:"devices>interface"` Serial Serial `xml:"devices>serial,omitempty"` Console []Console `xml:"devices>console"` }
Domain describes a libvirt domain. A domain is an instance of an operating system running on a virtualized machine. See: https://libvirt.org/formatdomain.html where we only care about kvm specific details.
type Features ¶
Features allows us to request one or more hypervisor features to be toggled on/off. See: https://libvirt.org/formatdomain.html#elementsFeatures
type GIC ¶
type GIC struct {
Version string `xml:"version,attr,omitempty"`
}
GIC is the Generic Interrupt Controller and is required to UEFI boot on ARM64.
NB: Dann Frazier (irc:dannf) reports: To deploy trusty, we'll either need to use a GICv2 host, or use the HWE kernel in your guest. There are no official cloud images w/ HWE kernel preinstalled AFAIK. The systems we have in our #hyperscale lab are GICv3 (requiring an HWE kernel) - but the system Juju QA has had for a while (McDivitt) is GICv2, so it should be able to boot a standard trusty EFI cloud image. Either way, you'll need a xenial *host*, at least to have a new enough version of qemu-efi and so libvirt can parse the gic_version=host xml.
TODO(ro) 2017-01-20 Determine if we can provide details to reliably boot trusty, or if we should exit on error if we are trying to boot trusty on arm64.
type Interface ¶
type Interface struct { Type string `xml:"type,attr"` MAC InterfaceMAC `xml:"mac"` Model Model `xml:"model"` Source InterfaceSource `xml:"source"` Guest InterfaceGuest `xml:"guest"` VirtualPortType *InterfaceVirtualPort `xml:"virtualport,omitempty"` }
Interface is dynamic. It represents a network interface. We generate it from an incoming argument. See: https://libvirt.org/formatdomain.html#elementsNICSBridge
type InterfaceGuest ¶
type InterfaceGuest struct {
Dev string `xml:"dev,attr"`
}
InterfaceGuest is the guests network device. See: Interface
type InterfaceInfo ¶
type InterfaceInfo interface { // MAC returns the interfaces MAC address. MACAddress() string // ParentInterfaceName returns the interface's parent device name. ParentInterfaceName() string // ParentVirtualPortType returns the type of the virtual port for this // interface's parent (e.g. for bridging to an OVS-managed device) or // an empty value if no virtual port is used. ParentVirtualPortType() string // InterfaceName returns the interface's device name. InterfaceName() string }
InterfaceInfo represents network interface parameters for a kvm domain.
type InterfaceMAC ¶
type InterfaceMAC struct {
Address string `xml:"address,attr"`
}
InterfaceMAC is the MAC address for an Interface. See: Interface
type InterfaceSource ¶
type InterfaceSource struct {
Bridge string `xml:"bridge,attr"`
}
InterfaceSource it the host bridge to the network. See: Interface
type InterfaceVirtualPort ¶
type InterfaceVirtualPort struct {
Type string `xml:"type,attr"`
}
InterfaceVirtualPort provides additional configuration data to be forwarded to a vepa (802.1Qbg) or 802.1Qbh compliant switch, or to an Open vSwitch virtual switch.
type Memory ¶
Memory is dynamic. We take an argument to set it. Unit is magnitude of memory: b, k or KiB, KB, M or MiB, MB, etc... The libvirt default is KiB. We want to set MiB so we default to that. See: https://libvirt.org/formatdomain.html#elementsMemoryAllocation
type Model ¶
type Model struct { Fallback string `xml:"fallback,attr,omitempty"` Text string `xml:",chardata"` Type string `xml:"type,attr,omitempty"` }
Model is used as an element in CPU and Interface. See: CPU, Interface
type NVRAMCode ¶
type NVRAMCode struct { Text string `xml:",chardata"` ReadOnly string `xml:"readonly,attr,omitempty"` Type string `xml:"type,attr,omitempty"` }
NVRAMCode represents the "firmware blob". In our case that is the UEFI code which is of type pflash. See: https://libvirt.org/formatdomain.html#elementsOS
type OS ¶
type OS struct { Type OSType `xml:"type"` // Loader is a pointer so it is omitted if empty. Loader *NVRAMCode `xml:"loader,omitempty"` }
OS is static. We generate a default value (kvm) for it. See: https://libvirt.org/formatdomain.html#elementsOSBIOS See also: https://libvirt.org/formatcaps.html#elementGuest
type OSType ¶
type OSType struct { Text string `xml:",chardata"` Arch string `xml:"arch,attr,omitempty"` Machine string `xml:"machine,attr,omitempty"` }
OSType provides details that are required on certain architectures, e.g. ARM64. See: https://libvirt.org/formatdomain.html#elementsOS
type Serial ¶
type Serial struct { Type string `xml:"type,attr"` Source SerialSource `xml:"source"` Target SerialTarget `xml:"target"` }
Serial is static. This was added specifically to create a functional console for troubleshooting vms as they boot. You can attach to this console with `virsh console <domainName>`. See: https://libvirt.org/formatdomain.html#elementsConsole
type SerialSource ¶
type SerialSource struct {
Path string `xml:"path,attr"`
}
SerialSource is static. We generate a default value for it. See: Serial
type SerialTarget ¶
type SerialTarget struct {
Port int `xml:"port,attr"`
}
SerialTarget is static. We generate a default value for it. See: Serial