You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by GitBox <gi...@apache.org> on 2020/03/04 17:02:07 UTC

[GitHub] [cloudstack] dpassante opened a new issue #3934: Zones are returned in a random order

dpassante opened a new issue #3934: Zones are returned in a random order
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:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [cloudstack] dpassante commented on issue #3934: Zones are returned in a random order

Posted by GitBox <gi...@apache.org>.
dpassante commented on issue #3934: Zones are returned in a random order
URL: https://github.com/apache/cloudstack/issues/3934#issuecomment-595271743
 
 
   In fact, the "problem" seems to come from the fact that zones are created with the sort key 0 which has priority by default.
   
   ~~~
   +----+--------------------------------------+----------+
   | id | name                                 | sort_key |
   +----+--------------------------------------+----------+
   |  1 | Sandbox-simulator-basic              |        0 |
   |  2 | Sandbox-simulator-advanced           |        0 |
   |  3 | ansible-test-dpassante-55511421-zone |        0 |
   |  4 | ansible-test-dpassante-46776470-zone |        0 |
   +----+--------------------------------------+----------+
   ~~~
   
   The sort keys are not unique, we also have the same behavior when we assign the same rank to 2 zones from the API.
   
   Once the sorting has been done, the new zones are returned first.
   ~~~
   +----+--------------------------------------+----------+
   | id | name                                 | sort_key |
   +----+--------------------------------------+----------+
   |  1 | Sandbox-simulator-basic              |        1 |
   |  2 | Sandbox-simulator-advanced           |        2 |
   |  3 | ansible-test-dpassante-91763618-zone |        0 |
   |  4 | ansible-test-dpassante-38650808-zone |        0 |
   +----+--------------------------------------+----------+
   ~~~
   
   ~~~
   $ cs listZones |grep name
         "name": "ansible-test-dpassante-38650808-zone",
         "name": "ansible-test-dpassante-91763618-zone",
         "name": "Sandbox-simulator-basic",
         "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:
users@infra.apache.org


With regards,
Apache Git Services