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

F #2356: Added more states to host hooks

This commit is contained in:
Ruben S. Montero 2018-08-29 11:35:50 +02:00
parent a8c3720cb4
commit 7b4fd7442d
2 changed files with 39 additions and 6 deletions

View File

@ -79,13 +79,26 @@ void HostStateMapHook::remove_host (int id)
void merge_state(Host::HostState &state)
{
if (state == Host::MONITORING_ERROR)
switch(state)
{
state = Host::ERROR;
}
else if (state == Host::MONITORING_DISABLED)
{
state = Host::DISABLED;
case Host::INIT:
case Host::MONITORED:
case Host::ERROR:
case Host::DISABLED:
case Host::OFFLINE:
break;
case Host::MONITORING_ERROR:
state = Host::ERROR;
break;
case Host::MONITORING_DISABLED:
state = Host::DISABLED;
break;
case Host::MONITORING_MONITORED:
state = Host::MONITORED;
break;
case Host::MONITORING_INIT:
state = Host::INIT;
break;
}
}

View File

@ -128,6 +128,26 @@ HostPool::HostPool(SqlDB* db,
add_hook(hook);
state_hook = true;
}
else if ( on == "OFFLINE" )
{
HostStateHook * hook;
hook = new HostStateHook(name, cmd, arg, remote, Host::OFFLINE);
add_hook(hook);
state_hook = true;
}
else if ( on == "ENABLE" )
{
HostStateHook * hook;
hook = new HostStateHook(name, cmd, arg, remote, Host::INIT);
add_hook(hook);
state_hook = true;
}
}