From 9edcd77a8333967da057eff049e53d34ee8422cd Mon Sep 17 00:00:00 2001 From: Jason Dillaman Date: Thu, 24 May 2018 10:02:27 -0400 Subject: [PATCH] rbd-mirror: always send image RPC messages via cluster Signed-off-by: Jason Dillaman --- src/tools/rbd_mirror/InstanceWatcher.cc | 52 +++++++++---------------- 1 file changed, 19 insertions(+), 33 deletions(-) diff --git a/src/tools/rbd_mirror/InstanceWatcher.cc b/src/tools/rbd_mirror/InstanceWatcher.cc index 7347816cf6eb0..9ba9d01056a9b 100644 --- a/src/tools/rbd_mirror/InstanceWatcher.cc +++ b/src/tools/rbd_mirror/InstanceWatcher.cc @@ -404,17 +404,12 @@ void InstanceWatcher::notify_image_acquire( ceph_assert(m_on_finish == nullptr); - if (instance_id == m_instance_id) { - handle_image_acquire(global_image_id, on_notify_ack); - } else { - uint64_t request_id = ++m_request_seq; - bufferlist bl; - encode(NotifyMessage{ImageAcquirePayload{request_id, global_image_id}}, - bl); - auto req = new C_NotifyInstanceRequest(this, instance_id, request_id, - std::move(bl), on_notify_ack); - req->send(); - } + uint64_t request_id = ++m_request_seq; + bufferlist bl; + encode(NotifyMessage{ImageAcquirePayload{request_id, global_image_id}}, bl); + auto req = new C_NotifyInstanceRequest(this, instance_id, request_id, + std::move(bl), on_notify_ack); + req->send(); } template @@ -428,17 +423,12 @@ void InstanceWatcher::notify_image_release( ceph_assert(m_on_finish == nullptr); - if (instance_id == m_instance_id) { - handle_image_release(global_image_id, on_notify_ack); - } else { - uint64_t request_id = ++m_request_seq; - bufferlist bl; - encode(NotifyMessage{ImageReleasePayload{request_id, global_image_id}}, - bl); - auto req = new C_NotifyInstanceRequest(this, instance_id, request_id, - std::move(bl), on_notify_ack); - req->send(); - } + uint64_t request_id = ++m_request_seq; + bufferlist bl; + encode(NotifyMessage{ImageReleasePayload{request_id, global_image_id}}, bl); + auto req = new C_NotifyInstanceRequest(this, instance_id, request_id, + std::move(bl), on_notify_ack); + req->send(); } template @@ -452,17 +442,13 @@ void InstanceWatcher::notify_peer_image_removed( Mutex::Locker locker(m_lock); ceph_assert(m_on_finish == nullptr); - if (instance_id == m_instance_id) { - handle_peer_image_removed(global_image_id, peer_mirror_uuid, on_notify_ack); - } else { - uint64_t request_id = ++m_request_seq; - bufferlist bl; - encode(NotifyMessage{PeerImageRemovedPayload{request_id, global_image_id, - peer_mirror_uuid}}, bl); - auto req = new C_NotifyInstanceRequest(this, instance_id, request_id, - std::move(bl), on_notify_ack); - req->send(); - } + uint64_t request_id = ++m_request_seq; + bufferlist bl; + encode(NotifyMessage{PeerImageRemovedPayload{request_id, global_image_id, + peer_mirror_uuid}}, bl); + auto req = new C_NotifyInstanceRequest(this, instance_id, request_id, + std::move(bl), on_notify_ack); + req->send(); } template -- 2.39.5