rgmanager: Add 'disabled' configuration option [RHEL6]
PATCH 1/1 rgmanager: Add 'disabled' configuration option [RHEL6]
The option turns off rgmanager, which will shut down if running and cause rgmanager to refuse to start if starting up.
Resolves: rhbz#723925
Signed-off-by Lon Hohberger <[email protected]>
--- rgmanager/src/daemons/main.c | 51 +++++++++++++++++++++++++++++++++++++++++- 1 files changed, 50 insertions(+), 1 deletions(-)
rgmanager/src/daemons/main.c +50 -1
@@ -749,6 +749,14 @@ event_loop(msgctx_t *localctx, msgctx_t *clusterctx)if (need_reconfigure) { need_reconfigure =0 ;configure_rgmanager (-1 ,0 ,NULL ); + +/* +* A shutdown during reconfiguration would slow down +* the exit request, so it's pointless to run the +* deltas at this point +*/ +if (shutdown_pending) +return 0 ;config_event_q ();return 0 ; }
@@ -782,7 +790,6 @@ cleanup(msgctx_t *clusterctx) } -static void statedump (int __attribute__ ((unused)) sig) {
@@ -790,6 +797,36 @@ statedump(int __attribute__ ((unused)) sig) } +static int +rgmanager_disabled (int ccsfd) +{ +char *v; +int disabled =0 ; +int internal; + +if (ccsfd <0 ) { + internal =1 ; + ccsfd =ccs_force_connect (NULL ,0 ); +if (ccsfd <0 ) +return -1 ; + } + +if (ccs_get (ccsfd,"/cluster/rm/@disabled" , &v) ==0 ) { +if (atoi (v) ==1 ) { + disabled =1 ; + shutdown_pending =1 ; +logt_print (LOG_NOTICE ,"Resource Group Manager Disabled\n" ); + } +free (v); + } + +if (internal) +ccs_disconnect (ccsfd); + +return disabled; +} + +/* * Configure logging based on data in cluster.conf */
@@ -810,6 +847,8 @@ configure_rgmanager(int ccsfd, int dbg, int *token_secs)setup_logging (ccsfd); +rgmanager_disabled (ccsfd); +if (token_secs &&ccs_get (ccsfd,"/cluster/totem/@token" , &v) ==0 ) { tmp =atoi (v);if (tmp >=1000 ) {
@@ -982,6 +1021,13 @@ main(int argc, char **argv) debug =1 ; } +/* If we're disabled in the configuration, don't fork */ +if (rgmanager_disabled (-1 ) >0 ) { +fprintf (stderr, +"rgmanager disabled in configuration; not starting\n" ); +return 2 ; + } +if (!foreground && (geteuid () ==0 )) {daemon_init (argv[0 ]);if (wd && !debug && !watchdog_init ())
@@ -1040,6 +1086,9 @@ main(int argc, char **argv)*/ xmlInitParser ();configure_rgmanager (-1 , debug, &cluster_timeout); +if (shutdown_pending ==1 ) + goto out_ls; +logt_print (LOG_NOTICE ,"Resource Group Manager Starting\n" );if (rgm_dbus_notify &&rgm_dbus_init () !=0 ) {
Signature · 1 line
1.7.3.4
PATCH 1/1 config: Add 'disabled' flag to rm element [RHEL6]
Related: rhbz#723925
Signed-off-by Lon Hohberger <[email protected]>
--- config/tools/xml/cluster.rng.in.head | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-)
config/tools/xml/cluster.rng.in.head +5 -0
@@ -869,6 +869,11 @@ To validate your cluster.conf against this schema, run: of the following keywords: auth, authpriv, cron, daemon, kern, lpr, mail, news, syslog, user, uucp and local0 through local7"/> </optional> + <optional> + <attribute name="disabled" rha:description="Disables rgmanager entirely if set to 1. Do not set unless you really mean it." rha:sample=""> + <data type="integer"/> + </attribute> + </optional> <interleave> <optional> <element name="failoverdomains" rha:description="Failover domain definitions.">
Signature · 1 line
1.7.3.4
PATCH 1/1 rgmanager: Add 'disabled' configuration option [RHEL6]
In reply to Lon HohbergerBoth patches look good to me (option and schema update)
Fabio
Quoted 108 lines · Lon Hohberger
The option turns off rgmanager, which will shut down if running and cause rgmanager to refuse to start if starting up.
Resolves: rhbz#723925
Signed-off-by Lon Hohberger <[email protected]>--- rgmanager/src/daemons/main.c | 51 +++++++++++++++++++++++++++++++++++++++++- 1 files changed, 50 insertions(+), 1 deletions(-)rgmanager/src/daemons/main.c +50
-1@@ -749,6 +749,14 @@ event_loop(msgctx_t *localctx, msgctx_t *clusterctx)if (need_reconfigure) { need_reconfigure =0 ;configure_rgmanager (-1 ,0 ,NULL ); + +/* +* A shutdown during reconfiguration would slow down +* the exit request, so it's pointless to run the +* deltas at this point +*/ +if (shutdown_pending) +return 0 ;config_event_q ();return 0 ; }@@ -782,7 +790,6 @@ cleanup(msgctx_t *clusterctx) } -static void statedump (int __attribute__ ((unused)) sig) {@@ -790,6 +797,36 @@ statedump(int __attribute__ ((unused)) sig) } +static int +rgmanager_disabled (int ccsfd) +{ +char *v; +int disabled =0 ; +int internal; + +if (ccsfd <0 ) { + internal =1 ; + ccsfd =ccs_force_connect (NULL ,0 ); +if (ccsfd <0 ) +return -1 ; + } + +if (ccs_get (ccsfd,"/cluster/rm/@disabled" , &v) ==0 ) { +if (atoi (v) ==1 ) { + disabled =1 ; + shutdown_pending =1 ; +logt_print (LOG_NOTICE ,"Resource Group Manager Disabled\n" ); + } +free (v); + } + +if (internal) +ccs_disconnect (ccsfd); + +return disabled; +} + +/* * Configure logging based on data in cluster.conf */ @@ -810,6 +847,8 @@ configure_rgmanager(int ccsfd, int dbg, int *token_secs)setup_logging (ccsfd); +rgmanager_disabled (ccsfd); +if (token_secs &&ccs_get (ccsfd,"/cluster/totem/@token" , &v) ==0 ) { tmp =atoi (v);if (tmp >=1000 ) {@@ -982,6 +1021,13 @@ main(int argc, char **argv) debug =1 ; } +/* If we're disabled in the configuration, don't fork */ +if (rgmanager_disabled (-1 ) >0 ) { +fprintf (stderr, +"rgmanager disabled in configuration; not starting\n" ); +return 2 ; + } +if (!foreground && (geteuid () ==0 )) {daemon_init (argv[0 ]);if (wd && !debug && !watchdog_init ())@@ -1040,6 +1086,9 @@ main(int argc, char **argv)*/ xmlInitParser ();configure_rgmanager (-1 , debug, &cluster_timeout); +if (shutdown_pending ==1 ) + goto out_ls; +logt_print (LOG_NOTICE ,"Resource Group Manager Starting\n" );if (rgm_dbus_notify &&rgm_dbus_init () !=0 ) {