GetVirtualMachinesMetricID method throwing panic error when accessing VMs from reponse
- 主要言語
- Go
- スター
- 39
- フォーク
- 47
- PR マージ指標
- 30日以内にマージされた PR はありません
説明
**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
コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
調査の方向性
CAPC の cloudstack/VirtualMachineService.go の 5543 行目と、pkg/cloud/instance.go の 61 行目にある呼び出し元を調査してください。count が 1 である一方、VirtualMachinesMetrics が nil または空になるレスポンスを再現し、その後、メソッドが panic しなくなり、レスポンスの動作が文書化されるか回帰テストでカバーされるように、期待される処理を確立してください。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- go
- 領域
- api
- issue の種類
- バグ
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 45/100