Adds support for NFS Ganesha

Elements were already available for use with containers.
A few updates on the elements were made in order to get
the latest changes for NFS Ganesha.

Closes-Bug: #1649404
Change-Id: I605e8a3793ec1dde1efcfcef2a84c42abe5219de
This commit is contained in:
Victoria Martinez de la Cruz 2016-12-15 17:46:43 -03:00
parent 56eeb23f2b
commit 5145607196
7 changed files with 57 additions and 119 deletions

View File

@ -48,7 +48,7 @@ Precisely, the syntax is as follows:
tox -e buildimage -- -s nfs
Where <share-protocol> can be nfs, cifs or zfs.
Where <share-protocol> can be nfs, cifs, zfs or nfs-ganesha.
For example, running:

View File

@ -56,15 +56,17 @@ err() {
print_usage() {
echo "Usage: ${0##*/} [-s share-proto] [-h]"
echo "Options:"
echo " -s | --share-proto: name of the share protocol. Possible options are nfs, cifs or zfs"
echo " -s | --share-proto: name of the share protocol. \
Possible options are nfs, nfs-ganesha, cifs or zfs"
echo " -h | --help: print this usage message and exit"
echo ""
echo "Usage example: manila_image_elements -s nfs"
}
valid_share_protocol(){
if [ "${MANILA_SHARE_PROTO}" != "nfs" ] && [ "${MANILA_SHARE_PROTO}" != "cifs" ] && [ "${MANILA_SHARE_PROTO}" != "zfs" ]; then
err "Protocol ${MANILA_SHARE_PROTO} not supported. Valid options are nfs, cifs or zfs."
if [ "${MANILA_SHARE_PROTO}" != "nfs" ] && [ "${MANILA_SHARE_PROTO}" != "nfs-ganesha" ] &&
[ "${MANILA_SHARE_PROTO}" != "cifs" ] && [ "${MANILA_SHARE_PROTO}" != "zfs" ]; then
err "Protocol ${MANILA_SHARE_PROTO} not supported. Valid options are nfs, nfs-ganesha, cifs or zfs."
exit 1
fi
}
@ -106,6 +108,8 @@ configure() {
OPTIONAL_ELEMENTS="$OPTIONAL_ELEMENTS manila-nfs manila-cifs"
elif [ "$MANILA_SHARE_PROTO" = "nfs" ]; then
OPTIONAL_ELEMENTS="$OPTIONAL_ELEMENTS manila-nfs"
elif [ "$MANILA_SHARE_PROTO" = "nfs-ganesha" ]; then
OPTIONAL_ELEMENTS="$OPTIONAL_ELEMENTS manila-nfs-ganesha"
elif [ "$MANILA_SHARE_PROTO" = "cifs" ]; then
OPTIONAL_ELEMENTS="$OPTIONAL_ELEMENTS manila-cifs"
elif [ "$MANILA_SHARE_PROTO" = "zfs" ]; then

View File

@ -1,35 +0,0 @@
#!/bin/bash
if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then
set -x
fi
set -eu
set -o pipefail
SCRIPTDIR=$(dirname $0)
# Install required packages
install-packages git-core cmake build-essential libkrb5-dev bison flex
# Build nfs-ganesha
cd /usr/src
# TODO(u_glide): Move branch to config option through "environment.d"
git config --global http.sslVerify false
git clone --depth 5 --recursive -b "V2.2-stable" \
https://github.com/nfs-ganesha/nfs-ganesha.git
cd nfs-ganesha
mkdir build && cd build
cmake ../src && make
# Install nfs-ganesha
sudo make install
# (aovchinnikov): This will be used later on when all peculiarities of
# running ganesha inside a container are sorted out.
#sudo cp ../src/scripts/ganeshactl/org.ganesha.nfsd.conf /etc/dbus-1/system.d/
#install -D -g root -o root -m 0755 \
# ${SCRIPTDIR}/nfs-ganesha /etc/init.d/nfs-ganesha
#sudo update-rc.d nfs-ganesha defaults
# Remove sources
cd /usr/src && rm -fR nfs-ganesha

View File

@ -1,71 +0,0 @@
#!/bin/bash
# nfs-ganesha init script for ubuntu
# source function library
. /lib/lsb/init-functions
PATHPROG=/usr/bin/ganesha.nfsd
LOGFILE=/var/log/ganesha.log
CONFFILE=/etc/ganesha/ganesha.conf
prog=ganesha.nfsd
PID_FILE=${PID_FILE:=/var/run/${prog}.pid}
LOCK_FILE=${LOCK_FILE:=/var/lock/subsys/${prog}}
[ -f /etc/sysconfig/ganesha ] && . /etc/sysconfig/ganesha
OPTIONS="-L $LOGFILE -f $CONFFILE -N NIV_EVENT"
RETVAL=0
start() {
log_daemon_msg "Starting $prog"
start-stop-daemon \
--start --oknodo --pidfile "$PID_FILE" --exec $PATHPROG -- $OPTIONS
status=$?
[ $status = 0 ]
log_end_msg $status
echo
}
stop() {
log_daemon_msg "Stopping $prog"
start-stop-daemon \
--stop --quiet --retry 5 --oknodo --pidfile $PID_FILE
status=$?
log_end_msg $status
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
sleep 3
start
;;
status)
if pidof ganesha.nfsd >/dev/null
then
echo "ganesha.nfsd running"
exit 0
else
echo "ganesha.nfsd not running"
exit 3
fi
;;
*)
echo $"Usage: $0 {start|stop|restart|reload|try-restart|status}"
RETVAL=1
esac
exit $RETVAL

View File

@ -1,9 +0,0 @@
cmake:
phase: post-install.d
uninstall: True
build-essential:
phase: post-install.d
uninstall: True
git-core:
phase: post-install.d
uninstall: True

View File

@ -0,0 +1,32 @@
#!/bin/bash
if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then
set -x
fi
set -eu
set -o pipefail
SCRIPTDIR=$(dirname $0)
# Build nfs-ganesha
cd /usr/src
# TODO(u_glide): Move branch to config option through "environment.d"
git config --global http.sslVerify false
git clone --recursive -b next https://github.com/nfs-ganesha/nfs-ganesha
cd nfs-ganesha
mkdir build && cd build
cmake -DUSE_DBUS=ON ../src
make
make install
# Set up systemd unit files for Xenial
cp ../src/scripts/systemd/*.service /lib/systemd/system/
sed -i '/^ExecStart.*/c\ExecStart=\/usr\/lib\/systemd\/scripts\/nfs-ganesha-config.sh' /lib/systemd/system/nfs-ganesha-config.service
cp ../src/scripts/nfs-ganesha-config.sh /usr/lib/systemd/scripts/
chmod 755 /usr/lib/systemd/scripts/nfs-ganesha-config.sh
mkdir -p /etc/sysconfig
cp ../src/scripts/systemd/sysconfig/nfs-ganesha /etc/sysconfig/ganesha
cp ../src/scripts/ganeshactl/org.ganesha.nfsd.conf /etc/dbus-1/system.d/
# Remove sources
cd /usr/src && rm -Rf nfs-ganesha

View File

@ -0,0 +1,17 @@
bison:
build-essential:
cmake:
dbus:
flex:
git-core:
libcephfs-dev:
libdbus-1-dev:
libkrb5-dev:
libtirpc1:
libssl-dev:
nfs-common:
pkg-config:
rpcbind:
uuid-dev:
libcap-dev:
libblkid-dev: