mirror of
https://github.com/ceph/ceph
synced 2025-02-19 08:57:27 +00:00
librados_test_stub: watcher id should be the instance id (gid)
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
This commit is contained in:
parent
37c74e6e52
commit
3e1e561cc2
@ -247,7 +247,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,
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user