Hi all,

This is a proposed set of two patches which would eliminate use
of LVM commands in the monitor path. We already discussed the
issue elsewhere and I don't see any point in keeping
vgck/vgdisplay given that they don't result in better monitoring
under normal circumstances. And if the circumstances are such
that the new monitoring fails, I think that there'll be many
more problems on the node than a failed volume group.

Cheers,

Dejan
commit 9e9d092e04095ed8ca323562af3422d192433491
Author: Dejan Muhamedagic <[email protected]>
Date:   Wed Apr 4 18:16:22 2012 +0200

    Medium: LVM: use ls instead of vgdisplay in status

diff --git a/heartbeat/LVM b/heartbeat/LVM
index 584f972..5e5bc84 100755
--- a/heartbeat/LVM
+++ b/heartbeat/LVM
@@ -125,7 +125,7 @@ EOF
 #	Return LVM status (silently)
 #
 LVM_status() {
-  local rc
+  local rc=1
   loglevel="debug"
 
   # Set the log level of the error message
@@ -140,22 +140,18 @@ LVM_status() {
 	fi
   fi
   
-  if 
-    [ "$LVM_MAJOR" -eq "1" ]
-  then
-	VGOUT=`vgdisplay $1 2>&1`
-	echo "$VGOUT" | grep -i 'Status.*available' >/dev/null
-	rc=$?
-  else
-	VGOUT=`vgdisplay -v $1 2>&1`
-	echo "$VGOUT" | grep -i 'Status[ \t]*available' >/dev/null
+  if [ -d /dev/$1 ]; then
+	test "`cd /dev/$1 && ls`" != ""
 	rc=$?
+	if [ $rc -ne 0 ]; then
+    	ocf_log err "VG $1 with no logical volumes is not supported by this RA!"
+	fi
   fi
 
   if [ $rc -ne 0 ]; then
-    	ocf_log $loglevel "LVM Volume $1 is not available (stopped). ${VGOUT}"
+    	ocf_log $loglevel "LVM Volume $1 is not available (stopped)"
   fi
-  
+
   if [ "X${2}" = "X" ]; then
 	# status call return
   	return $rc
@@ -163,17 +159,11 @@ LVM_status() {
 
   # Report on LVM volume status to stdout...
   if [ $rc -eq 0 ]; then
-    if
-    	echo "$VGOUT" | grep -i 'Access.*read/write' >/dev/null
-    then
-    	ocf_log debug "Volume $1 is available read/write (running)"
-    else
-    	ocf_log debug "Volume $1 is available read-only (running)"
-    fi
+	echo "Volume $1 is available (running)"
+  else
+	echo "Volume $1 is not available (stopped)"
   fi
- 
-  return $OCF_SUCCESS
-
+  return $rc
 }
 
 #

commit bc5f34e6f158ce7dd91d7c8087897b19733783c4
Author: Dejan Muhamedagic <[email protected]>
Date:   Wed Apr 4 18:17:44 2012 +0200

    Medium: LVM: drop vgck(8) from monitor
    
    vgck (or any other vg command for that matter) does a scan of
    storage which under some circumstances may lead to long operation
    time. It is also unwarranted, because a running volume group is
    loaded and thus must exist as a directory in /dev.

diff --git a/heartbeat/LVM b/heartbeat/LVM
index 5e5bc84..0423cf4 100755
--- a/heartbeat/LVM
+++ b/heartbeat/LVM
@@ -171,7 +171,6 @@ LVM_status() {
 #
 #
 LVM_monitor() {
-  local rc
   if
     LVM_status $1
   then
@@ -181,13 +180,6 @@ LVM_monitor() {
     return $OCF_NOT_RUNNING
   fi
 
-  VGOUT=`vgck $1 2>&1`
-  rc=$?
-  if [ $rc -ne 0 ]; then
-    ocf_log err "LVM Volume $1 is not found. ${VGOUT}:${rc}"
-    return $OCF_ERR_GENERIC
-  fi
-
   return $OCF_SUCCESS
 }
 
_______________________________________________________
Linux-HA-Dev: [email protected]
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/

Reply via email to