This commit is contained in:
2026-02-11 13:02:14 +03:00
parent 069d63a65c
commit b8283ebfaf
277 changed files with 2184 additions and 4192 deletions

View File

@@ -114,10 +114,6 @@ func DataSourceResgroup() *schema.Resource {
// Type: schema.TypeInt,
// Computed: true,
// },
// "exttraffic": {
// Type: schema.TypeInt,
// Computed: true,
// },
// "gpu": {
// Type: schema.TypeInt,
// Computed: true,
@@ -169,10 +165,6 @@ func DataSourceResgroup() *schema.Resource {
// Type: schema.TypeInt,
// Computed: true,
// },
// "exttraffic": {
// Type: schema.TypeInt,
// Computed: true,
// },
// "gpu": {
// Type: schema.TypeInt,
// Computed: true,
@@ -261,10 +253,6 @@ func resourceLimitsSchemaMake() map[string]*schema.Schema {
Type: schema.TypeFloat,
Computed: true,
},
"cu_np": {
Type: schema.TypeFloat,
Computed: true,
},
"gpu_units": {
Type: schema.TypeFloat,
Computed: true,

View File

@@ -138,10 +138,6 @@ func dataSourceRGResourceSchemaMake() map[string]*schema.Schema {
Type: schema.TypeInt,
Computed: true,
},
"exttraffic": {
Type: schema.TypeInt,
Computed: true,
},
"gpu": {
Type: schema.TypeInt,
Computed: true,
@@ -183,10 +179,6 @@ func dataSourceResourceLimitsSchemaMake() map[string]*schema.Schema {
Type: schema.TypeFloat,
Computed: true,
},
"cu_np": {
Type: schema.TypeFloat,
Computed: true,
},
"gpu_units": {
Type: schema.TypeFloat,
Computed: true,

View File

@@ -76,10 +76,6 @@ func dataSourceRgUsageSchemaMake() map[string]*schema.Schema {
Type: schema.TypeInt,
Computed: true,
},
"exttraffic": {
Type: schema.TypeInt,
Computed: true,
},
"gpu": {
Type: schema.TypeInt,
Computed: true,

View File

@@ -63,7 +63,6 @@ func flattenRGSeps(seps map[string]map[string]rg.DiskUsage) []map[string]interfa
// "cpu": r.CPU,
// "disksize": r.DiskSize,
// "extips": r.ExtIPs,
// "exttraffic": r.ExtTraffic,
// "gpu": r.GPU,
// "ram": r.RAM,
// "seps": flattenRgSeps(r.SEPs),
@@ -143,13 +142,12 @@ func flattenRgSeps(seps map[string]map[string]rg.DiskUsage) []map[string]interfa
func flattenQuota(resource rg.ResourceLimits) []map[string]interface{} {
res := make([]map[string]interface{}, 0)
temp := map[string]interface{}{
"cpu": resource.CUC,
"ram": resource.CUM,
"disk": resource.CUDM,
"ext_ips": resource.CUI,
"ext_traffic": resource.CUNP,
"gpu_units": resource.GPUUnits,
"cu_d": resource.CUD,
"cpu": resource.CUC,
"ram": resource.CUM,
"disk": resource.CUDM,
"ext_ips": resource.CUI,
"gpu_units": resource.GPUUnits,
"cu_d": resource.CUD,
}
res = append(res, temp)
@@ -164,7 +162,6 @@ func flattenResource(resource rg.Resource) []map[string]interface{} {
"disk_size": resource.DiskSize,
"disk_size_max": resource.DiskSizeMax,
"extips": resource.ExtIPs,
"exttraffic": resource.ExtTraffic,
"gpu": resource.GPU,
"ram": resource.RAM,
"seps": flattenRGSeps(resource.SEPs),
@@ -292,7 +289,6 @@ func flattenRgResourceLimits(rl rg.ResourceLimits) []map[string]interface{} {
"cu_i": rl.CUI,
"cu_m": rl.CUM,
"cu_dm": rl.CUDM,
"cu_np": rl.CUNP,
"gpu_units": rl.GPUUnits,
"storage_policy": flattenRgStoragePolicy(rl.StoragePolicies),
}
@@ -609,7 +605,6 @@ func flattenRgUsageResource(d *schema.ResourceData, usage rg.RecordResourceUsage
d.Set("disk_size", usage.DiskSize)
d.Set("disk_size_max", usage.DiskSizeMax)
d.Set("extips", usage.ExtIPs)
d.Set("exttraffic", usage.ExtraTraffic)
d.Set("gpu", usage.GPU)
d.Set("ram", usage.RAM)
d.Set("seps", flattenRgSeps(usage.SEPs))

View File

@@ -37,17 +37,15 @@ type ResourceLimits struct {
CUD float64 `json:"CU_D"`
CUI float64 `json:"CU_I"`
CUM float64 `json:"CU_M"`
CUNP float64 `json:"CU_NP"`
GpuUnits float64 `json:"gpu_units"`
}
type QuotaRecord struct { // this is how quota is reported by /api/.../rg/get
Cpu int `json:"CU_C"` // CPU count in pcs
Ram int `json:"CU_M"` // RAM volume in MB
Disk int `json:"CU_D"` // Disk capacity in GB
ExtIPs int `json:"CU_I"` // Ext IPs count
ExtTraffic int `json:"CU_NP"` // Ext network traffic
GpuUnits int `json:"gpu_units"` // GPU count
Cpu int `json:"CU_C"` // CPU count in pcs
Ram int `json:"CU_M"` // RAM volume in MB
Disk int `json:"CU_D"` // Disk capacity in GB
ExtIPs int `json:"CU_I"` // Ext IPs count
GpuUnits int `json:"gpu_units"` // GPU count
}
// Main information about audit
@@ -85,9 +83,6 @@ type Resource struct {
// Number of External IPs
ExtIPs int64 `json:"extips"`
// External traffic
ExtTraffic int64 `json:"exttraffic"`
// Number of grafic cores
GPU int64 `json:"gpu"`

View File

@@ -34,12 +34,11 @@ package rg
func makeQuotaRecord(arg_list []interface{}) QuotaRecord {
quota := QuotaRecord{
Cpu: -1,
Ram: -1,
Disk: -1,
ExtTraffic: -1,
ExtIPs: -1,
GpuUnits: -1,
Cpu: -1,
Ram: -1,
Disk: -1,
ExtIPs: -1,
GpuUnits: -1,
}
if len(arg_list) != 0 {
subres_data := arg_list[0].(map[string]interface{})
@@ -56,10 +55,6 @@ func makeQuotaRecord(arg_list []interface{}) QuotaRecord {
quota.Ram = subres_data["ram"].(int) // RAM volume in MB
}
if subres_data["ext_traffic"].(int) > 0 {
quota.ExtTraffic = subres_data["ext_traffic"].(int)
}
if subres_data["ext_ips"].(int) > 0 {
quota.ExtIPs = subres_data["ext_ips"].(int)
}
@@ -77,7 +72,6 @@ func makeQuotaRecord(arg_list []interface{}) QuotaRecord {
// quota_map["cpu"] = quota.Cpu
// quota_map["ram"] = quota.Ram // NB: this is float64, unlike the rest of values
// quota_map["disk"] = quota.Disk
// quota_map["ext_traffic"] = quota.ExtTraffic
// quota_map["ext_ips"] = quota.ExtIPs
// quota_map["gpu_units"] = quota.GpuUnits

View File

@@ -127,14 +127,6 @@ func resourceResgroupCreate(ctx context.Context, d *schema.ResourceData, m inter
req.MaxNumPublicIP = maxNumPublicIP
}
}
if quotaMap["ext_traffic"] != nil {
maxNP := int64(quotaMap["ext_traffic"].(int))
if maxNP == 0 {
req.MaxNetworkPeerTransfer = -1
} else {
req.MaxNetworkPeerTransfer = maxNP
}
}
}
if defNetType, ok := d.GetOk("def_net_type"); ok {
req.DefNet = defNetType.(string) // NOTE: in API default network type is set by "def_net" parameter
@@ -640,12 +632,6 @@ func ResourceRgSchemaMake() map[string]*schema.Schema {
Computed: true,
Description: "Limit on the total volume of virtual storage resources in this resource group, specified in GB.",
},
"ext_traffic": {
Type: schema.TypeInt,
Optional: true,
Computed: true,
Description: "Limit on the total ingress network traffic for this resource group, specified in GB.",
},
"ext_ips": {
Type: schema.TypeInt,
Optional: true,
@@ -913,10 +899,6 @@ func ResourceRgSchemaMake() map[string]*schema.Schema {
Type: schema.TypeFloat,
Computed: true,
},
"cu_np": {
Type: schema.TypeFloat,
Computed: true,
},
"gpu_units": {
Type: schema.TypeFloat,
Computed: true,

View File

@@ -11,12 +11,11 @@ func resourceRGStateUpgradeV1(ctx context.Context, rawState map[string]interface
quota, ok := rawState["quota"]
if !ok || quota == nil {
rawState["quota"] = QuotaRecord{
Cpu: -1,
Ram: -1,
Disk: -1,
ExtTraffic: -1,
ExtIPs: -1,
GpuUnits: -1,
Cpu: -1,
Ram: -1,
Disk: -1,
ExtIPs: -1,
GpuUnits: -1,
}
return rawState, nil
}

View File

@@ -113,14 +113,6 @@ func utilityUpdateRG(ctx context.Context, d *schema.ResourceData, m interface{},
req.MaxNumPublicIP = maxNumPublicIP
}
}
if resLimitsConv["ext_traffic"] != nil {
maxNP := int64(resLimitsConv["ext_traffic"].(int))
if maxNP == 0 {
req.MaxNetworkPeerTransfer = -1
} else {
req.MaxNetworkPeerTransfer = maxNP
}
}
}
}