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

[Cluster-devel] cluster/fence/scripts scsi_reserve



CVSROOT:	/cvs/cluster
Module name:	cluster
Changes by:	rohara sourceware org	2006-07-12 16:55:28

Modified files:
	fence/scripts  : scsi_reserve 

Log message:
	Added success and failure commands in start/stop.
	
	scsi_reserve start - success if we can register with a device.
	scsi_reserve stop  - success if wa can unregister with a device.
	
	Note that we always try to create a reservation for a device in start,
	but we do not care about success/failure. If it fails, it is probably
	because a reservation already exists.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/fence/scripts/scsi_reserve.diff?cvsroot=cluster&r1=1.2&r2=1.3

--- cluster/fence/scripts/scsi_reserve	2006/07/06 16:07:23	1.2
+++ cluster/fence/scripts/scsi_reserve	2006/07/12 16:55:28	1.3
@@ -50,17 +50,29 @@
 #
 for dev in $scsi_devices
 do
+
   echo -n "Registering device: $dev"
+
   for error in 1
   do
     sg_persist -d $dev -o -G -S $key &>/dev/null || break
-    sg_persist -d $dev -o -R -K $key -T 5 &>/dev/null || break
+    # sg_persist -d $dev -o -R -K $key -T 5 &>/dev/null || break
     error=0
   done
-  if [ $error -ne 0 ]; then
+
+  if [ $error -eq 0 ]; then
+      success
+  else
+      failure
       rval=1
   fi
+
   echo
+
+  # attempt to create a reservation
+  #
+  sg_persist -d $dev -o -R -K $key -T 5 &>/dev/null
+
 done
 ;;
 
@@ -75,7 +87,7 @@
 
   if sg_persist -d $dev -i -r 2>/dev/null | grep -qiE "${key#0}" ; then
       echo "Unable to unregister device: $dev"
-      error=0
+      error=1
   else
       echo -n "Unregistering device: $dev"
       for error in 1
@@ -84,9 +96,14 @@
 	error=0
       done
   fi
-  if [ $error -ne 0 ]; then
+
+  if [ $error -eq 0 ]; then
+      success
+  else
+      failure
       rval=1
   fi
+
   echo
 done
 


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