diff --git a/src/sunstone/models/OpenNebulaJSON/VirtualMachineJSON.rb b/src/sunstone/models/OpenNebulaJSON/VirtualMachineJSON.rb index 3cfcb23aee..472b736b39 100644 --- a/src/sunstone/models/OpenNebulaJSON/VirtualMachineJSON.rb +++ b/src/sunstone/models/OpenNebulaJSON/VirtualMachineJSON.rb @@ -76,6 +76,7 @@ module OpenNebulaJSON when "unresched" then self.unresched when "recover" then self.recover(action_hash['params']) when "save_as_template" then self.save_as_template(action_hash['params']) + when "disk_resize" then self.disk_resize(action_hash['params']) else error_msg = "#{action_hash['perform']} action not " << " available for this resource" @@ -112,6 +113,10 @@ module OpenNebulaJSON params['type'], params['snapshot_id'].to_i) end + def disk_resize(params=Hash.new) + super(params['disk_id'].to_i, params['new_size']) + end + def snapshot_create(params=Hash.new) super(params['snapshot_name']) end diff --git a/src/sunstone/models/SunstoneServer.rb b/src/sunstone/models/SunstoneServer.rb index 1d125e557d..c79d97c5f6 100644 --- a/src/sunstone/models/SunstoneServer.rb +++ b/src/sunstone/models/SunstoneServer.rb @@ -47,7 +47,7 @@ class SunstoneServer < CloudServer when "host" then HostPoolJSON.new(client) when "image" then ImagePoolJSON.new(client, user_flag) when "vmtemplate" then TemplatePoolJSON.new(client, user_flag) - when "vm_group" then VMGroupPoolJSON.new(client, user_flag) + when "vm_group" then VMGroupPoolJSON.new(client, user_flag) when "vm" then VirtualMachinePoolJSON.new(client, user_flag) when "vnet" then VirtualNetworkPoolJSON.new(client, user_flag) when "user" then UserPoolJSON.new(client) diff --git a/src/sunstone/public/app/tabs/vms-tab/dialogs/disk-resize.js b/src/sunstone/public/app/tabs/vms-tab/dialogs/disk-resize.js index f2a06529ff..816a3b9d59 100644 --- a/src/sunstone/public/app/tabs/vms-tab/dialogs/disk-resize.js +++ b/src/sunstone/public/app/tabs/vms-tab/dialogs/disk-resize.js @@ -92,21 +92,32 @@ define(function(require) { $( ".uinput-slider", context).on("input", function(){ $( ".uinput-slider-val",context).val(Humanize.size($( ".uinput-slider",context).val())); var cost = Humanize.sizeToMB($( ".uinput-slider",context).val())*that.diskCost; + if(isNaN(cost)){ + cost = 0; + } document.getElementById("new_cost_resize").textContent = Locale.tr("Cost")+": "+ convertCostNumber(cost); }); $( ".uinput-slider-val", context).on("change", function(){ $( ".uinput-slider",context).val(Humanize.sizeToMB($( ".uinput-slider-val",context).val())); var cost = Humanize.sizeToMB($( ".uinput-slider",context).val())*that.diskCost; + if(isNaN(cost)){ + cost = 0; + } document.getElementById("new_cost_resize").textContent = Locale.tr("Cost")+": "+ convertCostNumber(cost); }); var cost = Humanize.sizeToMB($( ".uinput-slider",context).val())*this.diskCost; + if(isNaN(cost)){ + cost = 0; + } document.getElementById("new_cost_resize").textContent = Locale.tr("Cost")+": "+ convertCostNumber(cost); $('#' + DIALOG_ID + 'Form', context).submit(function() { var new_size = $( ".uinput-slider",context).val(); + new_size = Math.round(parseInt(new_size) / 1024); + new_size = new_size.toString(); var obj = { "vm_id": that.element.ID, "disk_id" : that.diskId,