Skip to contentSkip to conversation

fix some issues in clvmd initscript

PATCH New Milan Broz 4 participants 11 messages May 26, 2010 – Jun 3, 2010

lore
Share & tools
lore

Milan Broz

author
#0 lore raw

PATCH 1/1 fix some issues in clvmd initscript

- if daemon is already running, do nothing (and not reactivate VGs)

- always explicitly return exit code in reload()

- fix restart() so it really tries full start & stop and returns exit code if clvmd -S fails and also touch lockfile afterwards

clvmd renamed from clvmd.old +11 -7
@@ -63,11 +63,12 @@ rh_status_q() {
 
 start()
 {
-	if ! rh_status_q; then
-		echo -n "Starting $DAEMON: "
-		daemon $DAEMON $CLVMDOPTS || return $?
-		echo
-	fi
+
+	rh_status_q && return 0
+
+	echo -n "Starting $DAEMON: "
+	daemon $DAEMON $CLVMDOPTS || return $?
+	echo
 
 	# Refresh local cache.
 	#
@@ -141,7 +142,8 @@ stop()
 
 reload() {
 	rh_status_q || exit 7
-	action "Reloading $DAEMON configuration: " $DAEMON -R || return $?
+	action "Reloading $DAEMON configuration: " $DAEMON -R
+	return $?
 }
 
 restart() {
@@ -152,13 +154,15 @@ restart() {
 
 	# Try to get clvmd to restart itself. This will preserve 
 	# exclusive LV locks
-	action "Restarting $DAEMON: " $DAEMON -S || return $?
+	action "Restarting $DAEMON: " $DAEMON -S
 
 	# If that fails then do a normal stop & restart
 	if  [ $? != 0 ]; then
 	    stop && start
+	    return $?
 	else
 	    touch $LOCK_FILE
+	    return 0
 	fi
 }
 
#1 lore raw

PATCH 1/1 fix some issues in clvmd initscript

Quoted 14 lines · Milan Broz

- if daemon is already running, do nothing (and not reactivate VGs)

- always explicitly return exit code in reload()

- fix restart() so it really tries full start & stop and returns exit code if clvmd -S fails and also touch lockfile afterwards

clvmd renamed from clvmd.old +0 -1
@@ -63,11 +63,12 @@ rh_status_q() {
 
 start()
 {
-	if ! rh_status_q; then

clvmd rh_status_q() { · line 71

Quoted 10 lines
clvmd renamed from clvmd.old +6 -4
-		echo -n "Starting $DAEMON: "
-		daemon $DAEMON $CLVMDOPTS || return $?
-		echo
-	fi
+
+	rh_status_q && return 0
+
+	echo -n "Starting $DAEMON: "
+	daemon $DAEMON $CLVMDOPTS || return $?
+	echo

careful with this change as it modifies the behavior compared to the old init script.

In the transition from old to new, we didn?t really want to modify what the script does.

Cheers
Fabio

author
#2 lore raw

PATCH 1/1 fix some issues in clvmd initscript

Quoted 12 lines · Fabio M. Di Nitto
Quoted 11 lines · Milan Broz

- if daemon is already running, do nothing (and not reactivate VGs)

- always explicitly return exit code in reload()

- fix restart() so it really tries full start & stop and returns exit code if clvmd -S fails and also touch lockfile afterwards

clvmd renamed from clvmd.old +0 -0
@@ -63,11 +63,12 @@ rh_status_q() {
 
Quoted 16 lines

clvmd rh_status_q() { · line 71

Quoted 13 lines
clvmd renamed from clvmd.old +6 -5
 start()
 {
-	if ! rh_status_q; then
-		echo -n "Starting $DAEMON: "
-		daemon $DAEMON $CLVMDOPTS || return $?
-		echo
-	fi
+
+	rh_status_q && return 0
+
+	echo -n "Starting $DAEMON: "
+	daemon $DAEMON $CLVMDOPTS || return $?
+	echo

careful with this change as it modifies the behavior compared to the old init script.

So you want reactivate LVs even if clvmd is already running? This is wrong IMHO.

Milan

#3 lore raw

PATCH 1/1 fix some issues in clvmd initscript

Quoted 30 lines · Milan Broz
Quoted 12 lines · Fabio M. Di Nitto
Quoted 11 lines · Milan Broz

- if daemon is already running, do nothing (and not reactivate VGs)

- always explicitly return exit code in reload()

- fix restart() so it really tries full start & stop and returns exit code if clvmd -S fails and also touch lockfile afterwards

clvmd renamed from clvmd.old +0 -0
@@ -63,11 +63,12 @@ rh_status_q() {
 
Quoted 16 lines

clvmd rh_status_q() { · line 71

Quoted 13 lines
clvmd renamed from clvmd.old +6 -5
 start()
 {
-	if ! rh_status_q; then
-		echo -n "Starting $DAEMON: "
-		daemon $DAEMON $CLVMDOPTS || return $?
-		echo
-	fi
+
+	rh_status_q && return 0
+
+	echo -n "Starting $DAEMON: "
+	daemon $DAEMON $CLVMDOPTS || return $?
+	echo

careful with this change as it modifies the behavior compared to the old init script.

Quoted 1 line

So you want reactivate LVs even if clvmd is already running?

Let me get this right :) I don?t care either way. Whatever the team wants is fine. I am only noticing that this a behavior change vs the old init script.

Fabio

#4 lore raw

PATCH 1/1 fix some issues in clvmd initscript

Hi,

just a suggestion, but, in case one wants to use clvm in a active/passive maner, there is a problem with the way clvmd is started, as it tries to activate all the clustered VG's whether or not they're already active on another node.

In case of active/passive setup, by the means of exclusive activation, this activation returns an error (as of LMV2.0.56, cf
https://bugzilla.redhat.com/show_bug.cgi?id=517900, errata
http://rhn.redhat.com/errata/RHBA-2010-0299.html)

Another scenario being, when using exclusive activation, the cluster resources can be managed by a "custom" cluster resource script (cf
https://www.redhat.com/archives/linux-cluster/2009-June/msg00002.html),
the resource script fails to start as clvmd init script has already activated the VG's.

My suggestion would be to be able to forbid (via an exclusion list) clvmd init script to activate automatically what's in this blacklist.

Regards

Brem

2010/6/3 Fabio M. Di Nitto <[email protected]>:

Quoted 44 lines · Milan Broz
Quoted 30 lines · Fabio M. Di Nitto
Quoted 12 lines · Milan Broz
Quoted 11 lines

- if daemon is already running, do nothing (and not reactivate VGs)

- always explicitly return exit code in reload()

- fix restart() so it really tries full start & stop and returns exit code ? if clvmd -S fails and also touch lockfile afterwards

clvmd ? 2010-05-26 14:55:17.671245376 +0200 renamed from clvmd.old ? ? ? 2010-05-26 14:21:15.000000000 +0200 +0 -0
@@ -63,11 +63,12 @@ rh_status_q() {
 
Quoted 16 lines

clvmd ? 2010-05-26 14:55:17.671245376 +0200 rh_status_q() { · line 71

Quoted 13 lines
clvmd ? 2010-05-26 14:55:17.671245376 +0200 renamed from clvmd.old ? ? ? 2010-05-26 14:21:15.000000000 +0200 +6 -5
 ?start()
 ?{
- ? if ! rh_status_q; then
- ? ? ? ? ? echo -n "Starting $DAEMON: "
- ? ? ? ? ? daemon $DAEMON $CLVMDOPTS || return $?
- ? ? ? ? ? echo
- ? fi
+
+ ? rh_status_q && return 0
+
+ ? echo -n "Starting $DAEMON: "
+ ? daemon $DAEMON $CLVMDOPTS || return $?
+ ? echo

careful with this change as it modifies the behavior compared to the old init script.

Quoted 1 line

So you want reactivate LVs even if clvmd is already running?

Let me get this right :) I don?t care either way. Whatever the team wants is fine. I am only noticing that this a behavior change vs the old init script.

Fabio

--
lvm-devel mailing list
lvm-devel at redhat.com
https://www.redhat.com/mailman/listinfo/lvm-devel

#5 lore raw

PATCH 1/1 fix some issues in clvmd initscript

Quoted 2 lines · brem belguebli

started, as it tries to activate all the clustered VG's whether or not they're already active on another node.

/etc/sysconfig/clvmd perhaps?

Something like:

# Specifies whether or not to activate clustered LVs after starting up clvmd. # Note that this file only controls which 'lvchange' commands get run

# and it cannot override lvm.conf.
ACTIVATE=yes

# Space-separated lists of LVs to activate when starting CLVMD. # Specifying a VG will activate all the LVs within it.

# Clustered LVs activated with "lvchange -aey" on this machine. # E.g. EXCLUSIVE_LVS="vg1/lvol0 vg1/lvol1 vg2" EXCLUSIVE_LVS=

# Clustered LVs activated with "lvchange -aly" on this machine. LOCAL_LVS=

# Clustered LVs activated with "lvchange -ay".
# If all 3 variables (LOCAL_LVS, EXCLUSIVE_LVS & SHARED_LVS) are unset

# or empty and ACTIVATE is "yes" then all clustered LVs visible on the system
# are activated as shared.
SHARED_LVS=

Alasdair

#6 lore raw

PATCH 1/1 fix some issues in clvmd initscript

Quoted 6 lines · Alasdair G Kergon
Quoted 2 lines · brem belguebli

started, as it tries to activate all the clustered VG's whether or not they're already active on another node.

/etc/sysconfig/clvmd perhaps?

Exactly what I was hopping....you're so reactive gentlemen... ;-)

Quoted 15 lines

Something like:

# Specifies whether or not to activate clustered LVs after starting up clvmd. # Note that this file only controls which 'lvchange' commands get run

# and it cannot override lvm.conf.
ACTIVATE=yes

# Space-separated lists of LVs to activate when starting CLVMD. # Specifying a VG will activate all the LVs within it.

# Clustered LVs activated with "lvchange -aey" on this machine. # E.g. EXCLUSIVE_LVS="vg1/lvol0 vg1/lvol1 vg2" EXCLUSIVE_LVS=

Quoted 10 lines

# Clustered LVs activated with "lvchange -aly" on this machine. LOCAL_LVS=

# Clustered LVs activated with "lvchange -ay".
# If all 3 variables (LOCAL_LVS, EXCLUSIVE_LVS & SHARED_LVS) are unset

# or empty and ACTIVATE is "yes" then all clustered LVs visible on the system
# are activated as shared.
SHARED_LVS=

Next time I'll read more carefully the man pages / init scripts / sysconfig configurations

Sorry .

Brem

Quoted 6 lines

Alasdair

--
lvm-devel mailing list
lvm-devel at redhat.com
https://www.redhat.com/mailman/listinfo/lvm-devel

#7 lore raw

PATCH 1/1 fix some issues in clvmd initscript

Quoted 2 lines · Brem Belguebli

Next time I'll read more carefully the man pages / init scripts / sysconfig configurations

That's only a proposal, to see if it would cover the cases people need. It's not been implemented.

Alasdair

#8 lore raw

PATCH 1/1 fix some issues in clvmd initscript

It looked so real I thought you were pushing me back to my seat.

Perfect, exactly what I was expecting.

Default would be to activate not to bother the gfs users....

Brem

Quoted 8 lines · Alasdair G Kergon
Quoted 2 lines · Brem Belguebli

Next time I'll read more carefully the man pages / init scripts / sysconfig configurations

That's only a proposal, to see if it would cover the cases people need. It's not been implemented.

Alasdair

#9 lore raw

PATCH 1/1 fix some issues in clvmd initscript

Quoted 1 line · Brem Belguebli

It looked so real I thought you were pushing me back to my seat.

Nah, I just typed that directly into the email.

We'll capture it into bugzilla, and I'm hoping we won't hit too many gotchas and it will be quick and easy to implement.

Alasdair

#10 lore raw

PATCH 1/1 fix some issues in clvmd initscript

Quoted 8 lines · Alasdair G Kergon
Quoted 1 line · Brem Belguebli

It looked so real I thought you were pushing me back to my seat.

Nah, I just typed that directly into the email.

We'll capture it into bugzilla, and I'm hoping we won't hit too many gotchas and it will be quick and easy to implement.

Great, thanks

By the way, not trying to being rude, but it would be great if you could "re" consider the resource script provided by Rafael Mico Miranda
https://www.redhat.com/archives/linux-cluster/2009-June/msg00002.html,
to see if it can be integrated to Cluster Suite, having Redhat's seal on it would be a must.

Quoted 1 line

Alasdair

Brem