add supported cpu types to node model
This commit is contained in:
@@ -23,6 +23,12 @@ type PVEDevice struct { // used only for requests to PVE
|
|||||||
Subsystem_Vendor_Name string `json:"subsystem_vendor_name"`
|
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 {
|
func NewClient(url string, token string, secret string) ProxmoxClient {
|
||||||
HTTPClient := http.Client{
|
HTTPClient := http.Client{
|
||||||
Transport: &http.Transport{
|
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.Name = node.Name
|
||||||
host.Cores = uint64(node.CPUInfo.CPUs)
|
host.Cores = uint64(node.CPUInfo.CPUs)
|
||||||
host.Memory = uint64(node.Memory.Total)
|
host.Memory = uint64(node.Memory.Total)
|
||||||
|
@@ -20,6 +20,7 @@ type Node struct {
|
|||||||
Swap uint64 `json:"swap"`
|
Swap uint64 `json:"swap"`
|
||||||
Devices map[DeviceBus]*Device `json:"devices"`
|
Devices map[DeviceBus]*Device `json:"devices"`
|
||||||
Instances map[InstanceID]*Instance `json:"instances"`
|
Instances map[InstanceID]*Instance `json:"instances"`
|
||||||
|
Proctypes []string `json:"cpus"`
|
||||||
pvenode *proxmox.Node
|
pvenode *proxmox.Node
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user