dpassante opened a new issue #3934:
URL: https://github.com/apache/cloudstack/issues/3934


   <!--
   Verify first that your issue/request is not already reported on GitHub.
   Also test if the latest release and master branch are affected too.
   Always add information AFTER of these HTML comments, but no need to delete 
the comments.
   -->
   
   ##### ISSUE TYPE
   <!-- Pick one below and delete the rest -->
    * Bug Report
   
   ##### COMPONENT NAME
   <!--
   Categorize the issue, e.g. API, VR, VPN, UI, etc.
   -->
   ~~~
   API
   ~~~
   
   ##### CLOUDSTACK VERSION
   <!--
   New line separated list of affected versions, commit ID for issues on master 
branch.
   -->
   
   ~~~
   4.13.0.0
   ~~~
   
   ##### CONFIGURATION
   <!--
   Information about the configuration if relevant, e.g. basic network, 
advanced networking, etc.  N/A otherwise
   -->
   N/A
   
   ##### OS / ENVIRONMENT
   <!--
   Information about the environment if relevant, N/A otherwise
   -->
   N/A
   
   ##### SUMMARY
   <!-- Explain the problem/feature briefly -->
   `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
   <!--
   For bugs, show exactly how to reproduce the problem, using a minimal 
test-case. Use Screenshots if accurate.
   
   For new features, show how the feature would be used.
   -->
   
   <!-- Paste example playbooks or commands between quotes below -->
   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.
   
   <!-- You can also paste gist.github.com links for larger files -->
   
   ##### EXPECTED RESULTS
   <!-- What did you expect to happen when running the steps above? -->
   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
   <!-- What actually happened? -->
   
   <!-- Paste verbatim command output between quotes below -->
   ~~~
   $ 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",
   ~~~
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to