Skip to contentSkip to conversation

STABLE2 - fenced: update cman only after complete success (NEW COMMIT FORMAT)

Cluster-devel Fabio M. Di Nitto 1 participant 1 message Jul 24, 2008

lore
Share & tools
lore
#0 lore raw

Hi guys,

this is how the new commit format will look like.

The equivalent for the old one is:
http://www.redhat.com/archives/cluster-devel/2008-July/msg00185.html

so you can compare.

Please let me know ASAP if you think something needs to be changed.

This is only an example of a normal commits. Tags/Annotated Tags and deletetion look slightly different (delete are way less informative) but we can always tune them at a later time.

Fabio

--
I'm going to make him an offer he can't refuse.

---------- Forwarded message ----------
Date: Thu, 24 Jul 2008 04:56:30 +0000 (UTC)
From: Fabio M. Di Nitto <[email protected]>
To: [email protected]
Subject: STABLE2 - fenced: update cman only after complete success

Gitweb:        http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=ff934655dbb265150c7c9ae5e499645be26ab586
Commit:        ff934655dbb265150c7c9ae5e499645be26ab586
Parent:        8819aeb2ea8d74c23c4af717bec8d55f8fcdb263
Author:        David Teigland <[email protected]>
AuthorDate:    Wed Jul 23 12:57:49 2008 -0500
Committer:     David Teigland <[email protected]>
CommitterDate: Wed Jul 23 13:20:24 2008 -0500

fenced: update cman only after complete success

bz 456403

Problem discovered by Lon: tell cman about a completed fencing operation only after all devices within a method have completed successfully. Otherwise, if the first device succeeds, cman will be told the node is fenced, even if the second device fails. When fenced subsequently retries the fencing, it asks cman if fencing is complete, and is wrongly told it is (the purpose of asking cman is to avoid double fencing when a node is fenced externally via fence_node). So, a failed node can be considered successfully fenced when it hasn't been.

---
  fence/fenced/agent.c |   16 +++++++++-------
  1 files changed, 9 insertions(+), 7 deletions(-)
fence/fenced/agent.c +9 -7
index 86c5bde..033f447 100644
@@ -291,10 +291,13 @@ void update_cman(char *victim, char *method)
 
  int dispatch_fence_agent(char *victim, int force)
  {
+	char good_device[256];
  	char *method = NULL, *device = NULL;
  	char *victim_nodename = NULL;
  	int num_methods, num_devices, m, d, error = -1, cd;
 
+	strcpy(good_device, "UNKNOWN");
+
  	if (force)
  		cd = ccs_force_connect(NULL, 0);
  	else {
@@ -322,16 +325,13 @@ int dispatch_fence_agent(char *victim, int force)
  		if (error == -EBADR) {
  			syslog(LOG_INFO, "ccs connection timed out, "
  				"retrying\n");
-
  			while ((cd = ccs_connect()) < 0)
  				sleep(1);
-
  			error = get_method(cd, victim, m, &method);
-
+		}
+
  		if (error)
  			continue;
-		} else if (error)
-			continue;
 
  		/* if num_devices is zero we should return an error */
  		error = -1;
@@ -347,7 +347,7 @@ int dispatch_fence_agent(char *victim, int force)
  			if (error)
  				break;
 
-			update_cman(victim, device);
+			strncpy(good_device, device, sizeof(good_device));
  			free(device);
  			device = NULL;
  		}
@@ -358,8 +358,10 @@ int dispatch_fence_agent(char *victim, int force)
  			free(victim_nodename);
  		free(method);
 
-		if (!error)
+		if (!error) {
+			update_cman(victim, good_device);
  			break;
+		}
  	}
 
  	ccs_disconnect(cd);