Skip to contentSkip to conversation

tabled: print hostname always

PATCH In review Pete Zaitcev 1 participant 1 message Apr 18, 2010

lore
Share & tools
lore
#0 lore raw

PATCH 12/12 tabled: print hostname always

This code clearly was obsolete and wishful thinking. Let's just be simple. Most importantly print something that tells the sysadmin what node is the problem.

---
 server/storage.c |   19 +++----------------
 server/tabled.h  |    2 +-
 2 files changed, 4 insertions(+), 17 deletions(-)

commit 31dc52b7d177bd18a765a9fc407c2afdd103613e

Author: Master <[email protected]>
Date:   Sat Apr 17 20:42:24 2010 -0600

Print host name in storage retries.

server/storage.c +3 -16
index 1793fa0..a63012e 100644
@@ -489,26 +489,13 @@ void stor_add_node(uint32_t nid, const char *hostname, const char *portstr,
 int stor_node_check(struct storage_node *stn)
 {
 	struct st_client *stc;
-	char host[41];
-	char port[6];
 	int rc;
 
 	rc = stor_new_stc(stn, &stc);
 	if (rc < 0) {
-		if (rc == -EINVAL) {
-			if (getnameinfo((struct sockaddr *) &stn->addr,
-					stn->alen, host, sizeof(host),
-					port, sizeof(port),
-					NI_NUMERICHOST|NI_NUMERICSERV) == 0) {
-				applog(LOG_INFO, "Error connecting to chunkd"
-				       " on host %s port %s",
-				       host, port);
-			} else {
-				applog(LOG_INFO, "Error connecting to chunkd");
-			}
-		} else {
-			applog(LOG_INFO, "Error %d connecting to chunkd", rc);
-		}
+		applog(LOG_INFO,
+		       "Error %d connecting to chunkd on host %s",
+		       rc, stn->hostname);
 		return -1;
 	}
 
server/tabled.h +1 -1
index eced4b6..75fa147 100644
@@ -96,7 +96,7 @@ struct storage_node {
 
 	unsigned		alen;
 	struct sockaddr_in6	addr;
-	char *hostname;		/* Only used because stc_new is overly smart. */
+	char			*hostname;
 
 	int ref;		/* number of open_chunk or other */
 };