vmservice

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Overview

Package vmservice implement Proxmox vm logic.

Index

Constants

View Source
const (
	// DefaultNetworkDeviceIPV4 is the default network device name for ipv4.
	DefaultNetworkDeviceIPV4 = "net0-inet"

	// DefaultNetworkDeviceIPV6 is the default network device name for ipv6.
	DefaultNetworkDeviceIPV6 = "net0-inet6"
)

Variables

View Source
var (
	// ErrVMNotCreated VM is not created yet.
	ErrVMNotCreated = errors.New("vm not created")

	// ErrVMNotFound VM is not Found in Proxmox.
	ErrVMNotFound = errors.New("vm not found")

	// ErrVMNotInitialized VM is not Initialized in Proxmox.
	ErrVMNotInitialized = errors.New("vm not initialized")
)

Functions

func DeleteVM

func DeleteVM(ctx context.Context, machineScope *scope.MachineScope) error

DeleteVM implements the logic of destroying a VM.

func FindVM

func FindVM(ctx context.Context, scope *scope.MachineScope) (*proxmox.VirtualMachine, error)

FindVM returns the Proxmox VM if the vmID is set, otherwise returns ErrVMNotCreated or ErrVMNotFound if the VM doesn't exist.

func IPAddressWithPrefix

func IPAddressWithPrefix(ip string, prefix int) string

IPAddressWithPrefix return formatted IP Address with prefix.

func ReconcileVM

ReconcileVM makes sure that the VM is in the desired state by:

  1. Creating the VM if it does not exist, then...
  2. Updating the VM with the bootstrap data, such as the cloud-init meta and user data, before...
  3. Powering on the VM, and finally...
  4. Returning the real-time state of the VM to the caller

func VMNotFound

func VMNotFound(err error) bool

VMNotFound checks if the given err is related to that the VM is not found in Proxmox.

Types

This section is empty.

Jump to

Keyboard shortcuts

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