add basic synchronization using mutex

This commit is contained in:
2025-02-11 07:11:05 +00:00
parent fdcab0a20a
commit b86034ae8f
5 changed files with 158 additions and 68 deletions

View File

@@ -1,21 +1,26 @@
package app
import "github.com/luthermonson/go-proxmox"
import (
"sync"
type Resource struct {
Reserved uint64
Free uint64
Total uint64
"github.com/luthermonson/go-proxmox"
)
type Cluster struct {
lock sync.Mutex
pve ProxmoxClient
Hosts map[string]*Host
}
type Host struct {
lock sync.Mutex
Name string
Cores Resource
Memory Resource
Swap Resource
Devices map[string]*Device
Instances map[uint]*Instance
node *proxmox.Node
pvenode *proxmox.Node
}
type InstanceType string
@@ -26,6 +31,7 @@ const (
)
type Instance struct {
lock sync.Mutex
Type InstanceType
Name string
Proctype string
@@ -35,11 +41,16 @@ type Instance struct {
Volumes map[string]*Volume
Nets map[uint]*Net
Devices map[uint][]*Device
config interface{}
pveconfig interface{}
configDisks map[string]string
configNets map[string]string
configHostPCIs map[string]string
proxmox.ContainerInterface
}
type Resource struct {
Reserved uint64
Free uint64
Total uint64
}
type Volume struct {