mirror of https://github.com/Icinga/icinga2.git
Fix deadlock when adding/removing acknowledgements.
This commit is contained in:
parent
16b0722cbc
commit
4371649064
|
@ -479,11 +479,7 @@ void ExternalCommandProcessor::AcknowledgeSvcProblem(double, const vector<String
|
||||||
|
|
||||||
Logger::Write(LogInformation, "icinga", "Setting acknowledgement for service '" + service->GetName() + "'");
|
Logger::Write(LogInformation, "icinga", "Setting acknowledgement for service '" + service->GetName() + "'");
|
||||||
|
|
||||||
{
|
service->AcknowledgeProblem(sticky ? AcknowledgementSticky : AcknowledgementNormal);
|
||||||
ObjectLock olock(service);
|
|
||||||
|
|
||||||
service->AcknowledgeProblem(sticky ? AcknowledgementSticky : AcknowledgementNormal);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ExternalCommandProcessor::AcknowledgeSvcProblemExpire(double, const vector<String>& arguments)
|
void ExternalCommandProcessor::AcknowledgeSvcProblemExpire(double, const vector<String>& arguments)
|
||||||
|
@ -501,11 +497,7 @@ void ExternalCommandProcessor::AcknowledgeSvcProblemExpire(double, const vector<
|
||||||
|
|
||||||
Logger::Write(LogInformation, "icinga", "Setting timed acknowledgement for service '" + service->GetName() + "'");
|
Logger::Write(LogInformation, "icinga", "Setting timed acknowledgement for service '" + service->GetName() + "'");
|
||||||
|
|
||||||
{
|
service->AcknowledgeProblem(sticky ? AcknowledgementSticky : AcknowledgementNormal, timestamp);
|
||||||
ObjectLock olock(service);
|
|
||||||
|
|
||||||
service->AcknowledgeProblem(sticky ? AcknowledgementSticky : AcknowledgementNormal, timestamp);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ExternalCommandProcessor::RemoveSvcAcknowledgement(double, const vector<String>& arguments)
|
void ExternalCommandProcessor::RemoveSvcAcknowledgement(double, const vector<String>& arguments)
|
||||||
|
@ -517,11 +509,7 @@ void ExternalCommandProcessor::RemoveSvcAcknowledgement(double, const vector<Str
|
||||||
|
|
||||||
Logger::Write(LogInformation, "icinga", "Removing acknowledgement for service '" + service->GetName() + "'");
|
Logger::Write(LogInformation, "icinga", "Removing acknowledgement for service '" + service->GetName() + "'");
|
||||||
|
|
||||||
{
|
service->ClearAcknowledgement();
|
||||||
ObjectLock olock(service);
|
|
||||||
|
|
||||||
service->ClearAcknowledgement();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ExternalCommandProcessor::AcknowledgeHostProblem(double, const vector<String>& arguments)
|
void ExternalCommandProcessor::AcknowledgeHostProblem(double, const vector<String>& arguments)
|
||||||
|
@ -536,8 +524,6 @@ void ExternalCommandProcessor::AcknowledgeHostProblem(double, const vector<Strin
|
||||||
Logger::Write(LogInformation, "icinga", "Setting acknowledgement for host '" + host->GetName() + "'");
|
Logger::Write(LogInformation, "icinga", "Setting acknowledgement for host '" + host->GetName() + "'");
|
||||||
Service::Ptr service = host->GetHostCheckService();
|
Service::Ptr service = host->GetHostCheckService();
|
||||||
if (service) {
|
if (service) {
|
||||||
ObjectLock olock(service);
|
|
||||||
|
|
||||||
if (service->GetState() == StateOK)
|
if (service->GetState() == StateOK)
|
||||||
BOOST_THROW_EXCEPTION(invalid_argument("The host '" + arguments[0] + "' is OK."));
|
BOOST_THROW_EXCEPTION(invalid_argument("The host '" + arguments[0] + "' is OK."));
|
||||||
|
|
||||||
|
@ -558,8 +544,6 @@ void ExternalCommandProcessor::AcknowledgeHostProblemExpire(double, const vector
|
||||||
Logger::Write(LogInformation, "icinga", "Setting timed acknowledgement for host '" + host->GetName() + "'");
|
Logger::Write(LogInformation, "icinga", "Setting timed acknowledgement for host '" + host->GetName() + "'");
|
||||||
Service::Ptr service = host->GetHostCheckService();
|
Service::Ptr service = host->GetHostCheckService();
|
||||||
if (service) {
|
if (service) {
|
||||||
ObjectLock olock(service);
|
|
||||||
|
|
||||||
if (service->GetState() == StateOK)
|
if (service->GetState() == StateOK)
|
||||||
BOOST_THROW_EXCEPTION(invalid_argument("The host '" + arguments[0] + "' is OK."));
|
BOOST_THROW_EXCEPTION(invalid_argument("The host '" + arguments[0] + "' is OK."));
|
||||||
|
|
||||||
|
@ -576,11 +560,8 @@ void ExternalCommandProcessor::RemoveHostAcknowledgement(double, const vector<St
|
||||||
|
|
||||||
Logger::Write(LogInformation, "icinga", "Removing acknowledgement for host '" + host->GetName() + "'");
|
Logger::Write(LogInformation, "icinga", "Removing acknowledgement for host '" + host->GetName() + "'");
|
||||||
Service::Ptr service = host->GetHostCheckService();
|
Service::Ptr service = host->GetHostCheckService();
|
||||||
if (service) {
|
if (service)
|
||||||
ObjectLock olock(service);
|
|
||||||
|
|
||||||
service->ClearAcknowledgement();
|
service->ClearAcknowledgement();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ExternalCommandProcessor::EnableHostgroupSvcChecks(double, const vector<String>& arguments)
|
void ExternalCommandProcessor::EnableHostgroupSvcChecks(double, const vector<String>& arguments)
|
||||||
|
|
Loading…
Reference in New Issue