Re: [PATCH] reboot flag + score fix

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

 



This implements a reboot flag which must be explicitly disabled.  Upon a
transition from majority score to less than majority score, a node will
reboot unless the reboot flag is explicitly set to 0 in the cluster
configuration.  This makes qdiskd operate consistently with section 2.2
in the manual page.

-- Lon
Index: man/qdisk.5
===================================================================
RCS file: /cvs/cluster/cluster/cman/man/qdisk.5,v
retrieving revision 1.1.2.1
diff -u -r1.1.2.1 qdisk.5
--- man/qdisk.5	21 Jul 2006 17:53:08 -0000	1.1.2.1
+++ man/qdisk.5	13 Sep 2006 22:22:21 -0000
@@ -236,6 +236,13 @@
 is the sum-total of all of defined heuristics' \fIscore\fP attribute.
 
 .in 9
+\fIreboot\fP\fB="\fP1\fB"\fP
+.in 12
+If set to 0 (off), qdiskd will *not* reboot after a negative transition
+as a result in a change in score (see section 2.2).  The default for
+this value is 1 (on).
+
+.in 9
 \fIdevice\fP\fB="\fP/dev/sda1\fB"\fP
 .in 12
 This is the device the quorum daemon will use.  This device must be the
Index: qdisk/disk.h
===================================================================
RCS file: /cvs/cluster/cluster/cman/qdisk/disk.h,v
retrieving revision 1.1.2.2
diff -u -r1.1.2.2 disk.h
--- qdisk/disk.h	23 Jun 2006 16:01:02 -0000	1.1.2.2
+++ qdisk/disk.h	13 Sep 2006 22:22:22 -0000
@@ -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;
Index: qdisk/main.c
===================================================================
RCS file: /cvs/cluster/cluster/cman/qdisk/main.c,v
retrieving revision 1.1.2.2
diff -u -r1.1.2.2 main.c
--- qdisk/main.c	23 Jun 2006 16:01:02 -0000	1.1.2.2
+++ qdisk/main.c	13 Sep 2006 22:22:22 -0000
@@ -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,
--
Linux-cluster mailing list
Linux-cluster@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/linux-cluster

[Index of Archives]     [Corosync Cluster Engine]     [GFS]     [Linux Virtualization]     [Centos Virtualization]     [Centos]     [Linux RAID]     [Fedora Users]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite Camping]

  Powered by Linux