Documentation ¶
Overview ¶
Package vmservice implement Proxmox vm logic.
Index ¶
- Constants
- Variables
- func DeleteVM(ctx context.Context, machineScope *scope.MachineScope) error
- func FindVM(ctx context.Context, scope *scope.MachineScope) (*proxmox.VirtualMachine, error)
- func IPAddressWithPrefix(ip string, prefix int) string
- func ReconcileVM(ctx context.Context, scope *scope.MachineScope) (infrav1alpha1.VirtualMachine, error)
- func VMNotFound(err error) bool
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") )
View Source
var ErrNoVMIDInRangeFree = errors.New("No free vmid found in vmIDRange")
ErrNoVMIDInRangeFree is returned if no free VMID is found in the specified vmIDRange.
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 ¶
IPAddressWithPrefix return formatted IP Address with prefix.
func ReconcileVM ¶
func ReconcileVM(ctx context.Context, scope *scope.MachineScope) (infrav1alpha1.VirtualMachine, error)
ReconcileVM makes sure that the VM is in the desired state by:
- Creating the VM if it does not exist, then...
- Updating the VM with the bootstrap data, such as the cloud-init meta and user data, before...
- Powering on the VM, and finally...
- Returning the real-time state of the VM to the caller
func VMNotFound ¶
VMNotFound checks if the given err is related to that the VM is not found in Proxmox.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.