diff --git a/src/im/InformationManager.cc b/src/im/InformationManager.cc index 934b0eba96..ef62e6ec5e 100644 --- a/src/im/InformationManager.cc +++ b/src/im/InformationManager.cc @@ -331,6 +331,17 @@ void InformationManager::_host_system(unique_ptr msg) static void test_and_trigger(const string& state_str, VirtualMachine * vm) { + time_t the_time = time(0); + + // Prevent Monitor and VMM driver race condition. + // Ignore state updates for 30s after state changes + if ( the_time - vm->get_running_etime() < 30 || + the_time - vm->get_running_stime() < 30 ) + { + vm->log("VMM", Log::INFO, "Ignoring VM state update"); + return; + } + auto state = vm->get_state(); auto lcm_state = vm->get_lcm_state(); auto lcm = Nebula::instance().get_lcm(); diff --git a/src/lcm/LifeCycleStates.cc b/src/lcm/LifeCycleStates.cc index a9b90ca590..c75fcba719 100644 --- a/src/lcm/LifeCycleStates.cc +++ b/src/lcm/LifeCycleStates.cc @@ -307,7 +307,7 @@ void LifeCycleManager::trigger_deploy_success(int vid) int uid = vm->get_uid(); int gid = vm->get_gid(); - + int plan_id = vm->plan_id(); int action_id = vm->action_id(); @@ -1242,14 +1242,6 @@ void LifeCycleManager::trigger_monitor_poweron(int vid) time_t the_time = time(0); - // Prevent Monitor and VMM driver race condition. - // Ignore state updates for 30s after state changes - if ( the_time - vm->get_running_etime() < 30 ) - { - vm->log("VMM", Log::INFO, "Ignoring VM state update"); - return; - } - int uid = vm->get_uid(); int gid = vm->get_gid();