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

[Linux-cluster] Patch: nodeid based cdpn for GFS shared root



Hi,

as posted before, we are using GFS for our diskless shared root cluster 
solutions. 

In this file system based ssi configurations all servers are “stateless” and 
share the same root partition and boot device in the SAN. Server, 
infrastructure and storage tier of the diskless shared root cluster can be 
scaled independently and incrementally. 

As we want to be independent from the servers hostnames at initrd boottime, we 
wrote a small GFS patch to use cmans nodeid parameter for a context dependent 
path name. 

I attached the patches to the mail. Note, that the GFS and cman patches are 
totally independent from each other and the cman patch is only for user 
information.

What do you think about nodeid cdpns ?

The Readme:
1. Reason for the patch
Create context dependent symbolic links (cdsl) dependent to cmans nodeid
E.g. ln -s @nodeid mynode

2. Contents
- cman-kernel-nodeid.patch
Applies against cman-kernel-2.6.9-41
- kernel-nodeid-symlink.patch
Applies against gfs-kernel-2.6.9-42

3. Changes:
3.1 cman-kernel
Added line to proc/cluster/status output. E.g: "Node ID: 4"
3.2 gfs-kernel
Added new parameter for cdsl symlink: @nodeid

Thanks,

Mark


-- 
Gruss / Regards,

Dipl.-Ing. Mark Hlawatschek
Phone: +49-89 121 409-55
http://www.atix.de/
http://www.open-sharedroot.org/

**
ATIX - Ges. fuer Informationstechnologie und Consulting mbH
Einsteinstr. 10 - 85716 Unterschleissheim - Germany
diff -Naur gfs-kernel-2.6.9-42.orig/src/gfs/Makefile gfs-kernel-2.6.9-42/src/gfs/Makefile
--- gfs-kernel-2.6.9-42.orig/src/gfs/Makefile	2005-09-16 22:09:27.000000000 +0200
+++ gfs-kernel-2.6.9-42/src/gfs/Makefile	2006-01-20 18:20:07.000000000 +0100
@@ -66,7 +66,7 @@
 	unlinked.o \
 	util.o
 
-EXTRA_CFLAGS += -I$(obj)
+EXTRA_CFLAGS += -I$(obj) -I/usr/include
 
 all:
 	rm -f linux lm_interface.h
diff -Naur gfs-kernel-2.6.9-42.orig/src/gfs/ops_inode.c gfs-kernel-2.6.9-42/src/gfs/ops_inode.c
--- gfs-kernel-2.6.9-42.orig/src/gfs/ops_inode.c	2005-09-16 22:09:27.000000000 +0200
+++ gfs-kernel-2.6.9-42/src/gfs/ops_inode.c	2006-01-23 23:12:02.000000000 +0100
@@ -24,6 +24,7 @@
 #include <linux/mm.h>
 #include <linux/xattr.h>
 #include <linux/posix_acl.h>
+#include <cluster/cnxman.h>
 
 #include "gfs.h"
 #include "acl.h"
@@ -120,6 +121,36 @@
 	return 0;
 }
 
+
+/** get_my_node_id - Returns the node id of the local node
+ *
+ *  Returns: the nodeid as int. If we are not part of a cluster
+ *          return 0.
+ */
+static int get_my_nodeid(void) 
+{
+	// we want to keep the information. 
+ 	static struct kcl_cluster_node *us=NULL;
+	
+	// if we already have our information, return it.
+	if (us) 
+		return us->node_id;
+	
+	// we are here, i.e. we need to collect information
+	us=kmalloc(sizeof (struct kcl_cluster_node), GFP_KERNEL);
+	if (kcl_get_node_by_nodeid(0,us)) 
+	{
+		// request failed. Cleaning up. Returning 0.
+		kfree(us);
+		us=NULL;
+		return 0;
+	}
+	// return collected data
+	return us->node_id;			
+}
+
+
+
 /**
  * lookup_cdpn_sub_at - Maybe lookup a Context Dependent Pathname
  * @sdp: the filesystem
@@ -145,6 +176,10 @@
 		new = lookup_one_len(system_utsname.nodename,
 				     parent,
 				     strlen(system_utsname.nodename));
+	else if (gfs_filecmp(&dentry->d_name, "@nodeid", 7)) 
+		new = lookup_one_len(buf,
+				     parent,
+				     sprintf(buf, "%s%i", "node", get_my_nodeid()));
 	else if (gfs_filecmp(&dentry->d_name, "@mach", 5))
 		new = lookup_one_len(system_utsname.machine,
 				     parent,
@@ -204,6 +239,11 @@
 		new = lookup_one_len(system_utsname.nodename,
 				     parent,
 				     strlen(system_utsname.nodename));
+	else if (gfs_filecmp(&dentry->d_name, "{nodeid}", 8))
+ 		new = lookup_one_len(buf,
+ 				     parent,
+ 				     sprintf(buf, "%s%i","node",
+ 				     get_my_nodeid()));	
 	else if (gfs_filecmp(&dentry->d_name, "{mach}", 6))
 		new = lookup_one_len(system_utsname.machine,
 				     parent,
diff -Naur cman-kernel-2.6.9-41.orig/src/proc.c cman-kernel-2.6.9-41/src/proc.c
--- cman-kernel-2.6.9-41.orig/src/proc.c	2005-11-28 17:20:39.000000000 +0100
+++ cman-kernel-2.6.9-41/src/proc.c	2006-01-23 23:20:15.000000000 +0100
@@ -149,6 +149,8 @@
 		 atomic_read(&use_count));
 
     c += sprintf(b+c, "Node name: %s\n", nodename);
+    
+    c += sprintf(b+c, "Node ID: %i\n", us->node_id);
 
     c += sprintf(b+c, "Node addresses: ");
     list_for_each_entry(node_addr, &us->addr_list, list) {

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