From a2ce6c0aa36a9b91864c719e3b1fd9563305f9e9 Mon Sep 17 00:00:00 2001 From: Alexey Ovchinnikov Date: Fri, 16 Sep 2016 11:56:17 +0300 Subject: [PATCH] Make nfs-kernel-server run on a clean host nfsd refuses to start on a host with empty /etc/exports. This change adds a workaround for affected first-party drivers. Change-Id: If62fdc4219ceb02455bc55c717b7f2c7f34b0dca Closes-Bug: 1616061 --- devstack/plugin.sh | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/devstack/plugin.sh b/devstack/plugin.sh index a422f873db..a7a46a5869 100755 --- a/devstack/plugin.sh +++ b/devstack/plugin.sh @@ -603,6 +603,23 @@ function init_manila { rm -f $MANILA_AUTH_CACHE_DIR/* } +# check_nfs_kernel_service_state_ubuntu- Make sure nfsd is running +function check_nfs_kernel_service_state_ubuntu { + # (aovchinnikov): Workaround for nfs-utils bug 1052264 + if [ ! sudo service nfs-kernel-server status | grep "nfsd running" -eq 0 ]; then + echo "Apparently nfsd is not running. Trying to fix that." + sudo mkdir -p "/media/nfsdonubuntuhelper" + # (aovchinnikov): shell wrapping is needed for cases when a file to be written + # is owned by root. + sudo sh -c "echo '/media/nfsdonubuntuhelper 127.0.0.1(ro)' >> /etc/exports" + sudo service nfs-kernel-server start + fi + if [ ! sudo service nfs-kernel-server status | grep "nfsd running" -eq 0 ]; then + echo "Failed to start nfsd. Exiting." + exit 1 + fi +} + # install_manila - Collect source and prepare function install_manila { git_clone $MANILACLIENT_REPO $MANILACLIENT_DIR $MANILACLIENT_BRANCH @@ -613,6 +630,7 @@ function install_manila { if is_service_enabled m-shr; then if is_ubuntu; then install_package nfs-kernel-server nfs-common samba + check_nfs_kernel_service_state_ubuntu elif is_fedora; then install_package nfs-utils nfs-utils-lib samba elif is_suse; then @@ -639,6 +657,8 @@ function install_manila { sudo apt-get install -y build-essential sudo apt-get install -y ubuntu-zfs sudo modprobe zfs + + check_nfs_kernel_service_state_ubuntu else echo "Manila Devstack plugin does not support installation "\ "of ZFS packages for non-'Ubuntu-trusty' distros. "\