Gitweb:
http://git.fedorahosted.org/git/?p=dlm.git;a=commitdiff;h=fb61984c9388cbb...
Commit: fb61984c9388cbbcc02c6a09c09948b21320412d
Parent: 090026f33031c1b46dfe3e2e077c6cb0aa149378
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Tue Apr 1 11:53:20 2014 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Tue Apr 1 11:58:03 2014 -0500
dlm_stonith: use kick_helper result
Don't depend on the fence time being later than
the fail time after using the kick helper function.
Make fail_time optional.
Signed-off-by: David Teigland <teigland(a)redhat.com>
---
fence/dlm_stonith.8 | 7 +++----
fence/stonith_helper.c | 22 ++++++----------------
2 files changed, 9 insertions(+), 20 deletions(-)
diff --git a/fence/dlm_stonith.8 b/fence/dlm_stonith.8
index 14993d9..36b9d67 100644
--- a/fence/dlm_stonith.8
+++ b/fence/dlm_stonith.8
@@ -26,10 +26,9 @@ The nodeid of the target node. (stdin key is "node")
.BI \-t " fail_time"
-The wall time at which the target node failed. The wall time at which the
-node is fenced must be later than this for fencing to succeed. (stdin key
-is "fail_time") For "wall time" see
-.BR time (2).
+The time(2) at which the target node failed.
+If this option is provided, and the last fencing time is
+later, then a new fencing request is not made.
.SH SEE ALSO
.BR dlm_controld (8),
diff --git a/fence/stonith_helper.c b/fence/stonith_helper.c
index c2821ec..3a0768a 100644
--- a/fence/stonith_helper.c
+++ b/fence/stonith_helper.c
@@ -56,11 +56,6 @@ static int get_options(int argc, char *argv[])
return -1;
}
- if (!fail_time) {
- fprintf(stderr, "no fail_time\n");
- return -1;
- }
-
return 0;
}
@@ -73,9 +68,11 @@ int main(int argc, char *argv[])
if (rv)
return rv;
- t = stonith_api_time_helper(nodeid, 0);
- if (t >= fail_time)
- return 0;
+ if (fail_time) {
+ t = stonith_api_time_helper(nodeid, 0);
+ if (t >= fail_time)
+ return 0;
+ }
rv = stonith_api_kick_helper(nodeid, 300, 0);
if (rv) {
@@ -85,13 +82,6 @@ int main(int argc, char *argv[])
return rv;
}
- while (1) {
- t = stonith_api_time_helper(nodeid, 0);
- if (t >= fail_time)
- return 0;
- sleep(1);
- }
-
- return -1;
+ return 0;
}