From 1f578c0fb6993c3e855938575816e19fc4c64d9a Mon Sep 17 00:00:00 2001 From: Alex Ainscow Date: Wed, 10 Jan 2024 21:20:26 +0000 Subject: [PATCH 1/3] src: various fixes to compile RBD on macOs --- do_cmake.sh | 1 - src/rbd_fuse/rbd-fuse.cc | 4 ++-- src/test/librbd/migration/test_mock_QCOWFormat.cc | 1 + src/tools/rbd_mirror/image_replayer/snapshot/Replayer.cc | 6 +++--- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/do_cmake.sh b/do_cmake.sh index d2644c641651b..c00737346a3a4 100755 --- a/do_cmake.sh +++ b/do_cmake.sh @@ -78,7 +78,6 @@ elif [ "$(uname)" == Darwin ] ; then ARGS+=" -DWITH_BLUESTORE=OFF" ARGS+=" -DWITH_LTTNG=OFF" ARGS+=" -DWITH_BABELTRACE=OFF" - ARGS+=" -DWITH_RBD=OFF" ARGS+=" -DWITH_KRBD=OFF" ARGS+=" -DWITH_RADOSGW_AMQP_ENDPOINT=OFF" ARGS+=" -DWITH_RADOSGW_KAFKA_ENDPOINT=OFF" diff --git a/src/rbd_fuse/rbd-fuse.cc b/src/rbd_fuse/rbd-fuse.cc index 12e30ceb04c61..0ca7e6bd85fb8 100644 --- a/src/rbd_fuse/rbd-fuse.cc +++ b/src/rbd_fuse/rbd-fuse.cc @@ -678,7 +678,7 @@ int rbdfs_setxattr(const char *path, const char *name, const char *value, size_t size, int flags -#if defined(DARWIN) +#if defined(__APPLE__) ,uint32_t pos #endif ) @@ -701,7 +701,7 @@ rbdfs_setxattr(const char *path, const char *name, const char *value, int rbdfs_getxattr(const char *path, const char *name, char *value, size_t size -#if defined(DARWIN) +#if defined(__APPLE__) ,uint32_t position #endif ) diff --git a/src/test/librbd/migration/test_mock_QCOWFormat.cc b/src/test/librbd/migration/test_mock_QCOWFormat.cc index 6e7225d22430c..4ce868eba4e5f 100644 --- a/src/test/librbd/migration/test_mock_QCOWFormat.cc +++ b/src/test/librbd/migration/test_mock_QCOWFormat.cc @@ -12,6 +12,7 @@ #include "gtest/gtest.h" #include "gmock/gmock.h" #include "json_spirit/json_spirit.h" +#include "include/endian_compat.h" namespace librbd { namespace { diff --git a/src/tools/rbd_mirror/image_replayer/snapshot/Replayer.cc b/src/tools/rbd_mirror/image_replayer/snapshot/Replayer.cc index 67eaa97779d7e..2a5688fdc440d 100644 --- a/src/tools/rbd_mirror/image_replayer/snapshot/Replayer.cc +++ b/src/tools/rbd_mirror/image_replayer/snapshot/Replayer.cc @@ -255,7 +255,7 @@ bool Replayer::get_replay_status(std::string* description, json_spirit::mObject root_obj; root_obj["replay_state"] = replay_state; - root_obj["remote_snapshot_timestamp"] = remote_snap_info->timestamp.sec(); + root_obj["remote_snapshot_timestamp"] = (int64_t)remote_snap_info->timestamp.sec(); if (m_perf_counters) { m_perf_counters->tset(l_rbd_mirror_snapshot_remote_timestamp, remote_snap_info->timestamp); @@ -274,7 +274,7 @@ bool Replayer::get_replay_status(std::string* description, // the local snapshot would just be the time the snapshot was // synced and not the consistency point in time. root_obj["local_snapshot_timestamp"] = - matching_remote_snap_it->second.timestamp.sec(); + (int64_t)matching_remote_snap_it->second.timestamp.sec(); if (m_perf_counters) { m_perf_counters->tset(l_rbd_mirror_snapshot_local_timestamp, matching_remote_snap_it->second.timestamp); @@ -286,7 +286,7 @@ bool Replayer::get_replay_status(std::string* description, if (m_remote_snap_id_end != CEPH_NOSNAP && matching_remote_snap_it != m_state_builder->remote_image_ctx->snap_info.end()) { - root_obj["syncing_snapshot_timestamp"] = remote_snap_info->timestamp.sec(); + root_obj["syncing_snapshot_timestamp"] = (int64_t)remote_snap_info->timestamp.sec(); if (m_local_object_count > 0) { root_obj["syncing_percent"] = From 64f5ec25ea8145adeadc0d469878531b23c67186 Mon Sep 17 00:00:00 2001 From: Alex Ainscow Date: Mon, 15 Jan 2024 00:25:27 +0000 Subject: [PATCH 2/3] Add long constructor for json_spirit --- src/json_spirit/json_spirit_value.h | 7 +++++++ src/tools/rbd_mirror/image_replayer/snapshot/Replayer.cc | 6 +++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/json_spirit/json_spirit_value.h b/src/json_spirit/json_spirit_value.h index a4126369fa150..5c2a1e5f0a5af 100644 --- a/src/json_spirit/json_spirit_value.h +++ b/src/json_spirit/json_spirit_value.h @@ -51,6 +51,7 @@ namespace json_spirit Value_impl( const Array& value ); Value_impl( bool value ); Value_impl( int value ); + Value_impl( long value ); Value_impl( boost::int64_t value ); Value_impl( boost::uint64_t value ); Value_impl( double value ); @@ -295,6 +296,12 @@ namespace json_spirit { } + template < class Config > + Value_impl< Config >::Value_impl( long value ) + : v_( static_cast< boost::int64_t >( value ) ) + { + } + template< class Config > Value_impl< Config >::Value_impl( boost::int64_t value ) : v_( value ) diff --git a/src/tools/rbd_mirror/image_replayer/snapshot/Replayer.cc b/src/tools/rbd_mirror/image_replayer/snapshot/Replayer.cc index 2a5688fdc440d..67eaa97779d7e 100644 --- a/src/tools/rbd_mirror/image_replayer/snapshot/Replayer.cc +++ b/src/tools/rbd_mirror/image_replayer/snapshot/Replayer.cc @@ -255,7 +255,7 @@ bool Replayer::get_replay_status(std::string* description, json_spirit::mObject root_obj; root_obj["replay_state"] = replay_state; - root_obj["remote_snapshot_timestamp"] = (int64_t)remote_snap_info->timestamp.sec(); + root_obj["remote_snapshot_timestamp"] = remote_snap_info->timestamp.sec(); if (m_perf_counters) { m_perf_counters->tset(l_rbd_mirror_snapshot_remote_timestamp, remote_snap_info->timestamp); @@ -274,7 +274,7 @@ bool Replayer::get_replay_status(std::string* description, // the local snapshot would just be the time the snapshot was // synced and not the consistency point in time. root_obj["local_snapshot_timestamp"] = - (int64_t)matching_remote_snap_it->second.timestamp.sec(); + matching_remote_snap_it->second.timestamp.sec(); if (m_perf_counters) { m_perf_counters->tset(l_rbd_mirror_snapshot_local_timestamp, matching_remote_snap_it->second.timestamp); @@ -286,7 +286,7 @@ bool Replayer::get_replay_status(std::string* description, if (m_remote_snap_id_end != CEPH_NOSNAP && matching_remote_snap_it != m_state_builder->remote_image_ctx->snap_info.end()) { - root_obj["syncing_snapshot_timestamp"] = (int64_t)remote_snap_info->timestamp.sec(); + root_obj["syncing_snapshot_timestamp"] = remote_snap_info->timestamp.sec(); if (m_local_object_count > 0) { root_obj["syncing_percent"] = From 1ebfbd64818029ee904c8f2a97c4286e7a95bb7e Mon Sep 17 00:00:00 2001 From: Alex Ainscow Date: Mon, 15 Jan 2024 00:25:46 +0000 Subject: [PATCH 3/3] Disable Jaeger tracing by default for MAC --- do_cmake.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/do_cmake.sh b/do_cmake.sh index c00737346a3a4..a1731f6f5eb87 100755 --- a/do_cmake.sh +++ b/do_cmake.sh @@ -83,6 +83,7 @@ elif [ "$(uname)" == Darwin ] ; then ARGS+=" -DWITH_RADOSGW_KAFKA_ENDPOINT=OFF" # currently, rgw posix driver requires inotify ARGS+=" -DWITH_RADOSGW_POSIX=OFF" + ARGS+=" -DWITH_JAEGER=OFF" # you should have configured and bootstrapped brew ARGS+=" -DICU_ROOT=$(brew --prefix icu4c)"