diff --git a/src/cli/onevm b/src/cli/onevm index e689810957..7983897fda 100755 --- a/src/cli/onevm +++ b/src/cli/onevm @@ -519,7 +519,7 @@ cmd=CommandParser::CmdParser.new(ARGV) do TO MANUALLY CHECK THE VM STATUS ON THE HOST, to decide if the operation was successful or not. - Example: A VM is stuck in "migrate" because of a harware failure. You + Example: A VM is stuck in "migrate" because of a hardware failure. You need to check if the VM is running in the new host or not to recover the vm with success (onevm recover --with success) or failure (onevm recover --with failure), respectively. diff --git a/src/sunstone/models/OpenNebulaJSON/VirtualMachineJSON.rb b/src/sunstone/models/OpenNebulaJSON/VirtualMachineJSON.rb index ac14b7c937..6a6dbdbc82 100644 --- a/src/sunstone/models/OpenNebulaJSON/VirtualMachineJSON.rb +++ b/src/sunstone/models/OpenNebulaJSON/VirtualMachineJSON.rb @@ -75,6 +75,7 @@ module OpenNebulaJSON when "undeploy" then self.undeploy(action_hash['params']) when "resched" then self.resched when "unresched" then self.unresched + when "recover" then self.recover(action_hash['params']) else error_msg = "#{action_hash['perform']} action not " << " available for this resource" @@ -160,5 +161,10 @@ module OpenNebulaJSON def rename(params=Hash.new) super(params['name']) end + + def recover(params=Hash.new) + result = params['with'] == "success" ? true : false + super(result) + end end end diff --git a/src/sunstone/public/js/opennebula.js b/src/sunstone/public/js/opennebula.js index 97b684280f..7a7cbe43e8 100644 --- a/src/sunstone/public/js/opennebula.js +++ b/src/sunstone/public/js/opennebula.js @@ -806,6 +806,10 @@ var OpenNebula = { }, "unresched" : function(params){ OpenNebula.Action.simple_action(params,OpenNebula.VM.resource,"unresched"); + }, + "recover" : function(params){ + var action_obj = {"with": params.data.extra_param}; + OpenNebula.Action.simple_action(params,OpenNebula.VM.resource,"recover",action_obj); } }, diff --git a/src/sunstone/public/js/plugins/vms-tab.js b/src/sunstone/public/js/plugins/vms-tab.js index b04bca5fb2..0887c41bd2 100644 --- a/src/sunstone/public/js/plugins/vms-tab.js +++ b/src/sunstone/public/js/plugins/vms-tab.js @@ -404,6 +404,15 @@ var vm_actions = { notify: true }, + "VM.recover" : { + type: "multiple", + call: OpenNebula.VM.recover, + callback: vmShow, + elements: vmElements, + error: onError, + notify: true + }, + "VM.resched" : { type: "multiple", call: OpenNebula.VM.resched, @@ -834,6 +843,17 @@ var vm_buttons = { layout: "vmsplanification_buttons", tip: tr("This will cancel the rescheduling for the selected VMs") }, + "VM.recover" : { + type: "confirm_with_select", + text: tr("Recover"), + layout: "vmsplanification_buttons", + select: function(){ return '\ + '}, + tip: tr("Recovers a stuck VM that is waiting for a driver operation. \ + The recovery may be done by failing or succeeding the pending operation. \ + YOU NEED TO MANUALLY CHECK THE VM STATUS ON THE HOST, to decide if the operation \ + was successful or not.") + } //"VM.help" : { // type: "action",