4.11.0
This commit is contained in:
@@ -70,7 +70,6 @@ func flattenRgResourceLimits(rl rg.ResourceLimits) []map[string]interface{} {
|
||||
"cu_dm": rl.CUDM,
|
||||
"cu_i": rl.CUI,
|
||||
"cu_m": rl.CUM,
|
||||
"cu_np": rl.CUNP,
|
||||
"gpu_units": rl.GPUUnits,
|
||||
"storage_policy": flattenRgStoragePolicy(rl.StoragePolicies),
|
||||
}
|
||||
@@ -160,7 +159,6 @@ func flattenRgUsageResource(d *schema.ResourceData, usage rg.Reservation) {
|
||||
d.Set("disk_size", usage.DiskSize)
|
||||
d.Set("disk_size_max", usage.DiskSizeMax)
|
||||
d.Set("extips", usage.ExtIPs)
|
||||
d.Set("exttraffic", usage.ExtTraffic)
|
||||
d.Set("gpu", usage.GPU)
|
||||
d.Set("ram", usage.RAM)
|
||||
d.Set("seps", flattenRGSeps(usage.SEPs))
|
||||
@@ -173,7 +171,6 @@ func flattenResource(resource rg.Reservation) []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),
|
||||
|
||||
@@ -36,7 +36,6 @@ 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"`
|
||||
}
|
||||
|
||||
@@ -124,21 +123,19 @@ type UserAclRecord struct {
|
||||
}
|
||||
|
||||
type QuotaRecord struct { // this is how quota is reported by /api/.../rg/get
|
||||
Cpu float64 `json:"CU_C"` // CPU count in pcs
|
||||
Ram float64 `json:"CU_M"` // RAM volume in MB, it is STILL reported as FLOAT
|
||||
Disk float64 `json:"CU_D"` // Disk capacity in GB
|
||||
ExtIPs float64 `json:"CU_I"` // Ext IPs count
|
||||
ExtTraffic float64 `json:"CU_NP"` // Ext network traffic
|
||||
GpuUnits float64 `json:"gpu_units"` // GPU count
|
||||
Cpu float64 `json:"CU_C"` // CPU count in pcs
|
||||
Ram float64 `json:"CU_M"` // RAM volume in MB, it is STILL reported as FLOAT
|
||||
Disk float64 `json:"CU_D"` // Disk capacity in GB
|
||||
ExtIPs float64 `json:"CU_I"` // Ext IPs count
|
||||
GpuUnits float64 `json:"gpu_units"` // GPU count
|
||||
}
|
||||
|
||||
type ResourceRecord struct { // this is how actual usage is reported by /api/.../rg/get
|
||||
Cpu int `json:"cpu"`
|
||||
Disk int `json:"disksize"`
|
||||
ExtIPs int `json:"extips"`
|
||||
ExtTraffic int `json:"exttraffic"`
|
||||
Gpu int `json:"gpu"`
|
||||
Ram int `json:"ram"`
|
||||
Cpu int `json:"cpu"`
|
||||
Disk int `json:"disksize"`
|
||||
ExtIPs int `json:"extips"`
|
||||
Gpu int `json:"gpu"`
|
||||
Ram int `json:"ram"`
|
||||
}
|
||||
|
||||
type UsageRecord struct {
|
||||
|
||||
@@ -38,12 +38,11 @@ import (
|
||||
|
||||
func makeQuotaRecord(arg_list []interface{}) QuotaRecord {
|
||||
quota := QuotaRecord{
|
||||
Cpu: -1,
|
||||
Ram: -1., // this is float64, but may change in the future
|
||||
Disk: -1,
|
||||
ExtTraffic: -1,
|
||||
ExtIPs: -1,
|
||||
GpuUnits: -1,
|
||||
Cpu: -1,
|
||||
Ram: -1., // this is float64, but may change in the future
|
||||
Disk: -1,
|
||||
ExtIPs: -1,
|
||||
GpuUnits: -1,
|
||||
}
|
||||
subres_data := arg_list[0].(map[string]interface{})
|
||||
|
||||
@@ -59,10 +58,6 @@ func makeQuotaRecord(arg_list []interface{}) QuotaRecord {
|
||||
quota.Ram = subres_data["ram"].(float64)
|
||||
}
|
||||
|
||||
if subres_data["ext_traffic"].(int) > 0 {
|
||||
quota.ExtTraffic = subres_data["ext_traffic"].(float64)
|
||||
}
|
||||
|
||||
if subres_data["ext_ips"].(int) > 0 {
|
||||
quota.ExtIPs = subres_data["ext_ips"].(float64)
|
||||
}
|
||||
@@ -80,7 +75,6 @@ func parseQuota(quota rg.ResourceLimits) []interface{} {
|
||||
quota_map["cpu"] = quota.CUC
|
||||
quota_map["ram"] = quota.CUM
|
||||
quota_map["disk"] = quota.CuD
|
||||
quota_map["ext_traffic"] = quota.CUNP
|
||||
quota_map["ext_ips"] = quota.CUI
|
||||
quota_map["gpu_units"] = quota.GPUUnits
|
||||
|
||||
|
||||
@@ -99,14 +99,6 @@ func resourceResgroupCreate(ctx context.Context, d *schema.ResourceData, m inter
|
||||
req.MaxNumPublicIP = maxNumPublicIP
|
||||
}
|
||||
}
|
||||
if resLimitsConv["cu_np"] != nil {
|
||||
maxNP := int64(resLimitsConv["cu_np"].(float64))
|
||||
if maxNP == 0 {
|
||||
req.MaxNetworkPeerTransfer = -1
|
||||
} else {
|
||||
req.MaxNetworkPeerTransfer = maxNP
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if owner, ok := d.GetOk("owner"); ok {
|
||||
@@ -423,14 +415,6 @@ func resourceResgroupUpdate(ctx context.Context, d *schema.ResourceData, m inter
|
||||
req.MaxNumPublicIP = maxNumPublicIP
|
||||
}
|
||||
}
|
||||
if resLimitsConv["cu_np"] != nil {
|
||||
maxNP := int64(resLimitsConv["cu_np"].(float64))
|
||||
if maxNP == 0 {
|
||||
req.MaxNetworkPeerTransfer = -1
|
||||
} else {
|
||||
req.MaxNetworkPeerTransfer = maxNP
|
||||
}
|
||||
}
|
||||
|
||||
doGeneralUpdate = true
|
||||
}
|
||||
|
||||
@@ -144,10 +144,6 @@ func dataSourceRgSchemaMake() map[string]*schema.Schema {
|
||||
Type: schema.TypeFloat,
|
||||
Computed: true,
|
||||
},
|
||||
"cu_np": {
|
||||
Type: schema.TypeFloat,
|
||||
Computed: true,
|
||||
},
|
||||
"gpu_units": {
|
||||
Type: schema.TypeFloat,
|
||||
Computed: true,
|
||||
@@ -435,10 +431,6 @@ func dataSourceRGResourceConsumptionGetSchemaMake() map[string]*schema.Schema {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
"exttraffic": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
"gpu": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
@@ -495,10 +487,6 @@ func dataSourceRGResourceConsumptionGetSchemaMake() map[string]*schema.Schema {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
"exttraffic": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
"gpu": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
@@ -559,10 +547,6 @@ func dataSourceRGResourceConsumptionGetSchemaMake() map[string]*schema.Schema {
|
||||
Type: schema.TypeFloat,
|
||||
Computed: true,
|
||||
},
|
||||
"cu_np": {
|
||||
Type: schema.TypeFloat,
|
||||
Computed: true,
|
||||
},
|
||||
"gpu_units": {
|
||||
Type: schema.TypeFloat,
|
||||
Computed: true,
|
||||
@@ -607,10 +591,6 @@ func dataSourceRGResourceConsumptionListSchemaMake() map[string]*schema.Schema {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
"exttraffic": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
"gpu": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
@@ -667,10 +647,6 @@ func dataSourceRGResourceConsumptionListSchemaMake() map[string]*schema.Schema {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
"exttraffic": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
"gpu": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
@@ -731,10 +707,6 @@ func dataSourceRGResourceConsumptionListSchemaMake() map[string]*schema.Schema {
|
||||
Type: schema.TypeFloat,
|
||||
Computed: true,
|
||||
},
|
||||
"cu_np": {
|
||||
Type: schema.TypeFloat,
|
||||
Computed: true,
|
||||
},
|
||||
"gpu_units": {
|
||||
Type: schema.TypeFloat,
|
||||
Computed: true,
|
||||
@@ -776,10 +748,6 @@ func dataSourceRgUsageSchemaMake() map[string]*schema.Schema {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
"exttraffic": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
"gpu": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
@@ -1669,10 +1637,6 @@ func dataSourceRgListDeletedSchemaMake() map[string]*schema.Schema {
|
||||
Type: schema.TypeFloat,
|
||||
Computed: true,
|
||||
},
|
||||
"cu_np": {
|
||||
Type: schema.TypeFloat,
|
||||
Computed: true,
|
||||
},
|
||||
"gpu_units": {
|
||||
Type: schema.TypeFloat,
|
||||
Computed: true,
|
||||
@@ -1967,10 +1931,6 @@ func dataSourceRgListSchemaMake() map[string]*schema.Schema {
|
||||
Type: schema.TypeFloat,
|
||||
Computed: true,
|
||||
},
|
||||
"cu_np": {
|
||||
Type: schema.TypeFloat,
|
||||
Computed: true,
|
||||
},
|
||||
"gpu_units": {
|
||||
Type: schema.TypeFloat,
|
||||
Computed: true,
|
||||
@@ -2309,12 +2269,6 @@ func resourceRgSchemaMake() map[string]*schema.Schema {
|
||||
Computed: true,
|
||||
Description: "MaxMemoryCapacity",
|
||||
},
|
||||
"cu_np": {
|
||||
Type: schema.TypeFloat,
|
||||
Optional: true,
|
||||
Computed: true,
|
||||
Description: "MaxNetworkPeerTransfer",
|
||||
},
|
||||
"gpu_units": {
|
||||
Type: schema.TypeFloat,
|
||||
Computed: true,
|
||||
|
||||
Reference in New Issue
Block a user