|
 |
0240e4 |
From f289115b5a3693934bb3140725e2dc9aef3a6a13 Mon Sep 17 00:00:00 2001
|
|
 |
0240e4 |
From: Ken Gaillot <kgaillot@redhat.com>
|
|
 |
0240e4 |
Date: Tue, 22 Dec 2015 12:24:14 -0600
|
|
 |
0240e4 |
Subject: [PATCH] Refactor: lrmd: handle shutdown a little more cleanly
|
|
 |
0240e4 |
|
|
 |
0240e4 |
---
|
|
 |
0240e4 |
lrmd/main.c | 33 +++++++++++++++++----------------
|
|
 |
0240e4 |
1 file changed, 17 insertions(+), 16 deletions(-)
|
|
 |
0240e4 |
|
|
 |
0240e4 |
diff --git a/lrmd/main.c b/lrmd/main.c
|
|
 |
0240e4 |
index a3b7929..73519e2 100644
|
|
 |
0240e4 |
--- a/lrmd/main.c
|
|
 |
0240e4 |
+++ b/lrmd/main.c
|
|
 |
0240e4 |
@@ -231,9 +231,23 @@ void
|
|
 |
0240e4 |
lrmd_shutdown(int nsig)
|
|
 |
0240e4 |
{
|
|
 |
0240e4 |
crm_info("Terminating with %d clients", crm_hash_table_size(client_connections));
|
|
 |
0240e4 |
+
|
|
 |
0240e4 |
+ if (stonith_api) {
|
|
 |
0240e4 |
+ stonith_api->cmds->remove_notification(stonith_api, T_STONITH_NOTIFY_DISCONNECT);
|
|
 |
0240e4 |
+ stonith_api->cmds->disconnect(stonith_api);
|
|
 |
0240e4 |
+ stonith_api_delete(stonith_api);
|
|
 |
0240e4 |
+ }
|
|
 |
0240e4 |
if (ipcs) {
|
|
 |
0240e4 |
mainloop_del_ipc_server(ipcs);
|
|
 |
0240e4 |
}
|
|
 |
0240e4 |
+
|
|
 |
0240e4 |
+#ifdef ENABLE_PCMK_REMOTE
|
|
 |
0240e4 |
+ lrmd_tls_server_destroy();
|
|
 |
0240e4 |
+ ipc_proxy_cleanup();
|
|
 |
0240e4 |
+#endif
|
|
 |
0240e4 |
+
|
|
 |
0240e4 |
+ crm_client_cleanup();
|
|
 |
0240e4 |
+ g_hash_table_destroy(rsc_list);
|
|
 |
0240e4 |
crm_exit(pcmk_ok);
|
|
 |
0240e4 |
}
|
|
 |
0240e4 |
|
|
 |
0240e4 |
@@ -255,7 +269,6 @@ static struct crm_option long_options[] = {
|
|
 |
0240e4 |
int
|
|
 |
0240e4 |
main(int argc, char **argv)
|
|
 |
0240e4 |
{
|
|
 |
0240e4 |
- int rc = 0;
|
|
 |
0240e4 |
int flag = 0;
|
|
 |
0240e4 |
int index = 0;
|
|
 |
0240e4 |
const char *option = NULL;
|
|
 |
0240e4 |
@@ -349,19 +362,7 @@ main(int argc, char **argv)
|
|
 |
0240e4 |
crm_info("Starting");
|
|
 |
0240e4 |
g_main_run(mainloop);
|
|
 |
0240e4 |
|
|
 |
0240e4 |
- mainloop_del_ipc_server(ipcs);
|
|
 |
0240e4 |
-#ifdef ENABLE_PCMK_REMOTE
|
|
 |
0240e4 |
- lrmd_tls_server_destroy();
|
|
 |
0240e4 |
- ipc_proxy_cleanup();
|
|
 |
0240e4 |
-#endif
|
|
 |
0240e4 |
- crm_client_cleanup();
|
|
 |
0240e4 |
-
|
|
 |
0240e4 |
- g_hash_table_destroy(rsc_list);
|
|
 |
0240e4 |
-
|
|
 |
0240e4 |
- if (stonith_api) {
|
|
 |
0240e4 |
- stonith_api->cmds->disconnect(stonith_api);
|
|
 |
0240e4 |
- stonith_api_delete(stonith_api);
|
|
 |
0240e4 |
- }
|
|
 |
0240e4 |
-
|
|
 |
0240e4 |
- return rc;
|
|
 |
0240e4 |
+ /* should never get here */
|
|
 |
0240e4 |
+ lrmd_shutdown(SIGTERM);
|
|
 |
0240e4 |
+ return pcmk_ok;
|
|
 |
0240e4 |
}
|
|
 |
0240e4 |
--
|
|
 |
0240e4 |
1.8.3.1
|
|
 |
0240e4 |
|