diff --git a/app/proxmox.go b/app/proxmox.go index 174a64e..eeb08a7 100644 --- a/app/proxmox.go +++ b/app/proxmox.go @@ -23,6 +23,12 @@ type PVEDevice struct { // used only for requests to PVE Subsystem_Vendor_Name string `json:"subsystem_vendor_name"` } +type PVEProctype struct { + Custom int + Name string + Vendor string +} + func NewClient(url string, token string, secret string) ProxmoxClient { HTTPClient := http.Client{ Transport: &http.Transport{ @@ -104,6 +110,15 @@ func (pve ProxmoxClient) Node(nodeName string) (*Node, error) { } } + proctypes := []PVEProctype{} + err = pve.client.Get(context.Background(), fmt.Sprintf("/nodes/%s/capabilities/qemu/cpu", nodeName), &proctypes) + if err != nil { + return &host, err + } + for _, proctype := range proctypes { + host.Proctypes = append(host.Proctypes, proctype.Name) + } + host.Name = node.Name host.Cores = uint64(node.CPUInfo.CPUs) host.Memory = uint64(node.Memory.Total) diff --git a/app/types.go b/app/types.go index 719d778..73aabb5 100644 --- a/app/types.go +++ b/app/types.go @@ -20,6 +20,7 @@ type Node struct { Swap uint64 `json:"swap"` Devices map[DeviceBus]*Device `json:"devices"` Instances map[InstanceID]*Instance `json:"instances"` + Proctypes []string `json:"cpus"` pvenode *proxmox.Node }