[Gluster-devel] Patch for NFS Mount, Gex tool bug fix, RC Scripts

Harshavardhana Ranganath harsha at 80x25.org
Tue Feb 21 12:41:42 UTC 2006


this patch does
* add NFS support for stage3 probing in stage2
* add shutdown and enchance reboot rc scripts
* add more error checking and fix bugs in gex tool

Regards
Harshavardhana
-------------- next part --------------
? gex-nfs-reboot.diff
? extensions/core/Gluster/GArgs.pyc
? extensions/core/Gluster/GConf.pyc
? extensions/core/Gluster/GPackage.pyc
? extensions/core/Gluster/GRegistry.pyc
? extensions/core/Gluster/__init__.pyc
? extensions/core/Gluster/GFrontEnd/UI.pyc
? extensions/core/Gluster/GFrontEnd/__init__.pyc
? extensions/core/Gluster/GFrontEnd/dialog.pyc
? extensions/core/Gluster/GTmp/Dir.pyc
? extensions/core/Gluster/GTmp/__init__.pyc
? stage2/skel-master/etc/rc.d/rc.halt
? stage2/skel-slave/etc/rc.d/rc.halt
? stage3/e2fsprogs.mk
? stage3/jfsutils.mk
? stage3/reiserfsprogs.mk
? stage3/xfsprogs.mk
Index: extensions/core/bin/gex
===================================================================
RCS file: /cvsroot/gluster/gluster-alpha1/extensions/core/bin/gex,v
retrieving revision 1.2
diff -p -u -r1.2 gex
--- extensions/core/bin/gex	2 Feb 2006 06:59:11 -0000	1.2
+++ extensions/core/bin/gex	21 Feb 2006 12:33:21 -0000
@@ -10,9 +10,17 @@ dlg = dialog.Dialog ();
 def file_to_dict (filename):
     _dict = {};
     for line in open (filename).readlines ():
+        line = line.strip ()
+        if not line.strip():
+            continue
         pieces = line.strip ().split (":", 1)
-        if pieces[1] is not None:
-            _dict[pieces[0]] = pieces[1];
+        if len(pieces) == 2: 
+            if not (pieces[0].strip() and pieces[1].strip()):
+                print " Warning: invalid key or value in line `" + line + "'";
+                continue
+            _dict[pieces[0]] = pieces[1]
+        else:
+            print " Warning: at `" + line + "' \":\" not specified ";
     return _dict;
 
 def GpkgInstall (option, opt_str, value, parser):
@@ -20,19 +28,43 @@ def GpkgInstall (option, opt_str, value,
         print value + ": cant read";
         return
     contents = file_to_dict (value);
-    for tgz in contents['package-contents'].split (" "):
-        if tgz == '': continue
+    if not 'package-contents' in contents.keys ():
+        print " Error: package-contents not specified in " + value;
+        return
+    if 'package-contents' in contents.keys ():
+        tgz = contents['package-contents'].strip ()
+        if not tgz:
+            print " Error: `package-contents' not specified in file " + value
+        package_exec = 'runme'
+        if not 'package-exec' in contents.keys ():
+            print " Warning: assuming package-exec as `runme' ";
+        else:
+            package_exec = contents['package-exec'].strip ();
         dir = Dir.TmpDir ();
-        ftgz = os.path.dirname (value) + "/" + tgz;
-        os.system ("tar -C " + dir.Name () + " -xzvf " + ftgz);
-        os.system (dir.Name () + "/" + contents['package-exec'].strip ());
+        if not os.path.dirname (value):
+            ftgz = "./" + tgz
+        else:
+            ftgz = os.path.dirname (value) + "/" + tgz;
+        if not os.access (ftgz, os.R_OK):
+            print " Error: cannot open file `" + ftgz + "' for reading"
+            return
+        os.system ("tar -C " + dir.Name () + " -xzf " + ftgz);
+        if not os.access (dir.Name () + "/" + package_exec, os.X_OK):
+            print " Error: cannot execute `" + package_exec + "' in " + ftgz
+            return
+        os.system (dir.Name () + "/" + package_exec);
+    else:
+        print " Error: `package-contents' not specified in file " + value
     return ;
 
 def GpkgDetails (option, opt_str, value, parser):
     contents = file_to_dict (value);
-    print "Name       : " + contents['package-name'];
-    print "Maintainer : " + contents['package-maintainer'];
-    print "Description: " + contents['package-description'];
+    if 'package-name' in contents.keys ():
+        print "Name       : " + contents['package-name'];
+    if 'package-maintainer' in contents.keys ():
+        print "Maintainer : " + contents['package-maintainer'];
+    if 'package-description' in contents.keys ():
+        print "Description: " + contents['package-description'];
     return ;
 
 def GpkgListApps (option, opt_str, value, parser):
Index: stage2/skel-master/etc/inittab
===================================================================
RCS file: /cvsroot/gluster/gluster-alpha1/stage2/skel-master/etc/inittab,v
retrieving revision 1.4
diff -p -u -r1.4 inittab
--- stage2/skel-master/etc/inittab	10 Feb 2006 17:48:05 -0000	1.4
+++ stage2/skel-master/etc/inittab	21 Feb 2006 12:33:21 -0000
@@ -19,3 +19,5 @@ c12:12:respawn:/sbin/agetty -n -l /bin/b
 ca::ctrlaltdel:/sbin/reboot
 
 r:6:wait:/etc/rc.d/rc.reboot
+
+h:0:wait:/etc/rc.d/rc.halt
\ No newline at end of file
Index: stage2/skel-master/etc/rc.d/rc.reboot
===================================================================
RCS file: /cvsroot/gluster/gluster-alpha1/stage2/skel-master/etc/rc.d/rc.reboot,v
retrieving revision 1.1.1.1
diff -p -u -r1.1.1.1 rc.reboot
--- stage2/skel-master/etc/rc.d/rc.reboot	24 Jan 2006 06:31:43 -0000	1.1.1.1
+++ stage2/skel-master/etc/rc.d/rc.reboot	21 Feb 2006 12:33:22 -0000
@@ -1,9 +1,21 @@
 #!/bin/sh
 
 cd /;
-killall5 -15;
-killall5 -9;
 
-umount -a;
+echo " Sending SIGTERM to all processes "
+killall5 -15 && sleep 1;
 
-/sbin/reboot -hif;
\ No newline at end of file
+echo " Sending SIGKILL to all processes "
+killall5 -9 && sleep 1;
+
+echo " Umounting all filesystems "
+umount -a -f;
+
+echo " Syncing hardware clock with system time "
+hwclock --systohc; 
+
+echo " Syncing disks "
+sync && sleep 1;
+
+echo " Powering down "
+reboot -hif;
\ No newline at end of file
Index: stage2/skel-master/etc/stage2/locate_stage3.sh
===================================================================
RCS file: /cvsroot/gluster/gluster-alpha1/stage2/skel-master/etc/stage2/locate_stage3.sh,v
retrieving revision 1.4
diff -p -u -r1.4 locate_stage3.sh
--- stage2/skel-master/etc/stage2/locate_stage3.sh	6 Feb 2006 09:19:02 -0000	1.4
+++ stage2/skel-master/etc/stage2/locate_stage3.sh	21 Feb 2006 12:33:22 -0000
@@ -34,7 +34,24 @@ method_nfs ()
       done
       /sbin/ip route get "${ip}";
       [ $? -eq 0 ] || continue;
-      dialog --msgbox "Incomplete feature" 0 0;
+      mkdir -p /mnt/nfs;
+      mount -t nfs $ip:$exportpoint /mnt/nfs;
+      [ $? -eq 0 ] || {
+	  dialog --msgbox " Could not mount NFS volume from $ip:$exportpoint " 0 0;
+	  continue;
+      }
+      [ -f /mnt/nfs/core.gex ] || {
+	  dialog --msgbox " $ip:$exportpoint is not a valid gluster stage3 export " 0 0;
+	  umount /mnt/nfs;
+	  continue;
+      }
+      rm -rf /stage3 && ln -sf /mnt/nfs /stage3;
+      [ $? -eq 0 ] || {
+	  dialog --msgbox " Could not create symlink " 0 0;
+	  umount /mnt/nfs;
+	  continue;
+      }
+      return 0;
     done
 }
 
Index: stage2/skel-slave/etc/rc.d/rc.reboot
===================================================================
RCS file: /cvsroot/gluster/gluster-alpha1/stage2/skel-slave/etc/rc.d/rc.reboot,v
retrieving revision 1.1.1.1
diff -p -u -r1.1.1.1 rc.reboot
--- stage2/skel-slave/etc/rc.d/rc.reboot	24 Jan 2006 06:31:49 -0000	1.1.1.1
+++ stage2/skel-slave/etc/rc.d/rc.reboot	21 Feb 2006 12:33:22 -0000
@@ -1,9 +1,21 @@
 #!/bin/sh
 
 cd /;
-killall5 -15;
-killall5 -9;
 
-umount -a;
+echo " Sending SIGTERM to all processes "
+killall5 -15 && sleep 1;
 
-/sbin/reboot -hif;
\ No newline at end of file
+echo " Sending SIGKILL to all processes "
+killall5 -9 && sleep 1;
+
+echo " Umounting all filesystems "
+umount -a -f;
+
+echo " Syncing hardware clock with system time "
+hwclock --systohc; 
+
+echo " Syncing disks "
+sync && sleep 1;
+
+echo " Powering down "
+reboot -hif;
\ No newline at end of file
-------------- next part --------------
#!/bin/sh

cd /;

echo " Sending SIGTERM to all processes "
killall5 -15 && sleep 1;

echo " Sending SIGKILL to all processes "
killall5 -9 && sleep 1;

echo " Umounting all filesystems "
umount -a -f;

echo " Syncing hardware clock with system time "
hwclock --systohc; 

echo " Syncing disks "
sync && sleep 1;

echo " Powering down "
poweroff -f;


More information about the Gluster-devel mailing list