GetVirtualMachinesMetricID method throwing panic error when accessing VMs from reponse
- Ngôn ngữ chính
- Go
- Star
- 39
- Fork
- 47
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Mô tả
**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
Hướng dẫn đóng góp
Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này
Hướng nghiên cứu
Kiểm tra cloudstack/VirtualMachineService.go tại dòng 5543 và caller trong pkg/cloud/instance.go tại dòng 61 của CAPC. Tái hiện response trong đó count là 1 nhưng VirtualMachinesMetrics là nil hoặc rỗng, sau đó xác định cách xử lý ожида vọng để method không còn panic và behavior của response được ghi lại hoặc được bao phủ bởi một regression test.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- go
- Lĩnh vực
- api
- Loại issue
- Lỗi
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 45/100