[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Cluster-devel] cluster/cman/qdisk disk.h main.c



CVSROOT:	/cvs/cluster
Module name:	cluster
Branch: 	RHEL4
Changes by:	lhh sourceware org	2006-10-05 20:30:22

Modified files:
	cman/qdisk     : disk.h main.c 

Log message:
	Fix #206149

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/cman/qdisk/disk.h.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.1.2.2&r2=1.1.2.3
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/cman/qdisk/main.c.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.1.2.2&r2=1.1.2.3

--- cluster/cman/qdisk/disk.h	2006/06/23 16:01:02	1.1.2.2
+++ cluster/cman/qdisk/disk.h	2006/10/05 20:30:21	1.1.2.3
@@ -66,6 +66,11 @@
 } disk_state_flag_t;
 
 
+typedef enum {
+	RF_REBOOT = 0x1		/* Reboot if we go from master->none */
+} run_flag_t;
+
+
 /* RHEL 2.1 / RHCS3 old magic numbers */
 #define HEADER_MAGIC_OLD	0x39119FCD	/* partition header */
 #define STATE_MAGIC_OLD		0xF1840DCE	/* Status block */
@@ -235,7 +240,7 @@
 	disk_node_state_t qc_disk_status;
 	disk_node_state_t qc_status;
 	int qc_master;		/* Master?! */
-	int qc_unused;
+	run_flag_t qc_flags;
 	cman_handle_t qc_ch;
 	char *qc_device;
 	char *qc_label;
--- cluster/cman/qdisk/main.c	2006/06/23 16:01:02	1.1.2.2
+++ cluster/cman/qdisk/main.c	2006/10/05 20:30:21	1.1.2.3
@@ -664,7 +664,7 @@
 
 		score_req = ctx->qc_scoremin;
 		if (score_req <= 0)
-			score_req = ((score_max + 1) / 2);
+			score_req = (score_max/2 + 1);
 
 		if (score < score_req) {
 			clear_bit(mask, (ctx->qc_my_id-1), sizeof(mask));
@@ -679,7 +679,8 @@
 				++msg.m_seq;
 				bid_pending = 0;
 				cman_poll_quorum_device(ctx->qc_ch, 0);
-				/* reboot??? */
+				if (ctx->qc_flags & RF_REBOOT)
+					reboot(RB_AUTOBOOT);
 			}
 		}  else {
 			set_bit(mask, (ctx->qc_my_id-1), sizeof(mask));
@@ -827,6 +828,7 @@
 	ctx->qc_interval = 1;
 	ctx->qc_tko = 10;
 	ctx->qc_scoremin = 0;
+	ctx->qc_flags = RF_REBOOT;
 
 	/* Get log log_facility */
 	snprintf(query, sizeof(query), "/cluster/quorumd/@log_facility");
@@ -901,6 +903,15 @@
 			ctx->qc_scoremin = 0;
 	}
 
+	/* Get reboot flag for when we transition -> offline */
+	/* default = on, so, 0 to turn off */
+	snprintf(query, sizeof(query), "/cluster/quorumd/@reboot");
+	if (ccs_get(ccsfd, query, &val) == 0) {
+		if (!atoi(val))
+			ctx->qc_flags &= ~RF_REBOOT;
+		free(val);
+	}
+
 	*cfh = configure_heuristics(ccsfd, h, maxh);
 
 	clulog(LOG_DEBUG,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]