Add ZFS element

ZFS filesystem is going to be used for replication feature by
Manila Generic share driver.
So, add appropriate Manila image element as optional and enabled by default.

Set env var 'MANILA_ENABLE_ZFS_SUPPORT' to any value other than 'yes' to
disable its installation.

Change-Id: If58186dc03d43430c1225e77aa80a1f85a62dd1b
Closes-Bug: #1538658
This commit is contained in:
vponomaryov 2016-01-21 15:54:24 +02:00
parent 1d6e3ff489
commit 572cef52e2
2 changed files with 63 additions and 0 deletions

View File

@ -36,6 +36,8 @@ MANILA_IMG_NAME=${MANILA_IMG_NAME:-"manila-service-image.qcow2"}
MANILA_ENABLE_NFS_SUPPORT=${MANILA_ENABLE_NFS_SUPPORT:-"yes"}
MANILA_ENABLE_CIFS_SUPPORT=${MANILA_ENABLE_CIFS_SUPPORT:-"yes"}
# Manila Generic share driver replication feature requires ZFS:
MANILA_ENABLE_ZFS_SUPPORT=${MANILA_ENABLE_ZFS_SUPPORT:-"yes"}
# Verify configuration
# --------------------
@ -55,6 +57,10 @@ if [ "$MANILA_ENABLE_CIFS_SUPPORT" = "yes" ]; then
OPTIONAL_ELEMENTS="$OPTIONAL_ELEMENTS manila-cifs"
fi
if [ "$MANILA_ENABLE_ZFS_SUPPORT" = "yes" ]; then
OPTIONAL_ELEMENTS="$OPTIONAL_ELEMENTS manila-zfs"
fi
if [ "$USE_OFFLINE_MODE" = "yes" ]; then
OPTIONAL_DIB_ARGS="$OPTIONAL_DIB_ARGS -offline"
fi

View File

@ -0,0 +1,57 @@
#!/bin/bash
if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then
set -x
fi
set -eu
set -o pipefail
# NOTE(vponomaryov): this approach of ZFS installation is valid for
# Ubuntu 14.04 (Trusty) and is very likely to be different for other releases.
# Also, ZFS should be installed in 'post-install.d' section because its
# dependency 'dkms' is installed in 'install.d/99-dkms'.
# Presense of 'ARCH' env var blocks DKMS from building new dynamic kernel
# modules. So, unset it temporary.
ARCH_BACKUP=$ARCH
unset ARCH
# Install 'software-properties-common' to get 'apt-add-repository' installed
apt-get install -y software-properties-common
# Register ZFS private package archive
apt-add-repository --yes ppa:zfs-native/stable
# Update list of available packages and then upgrade
apt-get -y -q update && apt-get -y -q upgrade
# 'linux-headers-*' should be installed prior to any dynamic kernel modules,
# which are 'zfs' and its dependency 'spl'.
# Same about 'build-essential', that is required for package compilations.
apt-get install -y linux-headers-generic
apt-get install -y build-essential
# Install ZFS for Ubuntu
apt-get install -y ubuntu-zfs
echo """
# Expected following template:
# %module-name%, %module-version%, %kernel-version%, %arch%: installed
#
# examples:
# spl, 0.6.5.4, 3.13.0-76-generic, x86_64: installed
# zfs, 0.6.5.4, 3.13.0-76-generic, x86_64: installed
#
# If it looks like following:
# spl, x.y.z, added
# zfs, x.y.z, added
#
# then something went wrong.
#
# List of dymanic kernel modules:
"""
dkms status
# Return back env var changes
export ARCH=$ARCH_BACKUP
unset ARCH_BACKUP