Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.github/workflows: Bump actions/stale from 5 to 9 #111

Closed
wants to merge 65 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
9acf16a
Add sceleton object NVMeofGwMon/Map, added it to the array of monitors
leonidc Oct 17, 2023
696debb
Commit GWMap
leonidc Oct 18, 2023
c8abde1
Add GWMap
leonidc Oct 22, 2023
1b4a9bb
initial skeletone
Oct 19, 2023
1285fc6
Initial integration
Oct 25, 2023
90a311b
debug MAP api
leonidc Oct 25, 2023
00231a2
new SM timer concept
leonidc Oct 26, 2023
f4e2234
Add dispatch for MSG_MNVMEOF_GW_BEACON + traces
leonidc Oct 26, 2023
f600f97
add MSG_MNVMEOF_GW_BEACON decode
Oct 26, 2023
1902ef0
MNVMeofGwBeacon:decode_payload() fix
Oct 29, 2023
96bac54
NVME monitor map logic
leonidc Oct 29, 2023
e65f392
NVME monitor map logic, simulated exceptions
leonidc Oct 29, 2023
5bf4cc4
Changes for receive beacon and sending the map
leonidc Oct 29, 2023
f97c654
MSG_MNVMEOF_GW_MAP decode
Oct 29, 2023
a1245a3
encode decode to Map message
leonidc Oct 30, 2023
095ed0f
fix prepare_beacon return
leonidc Oct 30, 2023
db8841c
Dump of GWMAp on the GW side
leonidc Oct 30, 2023
f9be897
rework beacon
Oct 31, 2023
2320252
GW FSM called when GW state is modified
Nov 5, 2023
03e59dc
Fixed beacon encode/decode ,added beacon processing in NVMeofGwMon
Nov 7, 2023
5f3d4f3
grpc integration + proto compiling
Nov 3, 2023
edf3e2a
Initial gateway GRPC client
Nov 8, 2023
763c77a
fix map distribution to clients, fix in beacon payload
Nov 9, 2023
6013ba2
prepare delete GW, simulate 2 GW clients
Nov 10, 2023
5e0dd9f
gateway monitor client: command line parameters
Nov 13, 2023
ad9a3c4
some exception handling in mon, changes in map
Nov 14, 2023
b696a84
Add array of failover peers to the map
Nov 19, 2023
7cd0c92
Initial beacon logic, still requires map handling
Nov 20, 2023
2002ab2
Monitor allocates ANA group for GW
Nov 20, 2023
5670a1e
gateway container and start up integration
Nov 20, 2023
84af814
Utilize distinct command line arguments.
Nov 21, 2023
297ba89
pass ceph configuration
Nov 21, 2023
cd05fcb
Beacon logic
Nov 22, 2023
6390dae
null pointer fix
Nov 22, 2023
0eaa84b
Process ceph commands gw-create gw delete in NVMeofGwMon
Nov 23, 2023
6a61b8f
fix gw delete in NVMeofGwMap
Nov 23, 2023
b18052c
NVMeofGw::handle_nvmeof_gw_map(): calculate gateway GRPC set_ana_info…
Nov 26, 2023
72c1b84
Added created_gws vector and usage, add it to encode/decode, dump it
Nov 26, 2023
7ff5dee
fix receiving MonCommands by GW monitor
Nov 27, 2023
16653b0
grpc gateway set_ana_state()
Nov 27, 2023
756d64f
Don't compile by default NVMEOF GATEWAY MONITOR CLIENT
Nov 28, 2023
e1927e9
send to the GW client just GMap and map epoch - previously the full
Nov 29, 2023
0397f2f
nvmeof keyring: mon use 'allow *'
Nov 29, 2023
2a5f612
nvmeof gw version update
Nov 30, 2023
55bb96d
GWMap class ana-grp index is zero based , later in gw each ana-grp-id…
Nov 30, 2023
433c4f7
fix issue with extra distributions of map
Dec 2, 2023
5188f91
Send map with vector of created-gws when received beacon shows GW av…
Dec 4, 2023
f393003
Add grpc service client to set monitor provided group id
Dec 5, 2023
9eef580
update gateway version
Dec 5, 2023
64c8ba1
Add NVMeofGwMonitorGroupClient.cc/h files to git
Dec 6, 2023
65fa483
monitor : handle removal of subsystems, limit max ana groups to 16
Dec 7, 2023
75a857a
nvmeof gateway, tracking monitor-client-rebase-20231213 branch
Dec 13, 2023
355d3cb
handle gRPC call failures by retrying
Dec 13, 2023
563ba07
Fix ceph command nvme-gw delete
Dec 17, 2023
ef9493e
disable bypassing of cli nvme-gw create
Dec 17, 2023
696893d
Use 0x800 as a bit mask for nvmeofgw messages.
Dec 18, 2023
353d8bd
gw_created is an std-map, added nonce-vector to it
Dec 20, 2023
f65dad6
refactor nvme-gw mon command, per gw and includes id, pool, group
Dec 24, 2023
c5cf8dd
Added nonce-map under Created_gw map, modified encode/decode, dump . …
Dec 25, 2023
fd252f9
nvmeof gw beacon: add pool and group
Dec 25, 2023
afca4c0
process ceph config commands dump and set-log-level - first commit
Dec 25, 2023
61ad449
Support in maps gw-name key = concatenation of id pool group
Dec 25, 2023
753e6d3
Multi gateway group refactoring
Dec 26, 2023
b2e2dd0
my additions
Dec 31, 2023
ecaa4a0
.github/workflows: Bump actions/stale from 5 to 9
dependabot[bot] Dec 31, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/stale.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
stale:
runs-on: ubuntu-latest
steps:
- uses: actions/stale@v8
- uses: actions/stale@v9
with:
# PAT for GitHub API authentication
repo-token: "${{ secrets.GITHUB_TOKEN }}"
Expand Down
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -75,3 +75,6 @@
[submodule "src/jaegertracing/opentelemetry-cpp"]
path = src/jaegertracing/opentelemetry-cpp
url = https://github.com/open-telemetry/opentelemetry-cpp.git
[submodule "src/nvmeof/gateway"]
path = src/nvmeof/gateway
url = https://github.com/ceph/ceph-nvmeof.git
101 changes: 101 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -865,6 +865,107 @@ if(WITH_FUSE)
install(PROGRAMS mount.fuse.ceph DESTINATION ${CMAKE_INSTALL_SBINDIR})
endif(WITH_FUSE)

# NVMEOF GATEWAY MONITOR CLIENT

option(WITH_NVMEOF_GATEWAY_MONITOR_CLIENT "build nvmeof gateway monitor client" OFF)
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_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.cc
nvmeof/NVMeofGwClient.cc
nvmeof/NVMeofGwMonitorGroupClient.cc
nvmeof/NVMeofGw.cc)
add_executable(ceph-nvmeof ${ceph_nvmeof_srcs})
add_dependencies(ceph-nvmeof ceph-common)
target_link_libraries(ceph-nvmeof
client
mon
global-static
ceph-common
${_REFLECTION}
${_GRPC_GRPCPP}
)
install(TARGETS ceph-nvmeof DESTINATION bin)
endif()
# END OF NVMEOF GATEWAY MONITOR CLIENT

if(WITH_DOKAN)
add_subdirectory(dokan)
endif(WITH_DOKAN)
Expand Down
73 changes: 73 additions & 0 deletions src/ceph_nvmeof.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
// vim: ts=8 sw=2 smarttab
/*
* Ceph - scalable distributed file system
*
* Copyright (C) 2023 Red Hat Inc
*
* Author: Alexander Indenbaum <aindenba@redhat.com>
*
* This is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1, as published by the Free Software
* Foundation. See file COPYING.
*
*/

#include <pthread.h>

#include "include/types.h"
#include "include/compat.h"
#include "common/config.h"
#include "common/ceph_argparse.h"
#include "common/errno.h"
#include "common/pick_address.h"
#include "global/global_init.h"

#include "nvmeof/NVMeofGw.h"

static void usage()
{
std::cout << "usage: ceph-nvmeof -i <ID> [flags]\n"
<< std::endl;
generic_server_usage();
}

/**
* A short main() which just instantiates a Nvme and
* hands over control to that.
*/
int main(int argc, const char **argv)
{
ceph_pthread_setname(pthread_self(), "ceph-nvmeof");

auto args = argv_to_vec(argc, argv);
if (args.empty()) {
std::cerr << argv[0] << ": -h or --help for usage" << std::endl;
exit(1);
}
if (ceph_argparse_need_usage(args)) {
usage();
exit(0);
}

auto cct = global_init(nullptr, args, CEPH_ENTITY_TYPE_CLIENT,
CODE_ENVIRONMENT_UTILITY, // maybe later use CODE_ENVIRONMENT_DAEMON,
CINIT_FLAG_NO_DEFAULT_CONFIG_FILE);

pick_addresses(g_ceph_context, CEPH_PICK_ADDRESS_PUBLIC);

global_init_daemonize(g_ceph_context);
global_init_chdir(g_ceph_context);
common_init_finish(g_ceph_context);

NVMeofGw gw(argc, argv);
int rc = gw.init();
if (rc != 0) {
std::cerr << "Error in initialization: " << cpp_strerror(rc) << std::endl;
return rc;
}

return gw.main(args);
}

27 changes: 27 additions & 0 deletions src/common/options/mon.yaml.in
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,14 @@ options:
default: 30
services:
- mon
- name: mon_nvmeofgw_beacon_grace
type: secs
level: advanced
desc: Period in seconds from last beacon to monitor marking a manager daemon as
failed
default: 10
services:
- mon
- name: mon_mgr_inactive_grace
type: int
level: advanced
Expand Down Expand Up @@ -1338,3 +1346,22 @@ options:
with_legacy: true
see_also:
- osd_heartbeat_use_min_delay_socket
- name: nvmf_mon_log_level
type: int
level: advanced
desc: log level of the nvmeofMon
fmt_desc: Monitor will set the log level.
default: 5
services:
- mon
with_legacy: true
- name: nvmf_mon_mapdump
type: bool
level: advanced
desc: dump maps of nvmeofMon
fmt_desc: Monitor will dump maps
default: false
services:
- mon
with_legacy: true

124 changes: 124 additions & 0 deletions src/messages/MNVMeofGwBeacon.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
// vim: ts=8 sw=2 smarttab
/*
* Ceph - scalable distributed file system
*
* Copyright (C) 2023
*
* This is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1, as published by the Free Software
* Foundation. See file COPYING.
*
*/

#ifndef CEPH_NVMEOFGWBEACON_H
#define CEPH_NVMEOFGWBEACON_H

#include <cstddef>
#include <vector>
#include "messages/PaxosServiceMessage.h"
#include "mon/MonCommand.h"
#include "mon/NVMeofGwMap.h"

#include "include/types.h"
class MNVMeofGwBeacon final : public PaxosServiceMessage {
private:
static constexpr int HEAD_VERSION = 1;
static constexpr int COMPAT_VERSION = 1;

protected:
std::string gw_id;
std::string gw_pool;
std::string gw_group;
GwSubsystems subsystems; // gateway susbsystem and their state machine states
GW_AVAILABILITY_E availability; // in absence of beacon heartbeat messages it becomes inavailable
uint32_t version;

public:
MNVMeofGwBeacon()
: PaxosServiceMessage{MSG_MNVMEOF_GW_BEACON, 0, HEAD_VERSION, COMPAT_VERSION}
{}

MNVMeofGwBeacon(const std::string &gw_id_,
const std::string& gw_pool_,
const std::string& gw_group_,
const GwSubsystems& subsystems_,
const GW_AVAILABILITY_E& availability_,
const uint32_t& version_
)
: PaxosServiceMessage{MSG_MNVMEOF_GW_BEACON, 0, HEAD_VERSION, COMPAT_VERSION},
gw_id(gw_id_), gw_pool(gw_pool_), gw_group(gw_group_), subsystems(subsystems_),
availability(availability_), version(version_)
{}

const std::string& get_gw_id() const { return gw_id; }
const std::string& get_gw_pool() const { return gw_pool; }
const std::string& get_gw_group() const { return gw_group; }
const GW_AVAILABILITY_E& get_availability() const { return availability; }
const uint32_t& get_version() const { return version; }
const GwSubsystems& get_subsystems() const { return subsystems; };

private:
~MNVMeofGwBeacon() final {}

public:

std::string_view get_type_name() const override { return "nvmeofgwbeacon"; }

void encode_payload(uint64_t features) override {
header.version = HEAD_VERSION;
header.compat_version = COMPAT_VERSION;
using ceph::encode;
paxos_encode();
encode(gw_id, payload);
encode(gw_pool, payload);
encode(gw_group, payload);
encode((int)subsystems.size(), payload);
for (const NqnState& st: subsystems) {
encode(st.nqn, payload);
for (int i = 0; i < MAX_SUPPORTED_ANA_GROUPS; i++)
encode((int)st.sm_state[i], payload);
encode(st.opt_ana_gid, payload);
}
encode((int)availability, payload);
encode(version, payload);
}

void decode_payload() override {
using ceph::decode;
auto p = payload.cbegin();

paxos_decode(p);
decode(gw_id, p);
decode(gw_pool, p);
decode(gw_group, p);
int n;
int tmp;
decode(n, p);
// Reserve memory for the vector to avoid reallocations
subsystems.clear();
subsystems.reserve(n);
for (int i = 0; i < n; i++) {
std::string nqn;
decode(nqn, p);
NqnState st(nqn);
for (int j = 0; j < MAX_SUPPORTED_ANA_GROUPS; j++) {
decode(tmp, p);
st.sm_state[j] = static_cast<GW_STATES_PER_AGROUP_E>(tmp);
}
decode(st.opt_ana_gid, p);
subsystems.push_back(st);
}
decode(tmp, p);
availability = static_cast<GW_AVAILABILITY_E>(tmp);
decode(version, p);
}

private:
template<class T, typename... Args>
friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args);
};


#endif