Compare commits

...

2 Commits
3.4.1 ... 3.4.3

Author SHA1 Message Date
KasimBaybikov
f5e0a53364 3.4.3 2023-02-16 16:29:04 +03:00
stSolo
9d1c8eeaa7 3.4.2 2023-02-10 17:29:09 +03:00
19 changed files with 78 additions and 37 deletions

View File

@@ -1,8 +1,11 @@
### Version 3.4.1
### Version 3.4.3
### Features
- Add the affinity_label field into the kvmvm resource
- Add affinity_rules blocks into the kvmvm resource
- Add anti-affinity_rules blocks into the kvmvm resource
- Update samples for the kvmvm resource
- Change field type disksize from int to float in:
- resource decort_resgroup
- resource decort_account
- data source decort_rg
- data source decort_account
- data source decort_account_rg_list
- Models of the resources

View File

@@ -198,7 +198,7 @@ func dataSourceAccountSchemaMake() map[string]*schema.Schema {
Computed: true,
},
"disksize": {
Type: schema.TypeInt,
Type: schema.TypeFloat,
Computed: true,
},
"extips": {
@@ -254,7 +254,7 @@ func dataSourceAccountSchemaMake() map[string]*schema.Schema {
Computed: true,
},
"disksize": {
Type: schema.TypeInt,
Type: schema.TypeFloat,
Computed: true,
},
"extips": {

View File

@@ -74,12 +74,41 @@ func flattenAccRGComputes(argc AccountRGComputes) []map[string]interface{} {
return res
}
func flattenAccResourceHack(r ResourceHack) []map[string]interface{} {
res := make([]map[string]interface{}, 0)
temp := map[string]interface{}{
"cpu": r.CPU,
"disksize": r.Disksize,
"extips": r.Extips,
"exttraffic": r.Exttraffic,
"gpu": r.GPU,
"ram": r.RAM,
//"seps": flattenAccountSeps(r.SEPs),
}
res = append(res, temp)
return res
}
func flattenAccResourceRg(r Resource) []map[string]interface{} {
res := make([]map[string]interface{}, 0)
temp := map[string]interface{}{
"cpu": r.CPU,
"disksize": r.Disksize,
"extips": r.Extips,
"exttraffic": r.Exttraffic,
"gpu": r.GPU,
"ram": r.RAM,
}
res = append(res, temp)
return res
}
func flattenAccRGResources(argr AccountRGResources) []map[string]interface{} {
res := make([]map[string]interface{}, 0)
temp := map[string]interface{}{
"consumed": flattenAccResource(argr.Consumed),
"limits": flattenAccResource(argr.Limits),
"reserved": flattenAccResource(argr.Reserved),
"consumed": flattenAccResourceRg(argr.Consumed),
"limits": flattenAccResourceHack(argr.Limits),
"reserved": flattenAccResourceRg(argr.Reserved),
}
res = append(res, temp)
return res

View File

@@ -96,7 +96,7 @@ type ResourceSep struct {
type Resource struct {
CPU int `json:"cpu"`
Disksize int `json:"disksize"`
Disksize float64 `json:"disksize"`
Extips int `json:"extips"`
Exttraffic int `json:"exttraffic"`
GPU int `json:"gpu"`
@@ -201,10 +201,19 @@ type AccountRGComputes struct {
Stopped int `json:"Stopped"`
}
type ResourceHack struct {
CPU int `json:"cpu"`
Disksize float64 `json:"disksize"`
Extips int `json:"extips"`
Exttraffic int `json:"exttraffic"`
GPU int `json:"gpu"`
RAM int `json:"ram"`
}
type AccountRGResources struct {
Consumed Resource `json:"Consumed"`
Limits Resource `json:"Limits"`
Reserved Resource `json:"Reserved"`
Consumed Resource `json:"Consumed"`
Limits ResourceHack `json:"Limits"`
Reserved Resource `json:"Reserved"`
}
type AccountRG struct {

View File

@@ -574,7 +574,7 @@ func resourceAccountSchemaMake() map[string]*schema.Schema {
Computed: true,
},
"disksize": {
Type: schema.TypeInt,
Type: schema.TypeFloat,
Computed: true,
},
"extips": {
@@ -630,7 +630,7 @@ func resourceAccountSchemaMake() map[string]*schema.Schema {
Computed: true,
},
"disksize": {
Type: schema.TypeInt,
Type: schema.TypeFloat,
Computed: true,
},
"extips": {

View File

@@ -385,7 +385,7 @@ func dataSourceDiskSchemaMake() map[string]*schema.Schema {
Description: "Size in GB",
},
"size_used": {
Type: schema.TypeInt,
Type: schema.TypeFloat,
Computed: true,
Description: "Number of used space, in GB",
},

View File

@@ -481,7 +481,7 @@ func dataSourceDiskListSchemaMake() map[string]*schema.Schema {
Description: "Size in GB",
},
"size_used": {
Type: schema.TypeInt,
Type: schema.TypeFloat,
Computed: true,
Description: "Number of used space, in GB",
},

View File

@@ -415,7 +415,7 @@ func dataSourceDiskListUnattachedSchemaMake() map[string]*schema.Schema {
Description: "Size in GB",
},
"size_used": {
Type: schema.TypeInt,
Type: schema.TypeFloat,
Computed: true,
Description: "Number of used space, in GB",
},

View File

@@ -74,7 +74,7 @@ type Disk struct {
Shareable bool `json:"shareable"`
SepID int `json:"sepId"` // NOTE: absent from compute/get output
SizeMax int `json:"sizeMax"`
SizeUsed int `json:"sizeUsed"` // sum over all snapshots of this disk to report total consumed space
SizeUsed float64 `json:"sizeUsed"` // sum over all snapshots of this disk to report total consumed space
Snapshots []Snapshot `json:"snapshots"`
Status string `json:"status"`
TechStatus string `json:"techStatus"`
@@ -165,7 +165,7 @@ type Unattached struct {
Role string `json:"role"`
SepID int `json:"sepId"`
SizeMax int `json:"sizeMax"`
SizeUsed int `json:"sizeUsed"`
SizeUsed float64 `json:"sizeUsed"`
Snapshots []Snapshot `json:"snapshots"`
Status string `json:"status"`
TechStatus string `json:"techStatus"`

View File

@@ -661,7 +661,7 @@ func resourceDiskSchemaMake() map[string]*schema.Schema {
Description: "Type SEP. Defines the type of storage system and contains one of the values set in the cloud platform",
},
"size_used": {
Type: schema.TypeInt,
Type: schema.TypeFloat,
Computed: true,
Description: "Number of used space, in GB",
},

View File

@@ -386,7 +386,7 @@ func DataSourceCompute() *schema.Resource {
Computed: true,
},
"size_used": {
Type: schema.TypeInt,
Type: schema.TypeFloat,
Computed: true,
},
"pool": {

View File

@@ -74,7 +74,7 @@ type DiskRecord struct {
SepID int `json:"sepId"` // NOTE: absent from compute/get output
Shareable bool `json:"shareable"`
SizeMax int `json:"sizeMax"`
SizeUsed int `json:"sizeUsed"` // sum over all snapshots of this disk to report total consumed space
SizeUsed float64 `json:"sizeUsed"` // sum over all snapshots of this disk to report total consumed space
Snapshots []SnapshotRecord `json:"snapshots"`
Status string `json:"status"`
TechStatus string `json:"techStatus"`

View File

@@ -1005,7 +1005,7 @@ func ResourceComputeSchemaMake() map[string]*schema.Schema {
Computed: true,
},
"size_used": {
Type: schema.TypeInt,
Type: schema.TypeFloat,
Computed: true,
},
"pool": {

View File

@@ -137,12 +137,12 @@ type QuotaRecord struct { // this is how quota is reported by /api/.../rg/get
}
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 float64 `json:"disksize"`
ExtIPs int `json:"extips"`
ExtTraffic int `json:"exttraffic"`
Gpu int `json:"gpu"`
Ram int `json:"ram"`
}
type UsageRecord struct {
@@ -157,7 +157,7 @@ type ResourceSep struct {
type Resource struct {
CPU int `json:"cpu"`
Disksize int `json:"disksize"`
Disksize float64 `json:"disksize"`
Extips int `json:"extips"`
Exttraffic int `json:"exttraffic"`
GPU int `json:"gpu"`

View File

@@ -317,7 +317,7 @@ func dataSourceDiskSchemaMake() map[string]*schema.Schema {
Computed: true,
},
"size_used": {
Type: schema.TypeInt,
Type: schema.TypeFloat,
Computed: true,
},
"snapshots": {

View File

@@ -399,7 +399,7 @@ func dataSourceDiskListSchemaMake() map[string]*schema.Schema {
Computed: true,
},
"size_used": {
Type: schema.TypeInt,
Type: schema.TypeFloat,
Computed: true,
},
"snapshots": {

View File

@@ -72,7 +72,7 @@ type Disk struct {
SepType string `json:"sepType"`
SepID int `json:"sepId"` // NOTE: absent from compute/get output
SizeMax int `json:"sizeMax"`
SizeUsed int `json:"sizeUsed"` // sum over all snapshots of this disk to report total consumed space
SizeUsed float64 `json:"sizeUsed"` // sum over all snapshots of this disk to report total consumed space
Snapshots []Snapshot `json:"snapshots"`
Status string `json:"status"`
TechStatus string `json:"techStatus"`

View File

@@ -548,7 +548,7 @@ func resourceDiskSchemaMake() map[string]*schema.Schema {
Computed: true,
},
"size_used": {
Type: schema.TypeInt,
Type: schema.TypeFloat,
Computed: true,
},
"snapshots": {

View File

@@ -72,7 +72,7 @@ type DiskRecord struct {
SepType string `json:"sepType"`
SepID int `json:"sepId"` // NOTE: absent from compute/get output
SizeMax int `json:"sizeMax"`
SizeUsed int `json:"sizeUsed"` // sum over all snapshots of this disk to report total consumed space
SizeUsed float64 `json:"sizeUsed"` // sum over all snapshots of this disk to report total consumed space
Snapshots []SnapshotRecord `json:"snapshots"`
Status string `json:"status"`
TechStatus string `json:"techStatus"`