From: Michael Friedrich Date: Tue, 4 Dec 2018 14:20:37 +0000 (+0100) Subject: Only create downtimes from non-paused ScheduledDowntime objects in HA enabled cluster... X-Git-Tag: v2.11.0-rc1~275^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=fd9b2dece1dfa481d1afe22271b5f1005a4a3b0e;p=icinga2 Only create downtimes from non-paused ScheduledDowntime objects in HA enabled cluster zones --- diff --git a/lib/icinga/scheduleddowntime.cpp b/lib/icinga/scheduleddowntime.cpp index c092ca9f0..449507e0c 100644 --- a/lib/icinga/scheduleddowntime.cpp +++ b/lib/icinga/scheduleddowntime.cpp @@ -95,13 +95,14 @@ void ScheduledDowntime::Start(bool runtimeCreated) l_Timer->Start(); }); - Utility::QueueAsyncCallback(std::bind(&ScheduledDowntime::CreateNextDowntime, this)); + if (!IsPaused()) + Utility::QueueAsyncCallback(std::bind(&ScheduledDowntime::CreateNextDowntime, this)); } void ScheduledDowntime::TimerProc() { for (const ScheduledDowntime::Ptr& sd : ConfigType::GetObjectsByType()) { - if (sd->IsActive()) + if (sd->IsActive() && !sd->IsPaused()) sd->CreateNextDowntime(); } } @@ -235,6 +236,13 @@ std::pair ScheduledDowntime::FindNextSegment() void ScheduledDowntime::CreateNextDowntime() { + /* HA enabled zones. */ + if (IsActive() && IsPaused()) { + Log(LogNotice, "Checkable") + << "Skipping downtime creation for HA-paused Scheduled Downtime object '" << GetName() << "'"; + return; + } + double minEnd = 0; for (const Downtime::Ptr& downtime : GetCheckable()->GetDowntimes()) {