Documentation ¶
Index ¶
- Constants
- func NewStatusError(status int, body string) error
- type Config
- type Dialer
- type NodeID
- type NodeInfo
- type NodeStatus
- type NodeVMID
- type PveClient
- func (c *PveClient) CloneVM(from, to NodeVMID, name, description, pool string) *Task
- func (c *PveClient) Config(id NodeVMID) (*Config, error)
- func (c *PveClient) DeleteVM(id NodeVMID) *Task
- func (c *PveClient) FixCloudInitDrive(id NodeVMID) error
- func (c *PveClient) IDFromName(name string) (NodeVMID, error)
- func (c *PveClient) ListAllVMs() ([]*VMInfo, error)
- func (c *PveClient) ListNodes() ([]*NodeInfo, error)
- func (c *PveClient) ListVMs(nodeID NodeID) ([]*VMInfo, error)
- func (c *PveClient) RandomVMID() (VMID, error)
- func (c *PveClient) ResizeVolume(id NodeVMID, disk string, size int) error
- func (c *PveClient) StartVM(id NodeVMID) *Task
- func (c *PveClient) StopVM(id NodeVMID) *Task
- func (c *PveClient) Ticket() error
- func (c *PveClient) UpdateConfig(id NodeVMID, config *Config) error
- func (c *PveClient) VMInfo(id NodeVMID) (*VMInfo, error)
- type PveClientOption
- type StatusError
- type Task
- type TaskID
- type TaskStatus
- type VMID
- type VMInfo
- type VMStatus
Constants ¶
const MaxConn = 4
const MaxRetry = 30
const OfflineNodeStatus = NodeStatus("offline")
const OnlineNodeStatus = NodeStatus("online")
const PveMaxVMID = 999999999
const RetryInterval = 3 * time.Second
const RunningVMStatus = VMStatus("running")
const StoppedVMStatus = VMStatus("stopped")
const UnknownNodeStatus = NodeStatus("unknown")
Variables ¶
This section is empty.
Functions ¶
func NewStatusError ¶ added in v0.2.0
Types ¶
type Config ¶
type Config struct { // CPU cores CPUCores int `url:"cores" json:"cores"` // CPU sockets CPUSockets int `url:"sockets" json:"sockets"` // VCPU cores VCPUs int `url:"vcpus" json:"vcpus"` // Memory size in megabytes Memory int `url:"memory" json:"memory"` // Cloud-init: user name User string `url:"ciuser" json:"ciuser"` // Cloud-init: SSH public keys SSHKeys string `url:"sshkeys" json:"sshkeys"` // Cloud-init: static IP address configuration // format: gw=<ipv4>,ip=<ipv4>/<CIDR> IPAddress string `url:"ipconfig0" json:"ipconfig0"` }
type NodeInfo ¶
type NodeInfo struct { ID NodeID `json:"node"` // Number of available CPUs. MaxCPU int `json:"maxcpu"` // Number of available memory in bytes. MaxMem int `json:"maxmem"` // Used memory in bytes. Mem int // Current node status // - unknown // - online // - offline Status NodeStatus }
type NodeStatus ¶ added in v0.3.0
type NodeStatus string
type PveClient ¶
type PveClient struct { PveClientOption // contains filtered or unexported fields }
See https://pve.proxmox.com/pve-docs/api-viewer/
func NewPveClient ¶
func NewPveClient(option PveClientOption) *PveClient
func (*PveClient) DeleteVM ¶
DeleteVM deletes the VM. If VM is running, it will be stop immediately and delete it.
func (*PveClient) FixCloudInitDrive ¶ added in v0.3.0
FixCloudInitDrive reconnects cloud-init drive. This method provides a workaround for the ProxmoxVE bug.
func (*PveClient) IDFromName ¶
IDFromName finds an VM with the given name and returns an ID.
func (*PveClient) ListAllVMs ¶
ListAllVMs returns information of all VMs in the cluster.
func (*PveClient) RandomVMID ¶
RandomVMID returns an unused VMID.
func (*PveClient) ResizeVolume ¶
ResizeVolume increases disk size. The size parameter is in gigabytes.
func (*PveClient) StopVM ¶
StopVM stops the VM immediately. This operation is not safe. This is akin to pulling the power plug of a running computer and may cause VM data corruption.
func (*PveClient) UpdateConfig ¶
UpdateConfig updates configuration of the specified VM.
type PveClientOption ¶
type StatusError ¶ added in v0.2.0
func (*StatusError) Error ¶ added in v0.2.0
func (e *StatusError) Error() string
type Task ¶
type TaskStatus ¶
func (*TaskStatus) IsOK ¶
func (s *TaskStatus) IsOK() bool
func (*TaskStatus) IsStopped ¶
func (s *TaskStatus) IsStopped() bool