From 8f6ce0c025714906e2409921e8c797df6b7aba2f Mon Sep 17 00:00:00 2001 From: "Ruben S. Montero" Date: Fri, 21 Jan 2022 14:39:30 +0100 Subject: [PATCH] M #-: Cooldown period after shutdown a VM --- 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 bcf5a4784e..8c40b23259 100644 --- a/src/lcm/LifeCycleStates.cc +++ b/src/lcm/LifeCycleStates.cc @@ -1120,13 +1120,21 @@ void LifeCycleManager::trigger_monitor_poweron(int vid) VirtualMachineTemplate quota_tmpl; string error; + 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(); vm->log("VMM",Log::INFO,"VM found again by the drivers"); - time_t the_time = time(0); - vm->set_state(VirtualMachine::ACTIVE); vm->set_state(VirtualMachine::RUNNING);