Documentation
¶
Overview ¶
This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
Index ¶
- Constants
- func Marshal(v interface{}) ([]byte, error)
- func Unmarshal(data []byte, v interface{}) error
- type BIOS
- type BusType
- type Config
- type Decoder
- type Device
- type Encoder
- type Error
- type Ethernet
- type EthernetAddressType
- type FloppyDevice
- type GUI
- type IDEDevice
- type Isolation
- type PCIBridge
- type PowerType
- type RTC
- type RemoteDisplay
- type SATADevice
- type SCSIDevice
- type SerialPort
- type SharedFolder
- type Sound
- type Tools
- type USB
- type USBDevice
- type UUID
- type VMCI
- type VMotion
- type Vhardware
- type VirtualMachine
Constants ¶
const ( MAC_TYPE_STATIC = "static" MAC_TYPE_GENERATED = "generated" )
const ( CDROM_IMAGE string = "cdrom-image" CDROM_RAW string = "cdrom-raw" )
CDROM device types
const ( MAX_VCPUS = 64 // Megabytes MAX_MEMORY = 1000000 // 1tib MAX_IDE_ADAPTERS = 2 MAX_IDE_DEVICES_PER_ADAPTER = 2 MAX_SATA_ADAPTERS = 4 MAX_SATA_DEVICES_PER_ADAPTER = 30 MAX_SCSI_ADAPTERS = 4 MAX_SCSI_DEVICES_PER_ADAPTER = 15 MAX_VDISKS = 60 // Megabytes MAX_VDISK_SIZE = 6200000 // 62tib MAX_FLOPPY_ADAPTERS = 1 MAX_FLOPPY_DEVICES = 2 MAX_VNICS = 10 MAX_USB_ADAPTERS = 1 MAX_USB_DEVICES = 20 MAX_PARALLEL_PORTS = 3 MAX_SERIAL_PORTS = 4 MAX_REMOTE_CONSOLE_CONNECTIONS = 40 // Megabytes MAX_VIDEO_MEMORY = 512 )
Maximum values for a virtual machine From http://www.vmware.com/pdf/vsphere5/r55/vsphere-55-configuration-maximums.pdf
Variables ¶
This section is empty.
Functions ¶
func Marshal ¶
Marshal traverses the value v recursively. If an encountered value implements the Marshaler interface and is not a nil pointer, Marshal calls its MarshalVMX method to produce VMX. The nil pointer exception is not strictly necessary but mimics a similar, necessary exception in the behavior of UnmarshalVMX.
Types ¶
type BusType ¶
type BusType string
Bus type to use when attaching or detaching CD/DVD drives and disks.
type Decoder ¶
type Decoder struct {
// Report an error if there are keys in the Go structure
// that do not have a match in the VMX file
ErrorUnmatched bool
// contains filtered or unexported fields
}
func (*Decoder) Decode ¶
Decodes a VMX file into a Go structure. This is O(n) for now, we can optimize later if needed. Although, runtime complexities will vary depending on the value type and whether there are nested fields in the reflect value. However, the impact could be minimized by setting bounds to the recursion.
type Error ¶
type Error struct {
Errors []string
}
Error implements the error interface and can represents multiple errors that occur in the course of a single decode.
type Ethernet ¶
type Ethernet struct {
VMXID string
Address string `vmx:"address,omitempty"`
GeneratedAddress string `vmx:"generatedaddress,omit"`
StartConnected bool `vmx:"startconnected,omitempty"`
Present bool `vmx:"present"`
ConnectionType string `vmx:"connectiontype,omitempty"`
VirtualDev string `vmx:"virtualdev,omitempty"`
WakeOnPcktRcv bool `vmx:"wakeonpcktrcv,omitempty"`
AddressType EthernetAddressType `vmx:"addresstype,omitempty"`
LinkStatePropagation bool `vmx:"linkstatepropagation.enable,omitempty"`
VNetwork string `vmx:"vnet,omitempty"`
}
type EthernetAddressType ¶
type EthernetAddressType string
type FloppyDevice ¶
type FloppyDevice struct {
VMXID string
Present bool `vmx:"present"`
StartConnected bool `vmx:"startconnected,omitempty"`
Autodetect bool `vmx:"autodetect,omitempty"`
Filename string `vmx:"filename,omitempty"`
Filetype string `vmx:"filetype,omitempty"`
GuestControl bool `vmx:"allowGuestConnectionControl,omitempty"`
}
type RemoteDisplay ¶
type RemoteDisplay struct {
VNCEnabled bool `vmx:"vnc.enabled,omitempty"`
VNCPort uint `vmx:"vnc.port,omitempty"`
VNCPassword string `vmx:"vnc.password,omitempty"`
VNCIPAddress string `vmx:"vnc.ip,omitempty"`
VNCKey string `vmx:"vnc.key,omitempty"`
VNCKeyMap string `vmx:"vnc.keymap,omitempty"`
VNCKeyMapFile string `vmx:"vnc.keymapfile,omitempty"`
VNCZlibLevel uint `vmx:"vnc.zliblevel,omitempty"`
VNCWheelStep string `vmx:"vncWheelStep,omitempty"`
Depth uint `vmx:"depth,omitempty"`
MaxConnections uint `vmx:"maxconnections,omitempty"`
MaxHeight uint `vmx:"maxheight,omitempty"`
MaxWidth uint `vmx:"maxwidth,omitempty"`
}
type SATADevice ¶
type SATADevice struct {
Device
}
type SCSIDevice ¶
type SerialPort ¶
type SerialPort struct {
VMXID string
StartConnected bool `vmx:"startconnected,omitempty"`
Present bool `vmx:"present"`
Filetype string `vmx:"filetype,omitempty"`
Filename string `vmx:"filename,omitempty"`
Autodetect bool `vmx:"autodetect,omitempty"`
TryNoRxLoss bool `vmx:"trynorxloss,omitempty"`
PipeEndpoint string `vmx:"pipe.endpoint,omitempty"`
AllowGuestConnCtrl bool `vmx:"allowguestconnectioncontrol,omitempty"`
HardwareFlowCtrl bool `vmx:"hardwareFlowControl,omitempty"`
}
type SharedFolder ¶
type SharedFolder struct {
}
type VirtualMachine ¶
type VirtualMachine struct {
Encoding string `vmx:".encoding,omitempty"`
ExtendedCfgFile string `vmx:"extendedconfigfile,omitempty"`
PowerType PowerType `vmx:"powertype,omitempty"`
Annotation string `vmx:"annotation,omitempty"`
Vhardware Vhardware `vmx:"virtualhw,omitempty"`
Memsize uint `vmx:"memsize,omitempty"`
NumvCPUs uint `vmx:"numvcpus,omitempty"`
MemHotAdd bool `vmx:"mem.hotadd,omitempty"`
VCPUHotAdd bool `vmx:"vcpu.hotadd,omitempty"`
DisplayName string `vmx:"displayname,omitempty"`
GuestOS string `vmx:"guestos,omitempty"`
Autoanswer bool `vmx:"msg.autoanswer,omitempty"`
Sound Sound `vmx:"sound,omitempty"`
Tools Tools `vmx:"tools,omitempty"`
NVRam string `vmx:"nvmram,omitempty"`
UUID UUID `vmx:"uuid,omitempty"`
CleanShutdown bool `vmx:"cleanshutdown,omitempty"`
SoftPowerOff bool `vmx:"softpoweroff,omitempty"`
VMCI VMCI `vmx:"vmci0,omitempty"`
VMotion VMotion `vmx:"vmotion,omitempty"`
USB USB `vmx:"usb,omitempty"`
RTC RTC `vmx:"rtc,omitempty"`
Config Config `vmx:"config"`
// Enable or not nested virtualiation
VHVEnable bool `vmx:"vhv.enable,omitempty"`
RemoteDisplay RemoteDisplay `vmx:"remotedisplay,omitempty"`
Isolation Isolation `vmx:"isolation,omitempty"`
PCIBridges []PCIBridge `vmx:"pcibridge,omitempty"`
SerialPorts []SerialPort `vmx:"serial,omitempty"`
Ethernet []Ethernet `vmx:"ethernet,omitempty"`
IDEDevices []IDEDevice `vmx:"ide,omitempty"`
SCSIDevices []SCSIDevice `vmx:"scsi,omitempty"`
SATADevices []SATADevice `vmx:"sata,omitempty"`
USBDevices []USBDevice `vmx:"usb,omitempty"`
FloppyDevices []FloppyDevice `vmx:"floppy,omitempty"`
}
func (VirtualMachine) FindDevice ¶
func (vm VirtualMachine) FindDevice(p func(Device) bool, types ...BusType) bool
FindDevice executes the given function p on all the devices of one of the given types until one of the calls returns true. If no bus types are provided all will be used. FindDevice returns true only if one of the calls of p returned true.
func (VirtualMachine) WalkDevices ¶
func (vm VirtualMachine) WalkDevices(f func(Device), types ...BusType)
WalkDevices executes the given function f on all the devices of one of the specified types. If no bus types are provided all will be used.