mirror of
https://github.com/OpenNebula/one.git
synced 2025-02-02 09:47:00 +03:00
parent
e267375c6a
commit
28d8e44ea4
@ -108,6 +108,38 @@ public:
|
||||
state = ERROR;
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the Host's last_monitored time stamp.
|
||||
* @param success if the monitored action was successfully performed
|
||||
*/
|
||||
void touch(bool success)
|
||||
{
|
||||
last_monitored = time(0);
|
||||
|
||||
switch (state)
|
||||
{
|
||||
case MONITORING_DISABLED:
|
||||
state = DISABLED;
|
||||
break;
|
||||
|
||||
case MONITORING_ERROR:
|
||||
case MONITORING_INIT:
|
||||
case MONITORING_MONITORED:
|
||||
if (success == true)
|
||||
{
|
||||
state = MONITORED;
|
||||
}
|
||||
else
|
||||
{
|
||||
state = ERROR;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Update host after a successful monitor. It modifies counters, state
|
||||
* and template attributes
|
||||
@ -431,42 +463,6 @@ private:
|
||||
|
||||
virtual ~Host();
|
||||
|
||||
// *************************************************************************
|
||||
// Host Management
|
||||
// *************************************************************************
|
||||
|
||||
/**
|
||||
* Updates the Host's last_monitored time stamp.
|
||||
* @param success if the monitored action was successfully performed
|
||||
*/
|
||||
void touch(bool success)
|
||||
{
|
||||
last_monitored = time(0);
|
||||
|
||||
switch (state)
|
||||
{
|
||||
case MONITORING_DISABLED:
|
||||
state = DISABLED;
|
||||
break;
|
||||
|
||||
case MONITORING_ERROR:
|
||||
case MONITORING_INIT:
|
||||
case MONITORING_MONITORED:
|
||||
if (success == true)
|
||||
{
|
||||
state = MONITORED;
|
||||
}
|
||||
else
|
||||
{
|
||||
state = ERROR;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
};
|
||||
|
||||
// *************************************************************************
|
||||
// DataBase implementation (Private)
|
||||
// *************************************************************************
|
||||
|
@ -267,10 +267,19 @@ void InformationManager::timer_action()
|
||||
|
||||
host->set_monitoring_state();
|
||||
}
|
||||
}
|
||||
else if (!host->isEnabled() && host->get_share_running_vms() == 0 )
|
||||
{
|
||||
// Disabled hosts without VMs are not monitored, but we need to
|
||||
// update the last_mon_time to rotate the Hosts returned by
|
||||
// HostPool::discover. We also update the monitoring values with
|
||||
// 0s
|
||||
|
||||
hpool->update(host);
|
||||
host->touch(true);
|
||||
hpool->update_monitoring(host);
|
||||
}
|
||||
|
||||
hpool->update(host);
|
||||
host->unlock();
|
||||
}
|
||||
}
|
||||
|
@ -55,7 +55,6 @@ void HostEnable::request_execute(xmlrpc_c::paramList const& paramList,
|
||||
else
|
||||
{
|
||||
host->disable();
|
||||
hpool->update_monitoring(host);
|
||||
}
|
||||
|
||||
hpool->update(host);
|
||||
|
Loading…
x
Reference in New Issue
Block a user