summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorIgor D.C <igor.duarte.cardoso@intel.com>2020-09-25 00:15:58 +0000
committerIgor D.C <igor.duarte.cardoso@intel.com>2020-09-28 22:38:41 +0000
commit4009ff23fa17910728c7985c89e65f4ac4ce3def (patch)
tree082cabd0333d0faf4398a55565ea4580156342c6 /src
parent2b971d6e7f234a5ff192c2a0415e4fde6f32f849 (diff)
Fix special characters issue in quotas in DCM
Before this patch, any resource quotas, say, with a dot (like limits.cpu), would not be stored properly in the database and thus unusable and ignored by DCM logical cloud apply operation. Issue-ID: MULTICLOUD-1143 Change-Id: I178e66756bc9bb2798427233d15196d0e2559a99 Signed-off-by: Igor D.C <igor.duarte.cardoso@intel.com>
Diffstat (limited to 'src')
-rw-r--r--src/dcm/pkg/module/apply.go6
-rw-r--r--src/dcm/pkg/module/quota.go6
2 files changed, 8 insertions, 4 deletions
diff --git a/src/dcm/pkg/module/apply.go b/src/dcm/pkg/module/apply.go
index dbcbf8ac..1bc68c5d 100644
--- a/src/dcm/pkg/module/apply.go
+++ b/src/dcm/pkg/module/apply.go
@@ -51,8 +51,10 @@ type MetaDatas struct {
type Specs struct {
Request string `yaml:"request,omitempty"`
Usages []string `yaml:"usages,omitempty"`
- //Hard logicalcloud.QSpec `yaml:"hard,omitempty"`
- Hard QSpec `yaml:"hard,omitempty"`
+ // TODO: validate quota keys
+ // //Hard logicalcloud.QSpec `yaml:"hard,omitempty"`
+ // Hard QSpec `yaml:"hard,omitempty"`
+ Hard map[string]string `yaml:"hard,omitempty"`
}
type RoleRules struct {
diff --git a/src/dcm/pkg/module/quota.go b/src/dcm/pkg/module/quota.go
index 8e15a794..c961fdfc 100644
--- a/src/dcm/pkg/module/quota.go
+++ b/src/dcm/pkg/module/quota.go
@@ -22,8 +22,9 @@ import (
// Quota contains the parameters needed for a Quota
type Quota struct {
- MetaData QMetaDataList `json:"metadata"`
- Specification QSpec `json:"spec"`
+ MetaData QMetaDataList `json:"metadata"`
+ // Specification QSpec `json:"spec"`
+ Specification map[string]string `json:"spec"`
}
// MetaData contains the parameters needed for metadata
@@ -32,6 +33,7 @@ type QMetaDataList struct {
Description string `json:"description"`
}
+// TODO: use QSpec fields to validate quota keys
// Spec contains the parameters needed for spec
type QSpec struct {
LimitsCPU string `json:"limits.cpu"`