This commit is contained in:
2025-02-07 11:30:15 +03:00
parent dc39a6412e
commit 5496073a0c
334 changed files with 33784 additions and 272 deletions

View File

@@ -46,12 +46,14 @@ func flattenNode(d *schema.ResourceData, item *node.RecordNode) {
d.Set("consumption", flattenConsumption(item.Consumption))
d.Set("cpu_info", flattenCpuInfo(item.CpuInfo))
d.Set("cpu_allocation_ratio", item.CPUAllocationRatio)
d.Set("dpdk", flattenDPDKItem(item.DPDK))
d.Set("gid", item.GID)
d.Set("ipaddr", item.IPAddr)
d.Set("isolated_cpus", flattenNodeItem(item.IsolatedCpus))
d.Set("name", item.Name)
d.Set("need_reboot", item.NeedReboot)
d.Set("net_addr", flattenGetNetAddr(item.NetAddr))
d.Set("network_mode", item.NetworkMode)
d.Set("nic_info", flattenNicInfo(item.NicInfo))
d.Set("numa_topology", flattenNumaTopology(item.NumaTopology))
d.Set("reserved_cpus", flattenNodeItem(item.ReservedCPUs))
@@ -59,6 +61,10 @@ func flattenNode(d *schema.ResourceData, item *node.RecordNode) {
d.Set("sriov_enabled", item.SriovEnabled)
d.Set("stack_id", item.StackID)
d.Set("status", item.Status)
d.Set("to_active", flattenRole(item.ToActive))
d.Set("to_installing", flattenRole(item.ToInstalling))
d.Set("to_maintenance", flattenRole(item.ToMaintenance))
d.Set("to_restricted", flattenRole(item.ToRestricted))
d.Set("version", item.Version)
}
@@ -107,44 +113,46 @@ func flattenNodeList(nodes *node.ListNodes) []map[string]interface{} {
res := make([]map[string]interface{}, 0, len(nodes.Data))
for _, item := range nodes.Data {
temp := map[string]interface{}{
"additional_pkgs": flattenNodeItem(item.AdditionalPkgs),
"cpu_info": flattenCpuInfo(item.CpuInfo),
"description": item.Description,
"gid": item.GID,
"guid": item.GUID,
"hostkey": item.HostKey,
"node_id": item.ID,
"ipaddr": item.IPAddr,
"isolated_cpus": flattenNodeItem(item.IsolatedCpus),
"lastcheck": item.LastCheck,
"machine_guid": item.MachineGUID,
"mainboard_sn": item.MainboardSN,
"memory": item.Memory,
"milestones": item.Milestones,
"model": item.Model,
"name": item.Name,
"need_reboot": item.NeedReboot,
"net_addr": flattenNetAddr(item.NetAddr),
"network_mode": item.NetworkMode,
"nic_info": flattenNicInfo(item.NicInfo),
"node_uuid": item.NodeUUID,
"numa_topology": flattenNumaTopology(item.NumaTopology),
"peer_backup": item.PeerBackup,
"peer_log": item.PeerLog,
"peer_stats": item.PeerStats,
"pgpus": item.Pgpus,
"public_keys": item.PublicKeys,
"release": item.Release,
"reserved_cpus": flattenNodeItem(item.ReservedCPUs),
"roles": item.Roles,
"seps": item.Seps,
"serial_num": item.SerialNum,
"sriov_enabled": item.SriovEnabled,
"stack_id": item.StackID,
"status": item.Status,
"tags": item.Tags,
"type": item.Type,
"version": item.Version,
"additional_pkgs": flattenNodeItem(item.AdditionalPkgs),
"cpu_info": flattenCpuInfo(item.CpuInfo),
"description": item.Description,
"dpdk": flattenDPDKItem(item.DPDK),
"gid": item.GID,
"guid": item.GUID,
"hostkey": item.HostKey,
"node_id": item.ID,
"ipaddr": item.IPAddr,
"isolated_cpus": flattenNodeItem(item.IsolatedCpus),
"lastcheck": item.LastCheck,
"machine_guid": item.MachineGUID,
"mainboard_sn": item.MainboardSN,
"memory": item.Memory,
"milestones": item.Milestones,
"model": item.Model,
"name": item.Name,
"need_reboot": item.NeedReboot,
"net_addr": flattenNetAddr(item.NetAddr),
"network_mode": item.NetworkMode,
"nic_info": flattenNicInfo(item.NicInfo),
"node_uuid": item.NodeUUID,
"numa_topology": flattenNumaTopology(item.NumaTopology),
"peer_backup": item.PeerBackup,
"peer_log": item.PeerLog,
"peer_stats": item.PeerStats,
"pgpus": item.Pgpus,
"public_keys": item.PublicKeys,
"release": item.Release,
"reserved_cpus": flattenNodeItem(item.ReservedCPUs),
"roles": item.Roles,
"seps": item.Seps,
"serial_num": item.SerialNum,
"sriov_enabled": item.SriovEnabled,
"stack_id": item.StackID,
"status": item.Status,
"tags": item.Tags,
"type": item.Type,
"uefi_firmware_file": item.UEFIFirmwareFile,
"version": item.Version,
}
res = append(res, temp)
}
@@ -261,3 +269,36 @@ func flattenNodeItem(m []interface{}) []string {
}
return output
}
func flattenDPDKItem(dpdk node.DPDK) []map[string]interface{} {
res := make([]map[string]interface{}, 1)
bridges := make([]map[string]interface{}, 1)
backplane := make([]map[string]interface{}, 1)
backplane[0] = map[string]interface{}{
"interfaces": dpdk.Bridges.Backplane1.Interfaces,
"numa_node": dpdk.Bridges.Backplane1.NumaNode,
}
bridges[0] = map[string]interface{}{
"backplane1": backplane,
}
res[0] = map[string]interface{}{
"bridges": bridges,
"hp_memory": dpdk.HPMemory,
"pmd_cpu": dpdk.PMDCPU,
}
return res
}
func flattenRole(role node.Role) []map[string]interface{} {
res := make([]map[string]interface{}, 1)
temp := map[string]interface{}{
"actor": role.Actor,
"reason": role.Reason,
"time": role.Time,
}
res[0] = temp
return res
}

View File

@@ -105,6 +105,55 @@ func dataSourceNodeSchemaMake() map[string]*schema.Schema {
Type: schema.TypeInt,
Computed: true,
},
"dpdk": {
Type: schema.TypeList,
Computed: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"bridges": {
Type: schema.TypeList,
Computed: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"backplane1": {
Type: schema.TypeList,
Computed: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"interfaces": {
Type: schema.TypeList,
Computed: true,
Elem: &schema.Schema{
Type: schema.TypeString,
},
},
"numa_node": {
Type: schema.TypeInt,
Computed: true,
},
},
},
},
},
},
},
"hp_memory": {
Type: schema.TypeMap,
Computed: true,
Elem: &schema.Schema{
Type: schema.TypeInt,
},
},
"pmd_cpu": {
Type: schema.TypeList,
Computed: true,
Elem: &schema.Schema{
Type: schema.TypeInt,
},
},
},
},
},
"gid": {
Type: schema.TypeInt,
Computed: true,
@@ -150,6 +199,10 @@ func dataSourceNodeSchemaMake() map[string]*schema.Schema {
},
},
},
"network_mode": {
Type: schema.TypeString,
Computed: true,
},
"nic_info": {
Type: schema.TypeList,
Computed: true,
@@ -272,6 +325,86 @@ func dataSourceNodeSchemaMake() map[string]*schema.Schema {
Type: schema.TypeString,
Computed: true,
},
"to_active": {
Type: schema.TypeList,
Computed: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"actor": {
Type: schema.TypeString,
Computed: true,
},
"reason": {
Type: schema.TypeString,
Computed: true,
},
"time": {
Type: schema.TypeInt,
Computed: true,
},
},
},
},
"to_installing": {
Type: schema.TypeList,
Computed: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"actor": {
Type: schema.TypeString,
Computed: true,
},
"reason": {
Type: schema.TypeString,
Computed: true,
},
"time": {
Type: schema.TypeInt,
Computed: true,
},
},
},
},
"to_maintenance": {
Type: schema.TypeList,
Computed: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"actor": {
Type: schema.TypeString,
Computed: true,
},
"reason": {
Type: schema.TypeString,
Computed: true,
},
"time": {
Type: schema.TypeInt,
Computed: true,
},
},
},
},
"to_restricted": {
Type: schema.TypeList,
Computed: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"actor": {
Type: schema.TypeString,
Computed: true,
},
"reason": {
Type: schema.TypeString,
Computed: true,
},
"time": {
Type: schema.TypeInt,
Computed: true,
},
},
},
},
"version": {
Type: schema.TypeString,
Computed: true,
@@ -368,6 +501,55 @@ func dataSourceNodeListSchemaMake() map[string]*schema.Schema {
Type: schema.TypeString,
Computed: true,
},
"dpdk": {
Type: schema.TypeList,
Computed: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"bridges": {
Type: schema.TypeList,
Computed: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"backplane1": {
Type: schema.TypeList,
Computed: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"interfaces": {
Type: schema.TypeList,
Computed: true,
Elem: &schema.Schema{
Type: schema.TypeString,
},
},
"numa_node": {
Type: schema.TypeInt,
Computed: true,
},
},
},
},
},
},
},
"hp_memory": {
Type: schema.TypeMap,
Computed: true,
Elem: &schema.Schema{
Type: schema.TypeInt,
},
},
"pmd_cpu": {
Type: schema.TypeList,
Computed: true,
Elem: &schema.Schema{
Type: schema.TypeInt,
},
},
},
},
},
"gid": {
Type: schema.TypeInt,
Computed: true,
@@ -650,6 +832,10 @@ func dataSourceNodeListSchemaMake() map[string]*schema.Schema {
Type: schema.TypeString,
Computed: true,
},
"uefi_firmware_file": {
Type: schema.TypeString,
Computed: true,
},
"version": {
Type: schema.TypeString,
Computed: true,