From b483b8bb2570fbddfe5efe33e17ac80a24ca103c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mart=C3=ADn?= Date: Wed, 3 Apr 2013 18:20:20 +0200 Subject: [PATCH] Feature #1631: Fix merge --- include/History.h | 8 ++++++++ src/lcm/LifeCycleActions.cc | 10 ++++++---- src/lcm/LifeCycleStates.cc | 2 +- src/rm/RequestManagerVirtualMachine.cc | 5 ++++- 4 files changed, 19 insertions(+), 6 deletions(-) diff --git a/include/History.h b/include/History.h index 9efdabe03f..5e79ace5a8 100644 --- a/include/History.h +++ b/include/History.h @@ -56,6 +56,7 @@ public: RESCHED_ACTION, UNRESCHED_ACTION, POWEROFF_ACTION, + POWEROFF_HARD_ACTION, NONE_ACTION }; @@ -122,6 +123,9 @@ public: case POWEROFF_ACTION: st = "poweroff"; break; + case POWEROFF_HARD_ACTION: + st = "poweroff-hard"; + break; case NONE_ACTION: st = "none"; break; @@ -208,6 +212,10 @@ public: { action = POWEROFF_ACTION; } + else if (st == "poweroff-hard") + { + action = POWEROFF_HARD_ACTION; + } else { action = NONE_ACTION; diff --git a/src/lcm/LifeCycleActions.cc b/src/lcm/LifeCycleActions.cc index 51174bce2e..95516cd110 100644 --- a/src/lcm/LifeCycleActions.cc +++ b/src/lcm/LifeCycleActions.cc @@ -463,22 +463,24 @@ void LifeCycleManager::poweroff_action(int vid, bool hard) vmpool->update(vm); - vm->set_history_action(History::POWEROFF_ACTION); - - vmpool->update_history(vm); - vm->log("LCM",Log::INFO,"New VM state is SHUTDOWN_POWEROFF"); //---------------------------------------------------- if (hard) { + vm->set_history_action(History::POWEROFF_HARD_ACTION); + vmm->trigger(VirtualMachineManager::CANCEL,vid); } else { + vm->set_history_action(History::POWEROFF_ACTION); + vmm->trigger(VirtualMachineManager::SHUTDOWN,vid); } + + vmpool->update_history(vm); } else { diff --git a/src/lcm/LifeCycleStates.cc b/src/lcm/LifeCycleStates.cc index b4528e071b..26ba3576a0 100644 --- a/src/lcm/LifeCycleStates.cc +++ b/src/lcm/LifeCycleStates.cc @@ -1010,7 +1010,7 @@ void LifeCycleManager::cancel_success_action(int vid) vm->set_vm_info(); - vm->set_reason(History::STOP_RESUME); + vm->set_reason(History::NONE); vmpool->update_history(vm); diff --git a/src/rm/RequestManagerVirtualMachine.cc b/src/rm/RequestManagerVirtualMachine.cc index b949438623..638019728f 100644 --- a/src/rm/RequestManagerVirtualMachine.cc +++ b/src/rm/RequestManagerVirtualMachine.cc @@ -391,7 +391,10 @@ void VirtualMachineAction::request_execute(xmlrpc_c::paramList const& paramList, rc = dm->reset(id); break; case History::POWEROFF_ACTION: - rc = dm->poweroff(id); + rc = dm->poweroff(id, false); + break; + case History::POWEROFF_HARD_ACTION: + rc = dm->poweroff(id, true); break; case History::UNDEPLOY_ACTION: rc = dm->undeploy(id, false);