From 9a8eb871e05b0f68d2cfa5c6b6bc0a85623aa250 Mon Sep 17 00:00:00 2001 From: Jason Dillaman Date: Fri, 21 Feb 2020 21:14:50 -0500 Subject: [PATCH] rbd-mirror: do not mirror snapshot image-meta key/value pairs Signed-off-by: Jason Dillaman --- .../image_replayer/snapshot/ApplyImageStateRequest.cc | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/tools/rbd_mirror/image_replayer/snapshot/ApplyImageStateRequest.cc b/src/tools/rbd_mirror/image_replayer/snapshot/ApplyImageStateRequest.cc index 3d85a85fc46f8..9a2e4e0687676 100644 --- a/src/tools/rbd_mirror/image_replayer/snapshot/ApplyImageStateRequest.cc +++ b/src/tools/rbd_mirror/image_replayer/snapshot/ApplyImageStateRequest.cc @@ -9,7 +9,9 @@ #include "librbd/Operations.h" #include "librbd/Utils.h" #include "librbd/image/GetMetadataRequest.h" +#include "librbd/mirror/snapshot/Utils.h" #include "tools/rbd_mirror/image_replayer/snapshot/Utils.h" +#include #define dout_context g_ceph_context #define dout_subsys ceph_subsys_rbd_mirror @@ -167,8 +169,12 @@ void ApplyImageStateRequest::handle_get_image_meta(int r) { template void ApplyImageStateRequest::update_image_meta() { + auto key_filter = librbd::mirror::snapshot::util::get_image_meta_key(""); std::set keys_to_remove; for (const auto& [key, value] : m_metadata) { + if (boost::starts_with(key, key_filter)) { + continue; + } if (m_image_state.metadata.count(key) == 0) { dout(15) << "removing image-meta key '" << key << "'" << dendl; keys_to_remove.insert(key); @@ -177,6 +183,10 @@ void ApplyImageStateRequest::update_image_meta() { std::map metadata_to_update; for (const auto& [key, value] : m_image_state.metadata) { + if (boost::starts_with(key, key_filter)) { + continue; + } + auto it = m_metadata.find(key); if (it == m_metadata.end() || !it->second.contents_equal(value)) { dout(15) << "updating image-meta key '" << key << "'" << dendl; -- 2.39.5