summaryrefslogtreecommitdiffstats
path: root/src/CMakeLists.txt
diff options
context:
space:
mode:
authorLeonid Chernin <lechernin@gmail.com>2023-10-17 15:25:07 +0200
committerAlexander Indenbaum <aindenba@redhat.com>2024-07-31 10:50:10 +0200
commit5843c6b04bacf9a7c981fca5d874ab3400f855db (patch)
tree0b4c623960659c1f3017bf98da3f1ce7d0960d8b /src/CMakeLists.txt
parentMerge pull request #58311 from rishabh-d-dave/fs-auth-nonalpha-test (diff)
downloadceph-5843c6b04bacf9a7c981fca5d874ab3400f855db.tar.xz
ceph-5843c6b04bacf9a7c981fca5d874ab3400f855db.zip
mon: add NVMe-oF gateway monitor and HA
- gateway submodule Fixes: https://tracker.ceph.com/issues/64777 This PR adds high availability support for the nvmeof Ceph service. High availability means that even in the case that a certain GW is down, there will be another available path for the initiator to be able to continue the IO through another GW. High availability is achieved by running nvmeof service consisting of at least 2 nvmeof GWs in the Ceph cluster. Every GW will be seen by the host (initiator) as a separate path to the nvme namespaces (volumes). The implementation consists of the following main modules: - NVMeofGWMon - a PaxosService. It is a monitor that tracks the status of the nvmeof running services, and take actions in case that services fail, and in case services restored. - NVMeofGwMonitorClient – It is an agent that is running as a part of each nvmeof GW. It is sending beacons to the monitor to signal that the GW is alive. As a part of the beacon, the client also sends information about the service. This information is used by the monitor to take decisions and perform some operations. - MNVMeofGwBeacon – It is a structure used by the client and the monitor to send/recv the beacons. - MNVMeofGwMap – The map is tracking the nvmeof GWs status. It also defines what should be the new role of every GW. So in the events of GWs go down or GWs restored, the map will reflect the new role of each GW resulted by these events. The map is distributed to the NVMeofGwMonitorClient on each GW, and it knows to update the GW with the required changes. It is also adding 3 new mon commands: - nvme-gw create - nvme-gw delete - nvme-gw show The commands are used by the ceph adm to update the monitor that a new GW is deployed. The monitor will update the map accordingly and will start tracking this GW until it is deleted. Signed-off-by: Leonid Chernin <lechernin@gmail.com> Signed-off-by: Alexander Indenbaum <aindenba@redhat.com>
Diffstat (limited to 'src/CMakeLists.txt')
-rw-r--r--src/CMakeLists.txt112
1 files changed, 112 insertions, 0 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 79b45ef171f..591ea5f357e 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -305,6 +305,12 @@ endif(WITH_BLKIN)
if(WITH_JAEGER)
find_package(thrift 0.13.0 REQUIRED)
+
+ if(EXISTS "/etc/redhat-release" OR EXISTS "/etc/fedora-release")
+ # absl is installed as grpc build dependency on RPM based systems
+ add_definitions(-DHAVE_ABSEIL)
+ endif()
+
include(BuildOpentelemetry)
build_opentelemetry()
add_library(jaeger_base INTERFACE)
@@ -875,6 +881,112 @@ if(WITH_FUSE)
install(PROGRAMS mount.fuse.ceph DESTINATION ${CMAKE_INSTALL_SBINDIR})
endif(WITH_FUSE)
+# NVMEOF GATEWAY MONITOR CLIENT
+# Supported on RPM-based platforms only, depends on grpc devel libraries/tools
+if(EXISTS "/etc/redhat-release" OR EXISTS "/etc/fedora-release")
+ option(WITH_NVMEOF_GATEWAY_MONITOR_CLIENT "build nvmeof gateway monitor client" ON)
+else()
+ option(WITH_NVMEOF_GATEWAY_MONITOR_CLIENT "build nvmeof gateway monitor client" OFF)
+endif()
+
+if(WITH_NVMEOF_GATEWAY_MONITOR_CLIENT)
+
+ # Find Protobuf installation
+ # Looks for protobuf-config.cmake file installed by Protobuf's cmake installation.
+ option(protobuf_MODULE_COMPATIBLE TRUE)
+ find_package(Protobuf REQUIRED)
+
+ set(_REFLECTION grpc++_reflection)
+ if(CMAKE_CROSSCOMPILING)
+ find_program(_PROTOBUF_PROTOC protoc)
+ else()
+ set(_PROTOBUF_PROTOC $<TARGET_FILE:protobuf::protoc>)
+ endif()
+
+ # Find gRPC installation
+ # Looks for gRPCConfig.cmake file installed by gRPC's cmake installation.
+ find_package(gRPC CONFIG REQUIRED)
+ message(STATUS "Using gRPC ${gRPC_VERSION}")
+ set(_GRPC_GRPCPP gRPC::grpc++)
+ if(CMAKE_CROSSCOMPILING)
+ find_program(_GRPC_CPP_PLUGIN_EXECUTABLE grpc_cpp_plugin)
+ else()
+ set(_GRPC_CPP_PLUGIN_EXECUTABLE $<TARGET_FILE:gRPC::grpc_cpp_plugin>)
+ endif()
+
+ # Gateway Proto file
+ get_filename_component(nvmeof_gateway_proto "nvmeof/gateway/control/proto/gateway.proto" ABSOLUTE)
+ get_filename_component(nvmeof_gateway_proto_path "${nvmeof_gateway_proto}" PATH)
+
+ # Generated sources
+ set(nvmeof_gateway_proto_srcs "${CMAKE_CURRENT_BINARY_DIR}/gateway.pb.cc")
+ set(nvmeof_gateway_proto_hdrs "${CMAKE_CURRENT_BINARY_DIR}/gateway.pb.h")
+ set(nvmeof_gateway_grpc_srcs "${CMAKE_CURRENT_BINARY_DIR}/gateway.grpc.pb.cc")
+ set(nvmeof_gateway_grpc_hdrs "${CMAKE_CURRENT_BINARY_DIR}/gateway.grpc.pb.h")
+
+ add_custom_command(
+ OUTPUT "${nvmeof_gateway_proto_srcs}" "${nvmeof_gateway_proto_hdrs}" "${nvmeof_gateway_grpc_srcs}" "${nvmeof_gateway_grpc_hdrs}"
+ COMMAND ${_PROTOBUF_PROTOC}
+ ARGS --grpc_out "${CMAKE_CURRENT_BINARY_DIR}"
+ --cpp_out "${CMAKE_CURRENT_BINARY_DIR}"
+ -I "${nvmeof_gateway_proto_path}"
+ --experimental_allow_proto3_optional
+ --plugin=protoc-gen-grpc="${_GRPC_CPP_PLUGIN_EXECUTABLE}"
+ "${nvmeof_gateway_proto}"
+ DEPENDS "${nvmeof_gateway_proto}")
+
+
+ # Monitor Proto file
+ get_filename_component(nvmeof_monitor_proto "nvmeof/gateway/control/proto/monitor.proto" ABSOLUTE)
+ get_filename_component(nvmeof_monitor_proto_path "${nvmeof_monitor_proto}" PATH)
+
+ # Generated sources
+ set(nvmeof_monitor_proto_srcs "${CMAKE_CURRENT_BINARY_DIR}/monitor.pb.cc")
+ set(nvmeof_monitor_proto_hdrs "${CMAKE_CURRENT_BINARY_DIR}/monitor.pb.h")
+ set(nvmeof_monitor_grpc_srcs "${CMAKE_CURRENT_BINARY_DIR}/monitor.grpc.pb.cc")
+ set(nvmeof_monitor_grpc_hdrs "${CMAKE_CURRENT_BINARY_DIR}/monitor.grpc.pb.h")
+
+ add_custom_command(
+ OUTPUT "${nvmeof_monitor_proto_srcs}" "${nvmeof_monitor_proto_hdrs}" "${nvmeof_monitor_grpc_srcs}" "${nvmeof_monitor_grpc_hdrs}"
+ COMMAND ${_PROTOBUF_PROTOC}
+ ARGS --grpc_out "${CMAKE_CURRENT_BINARY_DIR}"
+ --cpp_out "${CMAKE_CURRENT_BINARY_DIR}"
+ -I "${nvmeof_monitor_proto_path}"
+ --experimental_allow_proto3_optional
+ --plugin=protoc-gen-grpc="${_GRPC_CPP_PLUGIN_EXECUTABLE}"
+ "${nvmeof_monitor_proto}"
+ DEPENDS "${nvmeof_monitor_proto}")
+
+ # Include generated *.pb.h files
+ include_directories("${CMAKE_CURRENT_BINARY_DIR}")
+
+ set(ceph_nvmeof_monitor_client_srcs
+ ${nvmeof_gateway_proto_srcs}
+ ${nvmeof_gateway_proto_hdrs}
+ ${nvmeof_gateway_grpc_srcs}
+ ${nvmeof_gateway_grpc_hdrs}
+ ${nvmeof_monitor_proto_srcs}
+ ${nvmeof_monitor_proto_hdrs}
+ ${nvmeof_monitor_grpc_srcs}
+ ${nvmeof_monitor_grpc_hdrs}
+ ceph_nvmeof_monitor_client.cc
+ nvmeof/NVMeofGwClient.cc
+ nvmeof/NVMeofGwMonitorGroupClient.cc
+ nvmeof/NVMeofGwMonitorClient.cc)
+ add_executable(ceph-nvmeof-monitor-client ${ceph_nvmeof_monitor_client_srcs})
+ add_dependencies(ceph-nvmeof-monitor-client ceph-common)
+ target_link_libraries(ceph-nvmeof-monitor-client
+ client
+ mon
+ global-static
+ ceph-common
+ ${_REFLECTION}
+ ${_GRPC_GRPCPP}
+ )
+ install(TARGETS ceph-nvmeof-monitor-client DESTINATION bin)
+endif()
+# END OF NVMEOF GATEWAY MONITOR CLIENT
+
if(WITH_DOKAN)
add_subdirectory(dokan)
endif(WITH_DOKAN)