fix bug with incomplete cluster model when node is down,

improve various error messages
This commit is contained in:
2025-04-07 19:25:28 +00:00
parent cc35e38455
commit 2265a8e580
3 changed files with 34 additions and 9 deletions

View File

@@ -1,6 +1,7 @@
package app
import (
"fmt"
"sync"
"github.com/luthermonson/go-proxmox"
@@ -88,3 +89,24 @@ type Function struct {
VendorName string `json:"subsystem_vendor_name"`
Reserved bool `json:"reserved"`
}
func (cluster *Cluster) String() string {
s := "cluster:\n"
for _, node := range cluster.Nodes {
s += fmt.Sprintf("\t%s", node)
}
return s
}
func (node *Node) String() string {
s := fmt.Sprintf("%s:\n", node.Name)
for vmid, instance := range node.Instances {
s += fmt.Sprintf("\t\t%d:%s\n", vmid, instance)
}
return s
}
func (instance *Instance) String() string {
s := fmt.Sprintf("%s", instance.Name)
return s
}