Blob Blame History Raw
From 11ac2db8f55aa3e6858d6c1b2ab29ee36b612f03 Mon Sep 17 00:00:00 2001
From: Michele Baldessari <michele@acksyn.org>
Date: Tue, 17 Nov 2020 15:16:29 +0100
Subject: [PATCH] Fix delay_evacuate being unset

In Ie2fe784202d754eda38092479b1ab3ff4d02136a we added an additional
parameter to allow for setting a delay on the evacuation.
While it was tested with a specific delay, the case with a delay
being unset was missed.
Since OCF does not set the defaults from the metadata specification
for a parameter, we need to manually set it ourselves.

This fixes the following error:
Nov 17 13:00:21 database-1.foo.local pacemaker-execd     [185805] (log_op_output)    notice: nova-evacuate_monitor_10000[1038417] error output [ /usr/lib/ocf/resource.d/openstack/NovaEvacuate: line 228: [: !=: unary operator expected ]

Change-Id: I0b7aacd67b77bc44c67fe7da4c494807abbbb4f3
---

diff --git a/heartbeat/NovaEvacuate b/heartbeat/NovaEvacuate
index 596f520..8aa778c 100644
--- a/heartbeat/NovaEvacuate
+++ b/heartbeat/NovaEvacuate
@@ -359,6 +359,10 @@
         fence_options="${fence_options} -e ${OCF_RESKEY_endpoint_type}"
     fi
 
+    if [ -z "${OCF_RESKEY_evacuate_delay}" ]; then
+        OCF_RESKEY_evacuate_delay=0
+    fi
+
     if [ $rc != $OCF_SUCCESS ]; then
         exit $rc
     fi