Skip to content

bug(api): createCounter/deleteCounter functions not working properly #10043

Open
@chrxmvtik

Description

@chrxmvtik
ISSUE TYPE
  • Bug Report
COMPONENT NAME
API
CLOUDSTACK VERSION
4.19.1.3, 4.20.0.0
CONFIGURATION

Basic

OS / ENVIRONMENT

Cloudstack Simulator

SUMMARY
STEPS TO REPRODUCE

Using CMK for API

listCounters result:
    [{
      "id": "1a57158d-acce-11ef-ae80-0242ac110002",
      "name": "Linux System CPU - percentage",
      "provider": "Netscaler",
      "source": "SNMP",
      "value": "1.3.6.1.4.1.2021.11.10.0"
    }]

Delete counter:

deleteCounter id=1a57158d-acce-11ef-ae80-0242ac110002

result:
{
  "success": true
}

Create a counter with the same configuration:

createCounter name="Linux System CPU - percentage" provider="Netscaler" source="SNMP" value="1.3.6.1.4.1.2021.11.10.0"
🙈 Error: (HTTP 530, error code 9999) Entity already exists

Create a counter using different value:

createCounter name="Linux System CPU - percentage" provider="Netscaler" source="SNMP" value="1.3.6.1.4.1.2021.11.12.0"
panic: interface conversion: interface {} is nil, not map[string]interface {}

goroutine 1 [running]:
github.com/apache/cloudstack-cloudmonkey/cmd.pollAsyncJob(0x140013a6780, {0x1400001c270, 0x24})
	/Users/rohit/lab/apache/cloudstack-cloudmonkey/cmd/network.go:171 +0x500
github.com/apache/cloudstack-cloudmonkey/cmd.NewAPIRequest(0x140013a6780, {0x14000fc77f0, 0xd}, {0x140013c0210, 0x4, 0x0?}, 0x1)
	/Users/rohit/lab/apache/cloudstack-cloudmonkey/cmd/network.go:272 +0x1100
github.com/apache/cloudstack-cloudmonkey/cmd.init.0.func1(0x140013a6780)
	/Users/rohit/lab/apache/cloudstack-cloudmonkey/cmd/api.go:80 +0x488
github.com/apache/cloudstack-cloudmonkey/cli.ExecCmd({0x140013c0200?, 0x5, 0x8})
	/Users/rohit/lab/apache/cloudstack-cloudmonkey/cli/exec.go:67 +0x238
github.com/apache/cloudstack-cloudmonkey/cli.ExecLine({0x14001802e80, 0x76})
	/Users/rohit/lab/apache/cloudstack-cloudmonkey/cli/exec.go:51 +0x1ec
github.com/apache/cloudstack-cloudmonkey/cli.ExecPrompt()
	/Users/rohit/lab/apache/cloudstack-cloudmonkey/cli/prompt.go:84 +0x260
main.main()
	/Users/rohit/lab/apache/cloudstack-cloudmonkey/cmk.go:101 +0x6a4

createCounter function causes this error, however in v4.20.0.0 it creates a counter even tho it errored, however in v4.19.1.3 it doesn't create a counter.

EXPECTED RESULTS
createCounter function works properly

deleteCounter function removes counter and allow us to create a counter with the same value
ACTUAL RESULTS
Function causes an error, unable to create/delete a counter properly.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    In Review

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions