* [Cluster-devel] [PATCH] cman: Make qdiskd exit if removed from configuration
@ 2011-01-12 14:59 Lon Hohberger
2011-01-12 15:29 ` Fabio M. Di Nitto
0 siblings, 1 reply; 3+ messages in thread
From: Lon Hohberger @ 2011-01-12 14:59 UTC (permalink / raw)
To: cluster-devel.redhat.com
If qdiskd was previously configured and a configuration
update removes the device & label fields, qdiskd will
now set its votes to 0, unregister from CMAN, and exit.
Correct logging about device registration and
configuration errors is also required in order for
users to understand what is going on when this happens
since the current logging from CMAN is a bit unclear.
This is a clean cherry-pick to the RHEL6 branch.
Resolves: rhbz#620679
Signed-off-by: Lon Hohberger <lhh@redhat.com>
---
cman/qdisk/main.c | 33 +++++++++++++++++++++++++++++++--
1 files changed, 31 insertions(+), 2 deletions(-)
diff --git a/cman/qdisk/main.c b/cman/qdisk/main.c
index 78dc3f0..4bb2b16 100644
--- a/cman/qdisk/main.c
+++ b/cman/qdisk/main.c
@@ -1430,13 +1430,36 @@ get_dynamic_config_data(qd_ctx *ctx, int ccsfd)
{
char *val = NULL;
char query[256];
- int old_votes = 0;
+ int old_votes = 0, found = 0;
if (ccsfd < 0)
return -1;
logt_print(LOG_DEBUG, "Loading dynamic configuration\n");
+ /* Check label / device presence. If it disappeared, we need to exit */
+ if (ctx->qc_config) {
+ val = NULL;
+ snprintf(query, sizeof(query), "/cluster/quorumd/@device");
+ found = ccs_get(ccsfd, query, &val);
+ if (found != 0) {
+ val = NULL;
+ snprintf(query, sizeof(query), "/cluster/quorumd/@label");
+ found = ccs_get(ccsfd, query, &val);
+ free(val);
+ }
+
+ if (found != 0) {
+ logt_print(LOG_NOTICE,
+ "Quorum device removed from the configuration."
+ " Shutting down.\n");
+ ctx->qc_votes = 0;
+ register_device(ctx);
+ _running = 0;
+ return -1;
+ }
+ }
+
/* Get status file */
snprintf(query, sizeof(query), "/cluster/quorumd/@status_file");
if (ccs_get(ccsfd, query, &val) == 0) {
@@ -1724,6 +1747,12 @@ get_static_config_data(qd_ctx *ctx, int ccsfd)
ctx->qc_label = val;
}
+ if (!ctx->qc_device && !ctx->qc_label) {
+ logt_print(LOG_ERR, "No device or label specified; cannot "
+ "run QDisk services.\n");
+ return -1;
+ }
+
/* Get min score */
snprintf(query, sizeof(query), "/cluster/quorumd/@min_score");
if (ccs_get(ccsfd, query, &val) == 0) {
@@ -1765,7 +1794,6 @@ get_static_config_data(qd_ctx *ctx, int ccsfd)
free(val);
}
-
return 0;
}
@@ -2049,6 +2077,7 @@ main(int argc, char **argv)
if (quorum_loop(&ctx, ni, MAX_NODES_DISK) == 0) {
/* Only clean up if we're exiting w/o error) */
+ logt_print(LOG_NOTICE, "Unregistering quorum device.\n");
cman_unregister_quorum_device(ctx.qc_cman_admin);
quorum_logout(&ctx);
}
--
1.7.1.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [Cluster-devel] [PATCH] cman: Make qdiskd exit if removed from configuration
@ 2011-01-12 15:08 Lon Hohberger
0 siblings, 0 replies; 3+ messages in thread
From: Lon Hohberger @ 2011-01-12 15:08 UTC (permalink / raw)
To: cluster-devel.redhat.com
If qdiskd was previously configured and a configuration
update removes the device & label fields, qdiskd will
now set its votes to 0, unregister from CMAN, and exit.
Correct logging about device registration and
configuration errors is also required in order for
users to understand what is going on when this happens
since the current logging from CMAN is a bit unclear.
This is a clean cherry-pick to the RHEL6 branch.
Resolves: rhbz#620679
Signed-off-by: Lon Hohberger <lhh@redhat.com>
---
cman/qdisk/main.c | 33 +++++++++++++++++++++++++++++++--
1 files changed, 31 insertions(+), 2 deletions(-)
diff --git a/cman/qdisk/main.c b/cman/qdisk/main.c
index 78dc3f0..4bb2b16 100644
--- a/cman/qdisk/main.c
+++ b/cman/qdisk/main.c
@@ -1430,13 +1430,36 @@ get_dynamic_config_data(qd_ctx *ctx, int ccsfd)
{
char *val = NULL;
char query[256];
- int old_votes = 0;
+ int old_votes = 0, found = 0;
if (ccsfd < 0)
return -1;
logt_print(LOG_DEBUG, "Loading dynamic configuration\n");
+ /* Check label / device presence. If it disappeared, we need to exit */
+ if (ctx->qc_config) {
+ val = NULL;
+ snprintf(query, sizeof(query), "/cluster/quorumd/@device");
+ found = ccs_get(ccsfd, query, &val);
+ if (found != 0) {
+ val = NULL;
+ snprintf(query, sizeof(query), "/cluster/quorumd/@label");
+ found = ccs_get(ccsfd, query, &val);
+ free(val);
+ }
+
+ if (found != 0) {
+ logt_print(LOG_NOTICE,
+ "Quorum device removed from the configuration."
+ " Shutting down.\n");
+ ctx->qc_votes = 0;
+ register_device(ctx);
+ _running = 0;
+ return -1;
+ }
+ }
+
/* Get status file */
snprintf(query, sizeof(query), "/cluster/quorumd/@status_file");
if (ccs_get(ccsfd, query, &val) == 0) {
@@ -1724,6 +1747,12 @@ get_static_config_data(qd_ctx *ctx, int ccsfd)
ctx->qc_label = val;
}
+ if (!ctx->qc_device && !ctx->qc_label) {
+ logt_print(LOG_ERR, "No device or label specified; cannot "
+ "run QDisk services.\n");
+ return -1;
+ }
+
/* Get min score */
snprintf(query, sizeof(query), "/cluster/quorumd/@min_score");
if (ccs_get(ccsfd, query, &val) == 0) {
@@ -1765,7 +1794,6 @@ get_static_config_data(qd_ctx *ctx, int ccsfd)
free(val);
}
-
return 0;
}
@@ -2049,6 +2077,7 @@ main(int argc, char **argv)
if (quorum_loop(&ctx, ni, MAX_NODES_DISK) == 0) {
/* Only clean up if we're exiting w/o error) */
+ logt_print(LOG_NOTICE, "Unregistering quorum device.\n");
cman_unregister_quorum_device(ctx.qc_cman_admin);
quorum_logout(&ctx);
}
--
1.7.1.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [Cluster-devel] [PATCH] cman: Make qdiskd exit if removed from configuration
2011-01-12 14:59 [Cluster-devel] [PATCH] cman: Make qdiskd exit if removed from configuration Lon Hohberger
@ 2011-01-12 15:29 ` Fabio M. Di Nitto
0 siblings, 0 replies; 3+ messages in thread
From: Fabio M. Di Nitto @ 2011-01-12 15:29 UTC (permalink / raw)
To: cluster-devel.redhat.com
ACK?ed
Fabio
On 1/12/2011 3:59 PM, Lon Hohberger wrote:
> If qdiskd was previously configured and a configuration
> update removes the device & label fields, qdiskd will
> now set its votes to 0, unregister from CMAN, and exit.
>
> Correct logging about device registration and
> configuration errors is also required in order for
> users to understand what is going on when this happens
> since the current logging from CMAN is a bit unclear.
>
> This is a clean cherry-pick to the RHEL6 branch.
>
> Resolves: rhbz#620679
>
> Signed-off-by: Lon Hohberger <lhh@redhat.com>
> ---
> cman/qdisk/main.c | 33 +++++++++++++++++++++++++++++++--
> 1 files changed, 31 insertions(+), 2 deletions(-)
>
> diff --git a/cman/qdisk/main.c b/cman/qdisk/main.c
> index 78dc3f0..4bb2b16 100644
> --- a/cman/qdisk/main.c
> +++ b/cman/qdisk/main.c
> @@ -1430,13 +1430,36 @@ get_dynamic_config_data(qd_ctx *ctx, int ccsfd)
> {
> char *val = NULL;
> char query[256];
> - int old_votes = 0;
> + int old_votes = 0, found = 0;
>
> if (ccsfd < 0)
> return -1;
>
> logt_print(LOG_DEBUG, "Loading dynamic configuration\n");
>
> + /* Check label / device presence. If it disappeared, we need to exit */
> + if (ctx->qc_config) {
> + val = NULL;
> + snprintf(query, sizeof(query), "/cluster/quorumd/@device");
> + found = ccs_get(ccsfd, query, &val);
> + if (found != 0) {
> + val = NULL;
> + snprintf(query, sizeof(query), "/cluster/quorumd/@label");
> + found = ccs_get(ccsfd, query, &val);
> + free(val);
> + }
> +
> + if (found != 0) {
> + logt_print(LOG_NOTICE,
> + "Quorum device removed from the configuration."
> + " Shutting down.\n");
> + ctx->qc_votes = 0;
> + register_device(ctx);
> + _running = 0;
> + return -1;
> + }
> + }
> +
> /* Get status file */
> snprintf(query, sizeof(query), "/cluster/quorumd/@status_file");
> if (ccs_get(ccsfd, query, &val) == 0) {
> @@ -1724,6 +1747,12 @@ get_static_config_data(qd_ctx *ctx, int ccsfd)
> ctx->qc_label = val;
> }
>
> + if (!ctx->qc_device && !ctx->qc_label) {
> + logt_print(LOG_ERR, "No device or label specified; cannot "
> + "run QDisk services.\n");
> + return -1;
> + }
> +
> /* Get min score */
> snprintf(query, sizeof(query), "/cluster/quorumd/@min_score");
> if (ccs_get(ccsfd, query, &val) == 0) {
> @@ -1765,7 +1794,6 @@ get_static_config_data(qd_ctx *ctx, int ccsfd)
> free(val);
> }
>
> -
> return 0;
> }
>
> @@ -2049,6 +2077,7 @@ main(int argc, char **argv)
>
> if (quorum_loop(&ctx, ni, MAX_NODES_DISK) == 0) {
> /* Only clean up if we're exiting w/o error) */
> + logt_print(LOG_NOTICE, "Unregistering quorum device.\n");
> cman_unregister_quorum_device(ctx.qc_cman_admin);
> quorum_logout(&ctx);
> }
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-01-12 15:29 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-01-12 14:59 [Cluster-devel] [PATCH] cman: Make qdiskd exit if removed from configuration Lon Hohberger
2011-01-12 15:29 ` Fabio M. Di Nitto
-- strict thread matches above, loose matches on Subject: below --
2011-01-12 15:08 Lon Hohberger
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).