GetVirtualMachinesMetricID method throwing panic error when accessing VMs from reponse
- Lingua principale
- Go
- Stelle
- 39
- Fork
- 47
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
**Problem**: VirtualMachineService.GetVirtualMachinesMetricID method throws panic when it is trying to access the VMs response from server in below line of code. This happens when the count in the response is 1 but the actual VirtualMachinesMetrics array in the reponse is nil or empty. This is causing panic in the caller [CAPC](https://github.com/kubernetes-sigs/cluster-api-provider-cloudstack/blob/7b87895be9aa7d9dca1e2f70892feafd33ca4e59/pkg/cloud/instance.go#L61)
panic error is happening at: https://github.com/apache/cloudstack-go/blob/main/cloudstack/VirtualMachineService.go#L5543
**error**: `panic: runtime error: index out of range [0] with length 0`
version of cloudstack-go used: `2.16.1`
Please help investigate this error and let us know if this response is not expected
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Direzione di ricerca
Inspect cloudstack/VirtualMachineService.go at line 5543 and the caller in pkg/cloud/instance.go at line 61 of CAPC. Reproduce the response where count is 1 but VirtualMachinesMetrics is nil or empty, then establish the expected handling so the method no longer panics and the response behavior is documented or covered by a regression test.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- go
- Ambito
- api
- Tipo di issue
- Bug
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 45/100