Fix state mgmt issues for compute and add Import support for RG

This commit is contained in:
Sergey Shubin svs1370
2021-04-28 20:42:28 +03:00
parent 3aefa580dc
commit 7f6d11dfd5
11 changed files with 106 additions and 54 deletions

View File

@@ -31,7 +31,7 @@ import (
func makeQuotaRecord(arg_list []interface{}) (QuotaRecord, int) {
quota := QuotaRecord{
Cpu: -1,
Ram: -1., // this is float32, but may change in the future
Ram: -1., // this is float64, but may change in the future
Disk: -1,
ExtTraffic: -1,
ExtIPs: -1,
@@ -47,8 +47,8 @@ func makeQuotaRecord(arg_list []interface{}) (QuotaRecord, int) {
quota.Disk = subres_data["disk"].(int) // Disk capacity ib GB
}
if subres_data["ram"].(int) > 0 {
quota.Ram = subres_data["ram"].(float32) // RAM volume in MB, as float32!
if subres_data["ram"].(float64) > 0 {
quota.Ram = subres_data["ram"].(float64) // RAM volume in MB, as float64!
}
if subres_data["ext_traffic"].(int) > 0 {
@@ -70,7 +70,7 @@ func parseQuota(quota QuotaRecord) []interface{} {
quota_map := make(map[string]interface{})
quota_map["cpu"] = quota.Cpu
quota_map["ram"] = quota.Ram // NB: this is float32, unlike the rest of values
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