Documentation
¶
Index ¶
- func Bool(v bool) *bool
- func BoolMap(src map[string]bool) map[string]*bool
- func BoolSlice(src []bool) []*bool
- func BoolValue(v *bool) bool
- func BoolValueMap(src map[string]*bool) map[string]bool
- func BoolValueSlice(src []*bool) []bool
- func CheckResponse(r *http.Response) error
- func Float64(v float64) *float64
- func Float64Map(src map[string]float64) map[string]*float64
- func Float64Slice(src []float64) []*float64
- func Float64Value(v *float64) float64
- func Float64ValueMap(src map[string]*float64) map[string]float64
- func Float64ValueSlice(src []*float64) []float64
- func Int(v int) *int
- func Int64(v int64) *int64
- func Int64Map(src map[string]int64) map[string]*int64
- func Int64Slice(src []int64) []*int64
- func Int64Value(v *int64) int64
- func Int64ValueMap(src map[string]*int64) map[string]int64
- func Int64ValueSlice(src []*int64) []int64
- func IntMap(src map[string]int) map[string]*int
- func IntSlice(src []int) []*int
- func IntValue(v *int) int
- func IntValueMap(src map[string]*int) map[string]int
- func IntValueSlice(src []*int) []int
- func MillisecondsTimeValue(v *int64) time.Time
- func NewRawQMOption(value string) *rawQMOption
- func SecondsTimeValue(v *int64) time.Time
- func String(v string) *string
- func StringMap(src map[string]string) map[string]*string
- func StringSlice(src []string) []*string
- func StringValue(v *string) string
- func StringValueMap(src map[string]*string) map[string]string
- func StringValueSlice(src []*string) []string
- func Time(v time.Time) *time.Time
- func TimeMap(src map[string]time.Time) map[string]*time.Time
- func TimeSlice(src []time.Time) []*time.Time
- func TimeUnixMilli(t time.Time) int64
- func TimeValue(v *time.Time) time.Time
- func TimeValueMap(src map[string]*time.Time) map[string]time.Time
- func TimeValueSlice(src []*time.Time) []time.Time
- type ArgError
- type Bios
- type BootDevice
- type CPUType
- type Client
- type ErrorResponse
- type HugePages
- type IDEDevice
- type KeyboardLayout
- type Lock
- type MediaType
- type NetworkCardModel
- type NetworkDevice
- type Node
- type NodesService
- type NodesServiceOp
- type OSType
- type QMOption
- type QemuService
- type QemuServiceOp
- func (s *QemuServiceOp) CreateVM(node string, vmID int, config *VMConfig) error
- func (s *QemuServiceOp) DeleteVM(node string, vmID int) error
- func (s *QemuServiceOp) GetVMConfig(node string, vmID int) (*VMConfig, error)
- func (s *QemuServiceOp) GetVMCurrentStatus(node string, vmID int) (*VMStatus, error)
- func (s *QemuServiceOp) GetVMList(node string) ([]VM, error)
- func (s *QemuServiceOp) ResetVM(node string, vmID int) error
- func (s *QemuServiceOp) ResumeVM(node string, vmID int) error
- func (s *QemuServiceOp) ShutdownVM(node string, vmID int) error
- func (s *QemuServiceOp) StartVM(node string, vmID int) error
- func (s *QemuServiceOp) StopVM(node string, vmID int) error
- func (s *QemuServiceOp) SuspendVM(node string, vmID int) error
- func (s *QemuServiceOp) UpdateVM(node string, vmID int, config *VMConfig, async bool) error
- type RequestCompletionCallback
- type SCSIControllerType
- type SerialDevice
- type Storage
- type StorageService
- type StorageServiceOp
- func (s *StorageServiceOp) CreateVolume(node, storageName string, vmID int, filename string, size string, ...) error
- func (s *StorageServiceOp) DeleteVolume(node, storageName, volumeId string) error
- func (s *StorageServiceOp) GetStorageList(node string) ([]Storage, error)
- func (s *StorageServiceOp) GetStorageVolumes(node, storageName string) ([]StorageVolume, error)
- func (s *StorageServiceOp) GetVolume(node, storageName, volumeId string) (*StorageVolume, error)
- type StorageVolume
- type VGAType
- type VM
- type VMConfig
- func (c *VMConfig) AddIDEDevice(number int, value *IDEDevice)
- func (c *VMConfig) AddNUMATopology(number int, value QMOption)
- func (c *VMConfig) AddNetworkDevice(number int, value *NetworkDevice)
- func (c *VMConfig) AddParallelDevice(number int, value QMOption)
- func (c *VMConfig) AddSATADevice(number int, value QMOption)
- func (c *VMConfig) AddSCSIDevice(number int, value QMOption)
- func (c *VMConfig) AddSerialDevice(number int, value *SerialDevice)
- func (c *VMConfig) AddUSBDevice(number int, value QMOption)
- func (c *VMConfig) AddVirtIODevice(number int, value *VirtIODevice)
- func (c *VMConfig) GetOptionsMap() (map[string]string, error)
- type VMStatus
- type VirtIODevice
- type VolumeFormat
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BoolMap ¶ added in v0.1.1
BoolMap converts a string map of bool values into a string map of bool pointers
func BoolSlice ¶ added in v0.1.1
BoolSlice converts a slice of bool values into a slice of bool pointers
func BoolValue ¶ added in v0.1.1
BoolValue returns the value of the bool pointer passed in or false if the pointer is nil.
func BoolValueMap ¶ added in v0.1.1
BoolValueMap converts a string map of bool pointers into a string map of bool values
func BoolValueSlice ¶ added in v0.1.1
BoolValueSlice converts a slice of bool pointers into a slice of bool values
func CheckResponse ¶
CheckResponse checks the API response for errors, and returns them if present. A response is considered an error if it has a status code outside the 200 range. API error responses are expected to have either no response body, or a JSON response body that maps to ErrorResponse. Any other response body will be silently ignored.
func Float64Map ¶ added in v0.1.1
Float64Map converts a string map of float64 values into a string map of float64 pointers
func Float64Slice ¶ added in v0.1.1
Float64Slice converts a slice of float64 values into a slice of float64 pointers
func Float64Value ¶ added in v0.1.1
Float64Value returns the value of the float64 pointer passed in or 0 if the pointer is nil.
func Float64ValueMap ¶ added in v0.1.1
Float64ValueMap converts a string map of float64 pointers into a string map of float64 values
func Float64ValueSlice ¶ added in v0.1.1
Float64ValueSlice converts a slice of float64 pointers into a slice of float64 values
func Int64Map ¶ added in v0.1.1
Int64Map converts a string map of int64 values into a string map of int64 pointers
func Int64Slice ¶ added in v0.1.1
Int64Slice converts a slice of int64 values into a slice of int64 pointers
func Int64Value ¶ added in v0.1.1
Int64Value returns the value of the int64 pointer passed in or 0 if the pointer is nil.
func Int64ValueMap ¶ added in v0.1.1
Int64ValueMap converts a string map of int64 pointers into a string map of int64 values
func Int64ValueSlice ¶ added in v0.1.1
Int64ValueSlice converts a slice of int64 pointers into a slice of int64 values
func IntMap ¶ added in v0.1.1
IntMap converts a string map of int values into a string map of int pointers
func IntSlice ¶ added in v0.1.1
IntSlice converts a slice of int values into a slice of int pointers
func IntValue ¶ added in v0.1.1
IntValue returns the value of the int pointer passed in or 0 if the pointer is nil.
func IntValueMap ¶ added in v0.1.1
IntValueMap converts a string map of int pointers into a string map of int values
func IntValueSlice ¶ added in v0.1.1
IntValueSlice converts a slice of int pointers into a slice of int values
func MillisecondsTimeValue ¶ added in v0.1.1
MillisecondsTimeValue converts an int64 pointer to a time.Time value representing milliseconds sinch Epoch or time.Time{} if the pointer is nil.
func NewRawQMOption ¶ added in v0.1.1
func NewRawQMOption(value string) *rawQMOption
func SecondsTimeValue ¶ added in v0.1.1
SecondsTimeValue converts an int64 pointer to a time.Time value representing seconds since Epoch or time.Time{} if the pointer is nil.
func StringMap ¶ added in v0.1.1
StringMap converts a string map of string values into a string map of string pointers
func StringSlice ¶ added in v0.1.1
StringSlice converts a slice of string values into a slice of string pointers
func StringValue ¶ added in v0.1.1
StringValue returns the value of the string pointer passed in or "" if the pointer is nil.
func StringValueMap ¶ added in v0.1.1
StringValueMap converts a string map of string pointers into a string map of string values
func StringValueSlice ¶ added in v0.1.1
StringValueSlice converts a slice of string pointers into a slice of string values
func TimeMap ¶ added in v0.1.1
TimeMap converts a string map of time.Time values into a string map of time.Time pointers
func TimeSlice ¶ added in v0.1.1
TimeSlice converts a slice of time.Time values into a slice of time.Time pointers
func TimeUnixMilli ¶ added in v0.1.1
TimeUnixMilli returns a Unix timestamp in milliseconds from "January 1, 1970 UTC". The result is undefined if the Unix time cannot be represented by an int64. Which includes calling TimeUnixMilli on a zero Time is undefined.
This utility is useful for service API's such as CloudWatch Logs which require their unix time values to be in milliseconds.
See Go stdlib https://golang.org/pkg/time/#Time.UnixNano for more information.
func TimeValue ¶ added in v0.1.1
TimeValue returns the value of the time.Time pointer passed in or time.Time{} if the pointer is nil.
func TimeValueMap ¶ added in v0.1.1
TimeValueMap converts a string map of time.Time pointers into a string map of time.Time values
Types ¶
type ArgError ¶ added in v0.1.1
type ArgError struct {
// contains filtered or unexported fields
}
ArgError is an error that represents an error with an input to goproxmox. It identifies the argument and the cause (if possible).
func NewArgError ¶ added in v0.1.1
NewArgError creates an InputError.
type BootDevice ¶ added in v0.1.1
type BootDevice int
const ( BOOT_Floppy BootDevice = 1 + iota BOOT_HardDisk BOOT_CDROM BOOT_Network )
func BootDeviceFromString ¶ added in v0.1.1
func BootDeviceFromString(s string) (BootDevice, error)
func (BootDevice) String ¶ added in v0.1.1
func (m BootDevice) String() string
String returns the name of the BootDevice.
type CPUType ¶ added in v0.1.1
type CPUType int
const ( CPU_486 CPUType = 1 + iota CPU_Broadwell CPU_Broadwell_noTSX CPU_Conroe CPU_Haswell CPU_Haswell_noTSX CPU_IvyBridge CPU_Nehalem CPU_Opteron_G1 CPU_Opteron_G2 CPU_Opteron_G3 CPU_Opteron_G4 CPU_Opteron_G5 CPU_Penryn CPU_SandyBridge CPU_Skylake_Client CPU_Westmere CPU_Athlon CPU_Core2duo CPU_CoreDuo CPU_HOST CPU_KVM32 CPU_KVM64 CPU_Pentium CPU_Pentium2 CPU_Pentium3 CPU_Phenom CPU_Qemu32 CPU_Qemu64 )
func CPUTypeFromString ¶ added in v0.1.1
type Client ¶
type Client struct { // Base URL for API requests. BaseURL *url.URL // Control panel username Username string // Control panel password Password string // Services used for communicating with the API Nodes NodesService VMs QemuService Storages StorageService // contains filtered or unexported fields }
Client manages communication with proxmox API.
func (*Client) Do ¶
Do sends an API request and returns the API response. The API response is JSON decoded and stored in the value pointed to by v, or returned as an error if an API error has occurred. If v implements the io.Writer interface, the raw response will be written to v, without attempting to decode it.
func (*Client) NewRequest ¶
NewRequest creates an API request. A relative URL can be provided in urlStr, which will be resolved to the BaseURL of the Client. Relative URLS should always be specified without a preceding slash. If specified, the value pointed to by body is JSON encoded and included in as the request body.
func (*Client) OnRequestCompleted ¶
func (c *Client) OnRequestCompleted(rc RequestCompletionCallback)
OnRequestCompleted sets the API request completion callback
type ErrorResponse ¶
type ErrorResponse struct { // HTTP response that caused this error Response *http.Response // Errors map Errors map[string]string `json:"errors"` // ResponseCode returned from the API ResponseCode int }
An ErrorResponse reports the error caused by an API request
func (*ErrorResponse) Error ¶
func (r *ErrorResponse) Error() string
type IDEDevice ¶ added in v0.1.3
IDE device
func NewIDEDeviceFromString ¶ added in v0.1.3
func (*IDEDevice) GetQMOptionValue ¶ added in v0.1.3
type KeyboardLayout ¶ added in v0.1.1
type KeyboardLayout int
const ( KeyboardLayout_DA KeyboardLayout = 1 + iota KeyboardLayout_DE KeyboardLayout_DE_CH KeyboardLayout_EN_GB KeyboardLayout_EN_US KeyboardLayout_ES KeyboardLayout_FI KeyboardLayout_FR KeyboardLayout_FR_BE KeyboardLayout_FR_CA KeyboardLayout_FR_CH KeyboardLayout_HU KeyboardLayout_IS KeyboardLayout_IT KeyboardLayout_JA KeyboardLayout_LT KeyboardLayout_MK KeyboardLayout_NL KeyboardLayout_NO KeyboardLayout_PL KeyboardLayout_PT KeyboardLayout_PT_BR KeyboardLayout_SL KeyboardLayout_SV KeyboardLayout_TR )
func KeyboardLayoutFromString ¶ added in v0.1.1
func KeyboardLayoutFromString(s string) (KeyboardLayout, error)
func (KeyboardLayout) String ¶ added in v0.1.1
func (m KeyboardLayout) String() string
String returns the name of the KeyboardLayout.
type NetworkCardModel ¶ added in v0.1.1
type NetworkCardModel int
const ( NetworkCard_E1000 NetworkCardModel = 1 + iota NetworkCard_E1000_82540em NetworkCard_E1000_82544gc NetworkCard_E1000_82545em NetworkCard_I82551 NetworkCard_I82557b NetworkCard_I82559er NetworkCard_NE2K_ISA NetworkCard_NE2K_PCI NetworkCard_PCNET NetworkCard_RTL8139 NetworkCard_VIRTIO NetworkCard_VMXNET3 )
func NetworkCardModelFromString ¶ added in v0.1.1
func NetworkCardModelFromString(s string) (NetworkCardModel, error)
func (NetworkCardModel) String ¶ added in v0.1.1
func (m NetworkCardModel) String() string
String returns the name of the NetworkCardModel.
type NetworkDevice ¶ added in v0.1.1
type NetworkDevice struct { // Network Card Model. The virtio model provides the best performance with very low CPU overhead. // If your guest does not support this driver, it is usually best to use e1000. Model *NetworkCardModel // Bridge to attach the network device to. The Proxmox VE standard bridge is called vmbr0. Bridge *string // Whether this interface should be protected by the firewall. Firewall *bool // Whether this interface should be disconnected (like pulling the plug). LinkDown *bool // <XX:XX:XX:XX:XX:XX> MAC address. // That address must be unique withing your network. This is automatically generated if not specified. MacAddr *string // (0 - 16) Number of packet queues to be used on the device. Queues *int // (0 - N) Rate limit in mbps (megabytes per second) as floating point number. Rate *float64 // (1 - 4094) VLAN tag to apply to packets on this interface. Tag *int // <vlanid[;vlanid...]> VLAN trunks to pass through this interface. Trunks *string }
func NewNetworkDeviceFromString ¶ added in v0.1.1
func NewNetworkDeviceFromString(value string) *NetworkDevice
func (*NetworkDevice) GetQMOptionValue ¶ added in v0.1.1
func (c *NetworkDevice) GetQMOptionValue() string
type Node ¶
type Node struct { Id string `json:"id"` Node string `json:"node"` Type string `json:"type"` Cpu float64 `json:"cpu"` Mem uint64 `json:"mem"` Disk uint64 `json:"disk"` Maxcpu int `json:"maxcpu"` Maxmem uint64 `json:"maxmem"` Maxdisk uint64 `json:"maxdisk"` Uptime uint `json:"uptime"` Level string `json:"level"` }
type NodesService ¶
type NodesServiceOp ¶
type NodesServiceOp struct {
// contains filtered or unexported fields
}
func (*NodesServiceOp) GetNodes ¶
func (s *NodesServiceOp) GetNodes() ([]Node, error)
type QemuService ¶
type QemuService interface { GetVMList(node string) ([]VM, error) GetVMCurrentStatus(node string, vmID int) (*VMStatus, error) StartVM(node string, vmID int) error StopVM(node string, vmID int) error ShutdownVM(node string, vmID int) error ResetVM(node string, vmID int) error SuspendVM(node string, vmID int) error ResumeVM(node string, vmID int) error GetVMConfig(node string, vmID int) (*VMConfig, error) CreateVM(node string, vmID int, config *VMConfig) error UpdateVM(node string, vmID int, config *VMConfig, async bool) error DeleteVM(node string, vmID int) error }
type QemuServiceOp ¶
type QemuServiceOp struct {
// contains filtered or unexported fields
}
func (*QemuServiceOp) CreateVM ¶
func (s *QemuServiceOp) CreateVM(node string, vmID int, config *VMConfig) error
Create virtual machine.
func (*QemuServiceOp) DeleteVM ¶
func (s *QemuServiceOp) DeleteVM(node string, vmID int) error
Create virtual machine.
func (*QemuServiceOp) GetVMConfig ¶ added in v0.1.1
func (s *QemuServiceOp) GetVMConfig(node string, vmID int) (*VMConfig, error)
Get config for the virtual machine
func (*QemuServiceOp) GetVMCurrentStatus ¶
func (s *QemuServiceOp) GetVMCurrentStatus(node string, vmID int) (*VMStatus, error)
Get virtual machine status.
func (*QemuServiceOp) GetVMList ¶ added in v0.1.1
func (s *QemuServiceOp) GetVMList(node string) ([]VM, error)
Virtual machine index (per node).
func (*QemuServiceOp) ResetVM ¶
func (s *QemuServiceOp) ResetVM(node string, vmID int) error
Reset virtual machine.
func (*QemuServiceOp) ResumeVM ¶
func (s *QemuServiceOp) ResumeVM(node string, vmID int) error
Resume virtual machine.
func (*QemuServiceOp) ShutdownVM ¶
func (s *QemuServiceOp) ShutdownVM(node string, vmID int) error
Shutdown virtual machine. This is similar to pressing the power button on a physical machine. This will send an ACPI event for the guest OS, which should then proceed to a clean shutdown.
func (*QemuServiceOp) StartVM ¶
func (s *QemuServiceOp) StartVM(node string, vmID int) error
Start virtual machine.
func (*QemuServiceOp) StopVM ¶
func (s *QemuServiceOp) StopVM(node string, vmID int) error
Stop virtual machine. The qemu process will exit immediately. This is akin to pulling the power plug of a running computer and may damage the VM data.
type RequestCompletionCallback ¶
RequestCompletionCallback defines the type of the request callback function
type SCSIControllerType ¶ added in v0.1.1
type SCSIControllerType int
const ( SCSI_LSI SCSIControllerType = 1 + iota SCSI_LSI53C810 SCSI_VirtIO_SCSI_PCI SCSI_VirtIO_SCSI_SINGLE SCSI_MEGASAS SCSI_PVSCSI )
func SCSIControllerTypeFromString ¶ added in v0.1.1
func SCSIControllerTypeFromString(s string) (SCSIControllerType, error)
func (SCSIControllerType) String ¶ added in v0.1.1
func (m SCSIControllerType) String() string
String returns the name of the SCSIControllerType.
type SerialDevice ¶ added in v0.1.3
type SerialDevice struct {
Value string
}
Serial device
func NewSerialDeviceFromString ¶ added in v0.1.3
func NewSerialDeviceFromString(value string) *SerialDevice
func (*SerialDevice) GetQMOptionValue ¶ added in v0.1.3
func (c *SerialDevice) GetQMOptionValue() string
type StorageService ¶ added in v0.1.3
type StorageService interface { GetStorageList(node string) ([]Storage, error) GetStorageVolumes(node, storageName string) ([]StorageVolume, error) GetVolume(node, storageName, volumeId string) (*StorageVolume, error) CreateVolume(node, storageName string, vmID int, filename string, size string, format *string) error DeleteVolume(node, storageName, volumeId string) error }
type StorageServiceOp ¶ added in v0.1.3
type StorageServiceOp struct {
// contains filtered or unexported fields
}
func (*StorageServiceOp) CreateVolume ¶ added in v0.1.3
func (s *StorageServiceOp) CreateVolume(node, storageName string, vmID int, filename string, size string, format *string) error
Create new volume.
func (*StorageServiceOp) DeleteVolume ¶ added in v0.1.3
func (s *StorageServiceOp) DeleteVolume(node, storageName, volumeId string) error
Delete existing volume.
func (*StorageServiceOp) GetStorageList ¶ added in v0.1.3
func (s *StorageServiceOp) GetStorageList(node string) ([]Storage, error)
Storage list (per node).
func (*StorageServiceOp) GetStorageVolumes ¶ added in v0.1.3
func (s *StorageServiceOp) GetStorageVolumes(node, storageName string) ([]StorageVolume, error)
Get list of volumes per node and storage
func (*StorageServiceOp) GetVolume ¶ added in v0.1.3
func (s *StorageServiceOp) GetVolume(node, storageName, volumeId string) (*StorageVolume, error)
Get volume attributes
type StorageVolume ¶ added in v0.1.3
type VM ¶
type VM struct { VMID int `json:"vmid"` Name string `json:"name"` Status string `json:"status"` PID string `json:"pid"` Template string `json:"template"` CPU float64 `json:"cpu"` CPUs int `json:"cpus"` Memory int `json:"mem"` MaxMemory int `json:"maxmem"` Disk int `json:"disk"` DiskRead int `json:"diskread"` DiskWrite int `json:"diskwrite"` MaxDisk int `json:"maxdisk"` NetIn int `json:"netin"` NetOut int `json:"netout"` Uptime int `json:"uptime"` }
type VMConfig ¶ added in v0.1.1
type VMConfig struct { // Enable/disable ACPI. // default = 1 ACPI *bool // Enable/disable Qemu GuestAgent. // default = 0 QemuAgent *bool // // The backup file. Archive *string // TODO Create only // // Arbitrary arguments passed to kvm, for example: // args: -no-reboot -no-hpet Args *string // Automatic restart after crash // default = 0 AutoStart *bool // // Amount of target RAM for the VM in MB. Using zero disables the balloon driver. Balloon *int // // Select BIOS implementation. // default = seabios Bios *Bios // // Boot on floppy (a), hard disk (c), CD-ROM (d), or network (n). // default = cdn BootOrder []BootDevice // // Enable booting from specified disk. // (ide|sata|scsi|virtio)\d+ BootDisk *string // // <volume> This is an alias for option -ide2 CDROM *string // // The number of cores per socket. // default = 1 Cores *int // // [cputype=]<enum> [,hidden=<1|0>] Emulated CPU type. // default = kvm64 // hidden=<boolean> Do not identify as a KVM virtual machine. // default = 0 CPU *CPUType // // (0 - 128) Limit of CPU usage. NOTE: If the computer has 2 CPUs, it has total of '2' CPU time. Value '0' indicates no CPU limit. // default = 0 CPULimit *int // // (0 - 500000) CPU weight for a VM. Argument is used in the kernel fair scheduler. // The larger the number is, the more CPU time this VM gets. // Number is relative to weights of all the other running VMs. // You can disable fair-scheduler configuration by setting this to 0. // default = 1024 CPUUnits *int // // Description for the VM. Only used on the configuration web interface. // This is saved as comment inside the configuration file. Description *string // // TODO digest. Only post/put // // Allow to overwrite existing VM. Force *bool // // Freeze CPU at startup (use 'c' monitor command to start execution). Freeze *bool // // Map host PCI devices into guest. // NOTE: This option allows direct access to host hardware. // So it is no longer possible to migrate such machines - use with special care. HostPCI *string // // Selectively enable hotplug features. // This is a comma separated list of hotplug features: 'network', 'disk', 'cpu', 'memory' and 'usb'. // Use '0' to disable hotplug completely. // Value '1' is an alias for the default 'network,disk,usb'. HotPlug *string // // Enable/disable hugepages memory. HugePages *HugePages // // Use volume as IDE hard disk or CD-ROM IDEDevices map[int]*IDEDevice // // Keyboard layout for vnc server. Default is read from the '/etc/pve/datacenter.conf' configuration file. // default = en-us KeyboardLayout *KeyboardLayout // // Enable/disable KVM hardware virtualization. // default = 1 KVMHardwareVirtualization *bool // // Set the real time clock to local time. This is enabled by default if ostype indicates a Microsoft OS. LocalTime *bool // // Lock/unlock the VM. Lock *Lock // // Specify the Qemu machine type. // (pc|pc(-i440fx)?-\d+\.\d+(\.pxe)?|q35|pc-q35-\d+\.\d+(\.pxe)?) MachineType *string // // Amount of RAM for the VM in MB. This is the maximum available memory when you use the balloon device. // default = 512 Memory *int // // (0 - N) Set maximum tolerated downtime (in seconds) for migrations. // default = 0.1 MigrateDowntime *int // // Set maximum speed (in MB/s) for migrations. Value 0 is no limit. // default = 0 MigrateSpeed *int // // Set a name for the VM. Only used on the configuration web interface. Name *string // // Specify network devices. NetworkDevices map[int]*NetworkDevice // // Enable/disable NUMA. // default = 0 NUMA *bool // // NUMA topology. NUMATopologies map[int]QMOption // // Specifies whether a VM will be started during system bootup. // default = 0 StartAtBoot *bool // // Specify guest operating system. This is used to enable special optimization/features for specific operating systems. OSType *OSType // // Map host parallel devices (n is 0 to 2). // NOTE: This option allows direct access to host hardware. // So it is no longer possible to migrate such machines - use with special care. ParallelDevices map[int]QMOption // // Add theVM to the specified pool. Pool *string // TODO Create only // // Sets the protection flag of the VM. This will disable the remove VM and remove disk operations. Protection *bool // // Allow reboot. If set to '0' the VM exit on reboot. Reboot *bool // // Use volume as SATA hard disk or CD-ROM (n is 0 to 5). SATADevices map[int]QMOption // // Use volume as SCSI hard disk or CD-ROM (n is 0 to 13). SCSIDevices map[int]QMOption // // SCSI controller model // default = lsi SCSIControllerType *SCSIControllerType // // Create a serial device inside the VM (n is 0 to 3), and pass through a host serial device (i.e. /dev/ttyS0), // or create a unix socket on the host side (use 'qm terminal' to open a terminal connection). // NOTE: If you pass through a host serial device, it is no longer possible to migrate such machines - use with special care. SerialDevices map[int]*SerialDevice // Amount of memory shares for auto-ballooning. // The larger the number is, the more memory this VM gets. // Number is relative to weights of all other running VMs. Using zero disables auto-ballooning // default = 1000 MemoryShares *int // // Specify SMBIOS type 1 fields. SMBIOS1 *string // // The number of CPUs. Please use option -sockets instead. // default = 1 SMP *int // // The number of CPU sockets. // default = 1 Sockets *int // // Set the initial date of the real time clock. Valid format for date are: 'now' or '2006-06-17T16:01:21' or'2006-06-17'. // (now |YYYY-MM-DD | YYYY-MM-DDTHH:MM:SS) // default = now StartDate *string // // Startup and shutdown behavior. // Order is a non-negative number defining the general startup order. Shutdown is done with reverse ordering. // Additionally you can set the 'up' or 'down' delay in seconds, which specifies a delay to wait before the next VM is started or stopped. // [[order=]\d+] [,up=\d+] [,down=\d+] Startup *string // // Default storage. Storage *string // TODO Create only // // Enable/disable the USB tablet device. This device is usually needed to allow absolute mouse positioning with VNC. // Else the mouse runs out of sync with normal VNC clients. If you're running lots of console-only guests on one host, // you may consider disabling this to save some context switches. This is turned off by default if you use spice (-vga=qxl). // default = 1 Tablet *bool // // Enable/disable time drift fix. // default = 0 TDF *bool // // Enable/disable Template. // default = 0 Template *bool // // Assign a unique random ethernet address. Unique *bool // TODO Create only // // Configure an USB device (n is 0 to 4). USBDevices map[int]QMOption // // Number of hotplugged vCPUs. // default = 0 VCPUs *int // // Select the VGA type. If you want to use high resolution modes (>= 1280x1024x16) then you should use the options std or vmware. // Default is std for win8/win7/w2k8, and cirrus for other OS types. The qxl option enables the SPICE display sever. // For win* OS you can select how many independent displays you want, Linux guests can add displays them self. // You can also run without any graphic card, using a serial device as terminal. VGAType *VGAType // // Use volume as VirtIO hard disk (n is 0 to 15). VirtIODevices map[int]*VirtIODevice // // The (unique) ID of the VM. VMID *int // TODO Create only // // Create a virtual hardware watchdog device. Once enabled (by a guest action), // the watchdog must be periodically polled by an agent inside the guest or else the watchdog will reset the guest // (or execute the respective action specified) Watchdog *string }
func NewVMConfigFromMap ¶ added in v0.1.1
func (*VMConfig) AddIDEDevice ¶ added in v0.1.1
func (*VMConfig) AddNUMATopology ¶ added in v0.1.1
func (*VMConfig) AddNetworkDevice ¶ added in v0.1.1
func (c *VMConfig) AddNetworkDevice(number int, value *NetworkDevice)
func (*VMConfig) AddParallelDevice ¶ added in v0.1.1
func (*VMConfig) AddSATADevice ¶ added in v0.1.1
func (*VMConfig) AddSCSIDevice ¶ added in v0.1.1
func (*VMConfig) AddSerialDevice ¶ added in v0.1.1
func (c *VMConfig) AddSerialDevice(number int, value *SerialDevice)
func (*VMConfig) AddUSBDevice ¶ added in v0.1.1
func (*VMConfig) AddVirtIODevice ¶ added in v0.1.1
func (c *VMConfig) AddVirtIODevice(number int, value *VirtIODevice)
type VMStatus ¶
type VMStatus struct { Name string `json:"name"` Status string `json:"status"` QMPstatus string `json:"qmpstatus"` PID int `json:"pid"` Template string `json:"template"` CPU int `json:"cpu"` CPUs int `json:"cpus"` Memory int `json:"mem"` MaxMemory int `json:"maxmem"` Disk int `json:"disk"` DiskRead int `json:"diskread"` DiskWrite int `json:"diskwrite"` MaxDisk int `json:"maxdisk"` NetIn int `json:"netin"` NetOut int `json:"netout"` Uptime int `json:"uptime"` HA interface{} `json:"ha"` }
type VirtIODevice ¶ added in v0.1.1
type VirtIODevice struct { File *string Format *VolumeFormat Backup *bool IOThread *bool Size *string Snapshot *bool }
func NewVirtIODeviceFromString ¶ added in v0.1.1
func NewVirtIODeviceFromString(value string) *VirtIODevice
func (*VirtIODevice) GetQMOptionValue ¶ added in v0.1.1
func (c *VirtIODevice) GetQMOptionValue() string
type VolumeFormat ¶ added in v0.1.1
type VolumeFormat int
const ( VolumeFormat_CLOOP VolumeFormat = 1 + iota VolumeFormat_COW VolumeFormat_QCOW VolumeFormat_QCOW2 VolumeFormat_QED VolumeFormat_RAW VolumeFormat_VMDK )
func VolumeFormatFromString ¶ added in v0.1.1
func VolumeFormatFromString(s string) (VolumeFormat, error)
func (VolumeFormat) String ¶ added in v0.1.1
func (m VolumeFormat) String() string
String returns the name of the VolumeFormat.