1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-02-02 09:47:00 +03:00

Bug #1949: Prevent bug #1800 from reappearing

This commit is contained in:
Carlos Martín 2013-04-25 15:10:12 +02:00
parent e267375c6a
commit 28d8e44ea4
3 changed files with 42 additions and 38 deletions

View File

@ -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)
// *************************************************************************

View File

@ -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();
}
}

View File

@ -55,7 +55,6 @@ void HostEnable::request_execute(xmlrpc_c::paramList const& paramList,
else
{
host->disable();
hpool->update_monitoring(host);
}
hpool->update(host);