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

More leader check

This commit is contained in:
Ruben S. Montero 2020-05-25 15:02:47 +02:00 committed by GitHub
parent 7705d669a7
commit 7db3994f0e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -233,6 +233,11 @@ void HostMonitorManager::raft_status(const string& state)
void HostMonitorManager::monitor_host(int oid, bool result, const Template &tmpl)
{
if (!is_leader)
{
return;
}
auto host = hpool->get(oid);
if (!host.valid())
@ -297,6 +302,11 @@ void HostMonitorManager::monitor_host(int oid, bool result, const Template &tmpl
void HostMonitorManager::update_last_monitor(int oid)
{
if (!is_leader)
{
return;
}
auto host = hpool->get(oid);
if (!host.valid())
@ -321,6 +331,11 @@ void HostMonitorManager::monitor_vm(int oid,
const string& uuid,
const Template &tmpl)
{
if (!is_leader)
{
return;
}
if (oid < 0)
{
// Wild VM, check if it is imported to OpenNebula
@ -357,6 +372,11 @@ void HostMonitorManager::monitor_vm(int oid,
void HostMonitorManager::start_monitor_failure(int oid)
{
if (!is_leader)
{
return;
}
NebulaLog::error("HMM", "Unable to monitor host id: " + to_string(oid));
auto host = hpool->get(oid);
@ -375,6 +395,11 @@ void HostMonitorManager::start_monitor_failure(int oid)
void HostMonitorManager::start_monitor_success(int oid)
{
if (!is_leader)
{
return;
}
NebulaLog::debug("HMM", "Start monitor success, host: " + to_string(oid));
auto host = hpool->get(oid);