[Ocfs2-tools-commits] jlbec commits r514 - in trunk: clusterbo libo2cb/include libocfs2

svn-commits at oss.oracle.com svn-commits at oss.oracle.com
Mon Dec 27 19:06:13 CST 2004


Author: jlbec
Date: 2004-12-27 19:06:11 -0600 (Mon, 27 Dec 2004)
New Revision: 514

Modified:
   trunk/clusterbo/o2cb_config.c
   trunk/clusterbo/o2cb_ctl.c
   trunk/libo2cb/include/ocfs2_heartbeat.h
   trunk/libo2cb/include/ocfs2_nodemanager.h
   trunk/libocfs2/extent_map.c
Log:

o o2cb_ctl can now make a cluster online!



Modified: trunk/clusterbo/o2cb_config.c
===================================================================
--- trunk/clusterbo/o2cb_config.c	2004-12-27 19:38:57 UTC (rev 513)
+++ trunk/clusterbo/o2cb_config.c	2004-12-28 01:06:11 UTC (rev 514)
@@ -110,7 +110,7 @@
     addr = j_config_get_attribute(cfs, "ip_address");
     if (!addr || !*addr)
         goto out_error;
-    rc = o2cb_node_set_ip_string(node, name);
+    rc = o2cb_node_set_ip_string(node, addr);
     if (rc)
         goto out_error;
 
@@ -141,15 +141,15 @@
     gulong val;
     gchar *count, *ptr;
     JIterator *iter;
-    JConfigStanza *cfs;
+    JConfigStanza *c_cfs, *n_cfs;
     JConfigMatch match = {J_CONFIG_MATCH_VALUE, "cluster", NULL};
 
-    cfs = j_config_get_stanza_nth(cf, "cluster", 0);
-    if (!cfs)
+    c_cfs = j_config_get_stanza_nth(cf, "cluster", 0);
+    if (!c_cfs)
         return -ENOENT;
 
     rc = -ENOENT;
-    match.value = j_config_get_attribute(cfs, "name");
+    match.value = j_config_get_attribute(c_cfs, "name");
     if (!match.value && !*match.value)
         goto out_error;
 
@@ -165,8 +165,8 @@
     rc = 0;
     while (j_iterator_has_more(iter))
     {
-        cfs = (JConfigStanza *)j_iterator_get_next(iter);
-        rc = o2cb_config_fill_node(config, cfs);
+        n_cfs = (JConfigStanza *)j_iterator_get_next(iter);
+        rc = o2cb_config_fill_node(config, n_cfs);
         if (rc)
             break;
     }
@@ -176,7 +176,7 @@
         goto out_error;
 
     rc = -EINVAL;
-    count = j_config_get_attribute(cfs, "node_count");
+    count = j_config_get_attribute(c_cfs, "node_count");
     if (!count || !*count)
         goto out_error;
     val = strtoul(count, &ptr, 10);
@@ -244,10 +244,29 @@
     gchar *val;
     JConfigStanza *cfs;
 
+    cfs = j_config_get_stanza_nth(cf, "cluster", 0);
+    if (!cfs)
+        return -EINVAL;
+
+    val = j_config_get_attribute(cfs, "name");
+    if (!val)
+        return -ENOMEM;
+    if (!*val)
+    {
+        g_free(val);
+        return -EINVAL;
+    }
+
     cfs = j_config_add_stanza(cf, "node");
     if (!cfs)
+    {
+        g_free(val);
         return -ENOMEM;
+    }
 
+    j_config_set_attribute(cfs, "cluster", val);
+    g_free(val);
+
     j_config_set_attribute(cfs, "name", node->n_name);
     j_config_set_attribute(cfs, "ip_address", node->n_addr);
 

Modified: trunk/clusterbo/o2cb_ctl.c
===================================================================
--- trunk/clusterbo/o2cb_ctl.c	2004-12-27 19:38:57 UTC (rev 513)
+++ trunk/clusterbo/o2cb_ctl.c	2004-12-28 01:06:11 UTC (rev 514)
@@ -586,6 +586,7 @@
 
 static gint online_cluster(O2CBContext *ctxt)
 {
+    errcode_t ret;
     gint rc;
     gchar *name, *node_name;
     JIterator *iter;
@@ -630,9 +631,13 @@
     if (rc)
         goto out_error;
 
-    rc = o2cb_set_cluster_name(name);
-    if (rc)
+    rc = -EIO;
+    ret = o2cb_set_cluster_name(name);
+    if (ret)
+    {
+        com_err(PROGNAME, ret, "while setting cluster name");
         goto out_error;
+    }
 
     l = list;
     while (l)
@@ -674,7 +679,7 @@
 
 static gint run_change_cluster(O2CBContext *ctxt)
 {
-    gint rc;
+    gint rc = 0;
     const gchar *val;
 
     if (attr_set(ctxt, "name"))
@@ -705,7 +710,7 @@
             rc = offline_cluster(ctxt);
     }
 
-    return 0;
+    return rc;
 }  /* run_change_cluster() */
 
 static gint run_change(O2CBContext *ctxt)
@@ -773,6 +778,7 @@
     int rc;
     O2CBContext ctxt = {0, };
 
+    initialize_o2cb_error_table();
     rc = parse_options(argc, argv, &ctxt);
     if (rc)
         print_usage(rc);

Modified: trunk/libo2cb/include/ocfs2_heartbeat.h
===================================================================
--- trunk/libo2cb/include/ocfs2_heartbeat.h	2004-12-27 19:38:57 UTC (rev 513)
+++ trunk/libo2cb/include/ocfs2_heartbeat.h	2004-12-28 01:06:11 UTC (rev 514)
@@ -48,8 +48,9 @@
 {
 	__u16 magic;
 	__u16 opcode;
-	unsigned int fd;
+	__u32 fd;
 	char disk_uuid[CLUSTER_DISK_UUID_LEN+1];
+	char pad1[15];  /* Pad to the __u16 following it */
 	__u16 group_num;
 	__u32 bits;
 	__u32 blocks;

Modified: trunk/libo2cb/include/ocfs2_nodemanager.h
===================================================================
--- trunk/libo2cb/include/ocfs2_nodemanager.h	2004-12-27 19:38:57 UTC (rev 513)
+++ trunk/libo2cb/include/ocfs2_nodemanager.h	2004-12-28 01:06:11 UTC (rev 514)
@@ -75,7 +75,10 @@
 typedef struct _nm_node_info 
 {
 	__u16 node_num;
+	__u16 pad1;
+	__u32 pad2;
 	char node_name[NM_MAX_NAME_LEN+1];
+	char pad3[63];
 	nm_network_iface ifaces[NM_MAX_IFACES];
 } nm_node_info;
 
@@ -108,6 +111,7 @@
 {
 	__u16 magic;
 	__u16 opcode;
+	__u32 pad1;
 	union {
 		__u16 index;
 		char name[NM_MAX_NAME_LEN+1];

Modified: trunk/libocfs2/extent_map.c
===================================================================
--- trunk/libocfs2/extent_map.c	2004-12-27 19:38:57 UTC (rev 513)
+++ trunk/libocfs2/extent_map.c	2004-12-28 01:06:11 UTC (rev 514)
@@ -332,11 +332,13 @@
 						    left_ent);
 		if (ret)
 			goto out_free;
+		left_ent = NULL;
 	}
 
 	ret = ocfs2_extent_map_insert_entry(em, new_ent);
 	if (ret)
 		goto out_free;
+	new_ent = NULL;
 
 	if (right_ent) {
 		ret = ocfs2_extent_map_insert_entry(em,
@@ -354,7 +356,8 @@
 		ocfs2_free(&left_ent);
 	if (right_ent)
 		ocfs2_free(&right_ent);
-	ocfs2_free(&new_ent);
+	if (new_ent)
+		ocfs2_free(&new_ent);
 
 	return ret;
 }



More information about the Ocfs2-tools-commits mailing list