Documentation
¶
Index ¶
- func GenKeyPair() (string, string, error)
- func GetKeyPair(file string) (string, string, error)
- func NewDriver(hostName, storePath string) drivers.Driver
- type AccessTicketPostParameter
- type AccessTicketReturnParameter
- type ConfigReturn
- type Driver
- func (d *Driver) Create() error
- func (d *Driver) DriverName() string
- func (d *Driver) GetCreateFlags() []mcnflag.Flag
- func (d *Driver) GetIP() (string, error)
- func (d *Driver) GetMachineName() string
- func (d *Driver) GetNetBridge() string
- func (d *Driver) GetNetVlanTag() int
- func (d *Driver) GetSSHHostname() (string, error)
- func (d *Driver) GetSSHPort() (int, error)
- func (d *Driver) GetSSHUsername() string
- func (d *Driver) GetState() (state.State, error)
- func (d *Driver) GetURL() (string, error)
- func (d *Driver) Kill() error
- func (d *Driver) PreCreateCheck() error
- func (d *Driver) Remove() error
- func (d *Driver) Restart() error
- func (d *Driver) SetConfigFromFlags(flags drivers.DriverOptions) error
- func (d *Driver) Start() error
- func (d *Driver) Stop() error
- func (d *Driver) Upgrade() error
- type IPReturn
- type IntBool
- type NodesNodeQemuPostParameter
- type NodesNodeQemuVMIDAgentPostParameter
- type NodesNodeQemuVMIDClonePostParameter
- type NodesNodeQemuVMIDResizePutParameter
- type NodesNodeStorageStorageContentPostParameter
- type ProxmoxVE
- func (p ProxmoxVE) ClusterNextIDGet(id int) (vmid string, err error)
- func (p ProxmoxVE) EnableDebugging()
- func (p ProxmoxVE) GetConfig(node string, vmid string) (ConfigReturn, error)
- func (p ProxmoxVE) GetEth0IPv4(node string, vmid string) (string, error)
- func (p ProxmoxVE) GetStorageType(node string, storagename string) (string, error)
- func (p ProxmoxVE) NodesNodeQemuPost(node string, input *NodesNodeQemuPostParameter) (taskid string, err error)
- func (p ProxmoxVE) NodesNodeQemuVMIDAgentPost(node string, vmid string, input *NodesNodeQemuVMIDAgentPostParameter) error
- func (p ProxmoxVE) NodesNodeQemuVMIDClonePost(node string, vmid string, input *NodesNodeQemuVMIDClonePostParameter) (taskid string, err error)
- func (p ProxmoxVE) NodesNodeQemuVMIDConfigGet(node string, vmid string) (err error)
- func (p ProxmoxVE) NodesNodeQemuVMIDConfigPost(node string, vmid string, input *NodesNodeQemuPostParameter) (taskid string, err error)
- func (p ProxmoxVE) NodesNodeQemuVMIDConfigSetSSHKeys(node string, vmid string, SSHKeys string) (taskid string, err error)
- func (p ProxmoxVE) NodesNodeQemuVMIDDelete(node string, vmid string) (taskid string, err error)
- func (p ProxmoxVE) NodesNodeQemuVMIDResizePut(node string, vmid string, input *NodesNodeQemuVMIDResizePutParameter) (err error)
- func (p ProxmoxVE) NodesNodeQemuVMIDStatusCurrentGet(node string, vmid string) (string, error)
- func (p ProxmoxVE) NodesNodeQemuVMIDStatusRebootPost(node string, vmid string) (taskid string, err error)
- func (p ProxmoxVE) NodesNodeQemuVMIDStatusResetPost(node string, vmid string) (taskid string, err error)
- func (p ProxmoxVE) NodesNodeQemuVMIDStatusResumePost(node string, vmid string) (taskid string, err error)
- func (p ProxmoxVE) NodesNodeQemuVMIDStatusShutdownPost(node string, vmid string) (taskid string, err error)
- func (p ProxmoxVE) NodesNodeQemuVMIDStatusStartPost(node string, vmid string) (taskid string, err error)
- func (p ProxmoxVE) NodesNodeQemuVMIDStatusStopPost(node string, vmid string) (taskid string, err error)
- func (p ProxmoxVE) NodesNodeQemuVMIDStatusSuspendPost(node string, vmid string) (taskid string, err error)
- func (p ProxmoxVE) NodesNodeStorageStorageContentPost(node string, storage string, ...) (diskname string, err error)
- func (p ProxmoxVE) WaitForTaskToComplete(node string, taskid string) error
- type StorageReturn
- type TaskStatusReturn
- type VersionReturnParameter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenKeyPair ¶
GenKeyPair returns a freshly created public/private key pair and an optional error
func GetKeyPair ¶
GetKeyPair returns a public/private key pair and an optional error
Types ¶
type AccessTicketPostParameter ¶
type AccessTicketPostParameter struct { Privs string // optional Realm string // optional Username string OTP string // optional Password string Path string // optional }
AccessTicketPostParameter represents the input data for /access/ticket Original Description: Create or verify authentication ticket.
type AccessTicketReturnParameter ¶
type AccessTicketReturnParameter struct { Username string Csrfpreventiontoken string Ticket string }
AccessTicketReturnParameter represents the returned data from /access/ticket Original Description: Create or verify authentication ticket.
type ConfigReturn ¶
type ConfigReturn struct { Data struct { OSType string `json:"ostype"` SCSI0 string `json:"scsi0"` CPU string `json:"cpu"` ONBoot IntBool `json:"onboot"` SSHKeys string `json:"sshkeys"` Smbios1 string // optional, Specify SMBIOS type 1 fields. } `json:"data"` }
ConfigReturn represents the config response from the API
type Driver ¶
type Driver struct { *drivers.BaseDriver // Top-level strategy for proisioning a new node ProvisionStrategy string // Basic Authentication for Proxmox VE Host string // Host to connect to Node string // optional, node to create VM on, host used if omitted but must match internal node name User string // username Password string // password Realm string // realm, e.g. pam, pve, etc. // File to load as boot image RancherOS/Boot2Docker ImageFile string // in the format <storagename>:iso/<filename>.iso Pool string // pool to add the VM to (necessary for users with only pool permission) Storage string // internal PVE storage name StorageType string // Type of the storage (currently QCOW2 and RAW) DiskSize string // disk size in GB Memory int // memory in GB StorageFilename string Onboot string // Specifies whether a VM will be started during system bootup. Protection string // Sets the protection flag of the VM. This will disable the remove VM and remove disk operations. Citype string // Specifies the cloud-init configuration format. NUMA string // Enable/disable NUMA CiEnabled string NetModel string // Net Interface Model, [e1000, virtio, realtek, etc...] NetFirewall string // Enable/disable firewall NetMtu string // set nic MTU NetBridge string // bridge applied to network interface NetVlanTag int // vlan tag ScsiController string ScsiAttributes string VMID string // VM ID only filled by create() VMIDRange string // acceptable range of VMIDs VMUUID string // UUID to confirm CloneVMID string // VM ID to clone CloneFull int // Make a full (detached) clone from parent (defaults to true if VMID is not a template, otherwise false) GuestUsername string // user to log into the guest OS to copy the public key GuestPassword string // password to log into the guest OS to copy the public key GuestSSHPort int // ssh port to log into the guest OS to copy the public key CPU string // Emulated CPU type. CPUSockets string // The number of cpu sockets. CPUCores string // The number of cores per socket. // contains filtered or unexported fields }
Driver for Proxmox VE
func (*Driver) DriverName ¶
DriverName returns the name of the driver
func (*Driver) GetCreateFlags ¶
GetCreateFlags returns the argument flags for the program
func (*Driver) GetMachineName ¶
GetMachineName returns the machine name
func (*Driver) GetNetBridge ¶
GetNetBridge returns the bridge
func (*Driver) GetNetVlanTag ¶
GetNetVlanTag returns the vlan tag
func (*Driver) GetSSHHostname ¶
GetSSHHostname returns the ssh host returned by the API
func (*Driver) GetSSHPort ¶
GetSSHPort returns the ssh port, 22 if not specified
func (*Driver) GetSSHUsername ¶
GetSSHUsername returns the ssh user name, root if not specified
func (*Driver) PreCreateCheck ¶
PreCreateCheck is called to enforce pre-creation steps
func (*Driver) SetConfigFromFlags ¶
func (d *Driver) SetConfigFromFlags(flags drivers.DriverOptions) error
SetConfigFromFlags configures all command line arguments
type IPReturn ¶
type IPReturn struct { Data struct { Result []struct { HardwareAddress string `json:"hardware-address"` Name string `json:"name"` IPAdresses []struct { IPAddress string `json:"ip-address"` IPAddressType string `json:"ip-address-type"` Prefix int `json:"prefix"` } `json:"ip-addresses"` } `json:"result"` } `json:"data"` }
IPReturn represents the result from the qemu-guest-agent call network-get-interfaces
type IntBool ¶
type IntBool bool
IntBool represents a bool value as seen by the PERL API
func (IntBool) UnmarshalJSON ¶
UnmarshalJSON for Integer-based boolean values returned from the API
type NodesNodeQemuPostParameter ¶
type NodesNodeQemuPostParameter struct { VMID string // The (unique) ID of the VM. Memory int `json:"memory,omitempty"` // optional, Amount of RAM for the VM in MB. This is the maximum available memory when you use the balloon device. Autostart string // optional, Automatic restart after crash (currently ignored). Agent string // optional, Enable/disable Qemu GuestAgent. Net0 string Name string // optional, Set a name for the VM. Only used on the configuration web interface. SCSI0 string // optional, Use volume as VIRTIO hard disk (n is 0 to 15). Ostype string // optional, Specify guest operating system. KVM string // optional, Enable/disable KVM hardware virtualization. Pool string // optional, Add the VM to the specified pool. Sockets string `json:"sockets,omitempty"` // optional, The number of cpus. Cores string `json:"cores,omitempty"` // optional, The number of cores per socket. Cdrom string // optional, This is an alias for option -ide2 Ide3 string Citype string // Specifies the cloud-init configuration format. Scsihw string // SCSI controller model. Onboot string // Specifies whether a VM will be started during system bootup. Protection string // Sets the protection flag of the VM. This will disable the remove VM and remove disk operations. NUMA string // Enable/disable NUMA CPU string // Emulated CPU type. }
NodesNodeQemuPostParameter represents the input data for /nodes/{node}/qemu Original Description: Create or restore a virtual machine.
type NodesNodeQemuVMIDAgentPostParameter ¶
type NodesNodeQemuVMIDAgentPostParameter struct {
Command string // The QGA command.
}
NodesNodeQemuVMIDAgentPostParameter represents the input data for /nodes/{node}/qemu/{vmid}/agent Original Description: Execute Qemu Guest Agent commands.
type NodesNodeQemuVMIDClonePostParameter ¶
type NodesNodeQemuVMIDClonePostParameter struct { Newid string // VMID for the clone. VMID string // The (unique) ID of the VM. Name string // Set a name for the new VM. Pool string // Add the new VM to the specified pool. Full string // Create a full copy of all disks. Storage string // Target storage for full clone. Format string // Target format for file storage. Only valid for full clone. }
NodesNodeQemuVMIDClonePostParameter represents the input data for /nodes/{node}/qemu/{vmid}/clone Original Description: Create a copy of virtual machine/template.
type NodesNodeQemuVMIDResizePutParameter ¶
type NodesNodeQemuVMIDResizePutParameter struct { Disk string // The disk you want to resize. Size string // The new size. }
NodesNodeQemuVMIDResizePutParameter represents the input data for /nodes/{node}/qemu/{vmid}/resize Original Description: Extend volume size.
type NodesNodeStorageStorageContentPostParameter ¶
type NodesNodeStorageStorageContentPostParameter struct { Filename string // The name of the file to create. Size string // Size in kilobyte (1024 bytes). Optional suffixes 'M' (megabyte, 1024K) and 'G' (gigabyte, 1024M) VMID string // Specify owner VM Format string // optional, }
NodesNodeStorageStorageContentPostParameter represents the input data for /nodes/{node}/storage/{storage}/content Original Description: Allocate disk images.
type ProxmoxVE ¶
type ProxmoxVE struct { // connection parameters Username string // root Realm string // pam Host string Port int // default 8006 // not so imported internal stuff Node string // if not present, use first node present Prefix string // if PVE is proxied, this is the added prefix CSRFPreventionToken string // filled by the framework Ticket string // filled by the framework Version string // ProxmoxVE version of the connected host // contains filtered or unexported fields }
ProxmoxVE open api connection representation
func GetProxmoxVEConnection ¶
GetProxmoxVEConnection retrievs a connection to a Proxmox VE host
func GetProxmoxVEConnectionByValues ¶
func GetProxmoxVEConnectionByValues(username string, password string, realm string, hostname string) (*ProxmoxVE, error)
GetProxmoxVEConnectionByValues is a wrapper for GetProxmoxVEConnection with strings as input
func (ProxmoxVE) ClusterNextIDGet ¶
ClusterNextIDGet Get next free VMID. If you pass an VMID it will raise an error if the ID is already used.
func (ProxmoxVE) EnableDebugging ¶
func (p ProxmoxVE) EnableDebugging()
EnableDebugging enables Resty debugging of requests
func (ProxmoxVE) GetConfig ¶
func (p ProxmoxVE) GetConfig(node string, vmid string) (ConfigReturn, error)
GetConfig returns the vm configuration data
func (ProxmoxVE) GetEth0IPv4 ¶
GetEth0IPv4 access the API
func (ProxmoxVE) GetStorageType ¶
GetStorageType returns the storage type as string
func (ProxmoxVE) NodesNodeQemuPost ¶
func (p ProxmoxVE) NodesNodeQemuPost(node string, input *NodesNodeQemuPostParameter) (taskid string, err error)
NodesNodeQemuPost access the API Create or restore a virtual machine.
func (ProxmoxVE) NodesNodeQemuVMIDAgentPost ¶
func (p ProxmoxVE) NodesNodeQemuVMIDAgentPost(node string, vmid string, input *NodesNodeQemuVMIDAgentPostParameter) error
NodesNodeQemuVMIDAgentPost access the API Execute Qemu Guest Agent commands.
func (ProxmoxVE) NodesNodeQemuVMIDClonePost ¶
func (p ProxmoxVE) NodesNodeQemuVMIDClonePost(node string, vmid string, input *NodesNodeQemuVMIDClonePostParameter) (taskid string, err error)
NodesNodeQemuVMIDClonePost access the API Create a copy of virtual machine/template.
func (ProxmoxVE) NodesNodeQemuVMIDConfigGet ¶
NodesNodeQemuVMIDConfigGet access the API Get the virtual machine configuration with pending configuration changes applied. Set the 'current' parameter to get the current configuration instead.
func (ProxmoxVE) NodesNodeQemuVMIDConfigPost ¶
func (p ProxmoxVE) NodesNodeQemuVMIDConfigPost(node string, vmid string, input *NodesNodeQemuPostParameter) (taskid string, err error)
NodesNodeQemuVMIDConfigPost access the API Set config options
func (ProxmoxVE) NodesNodeQemuVMIDConfigSetSSHKeys ¶
func (p ProxmoxVE) NodesNodeQemuVMIDConfigSetSSHKeys(node string, vmid string, SSHKeys string) (taskid string, err error)
NodesNodeQemuVMIDConfigSetSSHKeys access the API Set config options https://forum.proxmox.com/threads/how-to-use-pvesh-set-vms-sshkeys.52570/ cray encoding style *AND* double-encoded
func (ProxmoxVE) NodesNodeQemuVMIDDelete ¶
NodesNodeQemuVMIDDelete access the API Destroy the vm (also delete all used/owned volumes).
func (ProxmoxVE) NodesNodeQemuVMIDResizePut ¶
func (p ProxmoxVE) NodesNodeQemuVMIDResizePut(node string, vmid string, input *NodesNodeQemuVMIDResizePutParameter) (err error)
NodesNodeQemuVMIDResizePut access the API Extend volume size.
func (ProxmoxVE) NodesNodeQemuVMIDStatusCurrentGet ¶
NodesNodeQemuVMIDStatusCurrentGet access the API Get virtual machine status.
func (ProxmoxVE) NodesNodeQemuVMIDStatusRebootPost ¶
func (p ProxmoxVE) NodesNodeQemuVMIDStatusRebootPost(node string, vmid string) (taskid string, err error)
NodesNodeQemuVMIDStatusRebootPost access the API Reboot the VM by shutting it down, and starting it again. Applies pending changes.
func (ProxmoxVE) NodesNodeQemuVMIDStatusResetPost ¶
func (p ProxmoxVE) NodesNodeQemuVMIDStatusResetPost(node string, vmid string) (taskid string, err error)
NodesNodeQemuVMIDStatusResetPost access the API Reset virtual machine.
func (ProxmoxVE) NodesNodeQemuVMIDStatusResumePost ¶
func (p ProxmoxVE) NodesNodeQemuVMIDStatusResumePost(node string, vmid string) (taskid string, err error)
NodesNodeQemuVMIDStatusResumePost access the API Resume virtual machine.
func (ProxmoxVE) NodesNodeQemuVMIDStatusShutdownPost ¶
func (p ProxmoxVE) NodesNodeQemuVMIDStatusShutdownPost(node string, vmid string) (taskid string, err error)
NodesNodeQemuVMIDStatusShutdownPost access the API 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 (ProxmoxVE) NodesNodeQemuVMIDStatusStartPost ¶
func (p ProxmoxVE) NodesNodeQemuVMIDStatusStartPost(node string, vmid string) (taskid string, err error)
NodesNodeQemuVMIDStatusStartPost access the API Start virtual machine.
func (ProxmoxVE) NodesNodeQemuVMIDStatusStopPost ¶
func (p ProxmoxVE) NodesNodeQemuVMIDStatusStopPost(node string, vmid string) (taskid string, err error)
NodesNodeQemuVMIDStatusStopPost access the API 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
func (ProxmoxVE) NodesNodeQemuVMIDStatusSuspendPost ¶
func (p ProxmoxVE) NodesNodeQemuVMIDStatusSuspendPost(node string, vmid string) (taskid string, err error)
NodesNodeQemuVMIDStatusSuspendPost access the API Suspend virtual machine.
func (ProxmoxVE) NodesNodeStorageStorageContentPost ¶
func (p ProxmoxVE) NodesNodeStorageStorageContentPost(node string, storage string, input *NodesNodeStorageStorageContentPostParameter) (diskname string, err error)
NodesNodeStorageStorageContentPost access the API Allocate disk images.
type StorageReturn ¶
type StorageReturn struct { Data []struct { Active int `json:"active"` Avail int `json:"avail"` Content string `json:"content"` Enabled IntBool `json:"enabled"` Shared IntBool `json:"shared"` Storage string `json:"storage"` Total int `json:"total"` Type string `json:"type"` Used int `json:"used"` } `json:"data"` }
StorageReturn represents the storage response from the API
type TaskStatusReturn ¶
type TaskStatusReturn struct { UPID string `json:"upid"` Node string `json:"node"` User string `json:"user"` PID int `json:"pid"` ID string `json:"id"` StartTime int `json:"starttime"` Exitstatus string `json:"exitstatus"` Type string `json:"type"` PStart int `json:"pstart"` Status string `json:"status"` }
TaskStatusReturn represents a status return message from the API
type VersionReturnParameter ¶
VersionReturnParameter represents the returned data from /version Original Description: API version details. The result also includes the global datacenter confguration.