1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-22 18:50:08 +03:00

Bug #3378: Do not trigger host hooks for each monitorization

(cherry picked from commit f1f22bc3c002c44ebcc6971112ffa5570015c071)
This commit is contained in:
Carlos Martín 2014-12-12 12:53:14 +01:00
parent f003bc2e5a
commit 6f6ef024bc

View File

@ -77,6 +77,20 @@ void HostStateMapHook::remove_host (int id)
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
void merge_state(Host::HostState &state)
{
if (state == Host::MONITORING_ERROR)
{
state = Host::ERROR;
}
else if (state == Host::MONITORING_DISABLED)
{
state = Host::DISABLED;
}
}
// -----------------------------------------------------------------------------
void HostStateHook::do_hook(void *arg)
{
Host * host;
@ -100,6 +114,9 @@ void HostStateHook::do_hook(void *arg)
cur_state = host->get_state();
merge_state(prev_state);
merge_state(cur_state);
if ( prev_state == cur_state ) //Still in the same state
{
return;