]> granicus.if.org Git - icinga2/commitdiff
Only create downtimes from non-paused ScheduledDowntime objects in HA enabled cluster... 6820/head
authorMichael Friedrich <michael.friedrich@icinga.com>
Tue, 4 Dec 2018 14:20:37 +0000 (15:20 +0100)
committerMichael Friedrich <michael.friedrich@icinga.com>
Tue, 4 Dec 2018 14:20:37 +0000 (15:20 +0100)
lib/icinga/scheduleddowntime.cpp

index c092ca9f0d7f12f83bda08dd7bf3fd780325706e..449507e0c06e26090e1288713487131bec47d83d 100644 (file)
@@ -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<ScheduledDowntime>()) {
-               if (sd->IsActive())
+               if (sd->IsActive() && !sd->IsPaused())
                        sd->CreateNextDowntime();
        }
 }
@@ -235,6 +236,13 @@ std::pair<double, double> 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()) {