diff --git a/bin/manila-image-create b/bin/manila-image-create index 382e2e4..cdaea48 100644 --- a/bin/manila-image-create +++ b/bin/manila-image-create @@ -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 diff --git a/elements/manila-zfs/post-install.d/50-manila-zfs b/elements/manila-zfs/post-install.d/50-manila-zfs new file mode 100755 index 0000000..54a1348 --- /dev/null +++ b/elements/manila-zfs/post-install.d/50-manila-zfs @@ -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