2019-10-03 08:33:31 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
set -e
|
2020-08-07 12:11:02 +00:00
|
|
|
set -o pipefail
|
2019-10-03 08:33:31 +00:00
|
|
|
|
|
|
|
SCRIPT_DIR="$(dirname "$BASH_SOURCE")"
|
|
|
|
SCRIPT_DIR="$(realpath "$SCRIPT_DIR")"
|
|
|
|
|
2020-03-27 02:14:52 +00:00
|
|
|
num_vcpus=$(nproc)
|
2019-10-03 08:33:31 +00:00
|
|
|
|
|
|
|
CEPH_DIR="${CEPH_DIR:-$SCRIPT_DIR}"
|
|
|
|
BUILD_DIR="${BUILD_DIR:-${CEPH_DIR}/build}"
|
|
|
|
DEPS_DIR="${DEPS_DIR:-$CEPH_DIR/build.deps}"
|
2020-08-07 12:11:02 +00:00
|
|
|
ZIP_DEST="${ZIP_DEST:-$BUILD_DIR/ceph.zip}"
|
2019-10-03 08:33:31 +00:00
|
|
|
|
|
|
|
CLEAN_BUILD=${CLEAN_BUILD:-}
|
|
|
|
SKIP_BUILD=${SKIP_BUILD:-}
|
2020-08-07 12:11:02 +00:00
|
|
|
# Usefull when packaging existing binaries.
|
|
|
|
SKIP_CMAKE=${SKIP_CMAKE:-}
|
|
|
|
SKIP_DLL_COPY=${SKIP_DLL_COPY:-}
|
|
|
|
SKIP_TESTS=${SKIP_TESTS:-}
|
2020-03-28 00:17:42 +00:00
|
|
|
SKIP_BINDIR_CLEAN=${SKIP_BINDIR_CLEAN:-}
|
2021-02-03 13:45:14 +00:00
|
|
|
# Use Ninja's default, it might be useful when having few cores.
|
|
|
|
NUM_WORKERS_DEFAULT=$(( $num_vcpus + 2 ))
|
|
|
|
NUM_WORKERS=${NUM_WORKERS:-$NUM_WORKERS_DEFAULT}
|
2019-10-03 08:33:31 +00:00
|
|
|
DEV_BUILD=${DEV_BUILD:-}
|
2021-02-03 08:59:24 +00:00
|
|
|
# Unless SKIP_ZIP is set, we're preparing an archive that contains the Ceph
|
|
|
|
# binaries, debug symbols as well as the required DLLs.
|
|
|
|
SKIP_ZIP=${SKIP_ZIP:-}
|
|
|
|
# By default, we'll move the debug symbols to separate files located in the
|
|
|
|
# ".debug" directory. If "EMBEDDED_DBG_SYM" is set, the debug symbols will
|
|
|
|
# remain embedded in the binaries.
|
|
|
|
#
|
2020-08-07 12:11:02 +00:00
|
|
|
# Unfortunately we cannot use pdb symbols when cross compiling. cv2pdb
|
|
|
|
# well as llvm rely on mspdb*.dll in order to support this proprietary format.
|
2021-02-03 08:59:24 +00:00
|
|
|
EMBEDDED_DBG_SYM=${EMBEDDED_DBG_SYM:-}
|
2020-03-27 02:43:22 +00:00
|
|
|
# Allow for OS specific customizations through the OS flag.
|
2022-09-09 17:37:16 +00:00
|
|
|
# Valid options are currently "ubuntu", "suse", and "rhel".
|
2020-03-27 02:43:22 +00:00
|
|
|
|
|
|
|
OS=${OS}
|
|
|
|
if [[ -z $OS ]]; then
|
2022-09-09 15:29:36 +00:00
|
|
|
source /etc/os-release
|
|
|
|
case "$ID" in
|
|
|
|
opensuse*|suse|sles)
|
2020-03-27 02:43:22 +00:00
|
|
|
OS="suse"
|
2022-09-09 15:29:36 +00:00
|
|
|
;;
|
2022-09-09 17:37:16 +00:00
|
|
|
rhel|centos)
|
|
|
|
OS="rhel"
|
|
|
|
;;
|
2022-09-09 15:29:36 +00:00
|
|
|
ubuntu)
|
2020-03-27 02:43:22 +00:00
|
|
|
OS="ubuntu"
|
2022-09-09 15:29:36 +00:00
|
|
|
;;
|
|
|
|
*)
|
2022-09-09 17:37:16 +00:00
|
|
|
echo "Unsupported Linux distro $ID."
|
|
|
|
echo "only SUSE, Ubuntu and RHEL are supported."
|
|
|
|
echo "Set the OS environment variable to override."
|
2020-03-27 02:43:22 +00:00
|
|
|
exit 1
|
2022-09-09 15:29:36 +00:00
|
|
|
;;
|
|
|
|
esac
|
2020-03-27 02:43:22 +00:00
|
|
|
fi
|
2019-10-03 08:33:31 +00:00
|
|
|
|
2023-04-07 10:39:59 +00:00
|
|
|
# The main advantages of mingw-llvm:
|
|
|
|
# * not affected by the libstdc++/winpthread rw lock bugs
|
|
|
|
# * can generate pdb debug symbols, which are compatible with WinDBG
|
|
|
|
TOOLCHAIN=${TOOLCHAIN:-"mingw-llvm"}
|
|
|
|
|
|
|
|
case "$TOOLCHAIN" in
|
|
|
|
mingw-llvm)
|
|
|
|
echo "Using mingw-llvm."
|
2023-09-04 10:01:48 +00:00
|
|
|
USE_MINGW_LLVM=1
|
2023-04-07 10:39:59 +00:00
|
|
|
;;
|
|
|
|
mingw-gcc)
|
|
|
|
echo "Using mingw-gcc"
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo "Unsupported toolchain: $TOOLCHAIN."
|
|
|
|
echo "Allowed toolchains: mingw-llvm or mingw-gcc."
|
|
|
|
esac
|
|
|
|
|
|
|
|
|
2019-10-03 08:33:31 +00:00
|
|
|
# We'll have to be explicit here since auto-detecting doesn't work
|
|
|
|
# properly when cross compiling.
|
|
|
|
ALLOCATOR=${ALLOCATOR:-libc}
|
|
|
|
# Debug builds don't work with MINGW for the time being, failing with
|
|
|
|
# can't close <file>: File too big
|
|
|
|
# -Wa,-mbig-obj does not help.
|
2021-02-03 08:59:24 +00:00
|
|
|
CMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE:-}
|
|
|
|
if [[ -z $CMAKE_BUILD_TYPE ]]; then
|
|
|
|
# By default, we're building release binaries with minimal debug information.
|
|
|
|
export CFLAGS="$CFLAGS -g1"
|
|
|
|
export CXXFLAGS="$CXXFLAGS -g1"
|
|
|
|
CMAKE_BUILD_TYPE=Release
|
|
|
|
fi
|
|
|
|
|
2023-09-04 10:01:48 +00:00
|
|
|
ENABLE_SHARED=${ENABLE_SHARED:-ON}
|
2019-10-03 08:33:31 +00:00
|
|
|
|
2020-08-07 12:11:02 +00:00
|
|
|
binDir="$BUILD_DIR/bin"
|
|
|
|
strippedBinDir="$BUILD_DIR/bin_stripped"
|
2021-02-03 08:59:24 +00:00
|
|
|
# GDB will look for this directory by default.
|
|
|
|
dbgDirname=".debug"
|
|
|
|
dbgSymbolDir="$strippedBinDir/${dbgDirname}"
|
2019-10-03 08:33:31 +00:00
|
|
|
depsSrcDir="$DEPS_DIR/src"
|
|
|
|
depsToolsetDir="$DEPS_DIR/mingw"
|
|
|
|
|
2021-02-03 13:45:14 +00:00
|
|
|
cmakeGenerator="Ninja"
|
2019-10-03 08:33:31 +00:00
|
|
|
lz4Dir="${depsToolsetDir}/lz4"
|
|
|
|
sslDir="${depsToolsetDir}/openssl"
|
|
|
|
boostDir="${depsToolsetDir}/boost"
|
|
|
|
zlibDir="${depsToolsetDir}/zlib"
|
2020-03-24 02:16:28 +00:00
|
|
|
backtraceDir="${depsToolsetDir}/libbacktrace"
|
2019-10-03 08:33:31 +00:00
|
|
|
snappyDir="${depsToolsetDir}/snappy"
|
|
|
|
winLibDir="${depsToolsetDir}/windows/lib"
|
rbd: allow mounting images on Windows
This change will allow mapping rbd images on Windows, leveraging the
WNBD[1] Virtual Storport Miniport driver [2].
The behavior and CLI is similar to the Linux rbd-nbd, with a few
notable differences:
* device paths cannot be requested. The disk number and path will
be picked by Windows. If a device path is provided by the user
when mapping an image, it will be used as an identifier, which
can also be used when unmapping the image.
* the "show" command was added, which describes a specific mapping.
This can be used for retrieving the disk path.
* the "service" command was added, allowing rbd-wnbd to run as a
Windows service. All mappings are currently perisistent, being
recreated when the service stops, unless explicitly unmapped.
The service disconnects the mappings when being stopped.
* the "list" command also includes a "status" column.
The purpose of the "service" mode is to ensure that mappings survive
reboots and that the Windows service start order can be adjusted so
that rbd images can be mapped before starting services that may depend
on it, such as VMMS.
The mapped images can either be consumed by the host directly or exposed
to Hyper-V VMs.
While at it, we'll skip building rbd-mirror as it's quite unlikely that
this daemon is going to be used on Windows for now.
[1] https://github.com/cloudbase/wnbd
[2] https://docs.microsoft.com/en-us/windows-hardware/drivers/storage/overview-of-storage-virtual-miniport-drivers
Signed-off-by: Lucian Petrut <lpetrut@cloudbasesolutions.com>
Signed-off-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
2020-07-30 11:40:31 +00:00
|
|
|
wnbdSrcDir="${depsSrcDir}/wnbd"
|
|
|
|
wnbdLibDir="${depsToolsetDir}/wnbd/lib"
|
cephfs: Add ceph-dokan, providing Windows support
In order to expose ceph filesystems to Windows hosts, we propose
including ceph-dokan[1][2] in the Ceph tree, while updating it to
work with the latest CephFS and Dokany APIs.
Dokany is a well maintained project (fork of the original Dokan
project), allowing filesystems to be implemented in userspace,
even providing a Fuse compatibility layer.
One reason for not using the FUSE compatibility layer is that it's
only covering the high level API while Ceph is using the low level
FUSE API, which among other things is inode centric.
Changes made by this patch compared to the upstream ceph-dokan:
* support latest stable Dokany API. The upstream version relies on
the legacy unmaintained Dokan API
* return proper error codes, converting standard errno.h values to
NTSTATUS
* minor changes to support latest cephfs API
* drop duplicated ceph code, no longer needed if we're to include it
in tree. This makes it much easier to maintain.
* drop redundant permission checks, leaving it up to libcephfs
* use ceph argparse helpers
* use ceph logging and daemon initialization
* fixed unicode handling
* switched to ceph coding style
* made ceph.conf param optional, using the default path if available
* enabled setting file timestamps
* append support
* configurable timeouts set once per mount
* ensure that the error code is always logged
* various cleanups (removed unused entry points, checks that have
been moved to dokany, simplified conditional statements,
unnecessary conversions in the hot path, etc).
[1] https://github.com/ketor/ceph-dokan
[2] https://github.com/ceph/ceph-dokan
Signed-off-by: Lucian Petrut <lpetrut@cloudbasesolutions.com>
2020-08-07 12:07:20 +00:00
|
|
|
dokanSrcDir="${depsSrcDir}/dokany"
|
|
|
|
dokanLibDir="${depsToolsetDir}/dokany/lib"
|
2019-10-03 08:33:31 +00:00
|
|
|
|
2022-09-09 18:44:45 +00:00
|
|
|
depsDirs="$lz4Dir;$sslDir;$boostDir;$zlibDir;$backtraceDir;$snappyDir"
|
2019-10-03 08:33:31 +00:00
|
|
|
depsDirs+=";$winLibDir"
|
|
|
|
|
2021-05-07 09:23:30 +00:00
|
|
|
# Cmake recommends using CMAKE_PREFIX_PATH instead of link_directories.
|
|
|
|
# Still, some library dependencies may not include the full path (e.g. Boost
|
|
|
|
# sets the "-lz" flag through INTERFACE_LINK_LIBRARIES), which is why
|
|
|
|
# we have to ensure that the linker will be able to locate them.
|
|
|
|
linkDirs="$zlibDir/lib"
|
|
|
|
|
2020-03-23 13:34:37 +00:00
|
|
|
lz4Lib="${lz4Dir}/lib/dll/liblz4-1.dll"
|
2019-10-03 08:33:31 +00:00
|
|
|
lz4Include="${lz4Dir}/lib"
|
|
|
|
|
|
|
|
if [[ -n $CLEAN_BUILD ]]; then
|
|
|
|
echo "Cleaning up build dir: $BUILD_DIR"
|
|
|
|
rm -rf $BUILD_DIR
|
2020-03-24 03:13:36 +00:00
|
|
|
rm -rf $DEPS_DIR
|
2019-10-03 08:33:31 +00:00
|
|
|
fi
|
2020-03-28 00:17:42 +00:00
|
|
|
if [[ -z $SKIP_BINDIR_CLEAN ]]; then
|
|
|
|
echo "Cleaning up bin dir: $binDir"
|
|
|
|
rm -rf $binDir
|
|
|
|
fi
|
2019-10-03 08:33:31 +00:00
|
|
|
|
2021-05-07 07:18:39 +00:00
|
|
|
mkdir -p $BUILD_DIR
|
|
|
|
cd $BUILD_DIR
|
|
|
|
|
2020-03-24 03:13:36 +00:00
|
|
|
if [[ ! -f ${depsToolsetDir}/completed ]]; then
|
2021-05-06 07:18:56 +00:00
|
|
|
echo "Preparing dependencies: $DEPS_DIR. Log: ${BUILD_DIR}/build_deps.log"
|
2023-09-04 10:01:48 +00:00
|
|
|
NUM_WORKERS=$NUM_WORKERS \
|
|
|
|
DEPS_DIR=$DEPS_DIR \
|
|
|
|
OS="$OS" \
|
|
|
|
ENABLE_SHARED=$ENABLE_SHARED \
|
|
|
|
USE_MINGW_LLVM=$USE_MINGW_LLVM \
|
|
|
|
"$SCRIPT_DIR/win32_deps_build.sh" | tee "${BUILD_DIR}/build_deps.log"
|
2019-10-03 08:33:31 +00:00
|
|
|
fi
|
|
|
|
|
2020-03-27 02:43:22 +00:00
|
|
|
# Due to distribution specific mingw settings, the mingw.cmake file
|
|
|
|
# must be built prior to running cmake.
|
|
|
|
MINGW_CMAKE_FILE="$BUILD_DIR/mingw32.cmake"
|
|
|
|
MINGW_POSIX_FLAGS=1
|
|
|
|
source "$SCRIPT_DIR/mingw_conf.sh"
|
|
|
|
|
2020-08-07 12:11:02 +00:00
|
|
|
if [[ -z $SKIP_CMAKE ]]; then
|
2019-10-03 08:33:31 +00:00
|
|
|
# We'll need to cross compile Boost.Python before enabling
|
|
|
|
# "WITH_MGR".
|
|
|
|
echo "Generating solution. Log: ${BUILD_DIR}/cmake.log"
|
|
|
|
|
|
|
|
# This isn't propagated to some of the subprojects, we'll use an env variable
|
|
|
|
# for now.
|
|
|
|
export CMAKE_PREFIX_PATH=$depsDirs
|
|
|
|
|
|
|
|
if [[ -n $DEV_BUILD ]]; then
|
|
|
|
echo "Dev build enabled."
|
|
|
|
echo "Git versioning will be disabled."
|
|
|
|
ENABLE_GIT_VERSION="OFF"
|
2019-12-19 13:32:47 +00:00
|
|
|
WITH_CEPH_DEBUG_MUTEX="ON"
|
2019-10-03 08:33:31 +00:00
|
|
|
else
|
|
|
|
ENABLE_GIT_VERSION="ON"
|
2019-12-19 13:32:47 +00:00
|
|
|
WITH_CEPH_DEBUG_MUTEX="OFF"
|
2019-10-03 08:33:31 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
# As opposed to Linux, Windows shared libraries can't have unresolved
|
|
|
|
# symbols. Until we fix the dependencies (which are either unspecified
|
|
|
|
# or circular), we'll have to stick to static linking.
|
|
|
|
cmake -D CMAKE_PREFIX_PATH=$depsDirs \
|
2021-05-07 09:23:30 +00:00
|
|
|
-D MINGW_LINK_DIRECTORIES="$linkDirs" \
|
2020-03-27 02:43:22 +00:00
|
|
|
-D CMAKE_TOOLCHAIN_FILE="$MINGW_CMAKE_FILE" \
|
2023-04-11 08:39:10 +00:00
|
|
|
-D WITH_FMT_HEADER_ONLY=ON \
|
2021-03-26 08:15:37 +00:00
|
|
|
-D WITH_LIBCEPHSQLITE=OFF \
|
2023-11-27 13:32:38 +00:00
|
|
|
-D WITH_QATLIB=OFF -D WITH_QATZIP=OFF \
|
2019-10-03 08:33:31 +00:00
|
|
|
-D WITH_RDMA=OFF -D WITH_OPENLDAP=OFF \
|
cephfs: Add ceph-dokan, providing Windows support
In order to expose ceph filesystems to Windows hosts, we propose
including ceph-dokan[1][2] in the Ceph tree, while updating it to
work with the latest CephFS and Dokany APIs.
Dokany is a well maintained project (fork of the original Dokan
project), allowing filesystems to be implemented in userspace,
even providing a Fuse compatibility layer.
One reason for not using the FUSE compatibility layer is that it's
only covering the high level API while Ceph is using the low level
FUSE API, which among other things is inode centric.
Changes made by this patch compared to the upstream ceph-dokan:
* support latest stable Dokany API. The upstream version relies on
the legacy unmaintained Dokan API
* return proper error codes, converting standard errno.h values to
NTSTATUS
* minor changes to support latest cephfs API
* drop duplicated ceph code, no longer needed if we're to include it
in tree. This makes it much easier to maintain.
* drop redundant permission checks, leaving it up to libcephfs
* use ceph argparse helpers
* use ceph logging and daemon initialization
* fixed unicode handling
* switched to ceph coding style
* made ceph.conf param optional, using the default path if available
* enabled setting file timestamps
* append support
* configurable timeouts set once per mount
* ensure that the error code is always logged
* various cleanups (removed unused entry points, checks that have
been moved to dokany, simplified conditional statements,
unnecessary conversions in the hot path, etc).
[1] https://github.com/ketor/ceph-dokan
[2] https://github.com/ceph/ceph-dokan
Signed-off-by: Lucian Petrut <lpetrut@cloudbasesolutions.com>
2020-08-07 12:07:20 +00:00
|
|
|
-D WITH_GSSAPI=OFF -D WITH_XFS=OFF \
|
|
|
|
-D WITH_FUSE=OFF -D WITH_DOKAN=ON \
|
2019-10-03 08:33:31 +00:00
|
|
|
-D WITH_BLUESTORE=OFF -D WITH_LEVELDB=OFF \
|
2022-02-07 13:15:12 +00:00
|
|
|
-D WITH_LTTNG=OFF -D WITH_BABELTRACE=OFF -D WITH_JAEGER=OFF \
|
2019-12-19 13:32:47 +00:00
|
|
|
-D WITH_SYSTEM_BOOST=ON -D WITH_MGR=OFF -D WITH_KVS=OFF \
|
cephfs: Add ceph-dokan, providing Windows support
In order to expose ceph filesystems to Windows hosts, we propose
including ceph-dokan[1][2] in the Ceph tree, while updating it to
work with the latest CephFS and Dokany APIs.
Dokany is a well maintained project (fork of the original Dokan
project), allowing filesystems to be implemented in userspace,
even providing a Fuse compatibility layer.
One reason for not using the FUSE compatibility layer is that it's
only covering the high level API while Ceph is using the low level
FUSE API, which among other things is inode centric.
Changes made by this patch compared to the upstream ceph-dokan:
* support latest stable Dokany API. The upstream version relies on
the legacy unmaintained Dokan API
* return proper error codes, converting standard errno.h values to
NTSTATUS
* minor changes to support latest cephfs API
* drop duplicated ceph code, no longer needed if we're to include it
in tree. This makes it much easier to maintain.
* drop redundant permission checks, leaving it up to libcephfs
* use ceph argparse helpers
* use ceph logging and daemon initialization
* fixed unicode handling
* switched to ceph coding style
* made ceph.conf param optional, using the default path if available
* enabled setting file timestamps
* append support
* configurable timeouts set once per mount
* ensure that the error code is always logged
* various cleanups (removed unused entry points, checks that have
been moved to dokany, simplified conditional statements,
unnecessary conversions in the hot path, etc).
[1] https://github.com/ketor/ceph-dokan
[2] https://github.com/ceph/ceph-dokan
Signed-off-by: Lucian Petrut <lpetrut@cloudbasesolutions.com>
2020-08-07 12:07:20 +00:00
|
|
|
-D WITH_LIBCEPHFS=ON -D WITH_KRBD=OFF -D WITH_RADOSGW=OFF \
|
2021-01-07 13:14:00 +00:00
|
|
|
-D ENABLE_SHARED=$ENABLE_SHARED -D WITH_RBD=ON -D BUILD_GMOCK=ON \
|
2019-10-03 08:33:31 +00:00
|
|
|
-D WITH_CEPHFS=OFF -D WITH_MANPAGE=OFF \
|
2019-12-19 13:32:47 +00:00
|
|
|
-D WITH_MGR_DASHBOARD_FRONTEND=OFF -D WITH_SYSTEMD=OFF -D WITH_TESTS=ON \
|
2019-10-03 08:33:31 +00:00
|
|
|
-D LZ4_INCLUDE_DIR=$lz4Include -D LZ4_LIBRARY=$lz4Lib \
|
|
|
|
-D Backtrace_INCLUDE_DIR="$backtraceDir/include" \
|
2020-04-02 15:45:44 +00:00
|
|
|
-D Backtrace_LIBRARY="$backtraceDir/lib/libbacktrace.a" \
|
2019-10-03 08:33:31 +00:00
|
|
|
-D ENABLE_GIT_VERSION=$ENABLE_GIT_VERSION \
|
|
|
|
-D ALLOCATOR="$ALLOCATOR" -D CMAKE_BUILD_TYPE=$CMAKE_BUILD_TYPE \
|
rbd: allow mounting images on Windows
This change will allow mapping rbd images on Windows, leveraging the
WNBD[1] Virtual Storport Miniport driver [2].
The behavior and CLI is similar to the Linux rbd-nbd, with a few
notable differences:
* device paths cannot be requested. The disk number and path will
be picked by Windows. If a device path is provided by the user
when mapping an image, it will be used as an identifier, which
can also be used when unmapping the image.
* the "show" command was added, which describes a specific mapping.
This can be used for retrieving the disk path.
* the "service" command was added, allowing rbd-wnbd to run as a
Windows service. All mappings are currently perisistent, being
recreated when the service stops, unless explicitly unmapped.
The service disconnects the mappings when being stopped.
* the "list" command also includes a "status" column.
The purpose of the "service" mode is to ensure that mappings survive
reboots and that the Windows service start order can be adjusted so
that rbd images can be mapped before starting services that may depend
on it, such as VMMS.
The mapped images can either be consumed by the host directly or exposed
to Hyper-V VMs.
While at it, we'll skip building rbd-mirror as it's quite unlikely that
this daemon is going to be used on Windows for now.
[1] https://github.com/cloudbase/wnbd
[2] https://docs.microsoft.com/en-us/windows-hardware/drivers/storage/overview-of-storage-virtual-miniport-drivers
Signed-off-by: Lucian Petrut <lpetrut@cloudbasesolutions.com>
Signed-off-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
2020-07-30 11:40:31 +00:00
|
|
|
-D WNBD_INCLUDE_DIRS="$wnbdSrcDir/include" \
|
|
|
|
-D WNBD_LIBRARIES="$wnbdLibDir/libwnbd.a" \
|
2019-12-19 13:32:47 +00:00
|
|
|
-D WITH_CEPH_DEBUG_MUTEX=$WITH_CEPH_DEBUG_MUTEX \
|
cephfs: Add ceph-dokan, providing Windows support
In order to expose ceph filesystems to Windows hosts, we propose
including ceph-dokan[1][2] in the Ceph tree, while updating it to
work with the latest CephFS and Dokany APIs.
Dokany is a well maintained project (fork of the original Dokan
project), allowing filesystems to be implemented in userspace,
even providing a Fuse compatibility layer.
One reason for not using the FUSE compatibility layer is that it's
only covering the high level API while Ceph is using the low level
FUSE API, which among other things is inode centric.
Changes made by this patch compared to the upstream ceph-dokan:
* support latest stable Dokany API. The upstream version relies on
the legacy unmaintained Dokan API
* return proper error codes, converting standard errno.h values to
NTSTATUS
* minor changes to support latest cephfs API
* drop duplicated ceph code, no longer needed if we're to include it
in tree. This makes it much easier to maintain.
* drop redundant permission checks, leaving it up to libcephfs
* use ceph argparse helpers
* use ceph logging and daemon initialization
* fixed unicode handling
* switched to ceph coding style
* made ceph.conf param optional, using the default path if available
* enabled setting file timestamps
* append support
* configurable timeouts set once per mount
* ensure that the error code is always logged
* various cleanups (removed unused entry points, checks that have
been moved to dokany, simplified conditional statements,
unnecessary conversions in the hot path, etc).
[1] https://github.com/ketor/ceph-dokan
[2] https://github.com/ceph/ceph-dokan
Signed-off-by: Lucian Petrut <lpetrut@cloudbasesolutions.com>
2020-08-07 12:07:20 +00:00
|
|
|
-D DOKAN_INCLUDE_DIRS="$dokanSrcDir/dokan" \
|
|
|
|
-D DOKAN_LIBRARIES="$dokanLibDir/libdokan.a" \
|
2021-02-03 13:45:14 +00:00
|
|
|
-G "$cmakeGenerator" \
|
2019-10-03 08:33:31 +00:00
|
|
|
$CEPH_DIR 2>&1 | tee "${BUILD_DIR}/cmake.log"
|
2020-08-07 12:11:02 +00:00
|
|
|
fi # [[ -z $SKIP_CMAKE ]]
|
2019-10-03 08:33:31 +00:00
|
|
|
|
|
|
|
if [[ -z $SKIP_BUILD ]]; then
|
|
|
|
echo "Building using $NUM_WORKERS workers. Log: ${BUILD_DIR}/build.log"
|
2019-11-25 15:00:59 +00:00
|
|
|
echo "" > "${BUILD_DIR}/build.log"
|
|
|
|
|
2021-02-03 13:45:14 +00:00
|
|
|
cd $BUILD_DIR
|
|
|
|
ninja_targets="rados rbd rbd-wnbd "
|
|
|
|
ninja_targets+=" ceph-conf ceph-immutable-object-cache"
|
|
|
|
ninja_targets+=" cephfs ceph-dokan"
|
|
|
|
# TODO: do we actually need the ceph compression libs?
|
|
|
|
ninja_targets+=" compressor ceph_lz4 ceph_snappy ceph_zlib ceph_zstd"
|
2021-01-13 09:57:12 +00:00
|
|
|
if [[ -z $SKIP_TESTS ]]; then
|
2022-09-15 08:41:56 +00:00
|
|
|
ninja_targets+=" tests ceph_radosacl ceph_scratchtool "
|
|
|
|
ninja_targets+=`ninja -t targets | grep ceph_test | cut -d ":" -f 1 | grep -v exe`
|
2021-01-13 09:57:12 +00:00
|
|
|
fi
|
|
|
|
|
2021-02-03 13:45:14 +00:00
|
|
|
ninja -v $ninja_targets 2>&1 | tee "${BUILD_DIR}/build.log"
|
2019-10-03 08:33:31 +00:00
|
|
|
fi
|
2020-08-07 12:11:02 +00:00
|
|
|
|
|
|
|
if [[ -z $SKIP_DLL_COPY ]]; then
|
2020-03-27 02:43:22 +00:00
|
|
|
# To adjust mingw paths, see 'mingw_conf.sh'.
|
2020-08-07 12:11:02 +00:00
|
|
|
required_dlls=(
|
|
|
|
$zlibDir/zlib1.dll
|
2020-03-23 13:34:37 +00:00
|
|
|
$lz4Dir/lib/dll/liblz4-1.dll
|
2020-08-07 12:11:02 +00:00
|
|
|
$sslDir/bin/libcrypto-1_1-x64.dll
|
|
|
|
$sslDir/bin/libssl-1_1-x64.dll
|
2023-08-23 14:21:12 +00:00
|
|
|
$mingwLibpthreadDir/libwinpthread-1.dll)
|
|
|
|
if [[ $ENABLE_SHARED == "ON" ]]; then
|
|
|
|
required_dlls+=(
|
|
|
|
$boostDir/lib/*.dll
|
|
|
|
)
|
|
|
|
fi
|
2023-04-07 10:39:59 +00:00
|
|
|
if [[ -n $USE_MINGW_LLVM ]]; then
|
|
|
|
required_dlls+=(
|
|
|
|
$mingwTargetLibDir/libc++.dll
|
|
|
|
$mingwTargetLibDir/libunwind.dll)
|
|
|
|
else
|
|
|
|
required_dlls+=(
|
|
|
|
$mingwTargetLibDir/libstdc++-6.dll
|
|
|
|
$mingwTargetLibDir/libssp*.dll
|
|
|
|
$mingwTargetLibDir/libgcc_s_seh-1.dll)
|
|
|
|
fi
|
2020-08-07 12:11:02 +00:00
|
|
|
echo "Copying required dlls to $binDir."
|
|
|
|
cp ${required_dlls[@]} $binDir
|
|
|
|
fi
|
|
|
|
|
2021-02-03 08:59:24 +00:00
|
|
|
if [[ -z $SKIP_ZIP ]]; then
|
2020-03-28 00:17:42 +00:00
|
|
|
# Use a temp directory, in order to create a clean zip file
|
|
|
|
ZIP_TMPDIR=$(mktemp -d win_binaries.XXXXX)
|
2021-02-03 08:59:24 +00:00
|
|
|
if [[ -z $EMBEDDED_DBG_SYM ]]; then
|
|
|
|
echo "Extracting debug symbols from binaries."
|
2020-03-28 00:57:55 +00:00
|
|
|
rm -rf $strippedBinDir; mkdir $strippedBinDir
|
2021-02-03 08:59:24 +00:00
|
|
|
rm -rf $dbgSymbolDir; mkdir $dbgSymbolDir
|
2020-03-28 00:57:55 +00:00
|
|
|
# Strip files individually, to save time and space
|
|
|
|
for file in $binDir/*.exe $binDir/*.dll; do
|
2021-02-03 08:59:24 +00:00
|
|
|
dbgFilename=$(basename $file).debug
|
|
|
|
dbgFile="$dbgSymbolDir/$dbgFilename"
|
|
|
|
strippedFile="$strippedBinDir/$(basename $file)"
|
|
|
|
|
|
|
|
echo "Copying debug symbols: $dbgFile"
|
|
|
|
$MINGW_OBJCOPY --only-keep-debug $file $dbgFile
|
|
|
|
$MINGW_STRIP --strip-debug --strip-unneeded -o $strippedFile $file
|
|
|
|
$MINGW_OBJCOPY --remove-section .gnu_debuglink $strippedFile
|
|
|
|
$MINGW_OBJCOPY --add-gnu-debuglink=$dbgFile $strippedFile
|
2020-03-28 00:57:55 +00:00
|
|
|
done
|
|
|
|
# Copy any remaining files to the stripped directory
|
|
|
|
for file in $binDir/*; do
|
|
|
|
[[ ! -f $strippedBinDir/$(basename $file) ]] && \
|
|
|
|
cp $file $strippedBinDir
|
|
|
|
done
|
2020-03-28 00:17:42 +00:00
|
|
|
ln -s $strippedBinDir $ZIP_TMPDIR/ceph
|
|
|
|
else
|
|
|
|
ln -s $binDir $ZIP_TMPDIR/ceph
|
2020-08-07 12:11:02 +00:00
|
|
|
fi
|
|
|
|
echo "Building zip archive $ZIP_DEST."
|
2020-03-28 00:17:42 +00:00
|
|
|
# Include the README file in the archive
|
|
|
|
ln -s $CEPH_DIR/README.windows.rst $ZIP_TMPDIR/ceph/README.windows.rst
|
|
|
|
cd $ZIP_TMPDIR
|
|
|
|
[[ -f $ZIP_DEST ]] && rm $ZIP_DEST
|
|
|
|
zip -r $ZIP_DEST ceph
|
|
|
|
cd -
|
|
|
|
rm -rf $ZIP_TMPDIR/ceph/README.windows.rst $ZIP_TMPDIR
|
|
|
|
echo -e '\n WIN32 files zipped to: '$ZIP_DEST'\n'
|
2020-08-07 12:11:02 +00:00
|
|
|
fi
|