Description of problem:
You can shut down the clvmd daemon with active volume groups.
The clvmd init script does a vgchange -aln for each clustered vg.
If the vgchange is unsuccessful, it returns $? as 0, but if it's
successful, it returns 1. Later in the script, it checks the
return code, but it checks the wrong value. So either vgchange
is returning the opposite return code, or else the init script
should be changed to check it correctly.
Version-Release number of selected component (if applicable):
Steps to Reproduce:
[root@trin-10 ~]# service clvmd start
Starting clvmd: [ OK ]
Activating VGs: 1 logical volume(s) in volume group "bob_vg" now active
1 logical volume(s) in volume group "trin_vg" now active
2 logical volume(s) in volume group "VolGroup00" now active
[ OK ]
[root@trin-10 ~]# mount -tgfs /dev/bob_vg/lvol0 /mnt/gfs1
[root@trin-10 ~]# service clvmd stop
Deactivating VG bob_vg: Can't deactivate volume group "bob_vg" with 1 open
Deactivating VG trin_vg: 0 logical volume(s) in volume group "trin_vg" now active
[ OK ]
Stopping clvm: [ OK ]
The clvmd daemon is stopped with bob_vg still active.
The clvmd daemon should not be stopped with active volume groups.
The following patch fixes the init script so that it works.
It also fixes an annoying typo:
[root@trin-10 /etc/init.d]# diff clvmd.orig clvmd
< [ $rtrn -ne 0 ] && break
> [ $rtrn -eq 0 ] && break
< echo -n "Stopping clvm:"
> echo -n "Stopping clvmd:"
The script would work just fine if vgchange returned a non-zero
return code on (active vg) errors and zero on (inactive vg) successes.
Created attachment 150139 [details]
Seems that rtrn=$? is incorrectly used, attaching patch with another fix...
Your attached patch works well. It's elegant too.
(Mine had a problem).
Fixed upstream in lvm2 2.02.24, will be includen in next rebuild.
Setting state to POST to indicate this.
Fixing Product Name. Cluster Suite components were integrated into the
Enterprise Linux version 5.0.
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on the solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.