Bug#555541: patch for glusterfs-client and insserv matter

2009-11-16 Thread Jan Villeminot

tag 41 + patch
thanks

In order to make glusterfs work properly with fstab and insserv, two 
scripts
have to be used : the first should mount the glusterfs partition, the 
second
should wait for the partitions to be mounted in case of asynchronous 
startup.

Moreover, insserv header should be properly configured in the scripts.
This mimics NFS client scripts behavior.

The following set of files manage to correctly mount the partitions at 
startup:


 * glusterfs-mount mounts the glusterfs partitions ; its insserv header is
configured to depend on fuse and on $network.

 * mountglusterfs.sh wait for the gluster partition to be mounted ; its
insserv header is configured to only depend on the other init script
glusterfs-mount.

 * The following line should be added to a dedicated file in the insserv
conf.d directory : $remote_fs   $local_fs +mountglusterfs +sendsigs
so that application such as xen might start when their configuration is 
on a

remote glusterfs file system.
   
The problem is that if you make use of nfs, it creates a loop in 
insserv: fuse
also depends on $remote_fs in case (according to the documentation) the 
/usr is

mounted via nfs...

Since we don't need that feature we simply remove the fuse dependency on
$remote_fs by overriding its configuration in the /etc/insserv/overrides/
directory (the joined fuse file). Perhaps, there is a need for splitting 
$remote_fs and and new

insserv variable $remote_usr, but this is beyond the scope of this package.

Those files should be provided by the glusterfs-client package.

Thanks,

  --Jan
#! /bin/bash
# description: Mount glustefs volumes at boot.
### BEGIN INIT INFO
# Provides: glusterfs-mount
# Required-Start: $network fuse
# Required-Stop: 
# Default-Start:  2 3 4 5 S
# Default-Stop:
# Short-Description: Mount glusterfs volumes at boot.
# Description:  Mount glusterfs volumes at boot.
### END INIT INFO
. /lib/lsb/init-functions

glusterfsmounts()
{
LC_ALL=C awk '$3 == fuse.glusterfs  { print $2 }' /proc/mounts
}

glusterfsfstab()
{
LC_ALL=C awk '!/^#/  $3 == glusterfs  $4 !~ /noauto/ { print $2 }' 
/etc/fstab
}

case $1 in
start|reload)
if [ -n `glusterfsfstab` ] ; then
log_action_begin_msg Mounting glusterfs partitions
mount -at glusterfs
if [ $? = 0 ]
then
log_action_end_msg 0 
else
  echo Error : Unable to mount glusterfs filesystems
  log_action_end_msg 1 
fi
fi
;;
stop)
log_action_begin_msg Unmounting glusterfs partitions
remaining=`glusterfsmounts`
sig=
retry=3
while [ -n remaining -a $retry -gt 0 ]; do
for i in $remaining; do
umount $i
done
sleep 1
remaining=`glusterfsmounts`
[ -z $remaining ]  break
echo  Error :Unable to unmount glusterfs attempt : $retry/3
sleep 5
retry=$(($retry - 1))
sig=-9
done
[ -z $remaining ]  log_action_end_msg 0 || log_action_end_msg 1
;;
restart)
$0 stop
$0 start
;;
status)
if [ -f /proc/mounts ] ; then
[ -n `glusterfsfstab` ]  {
echo Configured glusterfs mountpoints:  `glusterfsfstab`
}

[ -n `glusterfsmounts` ]  {
echo Active glusterfs mountpoints:  `glusterfsmounts`
}
else
echo -n Checking glusterfs mountpoints: 
echo -n FAILED
fi
;;
*)
echo Usage: $0 {start|stop|status|reload|restart}
exit 1
esac



#! /bin/sh
### BEGIN INIT INFO
# Provides:  mountglusterfs
# Required-Start:glusterfs-mount
# Required-Stop: glusterfs-mount
# Should-Start:  
# Default-Start: S
# Default-Stop:
# Short-Description: Wait for glusterfs file systems to be mounted
# Description:   Wait for glusterfs file systems to be mounted
### END INIT INFO

. /lib/init/vars.sh
. /lib/lsb/init-functions

do_wait_async_mount() {
[ -f /etc/fstab ] || return
#
# Read through fstab line by line. If it is glusterfs, set the flag
# for mounting glusterfs file systems. If any glusterfs partition is 
found
# then wait around for it.
#

exec 90 /etc/fstab

waitglusterfs=
while read DEV MTPT FSTYPE OPTS REST
do
case $DEV in
  |\#*)
continue
;;
esac
case $OPTS in
  noauto|*,noauto|noauto,*|*,noauto,*)
continue
;;
esac
case $FSTYPE in
  glusterfs)
;;
  *)
continue
;;
esac
   

Bug#555541: glusterfs-client: Support for proper client mounting via fstab at startup

2009-11-10 Thread Jan Villeminot
Package: glusterfs-client
Version: 2.0.7-0.0.1
Severity: wishlist

When starting up, Debian fails to mount the glusterfs partitions present
on fstab.

In fact, glusterfs does not find fuse because the mountall and
other init script related to mounting partitions are ran before fuse starts
up. 

After investigation, it appears that the information set within the 
comment header of fuse, and the lack of init script for glusterfs-client, 
causes insserv to attempt mounting the glusterfs volumes set in /etc/fstab 
before FUSE is operational.

On servers without insserv, fuse seems to start up before the mount*
init scripts ; which is correct.

The problem is that no init scripts are included in the glusterfs-client
package to prevent insserv from starting fuse after the mount* init scripts.
Furthermore, when the machine runs as a glusterfs client, FUSE's init comment
header should be overridden, as now FUSE should not depend on $remote_fs, but
provide it (through Glusterfs).

-- Jan

-- System Information:
Debian Release: squeeze/sid
  APT prefers testing
  APT policy: (800, 'testing')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.26-1-xen-amd64 (SMP w/4 CPU cores)
Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages glusterfs-client depends on:
ii  fuse-utils   2.7.4-2 Filesystem in USErspace (utilities
ii  glusterfs-server 2.0.7-0.0.1 clustered file-system

glusterfs-client recommends no packages.

Versions of packages glusterfs-client suggests:
ii  glusterfs-examples   2.0.7-0.0.1 example files for the glusterfs se

-- no debconf information



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org