2024-10-18 04:28:31 +00:00
|
|
|
package app
|
|
|
|
|
2025-01-08 22:42:17 +00:00
|
|
|
import "github.com/luthermonson/go-proxmox"
|
|
|
|
|
2024-12-27 19:59:44 +00:00
|
|
|
type Resource struct { // number of virtual cores (usually threads)
|
2025-01-08 22:42:17 +00:00
|
|
|
Reserved uint64
|
|
|
|
Free uint64
|
|
|
|
Total uint64
|
2024-12-27 19:59:44 +00:00
|
|
|
}
|
2024-10-18 04:28:31 +00:00
|
|
|
|
2024-12-27 19:59:44 +00:00
|
|
|
type Host struct {
|
|
|
|
Name string
|
|
|
|
Cores Resource
|
|
|
|
Memory Resource
|
|
|
|
Swap Resource
|
2025-01-08 22:42:17 +00:00
|
|
|
Hardware map[string]*HostSuperDevice
|
|
|
|
//QEMU map[uint]*QEMUInstance
|
|
|
|
//LXC map[uint]*LXCInstance
|
|
|
|
Instance map[uint]*Instance
|
|
|
|
node *proxmox.Node
|
2024-12-27 19:59:44 +00:00
|
|
|
}
|
2024-10-18 04:28:31 +00:00
|
|
|
|
2025-01-08 22:42:17 +00:00
|
|
|
/*
|
2024-10-18 04:28:31 +00:00
|
|
|
type QEMUInstance struct {
|
|
|
|
Name string
|
|
|
|
Proctype string
|
2025-01-08 22:42:17 +00:00
|
|
|
Cores uint64
|
|
|
|
Memory uint64
|
|
|
|
Drive map[uint]*Volume
|
|
|
|
Disk map[uint]*Volume
|
|
|
|
Net map[uint]*Net
|
|
|
|
Device map[uint]*InstanceDevice
|
|
|
|
vm *proxmox.VirtualMachine
|
2024-10-18 04:28:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
type LXCInstance struct {
|
|
|
|
Name string
|
2025-01-08 22:42:17 +00:00
|
|
|
Cores uint64
|
|
|
|
Memory uint64
|
|
|
|
Swap uint64
|
|
|
|
RootDisk *Volume
|
|
|
|
MP map[uint]*Volume
|
|
|
|
Net map[uint]*Net
|
|
|
|
ct *proxmox.Container
|
|
|
|
}
|
|
|
|
*/
|
|
|
|
|
|
|
|
type InstanceType bool
|
|
|
|
|
|
|
|
const (
|
|
|
|
VM InstanceType = true
|
|
|
|
CT InstanceType = false
|
|
|
|
)
|
|
|
|
|
|
|
|
type Instance struct {
|
|
|
|
Type InstanceType
|
|
|
|
Name string
|
|
|
|
Proctype string
|
|
|
|
Cores uint64
|
|
|
|
Memory uint64
|
|
|
|
Swap uint64
|
|
|
|
Volume map[string]*Volume
|
|
|
|
Net map[uint]*Net
|
|
|
|
Device map[uint]*InstanceDevice
|
|
|
|
config interface{}
|
|
|
|
configDisks map[string]string
|
|
|
|
configNets map[string]string
|
|
|
|
proxmox.ContainerInterface
|
2024-12-27 19:59:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
type Volume struct {
|
|
|
|
Path string
|
2025-01-08 22:42:17 +00:00
|
|
|
Format string
|
|
|
|
Size uint64
|
|
|
|
Volid string
|
2024-12-27 19:59:44 +00:00
|
|
|
}
|
|
|
|
|
2025-01-08 22:42:17 +00:00
|
|
|
type Net struct {
|
|
|
|
Rate uint64
|
|
|
|
VLAN uint64
|
|
|
|
}
|
|
|
|
|
|
|
|
type InstanceDevice struct {
|
|
|
|
Device []*HostDevice
|
|
|
|
PCIE bool
|
|
|
|
}
|
|
|
|
|
|
|
|
type HostSuperDevice struct {
|
|
|
|
BusID string
|
|
|
|
DeviceName string
|
|
|
|
VendorName string
|
|
|
|
Devices map[string]*HostDevice
|
|
|
|
}
|
2024-12-27 19:59:44 +00:00
|
|
|
|
2025-01-08 22:42:17 +00:00
|
|
|
type HostDevice struct {
|
|
|
|
SubID string
|
|
|
|
SubDeviceName string
|
|
|
|
SubVendorName string
|
|
|
|
Reserved bool
|
2024-10-18 04:28:31 +00:00
|
|
|
}
|