Angular LI:Make sure we always get all limits

When checking with nova for the absolute limits
we were not taking into account the reserved
quotas (i.e. instance in rebuilding will take
cpu and ram) so this could lead to wrongly
thinking that the user could launch more instances
that its quota allowed. It also made the overview
page display wrong quotas as it didnt took into
account those reserved resources.

Change-Id: I42d0bc1521a9da26ee2d23a5900c67badeb2d04b
Closes-bug: 1561310
This commit is contained in:
Itxaka 2016-06-21 11:54:06 +02:00 committed by Itxaka Serrano Garcia
parent 36e6bea4ce
commit 5c5f35afc2
4 changed files with 11 additions and 5 deletions

View File

@ -167,8 +167,8 @@ class Limits(generic.View):
The following get parameters may be passed in the GET
request:
:param reserved: This may be set to "true" but it's not
clear what the result of that is.
:param reserved: Take into account the reserved limits. Reserved limits
may be instances in the rebuild process for example.
The result is an object with limits as properties.
"""

View File

@ -220,7 +220,7 @@
novaAPI.getAvailabilityZones().then(onGetAvailabilityZones, noop),
novaAPI.getFlavors(true, true).then(onGetFlavors, noop),
novaAPI.getKeypairs().then(onGetKeypairs, noop),
novaAPI.getLimits().then(onGetNovaLimits, noop),
novaAPI.getLimits(true).then(onGetNovaLimits, noop),
securityGroup.query().then(onGetSecurityGroups, noop),
serviceCatalog.ifTypeEnabled('network').then(getNetworks, noop),
serviceCatalog.ifTypeEnabled('volume').then(getVolumes, noop),

View File

@ -180,8 +180,9 @@
* }
* @returns {Object} The result of the API call
*/
function getLimits() {
return apiService.get('/api/nova/limits/')
function getLimits(reserved) {
var params = { params: {reserved: reserved }};
return apiService.get('/api/nova/limits/', params)
.error(function () {
toastService.add('error', gettext('Unable to retrieve the limits.'));
});

View File

@ -86,6 +86,11 @@
"func": "getLimits",
"method": "get",
"path": "/api/nova/limits/",
"data": {
"params": {
"reserved": undefined
}
},
"error": "Unable to retrieve the limits."
},
{