Skip to content

Commit bb66463

Browse files
paczernyrsmontero
authored andcommitted
B #7058: Solve IM vs VMM race conditions (#3759)
(cherry picked from commit cc62c31)
1 parent 6a194cb commit bb66463

File tree

2 files changed

+12
-9
lines changed

2 files changed

+12
-9
lines changed

src/im/InformationManager.cc

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,17 @@ void InformationManager::_host_system(unique_ptr<im_msg_t> msg)
331331

332332
static void test_and_trigger(const string& state_str, VirtualMachine * vm)
333333
{
334+
time_t the_time = time(0);
335+
336+
// Prevent Monitor and VMM driver race condition.
337+
// Ignore state updates for 30s after state changes
338+
if ( the_time - vm->get_running_etime() < 30 ||
339+
the_time - vm->get_running_stime() < 30 )
340+
{
341+
vm->log("VMM", Log::INFO, "Ignoring VM state update");
342+
return;
343+
}
344+
334345
auto state = vm->get_state();
335346
auto lcm_state = vm->get_lcm_state();
336347
auto lcm = Nebula::instance().get_lcm();

src/lcm/LifeCycleStates.cc

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ void LifeCycleManager::trigger_deploy_success(int vid)
307307

308308
int uid = vm->get_uid();
309309
int gid = vm->get_gid();
310-
310+
311311
int plan_id = vm->plan_id();
312312
int action_id = vm->action_id();
313313

@@ -1242,14 +1242,6 @@ void LifeCycleManager::trigger_monitor_poweron(int vid)
12421242

12431243
time_t the_time = time(0);
12441244

1245-
// Prevent Monitor and VMM driver race condition.
1246-
// Ignore state updates for 30s after state changes
1247-
if ( the_time - vm->get_running_etime() < 30 )
1248-
{
1249-
vm->log("VMM", Log::INFO, "Ignoring VM state update");
1250-
return;
1251-
}
1252-
12531245
int uid = vm->get_uid();
12541246
int gid = vm->get_gid();
12551247

0 commit comments

Comments
 (0)