]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
librados_test_stub: watcher id should be the instance id (gid)
authorJason Dillaman <dillaman@redhat.com>
Fri, 15 May 2015 14:45:04 +0000 (10:45 -0400)
committerJason Dillaman <dillaman@redhat.com>
Wed, 29 Jul 2015 17:29:54 +0000 (13:29 -0400)
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
(cherry picked from commit 3e1e561cc29043eb64dff8afb3a2c1ed77788e93)

src/test/librados_test_stub/TestIoCtxImpl.cc
src/test/librados_test_stub/TestWatchNotify.cc
src/test/librados_test_stub/TestWatchNotify.h

index 41cbef58d2ba041731a331b0e49067a74ffca31d..e376e63cba51a90d29d2f1720c700eeb067a7499 100644 (file)
@@ -244,7 +244,8 @@ int TestIoCtxImpl::unwatch(uint64_t handle) {
 
 int TestIoCtxImpl::watch(const std::string& o, uint64_t *handle,
                          librados::WatchCtx *ctx, librados::WatchCtx2 *ctx2) {
-  return m_client->get_watch_notify().watch(o, handle, ctx, ctx2);
+  return m_client->get_watch_notify().watch(o, get_instance_id(), handle, ctx,
+                                            ctx2);
 }
 
 int TestIoCtxImpl::execute_aio_operations(const std::string& oid,
index 094bcb5b4058912118113ad1c10e2282fefcf716..14a43bc58cb1cf7bc56b3a1201e4995e82a42fce 100644 (file)
@@ -50,7 +50,7 @@ int TestWatchNotify::list_watchers(const std::string& o,
        it != watcher->watch_handles.end(); ++it) {
     obj_watch_t obj;
     strcpy(obj.addr, ":/0");
-    obj.watcher_id = static_cast<int64_t>(it->second.handle);
+    obj.watcher_id = static_cast<int64_t>(it->second.instance_id);
     obj.cookie = it->second.handle;
     obj.timeout_seconds = 30;
     out_watchers->push_back(obj);
@@ -113,12 +113,14 @@ void TestWatchNotify::notify_ack(const std::string& o, uint64_t notify_id,
   notify_handle->cond.Signal();
 }
 
-int TestWatchNotify::watch(const std::string& o, uint64_t *handle,
-                           librados::WatchCtx *ctx, librados::WatchCtx2 *ctx2) {
+int TestWatchNotify::watch(const std::string& o, uint64_t instance_id,
+                           uint64_t *handle, librados::WatchCtx *ctx,
+                           librados::WatchCtx2 *ctx2) {
   SharedWatcher watcher = get_watcher(o);
 
   RWLock::WLocker l(watcher->lock);
   WatchHandle watch_handle;
+  watch_handle.instance_id = instance_id;
   watch_handle.handle = ++m_handle;
   watch_handle.watch_ctx = ctx;
   watch_handle.watch_ctx2 = ctx2;
index 4912ef27444a899efc333597b52482f9449e6f1e..1761302bbf37bde86e16895f4fc1ccb263d22a22 100644 (file)
@@ -35,6 +35,7 @@ public:
   typedef std::map<uint64_t, SharedNotifyHandle> NotifyHandles;
 
   struct WatchHandle {
+    uint64_t instance_id;
     uint64_t handle;
     librados::WatchCtx* watch_ctx;
     librados::WatchCtx2* watch_ctx2;
@@ -60,7 +61,7 @@ public:
              uint64_t timeout_ms, bufferlist *pbl);
   void notify_ack(const std::string& o, uint64_t notify_id,
                   uint64_t handle, uint64_t gid, bufferlist& bl);
-  int watch(const std::string& o, uint64_t *handle,
+  int watch(const std::string& o, uint64_t instance_id, uint64_t *handle,
             librados::WatchCtx *ctx, librados::WatchCtx2 *ctx2);
   int unwatch(uint64_t handle);