dockermachinedriverproxmoxve

package module
v0.0.0-...-424d127 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 29, 2020 License: MIT Imports: 27 Imported by: 0

README

Docker Machine Driver for Proxmox VE

This driver can be used to kickstart a VM in Proxmox VE to be used with Docker/Docker Machine.

  • Download and copy it into your PATH (don't forget to chmod +x) or build your own driver

  • Check if it works:

      $ docker-machine create --driver proxmoxve --help | grep -c proxmox
      35
    

Operation

Now you have two modes of operation:

  • use an iso to install a Docker distribution (e.g. RancherOS)
  • use a previously created cloud-init-based image VM template as a base

There are also other options to customize your VM which are not shown here, so please feel free to explore them with docker-machine create --driver proxmoxve --help

Preparing a special test user in PVE

If you want to test this docker-machine driver, i strongly recommend to secure it properly. Best way to do this to create a special user that has its own pool and storage for creating the test machines. This corresponds to the examples below.

Here is what I use (based on ZFS):

  • create a pool for use as --proxmoxve-proxmox-pool docker-machine

      pvesh create /pools -poolid docker-machine
    
  • create an user docker-machine with password D0ck3rS3cr3t

      pvesh create /access/users -userid docker-machine@pve -password D0ck3rS3cr3t
    
  • creating a special ZFS dataset and use it as PVE storage

      zfs create -o refquota=50G rpool/docker-machine-test
      zfs create rpool/docker-machine-test/iso
      pvesh create /storage -storage docker-machine -type zfspool -pool rpool/docker-machine-test
      pvesh create /storage -storage docker-machine-iso -type dir -path /rpool/docker-machine-test/iso -content iso
      pvesh set /pools/docker-machine -storage docker-machine
      pvesh set /pools/docker-machine -storage docker-machine-iso
    
  • set proper permissions for the user

      pvesh set /access/acl -path /pool/docker-machine -roles PVEVMAdmin,PVEDatastoreAdmin,PVEPoolAdmin -users docker-machine@pve
    

If you have additional test storages, you can also add them easily:

    pvesh set /pools/docker-machine -storage nfs
    pvesh set /pools/docker-machine -storage lvm
    pvesh set /pools/docker-machine -storage directory

Ceph is currently not directly tested by me, but there are fine people out there wo tried it.

Clone VM

This approach uses a predefined VM template with cloud-init support to be cloned and used. There a lot of ways to do that, here is an adopted one (courtesy of @travisghansen):

#!/bin/bash

set -x
set -e

export IMGID=9007
export BASE_IMG="debian-10-openstack-amd64.qcow2"
export IMG="debian-10-openstack-amd64-${IMGID}.qcow2"
export STORAGEID="docker-machine"

if [ ! -f "${BASE_IMG}" ];then
  wget https://cloud.debian.org/images/cloud/OpenStack/current-10/debian-10-openstack-amd64.qcow2
fi

if [ ! -f "${IMG}" ];then
  cp -f "${BASE_IMG}" "${IMG}"
fi

# prepare mounts
guestmount -a ${IMG} -m /dev/sda1 /mnt/tmp/
mount --bind /dev/ /mnt/tmp/dev/
mount --bind /proc/ /mnt/tmp/proc/

# get resolving working
mv /mnt/tmp/etc/resolv.conf /mnt/tmp/etc/resolv.conf.orig
cp -a --force /etc/resolv.conf /mnt/tmp/etc/resolv.conf

# install desired apps
chroot /mnt/tmp /bin/bash -c "apt-get update"
chroot /mnt/tmp /bin/bash -c "DEBIAN_FRONTEND=noninteractive apt-get install -y net-tools curl qemu-guest-agent nfs-common open-iscsi lsscsi sg3-utils multipath-tools scsitools"

# https://www.electrictoolbox.com/sshd-hostname-lookups/
sed -i 's:#UseDNS no:UseDNS no:' /mnt/tmp/etc/ssh/sshd_config

sed -i '/package-update-upgrade-install/d' /mnt/tmp/etc/cloud/cloud.cfg

cat > /mnt/tmp/etc/cloud/cloud.cfg.d/99_custom.cfg << '__EOF__'
#cloud-config

# Install additional packages on first boot
#
# Default: none
#
# if packages are specified, this apt_update will be set to true
#
# packages may be supplied as a single package name or as a list
# with the format [<package>, <version>] wherein the specifc
# package version will be installed.
#packages:
# - qemu-guest-agent
# - nfs-common

ntp:
  enabled: true

# datasource_list: [ NoCloud, ConfigDrive ]
__EOF__

cat > /mnt/tmp/etc/multipath.conf << '__EOF__'
defaults {
    user_friendly_names yes
    find_multipaths yes
}
__EOF__

# enable services
chroot /mnt/tmp systemctl enable open-iscsi.service || true
chroot /mnt/tmp systemctl enable multipath-tools.service || true

# restore systemd-resolved settings
mv /mnt/tmp/etc/resolv.conf.orig /mnt/tmp/etc/resolv.conf

# umount everything
umount /mnt/tmp/dev
umount /mnt/tmp/proc
umount /mnt/tmp

# create template
qm create ${IMGID} --memory 512 --net0 virtio,bridge=vmbr0
qm importdisk ${IMGID} ${IMG} ${STORAGEID} --format qcow2
qm set ${IMGID} --scsihw virtio-scsi-pci --scsi0 ${STORAGEID}:vm-${IMGID}-disk-0
qm set ${IMGID} --ide2 ${STORAGEID}:cloudinit
qm set ${IMGID} --boot c --bootdisk scsi0
qm set ${IMGID} --serial0 socket --vga serial0
qm template ${IMGID}

# set host cpu, ssh key, etc
qm set ${IMGID} --scsihw virtio-scsi-pci
qm set ${IMGID} --cpu host
qm set ${IMGID} --agent enabled=1
qm set ${IMGID} --autostart
qm set ${IMGID} --onboot 1
qm set ${IMGID} --ostype l26
qm set ${IMGID} --ipconfig0 "ip=dhcp"

Adapt to fit your needs and run it on your Proxmox VE until it works without any problems and creates a template in your Proxmox VE. You may need to install libguestfs-tools.

After the image is created, you can start to use the machine driver to create new VMs:

#!/bin/sh
set -ex

export PATH=$PWD:$PATH

PVE_NODE="proxmox"
PVE_HOST="192.168.1.5"

PVE_USER="docker-machine"
PVE_REALM="pve"
PVE_PASSWD="D0ck3rS3cr3t"

PVE_STORAGE_NAME="${1:-docker-machine}"
PVE_POOL="docker-machine"

VM_NAME="docker-clone"

docker-machine rm --force $VM_NAME >/dev/null 2>&1 || true

docker-machine --debug \
    create \
    --driver proxmoxve \
    --proxmoxve-proxmox-host $PVE_HOST \
    --proxmoxve-proxmox-node $PVE_NODE \
    --proxmoxve-proxmox-user-name $PVE_USER \
    --proxmoxve-proxmox-user-password $PVE_PASSWD \
    --proxmoxve-proxmox-realm $PVE_REALM \
    --proxmoxve-proxmox-pool $PVE_POOL \
    \
    --proxmoxve-provision-strategy clone \
    --proxmoxve-ssh-username 'debian' \
    --proxmoxve-ssh-password 'geheim' \
    --proxmoxve-vm-clone-vmid 9007 \
    \
    --proxmoxve-debug-resty \
    --proxmoxve-debug-driver \
    \
    $* \
    \
    $VM_NAME

eval $(docker-machine env $VM_NAME)

docker ps
Rancher OS
  • Use a recent, e.g. 1.5.6 version of RancherOS and copy the rancheros-proxmoxve-autoformat.iso to your iso image storage on your PVE
  • Create a script with the following contents and adapt to your needs:
PVE_NODE="proxmox-docker-machine"
PVE_HOST="192.168.1.10"

PVE_USER="docker-machine"
PVE_REALM="pve"
PVE_PASSWD="D0ck3rS3cr3t"

PVE_STORAGE_NAME="docker-machine"
PVE_STORAGE_SIZE="4"
PVE_POOL="docker-machine"

SSH_USERNAME="docker"
SSH_PASSWORD="tcuser"

PVE_MEMORY=2
PVE_CPU_CORES=4
PVE_IMAGE_FILE="docker-machine-iso:iso/rancheros-proxmoxve-autoformat-v1.5.5.iso"
VM_NAME="docker-rancher"

docker-machine rm --force $VM_NAME >/dev/null 2>&1 || true

docker-machine --debug \
    create \
    --driver proxmoxve \
    --proxmoxve-proxmox-host $PVE_HOST \
    --proxmoxve-proxmox-node $PVE_NODE \
    --proxmoxve-proxmox-user-name $PVE_USER \
    --proxmoxve-proxmox-user-password $PVE_PASSWD \
    --proxmoxve-proxmox-realm $PVE_REALM \
    --proxmoxve-proxmox-pool $PVE_POOL \
    \
    --proxmoxve-vm-storage-path $PVE_STORAGE_NAME \
    --proxmoxve-vm-storage-size $PVE_STORAGE_SIZE \
    --proxmoxve-vm-cpu-cores $PVE_CPU_CORES \
    --proxmoxve-vm-memory $PVE_MEMORY \
    --proxmoxve-vm-image-file "$PVE_IMAGE_FILE" \
    \
    --proxmoxve-ssh-username $SSH_USERNAME \
    --proxmoxve-ssh-password $SSH_PASSWORD \
    \
    --proxmoxve-debug-resty \
    --proxmoxve-debug-driver \
    \
    $VM_NAME


eval $(docker-machine env $VM_NAME)

docker ps
  • Run the script

At the first run, it is advisable to not comment out the debug flags. If everything works as expected, you can remove them.

Changes

Version 4
Version 3
Version 2
  • exclusive RancherOS support due to their special Proxmox VE iso files
  • adding wait cycles for asynchronous background tasks, e.g. create, stop etc.
  • use one logger engine
  • add guest username, password and ssh-port as new command line arguments
  • more and potentially better error handling
Version 1
  • Initial Version

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenKeyPair

func GenKeyPair() (string, string, error)

GenKeyPair returns a freshly created public/private key pair and an optional error

func GetKeyPair

func GetKeyPair(file string) (string, string, error)

GetKeyPair returns a public/private key pair and an optional error

func NewDriver

func NewDriver(hostName, storePath string) drivers.Driver

NewDriver returns a new driver

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) Create

func (d *Driver) Create() error

Create creates a new VM with storage

func (*Driver) DriverName

func (d *Driver) DriverName() string

DriverName returns the name of the driver

func (*Driver) GetCreateFlags

func (d *Driver) GetCreateFlags() []mcnflag.Flag

GetCreateFlags returns the argument flags for the program

func (*Driver) GetIP

func (d *Driver) GetIP() (string, error)

GetIP returns the ip

func (*Driver) GetMachineName

func (d *Driver) GetMachineName() string

GetMachineName returns the machine name

func (*Driver) GetNetBridge

func (d *Driver) GetNetBridge() string

GetNetBridge returns the bridge

func (*Driver) GetNetVlanTag

func (d *Driver) GetNetVlanTag() int

GetNetVlanTag returns the vlan tag

func (*Driver) GetSSHHostname

func (d *Driver) GetSSHHostname() (string, error)

GetSSHHostname returns the ssh host returned by the API

func (*Driver) GetSSHPort

func (d *Driver) GetSSHPort() (int, error)

GetSSHPort returns the ssh port, 22 if not specified

func (*Driver) GetSSHUsername

func (d *Driver) GetSSHUsername() string

GetSSHUsername returns the ssh user name, root if not specified

func (*Driver) GetState

func (d *Driver) GetState() (state.State, error)

GetState returns the state of the VM

func (*Driver) GetURL

func (d *Driver) GetURL() (string, error)

GetURL returns the URL for the target docker daemon

func (*Driver) Kill

func (d *Driver) Kill() error

Kill the VM immediately

func (*Driver) PreCreateCheck

func (d *Driver) PreCreateCheck() error

PreCreateCheck is called to enforce pre-creation steps

func (*Driver) Remove

func (d *Driver) Remove() error

Remove removes the VM

func (*Driver) Restart

func (d *Driver) Restart() error

Restart restarts the VM

func (*Driver) SetConfigFromFlags

func (d *Driver) SetConfigFromFlags(flags drivers.DriverOptions) error

SetConfigFromFlags configures all command line arguments

func (*Driver) Start

func (d *Driver) Start() error

Start starts the VM

func (*Driver) Stop

func (d *Driver) Stop() error

Stop stopps the VM

func (*Driver) Upgrade

func (d *Driver) Upgrade() error

Upgrade is currently a NOOP

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

func (bit IntBool) UnmarshalJSON(data []byte) error

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

func GetProxmoxVEConnection(data *ProxmoxVE) (*ProxmoxVE, error)

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

func (p ProxmoxVE) ClusterNextIDGet(id int) (vmid string, err error)

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

func (p ProxmoxVE) GetEth0IPv4(node string, vmid string) (string, error)

GetEth0IPv4 access the API

func (ProxmoxVE) GetStorageType

func (p ProxmoxVE) GetStorageType(node string, storagename string) (string, error)

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

func (p ProxmoxVE) NodesNodeQemuVMIDConfigGet(node string, vmid string) (err error)

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

func (p ProxmoxVE) NodesNodeQemuVMIDDelete(node string, vmid string) (taskid string, err error)

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

func (p ProxmoxVE) NodesNodeQemuVMIDStatusCurrentGet(node string, vmid string) (string, error)

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.

func (ProxmoxVE) WaitForTaskToComplete

func (p ProxmoxVE) WaitForTaskToComplete(node string, taskid string) error

WaitForTaskToComplete waits until the given task in taskid is finished (exited or otherwise)

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

type VersionReturnParameter struct {
	RepoID  string
	Version string
	Release string
}

VersionReturnParameter represents the returned data from /version Original Description: API version details. The result also includes the global datacenter confguration.

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL