Describe the bug
On testing, I found there is a bug in Aliyun CLI which affects the sizing tool. With the bug, the sizing script would just return all 0 in the counting.
Expected behavior
The Aliyun Sizing Script is reading the "Total Count" attribute from the json obtained by "aliyun ecs describeinstances". The "Total Count" should report the total ECS (VM) instances number.
Current behavior
But perhaps an API bug from Alicloud side, the "Total Count" is always 0 even there are vm listed.

Possible solution
Amend the script function "get_instance_count()", skip relying on the "Total Count" attribute. Instead, add the new lines to count the instances number instead.
get_instance_count() {
COUNT=0
RESULT=$(abc_compute_instances_list "${1}")
// COUNT=$(echo "${RESULT}" | jq -r '.TotalCount' 2>/dev/null) //commented this original line
INSTANCES=($(echo "${RESULT}" | jq -r '.Instances.Instance[].InstanceId' 2>/dev/null)) //add new line 1
COUNT=$((COUNT + ${#INSTANCES[@]})) //add new line 2
echo "${COUNT}"
}
Describe the bug
On testing, I found there is a bug in Aliyun CLI which affects the sizing tool. With the bug, the sizing script would just return all 0 in the counting.
Expected behavior
The Aliyun Sizing Script is reading the "Total Count" attribute from the json obtained by "aliyun ecs describeinstances". The "Total Count" should report the total ECS (VM) instances number.
Current behavior
But perhaps an API bug from Alicloud side, the "Total Count" is always 0 even there are vm listed.

Possible solution
Amend the script function "get_instance_count()", skip relying on the "Total Count" attribute. Instead, add the new lines to count the instances number instead.
get_instance_count() {$(echo "$ {RESULT}" | jq -r '.Instances.Instance[].InstanceId' 2>/dev/null)) //add new line 1
COUNT=0
RESULT=$(abc_compute_instances_list "${1}")
// COUNT=$(echo "${RESULT}" | jq -r '.TotalCount' 2>/dev/null) //commented this original line
INSTANCES=(
COUNT=$((COUNT + ${#INSTANCES[@]})) //add new line 2
echo "${COUNT}"
}