mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-22 18:50:08 +03:00
Bug #4119: Use DISK_COST to calculate role cost
(cherry picked from commit 7abb4ccbada904eaaf4ec7c4c74230ee74f91fcc)
This commit is contained in:
parent
ac8f45433e
commit
cd4b4b2a96
@ -246,7 +246,7 @@ define(function(require) {
|
||||
|
||||
var capacity = template_json.VMTEMPLATE.TEMPLATE;
|
||||
var cost = 0;
|
||||
if (capacity.CPU_COST || capacity.MEMORY_COST && Config.isFeatureEnabled("showback")) {
|
||||
if ((capacity.CPU_COST || capacity.MEMORY_COST || capacity.DISK_COST) && Config.isFeatureEnabled("showback")) {
|
||||
$(".provision_create_service_cost_div", context).show();
|
||||
|
||||
if (capacity.CPU && capacity.CPU_COST) {
|
||||
@ -259,6 +259,28 @@ define(function(require) {
|
||||
$(".cost_value", context).data("MEMORY_COST", capacity.MEMORY_COST);
|
||||
}
|
||||
|
||||
if (capacity.DISK_COST) {
|
||||
var template_disk = capacity.DISK;
|
||||
var disks = [];
|
||||
if ($.isArray(template_disk)) {
|
||||
disks = template_disk;
|
||||
} else if (!$.isEmptyObject(template_disk)) {
|
||||
disks = [template_disk];
|
||||
}
|
||||
|
||||
$(".cost_value", context).data("DISK_COST", capacity.DISK_COST);
|
||||
|
||||
$.each(disks, function(i,disk){
|
||||
if (disk.SIZE) {
|
||||
cost += capacity.DISK_COST * disk.SIZE;
|
||||
}
|
||||
|
||||
if (disk.DISK_SNAPSHOT_TOTAL_SIZE) {
|
||||
cost += capacity.DISK_COST * disk.DISK_SNAPSHOT_TOTAL_SIZE;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
$(".provision_create_service_cost_div", context).data("cost", cost)
|
||||
var cost_value = cost*parseInt(role_template.cardinality);
|
||||
$(".cost_value", context).html(cost_value.toFixed(2));
|
||||
@ -364,7 +386,7 @@ define(function(require) {
|
||||
'<br>');
|
||||
|
||||
var cost = 0;
|
||||
if (capacity.CPU_COST || capacity.MEMORY_COST && Config.isFeatureEnabled("showback")) {
|
||||
if ((capacity.CPU_COST || capacity.MEMORY_COST) && Config.isFeatureEnabled("showback")) {
|
||||
$(".provision_create_template_cost_div").show();
|
||||
|
||||
if (capacity.CPU && capacity.CPU_COST) {
|
||||
@ -1541,7 +1563,8 @@ define(function(require) {
|
||||
|
||||
OpenNebula.Template.show({
|
||||
data : {
|
||||
id: template_id
|
||||
id: template_id,
|
||||
extended: true
|
||||
},
|
||||
success: function(request,template_json){
|
||||
var role_context = $(role_html_id)
|
||||
|
Loading…
x
Reference in New Issue
Block a user