diff --git a/.gitmodules b/.gitmodules index c59c0179b..15ad44e45 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,6 @@ -[submodule "external/src/ceph"] - path = external/src/ceph +[submodule "external/src/ceph-kraken"] + path = external/src/ceph-kraken + url = https://github.com/rook/ceph +[submodule "external/src/ceph-luminous"] + path = external/src/ceph-luminous url = https://github.com/rook/ceph diff --git a/Makefile b/Makefile index 6e5329642..c4b2ed54d 100644 --- a/Makefile +++ b/Makefile @@ -91,6 +91,9 @@ include build/makelib/cross.mk ifeq ($(GOOS),linux) +# Set the memory allocator used for ceph +CEPH_BRANCH ?= kraken + # Set the memory allocator used for ceph ALLOCATOR ?= tcmalloc_minimal @@ -148,7 +151,7 @@ include build/makelib/release.mk external: ifeq ($(GOOS),linux) - @$(MAKE) -C external ALLOCATOR=$(ALLOCATOR) PLATFORMS=$(CROSS_TRIPLE) cross + @$(MAKE) -C external CEPH_BRANCH=$(CEPH_BRANCH) ALLOCATOR=$(ALLOCATOR) PLATFORMS=$(CROSS_TRIPLE) cross endif external/build/$(CROSS_TRIPLE)/lib/libcephd.a: @@ -195,10 +198,7 @@ distclean: go.distclean clean external.distclean build.platform.%: @$(MAKE) GOOS=$(word 1, $(subst _, ,$*)) GOARCH=$(word 2, $(subst _, ,$*)) build -build.cross: $(foreach p,$(ALL_PLATFORMS), build.platform.$(p)) - -cross: - @$(MAKE) build.cross +cross: $(foreach p,$(ALL_PLATFORMS), build.platform.$(p)) release: cross @$(MAKE) release.build diff --git a/external/CMakeLists.txt b/external/CMakeLists.txt index c7b838247..1611d25eb 100644 --- a/external/CMakeLists.txt +++ b/external/CMakeLists.txt @@ -34,6 +34,9 @@ option(EXTERNAL_ALWAYS_BUILD "whether to force build some packages like ceph" ON # or have them go to stdout. option(EXTERNAL_LOGGING "whether to log all external build output to files" ON) +# the version of ceph to build +set(CEPH_BRANCH "kraken" CACHE STRING "the branch of ceph to build") + # set the processor count # FIX: this should really be done at runtime with make -j4. Boost requires this # now since it goes inside ExternalProject_Add diff --git a/external/Makefile b/external/Makefile index 9cfc781a1..6a8e7c99f 100644 --- a/external/Makefile +++ b/external/Makefile @@ -21,6 +21,9 @@ all: build # Set the memory allocator used for ceph ALLOCATOR ?= tcmalloc_minimal +# The release of ceph to build +CEPH_BRANCH ?= kraken + # Whether to build ceph everytime and ignore the timestamps ALWAYS_BUILD ?= ON @@ -65,6 +68,7 @@ build.$(1): -H$(CURDIR) \ -B$(BUILDDIR)/$(1) \ -DALLOCATOR=$(ALLOCATOR) \ + -DCEPH_BRANCH=$(CEPH_BRANCH) \ -DEXTERNAL_ALWAYS_BUILD=$(ALWAYS_BUILD) \ -DEXTERNAL_DOWNLOAD_DIR=$(DOWNLOADDIR) \ -DCMAKE_TOOLCHAIN_FILE=$(CURDIR)/toolchain/$(1).cmake \ @@ -112,6 +116,8 @@ help: @echo ' tcmalloc_minimal (default).' @echo ' ALWAYS_BUILD Set to 1 to always build ceph. The' @echo ' default is 1.' + @echo ' CEPH_BRANCH The ceph branch to build from. Can be set' + @echo ' to kraken, or luminous.' @echo ' BUILD_TYPE The build type. Debug produces non-' @echo ' optimized builds. Release produces fully' @echo ' optimized builds. RelWithDebInfo produces' diff --git a/external/ceph-submodule-check b/external/ceph-submodule-check index 7d29d37b1..75fb70899 100755 --- a/external/ceph-submodule-check +++ b/external/ceph-submodule-check @@ -14,9 +14,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -errors=0 -remote= - # find the remote for upstream rook function get_remote() { gitdir=$1 @@ -34,65 +31,73 @@ function get_remote() { echo $remote } -rook_remote=$(get_remote . rook) -if [[ ${rook_remote} == "" ]]; then - echo ERROR: could not find a git remote pointing to https://github.com/rook/rook - exit 2 -fi +errors=0 +remote= -echo using remote ${rook_remote} branch master +for release in kraken luminous; do -ceph_remote=$(get_remote `pwd`/external/src/ceph ceph) -if [[ ${ceph_remote} == "" ]]; then - echo ERROR: could not find a git remote pointing to https://github.com/rook/ceph - exit 2 -fi + echo checking external/src/ceph-${release} -echo using ceph remote ${ceph_remote} branch master + rook_remote=$(get_remote . rook) + if [[ ${rook_remote} == "" ]]; then + echo ERROR: could not find a git remote pointing to https://github.com/rook/rook + exit 2 + fi -# get all the commits in rook/rook that have modified the ceph submodule -commits=$(git log --pretty=format:%H --no-abbrev ${rook_remote}/master --submodule=log -- ceph external/src/ceph) -for c in ${commits}; do + echo using remote ${rook_remote} branch master - # find the branches this commit is in - branch=$(git branch --contains $c | tr -d "* ") + ceph_remote=$(get_remote `pwd`/external/src/ceph-${release} ceph) + if [[ ${ceph_remote} == "" ]]; then + echo ERROR: could not find a git remote pointing to https://github.com/rook/ceph + exit 2 + fi - # now find the commit hash of the submodule - ceph_commit=$(git show --no-abbrev --oneline --raw ${c} --submodule -- ceph external/src/ceph | grep '^:' | cut -d' ' -f4) + echo using ceph remote ${ceph_remote} branch master - # ignore the some commits that were lost in the past when the project was first getting started. - if [[ "$ceph_commit" == "c4da56d0cbfcd75e37be29dd4853b23487a3526f" ]] || - [[ "$ceph_commit" == "d43b87b16610f5278da38953f4bffa03fb788b17" ]] || - [[ "$ceph_commit" == "d536828eaafa3866e0aaaee703ae0f54dc66ea91" ]] || - [[ "$ceph_commit" == "b7ce5af680249349a76d79ccf54ff568a736757c" ]] || - [[ "$ceph_commit" == "ccf17262cbaf4cb2795d4b6e72df6c175b504687" ]] || - [[ "$ceph_commit" == "239cbebf96dba6c1532702b7a460937ed4ae6785" ]] || - [[ "$ceph_commit" == "ad1f5e0c3d9679d1f46250497927112ccb72c9be" ]] || - [[ "$ceph_commit" == "f1f1910c488036500abc19a36d22cfd7937741aa" ]] || - [[ "$ceph_commit" == "56131a5545544369f2cfe5d3c43333082859d69b" ]] || - [[ "$ceph_commit" == "0cbdba99b4ed85cfdf6d4eb8d6bd65013ed26c23" ]] || - [[ "$ceph_commit" == "12209224c24f589fe0e4918052dbface874faff1" ]] || - [[ "$ceph_commit" == "d2088b133b2a29a6c1efb22072016ee3268ca3df" ]] || - [[ "$ceph_commit" == "47b199109bbff1db37ddff9461652e30d79df330" ]] || - [[ "$ceph_commit" == "763750b0f06f6e27b976853bfe314aa555757e61" ]] || - [[ "$ceph_commit" == "8953972151cae60be4999ba4896f78fc358b1150" ]] || - [[ "$ceph_commit" == "dc578817ca6d169e2225f1ec9428942668f46a8c" ]] || - [[ "$ceph_commit" == "137d2718d89128f23387ca15aefdb22bdc175a64" ]] || - [[ "$ceph_commit" == "949e02e7af4ab140e207a25baabeb90e6c06553c" ]]; then - continue - fi + # get all the commits in rook/rook that have modified the ceph submodule + commits=$(git log --pretty=format:%H --no-abbrev ${rook_remote}/master --submodule=log -- ceph external/src/ceph-${release}) + for c in ${commits}; do - # check if the commit hash is valid - if $(cd external/src/ceph; git show "$ceph_commit" > /dev/null 2>&1); then - ceph_branch=$(cd external/src/ceph; git branch -r --no-color --contains "$ceph_commit" "${ceph_remote}/rook*" | tr -d "* ") - if [[ "$ceph_branch" == "" ]]; then - echo submodule reference in rook/rook commmit $c \(appears in branches $branch\) has a reference to rook/ceph $ceph_commit but is not part of a branch - ((++errors)) - fi - else - echo submodule reference in rook/rook commmit $c \(appears in branches $branch\) is missing from rook/ceph - ((++errors)) - fi + # find the branches this commit is in + branch=$(git branch --contains $c | tr -d "* ") + + # now find the commit hash of the submodule + ceph_commit=$(git show --no-abbrev --oneline --raw ${c} --submodule -- ceph external/src/ceph-${release} | grep '^:' | cut -d' ' -f4) + + # ignore the some commits that were lost in the past when the project was first getting started. + if [[ "$ceph_commit" == "c4da56d0cbfcd75e37be29dd4853b23487a3526f" ]] || + [[ "$ceph_commit" == "d43b87b16610f5278da38953f4bffa03fb788b17" ]] || + [[ "$ceph_commit" == "d536828eaafa3866e0aaaee703ae0f54dc66ea91" ]] || + [[ "$ceph_commit" == "b7ce5af680249349a76d79ccf54ff568a736757c" ]] || + [[ "$ceph_commit" == "ccf17262cbaf4cb2795d4b6e72df6c175b504687" ]] || + [[ "$ceph_commit" == "239cbebf96dba6c1532702b7a460937ed4ae6785" ]] || + [[ "$ceph_commit" == "ad1f5e0c3d9679d1f46250497927112ccb72c9be" ]] || + [[ "$ceph_commit" == "f1f1910c488036500abc19a36d22cfd7937741aa" ]] || + [[ "$ceph_commit" == "56131a5545544369f2cfe5d3c43333082859d69b" ]] || + [[ "$ceph_commit" == "0cbdba99b4ed85cfdf6d4eb8d6bd65013ed26c23" ]] || + [[ "$ceph_commit" == "12209224c24f589fe0e4918052dbface874faff1" ]] || + [[ "$ceph_commit" == "d2088b133b2a29a6c1efb22072016ee3268ca3df" ]] || + [[ "$ceph_commit" == "47b199109bbff1db37ddff9461652e30d79df330" ]] || + [[ "$ceph_commit" == "763750b0f06f6e27b976853bfe314aa555757e61" ]] || + [[ "$ceph_commit" == "8953972151cae60be4999ba4896f78fc358b1150" ]] || + [[ "$ceph_commit" == "dc578817ca6d169e2225f1ec9428942668f46a8c" ]] || + [[ "$ceph_commit" == "137d2718d89128f23387ca15aefdb22bdc175a64" ]] || + [[ "$ceph_commit" == "949e02e7af4ab140e207a25baabeb90e6c06553c" ]]; then + continue + fi + + # check if the commit hash is valid + if $(cd external/src/ceph-${release}; git show "$ceph_commit" > /dev/null 2>&1); then + ceph_branch=$(cd external/src/ceph-${release}; git branch -r --no-color --contains "$ceph_commit" "${ceph_remote}/rook*" | tr -d "* ") + if [[ "$ceph_branch" == "" ]]; then + echo submodule reference in rook/rook commmit $c \(appears in branches $branch\) has a reference to rook/ceph $ceph_commit but is not part of a branch + ((++errors)) + fi + else + echo submodule reference in rook/rook commmit $c \(appears in branches $branch\) is missing from rook/ceph + ((++errors)) + fi + done done if [[ ${errors} != 0 ]]; then diff --git a/external/packages/ceph/CMakeLists.txt b/external/packages/ceph/CMakeLists.txt index 326ee006e..cb0d9f5e6 100644 --- a/external/packages/ceph/CMakeLists.txt +++ b/external/packages/ceph/CMakeLists.txt @@ -17,7 +17,7 @@ if (NOT ALLOCATOR) set(ALLOCATOR tcmalloc_minimal) endif() -message(STATUS "External: Building embedded ceph(${ALLOCATOR}) from submodule") +message(STATUS "External: Building Ceph ${CEPH_BRANCH} (allocator ${ALLOCATOR})") set(Ceph_CMAKE_ARGS -DEXTERNAL_ROOT=${EXTERNAL_ROOT} @@ -29,7 +29,6 @@ set(Ceph_CMAKE_ARGS -DUSE_CRYPTOPP=ON -DWITH_EMBEDDED=ON -DWITH_FUSE=OFF - -DWITH_KRBD=OFF -DWITH_LEVELDB=OFF -DWITH_LTTNG=OFF -DWITH_MANPAGE=OFF @@ -43,10 +42,15 @@ set(Ceph_CMAKE_ARGS -DWITH_SSL=OFF -DWITH_SYSTEM_BOOST=ON -DWITH_SYSTEM_ROCKSDB=ON - -DWITH_SYSTEM_ZSTD=ON -DWITH_XFS=OFF ) +if (NOT CEPH_BRANCH STREQUAL "kraken") + list(APPEND Ceph_CMAKE_ARGS + -DWITH_KRBD=OFF + -DWITH_SYSTEM_ZSTD=ON) +endif() + # # Build # @@ -55,8 +59,9 @@ ExternalProject_Add(ceph DEPENDS aio boost cryptopp curl expat gperftools jemalloc openssl rocksdb snappy util-linux zlib zstd PREFIX ${EXTERNAL_ROOT} - SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../src/ceph + SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../src/ceph-${CEPH_BRANCH} DOWNLOAD_DIR ${EXTERNAL_DOWNLOAD_DIR} + CMAKE_ARGS ${Ceph_CMAKE_ARGS} BUILD_COMMAND $(MAKE) cephd BUILD_ALWAYS ${EXTERNAL_ALWAYS_BUILD} @@ -67,6 +72,6 @@ ExternalProject_Add(ceph LOG_DOWNLOAD ${EXTERNAL_LOGGING} LOG_PATCH ${EXTERNAL_LOGGING} - LOG_CONFIGURE ${EXTERNAL_LOGGING} + LOG_CONFIGURE OFF LOG_BUILD OFF LOG_INSTALL ${EXTERNAL_LOGGING}) diff --git a/external/src/ceph-kraken b/external/src/ceph-kraken new file mode 160000 index 000000000..83e46925c --- /dev/null +++ b/external/src/ceph-kraken @@ -0,0 +1 @@ +Subproject commit 83e46925c910bace45d1e99745b5c5188b154a8b diff --git a/external/src/ceph b/external/src/ceph-luminous similarity index 100% rename from external/src/ceph rename to external/src/ceph-luminous