[Ocfs2-tools-commits] jlbec commits r1135 - trunk/ocfs2console/ocfs2interface

svn-commits at oss.oracle.com svn-commits at oss.oracle.com
Fri Nov 18 17:11:53 CST 2005


Author: jlbec
Date: 2005-11-18 17:11:52 -0600 (Fri, 18 Nov 2005)
New Revision: 1135

Modified:
   trunk/ocfs2console/ocfs2interface/nodeconfig.py
   trunk/ocfs2console/ocfs2interface/o2cb_ctl.py
   trunk/ocfs2console/ocfs2interface/o2cbmodule.c
Log:

o Remove the O2CB configfs hardcodes from o2cbmodule.c
o Use /etc/init.d/o2cb to check the cluster status.



Modified: trunk/ocfs2console/ocfs2interface/nodeconfig.py
===================================================================
--- trunk/ocfs2console/ocfs2interface/nodeconfig.py	2005-11-18 22:45:12 UTC (rev 1134)
+++ trunk/ocfs2console/ocfs2interface/nodeconfig.py	2005-11-18 23:11:52 UTC (rev 1135)
@@ -436,7 +436,21 @@
                 break
 
 def node_config(parent=None):
-    if not os.access(o2cb.FORMAT_CLUSTER_DIR, os.F_OK):
+    success, output, k = o2cb_ctl.init_status(None, parent)
+    if not success:
+        msg = ('Could not query the state of the cluster stack.'
+               'This must be resolved before any OCFS2 filesystem'
+               'can be mounted.')
+        info = gtk.MessageDialog(parent=parent,
+                                 flags=gtk.DIALOG_DESTROY_WITH_PARENT,
+                                 type=gtk.MESSAGE_WARNING,
+                                 buttons=gtk.BUTTONS_CLOSE,
+                                 message_format=msg)
+        info.run()
+        info.destroy()
+        return
+
+    if (output.find('Not loaded') != -1) or (output.find('Not mounted') != -1):
         success, output, k = o2cb_ctl.init_load(parent)
 
         if success:
@@ -477,7 +491,21 @@
     conf.run()
     conf.destroy()
 
-    if not os.access(o2cb.FORMAT_CLUSTER % cluster_name, os.F_OK):
+    success, output, k = o2cb_ctl.init_status(cluster_name, parent)
+    if not success:
+        msg = ('Could not query the state of the cluster.' 
+               'This must be resolved before any OCFS2 filesystem'
+               'can be mounted.')
+        info = gtk.MessageDialog(parent=parent,
+                                 flags=gtk.DIALOG_DESTROY_WITH_PARENT,
+                                 type=gtk.MESSAGE_WARNING,
+                                 buttons=gtk.BUTTONS_CLOSE,
+                                 message_format=msg)
+        info.run()
+        info.destroy()
+        return
+
+    if output.find('Online') == -1:
         success, output, k = o2cb_ctl.init_online(cluster_name, parent)
 
         if not success:

Modified: trunk/ocfs2console/ocfs2interface/o2cb_ctl.py
===================================================================
--- trunk/ocfs2console/ocfs2interface/o2cb_ctl.py	2005-11-18 22:45:12 UTC (rev 1134)
+++ trunk/ocfs2console/ocfs2interface/o2cb_ctl.py	2005-11-18 23:11:52 UTC (rev 1135)
@@ -56,6 +56,16 @@
     o2cb_init = O2CBInit(args, desc, parent)
     return o2cb_init.reap()
 
+def init_status(cluster_name=None, parent=None):
+    if cluster_name: 
+        desc = 'Querying status of %s...' % cluster_name
+        args = ('status', cluster_name)
+    else:
+        desc = 'Querying cluster software status...'
+        args = ('status',)
+    o2cb_init = O2CBInit(args, desc, parent)
+    return o2cb_init.reap()
+
 def query_clusters(parent=None):
     args = '-I -t cluster -o'
     o2cb_ctl = O2CBCtl(args, 'Querying cluster...', parent)

Modified: trunk/ocfs2console/ocfs2interface/o2cbmodule.c
===================================================================
--- trunk/ocfs2console/ocfs2interface/o2cbmodule.c	2005-11-18 22:45:12 UTC (rev 1134)
+++ trunk/ocfs2console/ocfs2interface/o2cbmodule.c	2005-11-18 23:11:52 UTC (rev 1135)
@@ -518,22 +518,6 @@
 static void
 add_constants (PyObject *m)
 {
-  PyModule_AddStringConstant (m, "CONFIGFS_PATH", CONFIGFS_PATH);
-
-#define ADD_STR_CONSTANT(name) \
-  PyModule_AddStringConstant (m, "FORMAT_" #name, O2CB_FORMAT_ ## name)
-
-  ADD_STR_CONSTANT (CLUSTER_DIR);
-  ADD_STR_CONSTANT (CLUSTER);
-  ADD_STR_CONSTANT (NODE_DIR);
-  ADD_STR_CONSTANT (NODE);
-  ADD_STR_CONSTANT (NODE_ATTR);
-  ADD_STR_CONSTANT (HEARTBEAT_DIR);
-  ADD_STR_CONSTANT (HEARTBEAT_REGION);
-  ADD_STR_CONSTANT (HEARTBEAT_REGION_ATTR);
-
-#undef ADD_STR_CONSTANT
-
 #define ADD_INT_CONSTANT(name) \
     PyModule_AddIntConstant (m, "O2NM_" #name, O2NM_ ## name)
 



More information about the Ocfs2-tools-commits mailing list