-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Closed
Labels
Milestone
Description
ISSUE TYPE
- Bug Report
COMPONENT NAME
API
CLOUDSTACK VERSION
4.13.0.0
CONFIGURATION
N/A
OS / ENVIRONMENT
N/A
SUMMARY
listZones returns the zones in a "random" order when it has not been explicitly defined with the new sort key feature.
This impacts the correct functioning of the Ansible Cloudstack modules which use the first zone if no zone parameter is given.
STEPS TO REPRODUCE
Keep zones unsorted:
mysql> select id, name, sort_key from data_center;
+----+----------------------------+----------+
| id | name | sort_key |
+----+----------------------------+----------+
| 1 | Sandbox-simulator-basic | 0 |
| 2 | Sandbox-simulator-advanced | 0 |
+----+----------------------------+----------+
2 rows in set (0.00 sec)
And use a playbook in which the zone param is not given.
Several calls to listZones also do the trick.
EXPECTED RESULTS
A list of zones sorted by SQL ID when no sort key are configured to avoid breaking some existing Ansible deployments.
Ensure that a sort key is automatically incremented for new zones and existing zones in the case of a Cloudstack upgrade could also be a nice feature.
ACTUAL RESULTS
$ for in in `seq 1 1 10`; do cs listZones |grep -m1 name; done
"name": "Sandbox-simulator-basic",
"name": "Sandbox-simulator-basic",
"name": "Sandbox-simulator-basic",
"name": "Sandbox-simulator-basic",
"name": "Sandbox-simulator-basic",
"name": "Sandbox-simulator-basic",
"name": "Sandbox-simulator-advanced",
"name": "Sandbox-simulator-advanced",
"name": "Sandbox-simulator-advanced",
"name": "Sandbox-simulator-advanced",