Skip to content

Commit 358fe85

Browse files
Fix VM Usage history response
2 parents 1b6b293 + 4428802 commit 358fe85

File tree

4 files changed

+68
-4
lines changed

4 files changed

+68
-4
lines changed

cloudstack/BackupService.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -922,8 +922,7 @@ func (p *CreateVMFromBackupParams) toURLValues() url.Values {
922922
if v, found := p.p["userdatadetails"]; found {
923923
m := v.(map[string]string)
924924
for i, k := range getSortedKeysFromMap(m) {
925-
u.Set(fmt.Sprintf("userdatadetails[%d].key", i), k)
926-
u.Set(fmt.Sprintf("userdatadetails[%d].value", i), m[k])
925+
u.Set(fmt.Sprintf("userdatadetails[%d].%s", i, k), m[k])
927926
}
928927
}
929928
if v, found := p.p["userdataid"]; found {

cloudstack/VirtualMachineService.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11450,7 +11450,7 @@ func (s *VirtualMachineService) ListVirtualMachinesUsageHistory(p *ListVirtualMa
1145011450

1145111451
type ListVirtualMachinesUsageHistoryResponse struct {
1145211452
Count int `json:"count"`
11453-
VirtualMachinesUsageHistory []*VirtualMachinesUsageHistory `json:"virtualmachinesusagehistory"`
11453+
VirtualMachinesUsageHistory []*VirtualMachinesUsageHistory `json:"virtualmachine"`
1145411454
}
1145511455

1145611456
type VirtualMachinesUsageHistory struct {

generate/generate.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2076,6 +2076,9 @@ func (s *service) generateResponseType(a *API) {
20762076
case "listSecondaryStorageSelectors":
20772077
pn(" Count int `json:\"count\"`")
20782078
pn(" %s []*%s `json:\"%s\"`", ln, parseSingular(ln), "heuristics")
2079+
case "listVirtualMachinesUsageHistory":
2080+
pn(" Count int `json:\"count\"`")
2081+
pn(" VirtualMachinesUsageHistory []*VirtualMachinesUsageHistory `json:\"virtualmachine\"`")
20792082
case "listHostHAResources":
20802083
pn(" Count int `json:\"count\"`")
20812084
pn(" %s []*%s `json:\"%s\"`", ln, parseSingular(ln), "hostha")

test/testdata/VirtualMachineService.json

Lines changed: 63 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -505,5 +505,67 @@
505505
"completed": "2021-10-13T04:54:56+0000",
506506
"jobid": "f9a9af61-47ea-4fb7-acc9-93ea50f12042"
507507
}
508+
},
509+
"listVirtualMachinesUsageHistory": {
510+
"listvirtualmachinesusagehistoryresponse": {
511+
"count": 1,
512+
"virtualmachine": [
513+
{
514+
"id": "4f6d7879-8e9d-40cb-9390-28924a31df78",
515+
"name": "i-5-39-VM",
516+
"displayname": "ubuntu-01",
517+
"stats": [
518+
{
519+
"timestamp": "2024-12-31T17:54:37+0600",
520+
"cpuused": "55.56%",
521+
"diskioread": 0,
522+
"diskiowrite": 0,
523+
"diskiopstotal": 0,
524+
"diskkbsread": 0,
525+
"diskkbswrite": 0,
526+
"memoryintfreekbs": 182168,
527+
"memorykbs": 1048576,
528+
"memorytargetkbs": 1048576,
529+
"networkkbsread": 0,
530+
"networkkbswrite": 0,
531+
"networkread": "0.00 MiB",
532+
"networkwrite": "0.00 MiB"
533+
},
534+
{
535+
"timestamp": "2024-12-31T17:54:37+0600",
536+
"cpuused": "0.2%",
537+
"diskioread": 0,
538+
"diskiowrite": 0,
539+
"diskiopstotal": 0,
540+
"diskkbsread": 0,
541+
"diskkbswrite": 0,
542+
"memoryintfreekbs": 182168,
543+
"memorykbs": 1048576,
544+
"memorytargetkbs": 1048576,
545+
"networkkbsread": 0,
546+
"networkkbswrite": 0,
547+
"networkread": "0.00 MiB",
548+
"networkwrite": "0.00 MiB"
549+
},
550+
{
551+
"timestamp": "2024-12-31T17:54:37+0600",
552+
"cpuused": "11.43%",
553+
"diskioread": 0,
554+
"diskiowrite": 0,
555+
"diskiopstotal": 0,
556+
"diskkbsread": 0,
557+
"diskkbswrite": 0,
558+
"memoryintfreekbs": 182168,
559+
"memorykbs": 1048576,
560+
"memorytargetkbs": 1048576,
561+
"networkkbsread": 0,
562+
"networkkbswrite": 0,
563+
"networkread": "0.00 MiB",
564+
"networkwrite": "0.00 MiB"
565+
}
566+
]
567+
}
568+
]
569+
}
508570
}
509-
}
571+
}

0 commit comments

Comments
 (0)