From 0c8d595dbad10fc60720bcb6645a3be7e358c608 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mart=C3=ADn?= Date: Wed, 18 Mar 2015 18:59:02 +0100 Subject: [PATCH] Bug #3695: Set etime for boot failure from poweroff, suspend --- src/lcm/LifeCycleStates.cc | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/lcm/LifeCycleStates.cc b/src/lcm/LifeCycleStates.cc index fa150e8884..f794cc0296 100644 --- a/src/lcm/LifeCycleStates.cc +++ b/src/lcm/LifeCycleStates.cc @@ -339,6 +339,8 @@ void LifeCycleManager::deploy_failure_action(int vid) return; } + time_t the_time = time(0); + if ( vm->get_lcm_state() == VirtualMachine::MIGRATE ) { int cpu,mem,disk; @@ -400,8 +402,6 @@ void LifeCycleManager::deploy_failure_action(int vid) } else if (vm->get_lcm_state() == VirtualMachine::BOOT) { - time_t the_time = time(0); - vm->set_running_etime(the_time); failure_action(vm); @@ -416,19 +416,27 @@ void LifeCycleManager::deploy_failure_action(int vid) } else if (vm->get_lcm_state() == VirtualMachine::BOOT_POWEROFF) { + vm->set_etime(the_time); + vm->set_running_etime(the_time); + vm->set_state(VirtualMachine::POWEROFF); vm->set_state(VirtualMachine::LCM_INIT); vmpool->update(vm); + vmpool->update_history(vm); vm->log("LCM", Log::INFO, "Fail to boot VM. New VM state is POWEROFF"); } else if (vm->get_lcm_state() == VirtualMachine::BOOT_SUSPENDED) { + vm->set_etime(the_time); + vm->set_running_etime(the_time); + vm->set_state(VirtualMachine::SUSPENDED); vm->set_state(VirtualMachine::LCM_INIT); vmpool->update(vm); + vmpool->update_history(vm); vm->log("LCM", Log::INFO, "Fail to boot VM. New VM state is SUSPENDED"); }