From 78e470996d4b541acdfa248e4d950a87f4dca598 Mon Sep 17 00:00:00 2001 From: Michael Friedrich Date: Tue, 4 Dec 2018 15:20:37 +0100 Subject: [PATCH] Only create downtimes from non-paused ScheduledDowntime objects in HA enabled cluster zones --- lib/icinga/scheduleddowntime.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/lib/icinga/scheduleddowntime.cpp b/lib/icinga/scheduleddowntime.cpp index 6436487b4..978115e61 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(); } } @@ -167,6 +168,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; + } + for (const Downtime::Ptr& downtime : GetCheckable()->GetDowntimes()) { if (downtime->GetScheduledBy() != GetName() || downtime->GetStartTime() < Utility::GetTime()) @@ -261,4 +269,4 @@ void ScheduledDowntime::ValidateChildOptions(const Lazy& lvalue, const Va } catch (const std::exception&) { BOOST_THROW_EXCEPTION(ValidationError(this, { "child_options" }, "Invalid child_options specified")); } -} \ No newline at end of file +} -- 2.40.0