* [Cluster-devel] [PATCH] rgmanager: Add 'disabled' configuration option [RHEL6]
@ 2011-08-01 20:39 Lon Hohberger
2011-08-01 20:39 ` [Cluster-devel] [PATCH] config: Add 'disabled' flag to rm element [RHEL6] Lon Hohberger
2011-08-02 6:57 ` [Cluster-devel] [PATCH] rgmanager: Add 'disabled' configuration option [RHEL6] Fabio M. Di Nitto
0 siblings, 2 replies; 3+ messages in thread
From: Lon Hohberger @ 2011-08-01 20:39 UTC (permalink / raw)
To: cluster-devel.redhat.com
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 <lhh@redhat.com>
---
rgmanager/src/daemons/main.c | 51 +++++++++++++++++++++++++++++++++++++++++-
1 files changed, 50 insertions(+), 1 deletions(-)
diff --git a/rgmanager/src/daemons/main.c b/rgmanager/src/daemons/main.c
index 46ddf18..4e12c68 100644
--- a/rgmanager/src/daemons/main.c
+++ b/rgmanager/src/daemons/main.c
@@ -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) {
--
1.7.3.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [Cluster-devel] [PATCH] config: Add 'disabled' flag to rm element [RHEL6]
2011-08-01 20:39 [Cluster-devel] [PATCH] rgmanager: Add 'disabled' configuration option [RHEL6] Lon Hohberger
@ 2011-08-01 20:39 ` Lon Hohberger
2011-08-02 6:57 ` [Cluster-devel] [PATCH] rgmanager: Add 'disabled' configuration option [RHEL6] Fabio M. Di Nitto
1 sibling, 0 replies; 3+ messages in thread
From: Lon Hohberger @ 2011-08-01 20:39 UTC (permalink / raw)
To: cluster-devel.redhat.com
Related: rhbz#723925
Signed-off-by: Lon Hohberger <lhh@redhat.com>
---
config/tools/xml/cluster.rng.in.head | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/config/tools/xml/cluster.rng.in.head b/config/tools/xml/cluster.rng.in.head
index f9606ad..7696533 100644
--- a/config/tools/xml/cluster.rng.in.head
+++ b/config/tools/xml/cluster.rng.in.head
@@ -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.">
--
1.7.3.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [Cluster-devel] [PATCH] rgmanager: Add 'disabled' configuration option [RHEL6]
2011-08-01 20:39 [Cluster-devel] [PATCH] rgmanager: Add 'disabled' configuration option [RHEL6] Lon Hohberger
2011-08-01 20:39 ` [Cluster-devel] [PATCH] config: Add 'disabled' flag to rm element [RHEL6] Lon Hohberger
@ 2011-08-02 6:57 ` Fabio M. Di Nitto
1 sibling, 0 replies; 3+ messages in thread
From: Fabio M. Di Nitto @ 2011-08-02 6:57 UTC (permalink / raw)
To: cluster-devel.redhat.com
Both patches look good to me (option and schema update)
Fabio
On 8/1/2011 10:39 PM, Lon Hohberger wrote:
> 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 <lhh@redhat.com>
> ---
> rgmanager/src/daemons/main.c | 51 +++++++++++++++++++++++++++++++++++++++++-
> 1 files changed, 50 insertions(+), 1 deletions(-)
>
> diff --git a/rgmanager/src/daemons/main.c b/rgmanager/src/daemons/main.c
> index 46ddf18..4e12c68 100644
> --- a/rgmanager/src/daemons/main.c
> +++ b/rgmanager/src/daemons/main.c
> @@ -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) {
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-08-02 6:57 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-01 20:39 [Cluster-devel] [PATCH] rgmanager: Add 'disabled' configuration option [RHEL6] Lon Hohberger
2011-08-01 20:39 ` [Cluster-devel] [PATCH] config: Add 'disabled' flag to rm element [RHEL6] Lon Hohberger
2011-08-02 6:57 ` [Cluster-devel] [PATCH] rgmanager: Add 'disabled' configuration option [RHEL6] Fabio M. Di Nitto
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).