1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-20 10:50:08 +03:00

Feature #3748: Update default quotas on .show success

This commit is contained in:
Carlos Martín 2015-06-18 16:09:03 +02:00
parent 9bf88c1a9b
commit 34248482f7
3 changed files with 52 additions and 2 deletions

View File

@ -49,6 +49,18 @@ define(function(require) {
OpenNebulaAction.simple_action(params, RESOURCE, "set_quota", action_obj);
},
"show" : function(params) {
var callback = params.success;
// Before calling the true callback, we update the default quotas
// included in the .show response
params.success = function(request, response) {
QuotaDefaults.setDefaultGroupQuotas(
QuotaDefaults.default_quotas(response.GROUP.DEFAULT_GROUP_QUOTAS)
);
return callback ? callback(request, response) : null;
};
OpenNebulaAction.show(params, RESOURCE);
},
"accounting" : function(params) {

View File

@ -42,6 +42,18 @@ define(function(require) {
});
},
"show" : function(params) {
var callback = params.success;
// Before calling the true callback, we update the default quotas
// included in the .show response
params.success = function(request, response) {
QuotaDefaults.setDefaultUserQuotas(
QuotaDefaults.default_quotas(response.USER.DEFAULT_USER_QUOTAS)
);
return callback ? callback(request, response) : null;
};
OpenNebulaAction.show(params, RESOURCE);
},
"passwd": function(params) {

View File

@ -1,7 +1,33 @@
define(function(require) {
// The default quotas returned by the pool.list method are stored here
var _defaultUserQuotas;
var _defaultGroupQuotas;
var _defaultUserQuotas = {
"VM_QUOTA": {
"VM": {
"CPU": QUOTA_LIMIT_UNLIMITED,
"MEMORY": QUOTA_LIMIT_UNLIMITED,
"VMS": QUOTA_LIMIT_UNLIMITED,
"VOLATILE_SIZE": QUOTA_LIMIT_UNLIMITED,
}
},
"DATASTORE_QUOTA": {},
"IMAGE_QUOTA": {},
"NETWORK_QUOTA": {}
};
var _defaultGroupQuotas = {
"VM_QUOTA": {
"VM": {
"CPU": QUOTA_LIMIT_UNLIMITED,
"MEMORY": QUOTA_LIMIT_UNLIMITED,
"VMS": QUOTA_LIMIT_UNLIMITED,
"VOLATILE_SIZE": QUOTA_LIMIT_UNLIMITED,
}
},
"DATASTORE_QUOTA": {},
"IMAGE_QUOTA": {},
"NETWORK_QUOTA": {}
};
var QuotaLimits = require('./quota-limits');