GetVirtualMachinesMetricID method throwing panic error when accessing VMs from reponse
- Linguagem predominante
- Go
- Estrelas
- 39
- Forks
- 47
- Métricas de merge de PRs
- Nenhum PR com merge em 30d
Descrição
**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
Guia de contribuição
Nenhum guia de contribuição indexado para este repositório
Direção de pesquisa
Inspecione cloudstack/VirtualMachineService.go na linha 5543 e o chamador em pkg/cloud/instance.go na linha 61 do CAPC. Reproduza a resposta em que count é 1, mas VirtualMachinesMetrics é nil ou vazio, e então estabeleça o tratamento esperado para que o método não entre mais em panic e o comportamento da resposta seja documentado ou coberto por um teste de regressão.
Escrita pelo modelo de indexação a partir do texto da issue.
Avaliação
- Stack de tecnologia
- go
- Domínio
- api
- Tipo de issue
- Bug
- Dificuldade
- 3/5
- Tempo estimado
- 1-2 dias
- Status de atividade
- Estagnada
- Clareza
- Razoavelmente clara
- Facilidade para iniciantes
- 45/100