]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
test/librados_test_stub: raise a watch error on blocklisting
authorIlya Dryomov <idryomov@gmail.com>
Thu, 30 Mar 2023 16:22:24 +0000 (18:22 +0200)
committerIlya Dryomov <idryomov@gmail.com>
Thu, 6 Apr 2023 15:08:00 +0000 (17:08 +0200)
Simulate getting MWatchNotify CEPH_WATCH_EVENT_DISCONNECT message after
the client is blocklisted.

Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
(cherry picked from commit 0dfe87d3b6ed52cee6f6660b42af42a8dd7708bb)

src/test/librados_test_stub/TestWatchNotify.cc

index 48aaf64ef14fb1572fc2c73029dac6a7539ce55a..93875182c9b40ff9a8cd592c19ce6ca413105e6e 100644 (file)
@@ -402,7 +402,16 @@ void TestWatchNotify::blocklist(uint32_t nonce) {
     auto &watcher = file_it->second;
     for (auto w_it = watcher->watch_handles.begin();
          w_it != watcher->watch_handles.end();) {
-      if (w_it->second.nonce == nonce) {
+      auto& watch_handle = w_it->second;
+      if (watch_handle.nonce == nonce) {
+        auto handle = watch_handle.handle;
+        auto watch_ctx2 = watch_handle.watch_ctx2;
+        if (watch_ctx2 != nullptr) {
+          auto ctx = new LambdaContext([handle, watch_ctx2](int) {
+              watch_ctx2->handle_error(handle, -ENOTCONN);
+            });
+          watch_handle.rados_client->get_aio_finisher()->queue(ctx);
+        }
         w_it = watcher->watch_handles.erase(w_it);
       } else {
         ++w_it;