aio_comp->add_request();
}
- virtual void finish(int r) {
+ void finish(int r) override {
CephContext *cct = image_ctx.cct;
ldout(cct, 20) << this << " C_DiscardJournalCommit: "
<< "journal committed: discarding from cache" << dendl;
aio_comp->add_request();
}
- virtual void finish(int r) {
+ void finish(int r) override {
CephContext *cct = image_ctx.cct;
ldout(cct, 20) << this << " C_FlushJournalCommit: journal committed"
<< dendl;
: C_AioRequest(completion), m_req(nullptr) {
}
- virtual void finish(int r) {
+ void finish(int r) override {
m_completion->lock.Lock();
CephContext *cct = m_completion->ictx->cct;
ldout(cct, 10) << "C_AioRead::finish() " << this << " r = " << r << dendl;
}
protected:
- virtual void finish(int r) {
+ void finish(int r) override {
CephContext *cct = m_completion->ictx->cct;
ldout(cct, 10) << "C_ImageCacheRead::finish() " << this << ": r=" << r
<< dendl;
explicit C_ObjectCacheRead(ImageCtxT &ictx, AioObjectRead<ImageCtxT> *req)
: m_image_ctx(ictx), m_req(req), m_enqueued(false) {}
- virtual void complete(int r) {
+ void complete(int r) override {
if (!m_enqueued) {
// cache_lock creates a lock ordering issue -- so re-execute this context
// outside the cache_lock
}
protected:
- virtual void finish(int r) {
+ void finish(int r) override {
m_req->complete(r);
}
explicit C_CompleteFlushes(ImageCtx *image_ctx, std::list<Context *> &&flush_contexts)
: image_ctx(image_ctx), flush_contexts(std::move(flush_contexts)) {
}
- virtual void finish(int r) {
+ void finish(int r) override {
RWLock::RLocker owner_locker(image_ctx->owner_lock);
while (!flush_contexts.empty()) {
Context *flush_ctx = flush_contexts.front();
{
}
- virtual int send() {
+ int send() override {
uint64_t snap_id = m_snap_ids[m_snap_id_idx];
if (snap_id == CEPH_NOSNAP) {
RWLock::RLocker snap_locker(m_image_ctx.snap_lock);
typedef boost::tuple<uint64_t, size_t, bool> Diff;
typedef std::list<Diff> Diffs;
- virtual void finish(int r) {
+ void finish(int r) override {
CephContext *cct = m_image_ctx.cct;
if (r == 0 && m_snap_ret < 0) {
r = m_snap_ret;
Context *on_init)
: exclusive_lock(exclusive_lock), features(features), on_init(on_init) {
}
- virtual void finish(int r) override {
+ void finish(int r) override {
if (r == 0) {
exclusive_lock->handle_init_complete(features);
}
"rbd_op_threads") {
start();
}
- virtual ~ThreadPoolSingleton() {
+ ~ThreadPoolSingleton() override {
stop();
}
};
C_FlushCache(ImageCtx *_image_ctx, Context *_on_safe)
: image_ctx(_image_ctx), on_safe(_on_safe) {
}
- virtual void finish(int r) {
+ void finish(int r) override {
// successful cache flush indicates all IO is now safe
image_ctx->flush_cache(on_safe);
}
C_ShutDownCache(ImageCtx *_image_ctx, Context *_on_finish)
: image_ctx(_image_ctx), on_finish(_on_finish) {
}
- virtual void finish(int r) {
+ void finish(int r) override {
image_ctx->object_cacher->stop();
on_finish->complete(r);
}
: image_ctx(_image_ctx), purge_on_error(_purge_on_error),
reentrant_safe(_reentrant_safe), on_finish(_on_finish) {
}
- virtual void finish(int r) {
+ void finish(int r) override {
assert(image_ctx->cache_lock.is_locked());
CephContext *cct = image_ctx->cct;
1) {
start();
}
- virtual ~ThreadPoolSingleton() {
+ ~ThreadPoolSingleton() override {
stop();
}
};
: ThreadPool(cct, "librbd::Journal", "tp_librbd_journ", 1) {
start();
}
- virtual ~ThreadPoolSingleton() {
+ ~ThreadPoolSingleton() override {
stop();
}
};
{})) {
}
- virtual void finish(int r) {
+ void finish(int r) override {
ldout(cct, 20) << this << " C_IsTagOwner::" << __func__ << ": r=" << r
<< dendl;
if (r < 0) {
lock("librbd::Journal::C_RefreshTags::lock") {
async_op_tracker.start_op();
}
- virtual ~C_RefreshTags() {
+ ~C_RefreshTags() override {
async_op_tracker.finish_op();
}
- virtual void finish(int r) {
+ void finish(int r) override {
on_finish->complete(r);
}
};
public:
explicit FlushCacheCommand(ImageCtx *ictx) : ictx(ictx) {}
- bool call(stringstream *ss) {
+ bool call(stringstream *ss) override {
int r = flush(ictx);
if (r < 0) {
*ss << "flush: " << cpp_strerror(r);
public:
explicit InvalidateCacheCommand(ImageCtx *ictx) : ictx(ictx) {}
- bool call(stringstream *ss) {
+ bool call(stringstream *ss) override {
int r = invalidate_cache(ictx);
if (r < 0) {
*ss << "invalidate_cache: " << cpp_strerror(r);
C_ReadRequest(CephContext *cct, Context *c, Mutex *cache_lock)
: m_cct(cct), m_ctx(c), m_cache_lock(cache_lock) {
}
- virtual void finish(int r) {
+ void finish(int r) override {
ldout(m_cct, 20) << "aio_cb completing " << dendl;
{
Mutex::Locker cache_locker(*m_cache_lock);
C_OrderedWrite(CephContext *cct, LibrbdWriteback::write_result_d *result,
LibrbdWriteback *wb)
: m_cct(cct), m_result(result), m_wb_handler(wb) {}
- virtual ~C_OrderedWrite() {}
- virtual void finish(int r) {
+ ~C_OrderedWrite() override {}
+ void finish(int r) override {
ldout(m_cct, 20) << "C_OrderedWrite completing " << m_result << dendl;
{
Mutex::Locker l(m_wb_handler->m_lock);
<< journal_tid << " safe" << dendl;
}
- virtual void complete(int r) {
+ void complete(int r) override {
if (request_sent || r < 0) {
if (request_sent && r == 0) {
// only commit IO events that are safely recorded to the backing image
}
}
- virtual void finish(int r) {
+ void finish(int r) override {
}
void commit_io_event_extent(int r) {
length(length) {
}
- virtual void finish(int r) {
+ void finish(int r) override {
// all IO operations are flushed prior to closing the journal
assert(image_ctx->journal != nullptr);
R* request;
explicit C_SendLockRequest(R* request) : request(request) {
}
- virtual void finish(int r) override {
+ void finish(int r) override {
request->send();
}
};
: tracker(tracker), ctx(ctx) {
tracker.start_op();
}
- virtual ~C_Tracked() {
+ ~C_Tracked() override {
tracker.finish_op();
}
- virtual void finish(int r) override {
+ void finish(int r) override {
ctx->complete(r);
}
};
: image_ctx(image_ctx), on_finish(on_finish) {
}
- virtual void complete(int r) override {
+ void complete(int r) override {
CephContext *cct = image_ctx.cct;
if (notified) {
if (r == -ETIMEDOUT) {
notified = true;
image_ctx.notify_update(this);
}
- virtual void finish(int r) override {
+ void finish(int r) override {
on_finish->complete(r);
}
};
complete(r);
}
- virtual void finish(int r) override {
+ void finish(int r) override {
if (filter_error_codes.count(r) != 0) {
r = 0;
}
: rados(io_ctx), on_finish(on_finish) {
}
- virtual void complete(int r) override {
+ void complete(int r) override {
if (ret_val == 0 && r < 0) {
ret_val = r;
}
ctx->complete(r);
}
- virtual void finish(int r) override {
+ void finish(int r) override {
}
};
public:
C_CopyWrite(SimpleThrottle *throttle, bufferlist *bl)
: m_throttle(throttle), m_bl(bl) {}
- virtual void finish(int r) {
+ void finish(int r) override {
delete m_bl;
m_throttle->end_op(r);
}
: m_throttle(throttle), m_dest(dest), m_offset(offset), m_bl(bl) {
m_throttle->start_op();
}
- virtual void finish(int r) {
+ void finish(int r) override {
if (r < 0) {
lderr(m_dest->cct) << "error reading from source image at offset "
<< m_offset << ": " << cpp_strerror(r) << dendl;
uint64_t length;
C_RBD_Readahead(ImageCtx *ictx, object_t oid, uint64_t offset, uint64_t length)
: ictx(ictx), oid(oid), offset(offset), length(length) { }
- void finish(int r) {
+ void finish(int r) override {
ldout(ictx->cct, 20) << "C_RBD_Readahead on " << oid << ": " << offset << "+" << length << dendl;
ictx->readahead.dec_pending();
}
image_ctx.operations->execute_metadata_remove(event.key, on_op_complete);
}
- virtual void finish(int r) override {
+ void finish(int r) override {
CephContext *cct = image_ctx.cct;
if (r < 0) {
lderr(cct) << ": ExecuteOp::" << __func__ << ": r=" << r << dendl;
C_RefreshIfRequired(I &image_ctx, Context *on_finish)
: image_ctx(image_ctx), on_finish(on_finish) {
}
- virtual ~C_RefreshIfRequired() {
+ ~C_RefreshIfRequired() override {
delete on_finish;
}
- virtual void finish(int r) override {
+ void finish(int r) override {
CephContext *cct = image_ctx.cct;
Context *ctx = on_finish;
on_finish = nullptr;
comp->init_time(ictx, librbd::AIO_TYPE_OPEN);
comp->get();
}
- virtual void finish(int r) {
+ void finish(int r) override {
ldout(ictx->cct, 20) << "C_OpenComplete::finish: r=" << r << dendl;
if (reopen) {
delete reinterpret_cast<librbd::ImageCtx*>(*ictxp);
void **ictxp)
: ictx(ictx), comp(comp), ictxp(ictxp) {
}
- virtual void finish(int r) {
+ void finish(int r) override {
ldout(ictx->cct, 20) << "C_OpenAfterCloseComplete::finish: r=" << r
<< dendl;
ictx->state->open(false, new C_OpenComplete(ictx, comp, ictxp, true));
comp->init_time(ictx, librbd::AIO_TYPE_CLOSE);
comp->get();
}
- virtual void finish(int r) {
+ void finish(int r) override {
ldout(cct, 20) << "C_CloseComplete::finish: r=" << r << dendl;
if (r < 0) {
comp->fail(r);
C_UpdateWatchCB(rbd_update_callback_t watch_cb, void *arg) :
watch_cb(watch_cb), arg(arg) {
}
- void handle_notify() {
+ void handle_notify() override {
watch_cb(arg);
}
};
: m_fn(fn), m_data(data)
{
}
- int update_progress(uint64_t offset, uint64_t src_size)
+ int update_progress(uint64_t offset, uint64_t src_size) override
{
return m_fn(offset, src_size, m_data);
}
expire_seconds(expire_seconds), on_finish(on_finish) {
}
- virtual void finish(int r) override {
+ void finish(int r) override {
librados::Rados rados(ioctx);
r = rados.blacklist_add(locker_address, expire_seconds);
on_finish->complete(r);
{
}
- virtual int send() {
+ int send() override {
I &image_ctx = this->m_image_ctx;
assert(image_ctx.owner_lock.is_locked());
CephContext *cct = image_ctx.cct;
m_io_ctx.snap_set_read(CEPH_SNAPDIR);
}
- virtual void complete(int r) {
+ void complete(int r) override {
I &image_ctx = this->m_image_ctx;
if (should_complete(r)) {
ldout(image_ctx.cct, 20) << m_oid << " C_VerifyObjectCallback completed "
}
}
- virtual int send() {
+ int send() override {
send_list_snaps();
return 0;
}
m_object_num(object_num) {
}
- virtual int send() {
+ int send() override {
I &image_ctx = this->m_image_ctx;
CephContext *cct = image_ctx.cct;
ldout(cct, 20) << "C_RollbackObject: " << __func__ << ": object_num="
m_pool(pools[pool_idx]) {
}
- virtual int send() {
+ int send() override {
I &image_ctx = this->m_image_ctx;
assert(image_ctx.owner_lock.is_locked());
}
protected:
- virtual void finish(int r) {
+ void finish(int r) override {
I &image_ctx = this->m_image_ctx;
CephContext *cct = image_ctx.cct;
{
}
- virtual int send() {
+ int send() override {
I &image_ctx = this->m_image_ctx;
assert(image_ctx.owner_lock.is_locked());
assert(image_ctx.exclusive_lock == nullptr ||
{
}
- virtual int send() {
+ int send() override {
I &image_ctx = this->m_image_ctx;
assert(image_ctx.owner_lock.is_locked());
assert(image_ctx.exclusive_lock == nullptr ||
librados::IoCtx *m_ioctx;
WatchCtx(librados::IoCtx *ioctx) : m_ioctx(ioctx) {}
- virtual void handle_notify(uint64_t notify_id, uint64_t cookie,
- uint64_t notifier_id, bufferlist& bl_) {
+ void handle_notify(uint64_t notify_id, uint64_t cookie,
+ uint64_t notifier_id, bufferlist& bl_) override {
bufferlist bl;
m_ioctx->notify_ack(RBD_MIRRORING, notify_id, cookie, bl);
}
- virtual void handle_error(uint64_t cookie, int err) {}
+ void handle_error(uint64_t cookie, int err) override {}
};
map<std::string, cls::rbd::MirrorImage> images;
on_finish(on_finish) {
}
- virtual void get() {
+ void get() override {
}
- virtual void put() {
+ void put() override {
}
- virtual void handle_entries_available() {
+ void handle_entries_available() override {
while (true) {
journal::ReplayEntry replay_entry;
if (!journaler->try_pop_front(&replay_entry)) {
}
}
- virtual void handle_complete(int r) {
+ void handle_complete(int r) override {
on_finish->complete(r);
}
};
: lock("ReplayHandler::lock"), entries_available(false), complete(false) {
}
- virtual void get() {
+ void get() override {
}
- virtual void put() {
+ void put() override {
}
- virtual void handle_entries_available() {
+ void handle_entries_available() override {
Mutex::Locker locker(lock);
entries_available = true;
cond.Signal();
}
- virtual void handle_complete(int r) {
+ void handle_complete(int r) override {
Mutex::Locker locker(lock);
complete = true;
cond.Signal();
ReplayHandler m_replay_handler;
Journalers m_journalers;
- virtual void TearDown() {
+ void TearDown() override {
for (Journalers::iterator it = m_journalers.begin();
it != m_journalers.end(); ++it) {
journal::Journaler *journaler = *it;
typedef BlockGuard<Operation> OpBlockGuard;
- virtual void SetUp() override {
+ void SetUp() override {
TestFixture::SetUp();
m_cct = reinterpret_cast<CephContext*>(m_ioctx.cct());
}
return m_parent.m_ioctx.unwatch2(m_handle);
}
- virtual void handle_notify(uint64_t notify_id,
+ void handle_notify(uint64_t notify_id,
uint64_t cookie,
uint64_t notifier_id,
- bufferlist& bl) {
+ bufferlist& bl) override {
try {
int op;
bufferlist payload;
}
}
- virtual void handle_error(uint64_t cookie, int err) {
+ void handle_error(uint64_t cookie, int err) override {
std::cerr << "ERROR: " << cookie << ", " << cpp_strerror(err)
<< std::endl;
}
uint64_t m_handle;
};
- virtual void TearDown() {
+ void TearDown() override {
deregister_image_watch();
TestFixture::TearDown();
}
ProgressContext() : mutex("ProgressContext::mutex"), received(false),
offset(0), total(0) {}
- virtual int update_progress(uint64_t offset_, uint64_t total_) {
+ int update_progress(uint64_t offset_, uint64_t total_) override {
Mutex::Locker l(mutex);
offset = offset_;
total = total_;
class TestMirroringWatcher : public TestFixture {
public:
- virtual void SetUp() {
+ void SetUp() override {
TestFixture::SetUp();
bufferlist bl;
}
}
- virtual void TearDown() {
+ void TearDown() override {
if (m_image_watcher != nullptr) {
C_SaferCond ctx;
m_image_watcher->unregister_watch(&ctx);
typedef std::vector<std::pair<std::string, bool> > Snaps;
- virtual void TearDown() {
+ void TearDown() override {
unlock_image();
for (Snaps::iterator iter = m_snaps.begin(); iter != m_snaps.end(); ++iter) {
librbd::ImageCtx *ictx;
class DummyContext : public Context {
public:
- virtual void finish(int r) {
+ void finish(int r) override {
}
};
}
}
- virtual void SetUp() {
+ void SetUp() override {
ASSERT_NE("", m_pool_name = create_pool());
}
struct Watcher : public librbd::UpdateWatchCtx {
Watcher(librbd::Image &image) : m_image(image), m_lock("lock") {
}
- void handle_notify() {
+ void handle_notify() override {
librbd::image_info_t info;
ASSERT_EQ(0, m_image.stat(info, sizeof(info)));
Mutex::Locker locker(m_lock);
class PrintProgress : public librbd::ProgressContext
{
public:
- int update_progress(uint64_t offset, uint64_t src_size)
+ int update_progress(uint64_t offset, uint64_t src_size) override
{
float percent = ((float)offset * 100) / src_size;
printf("%3.2f%% done\n", percent);
public:
explicit RBDWriter(librbd::Image &image) : m_image(image) {};
protected:
- void *entry() {
+ void *entry() override {
librbd::image_info_t info;
int r = m_image.stat(info, sizeof(info));
assert(r == 0);
};
protected:
- void *entry() {
+ void *entry() override {
for (int i = 0; i < 10; i++) {
{
Mutex::Locker locker(m_lock);
TestMirroring() {}
- virtual void TearDown() {
+ void TearDown() override {
unlock_image();
TestFixture::TearDown();
}
- virtual void SetUp() {
+ void SetUp() override {
ASSERT_EQ(0, _rados.ioctx_create(_pool_name.c_str(), m_ioctx));
}
struct MirrorWatcher : public librados::WatchCtx2 {
MirrorWatcher(librados::IoCtx &ioctx) : m_ioctx(ioctx) {
}
- virtual void handle_notify(uint64_t notify_id, uint64_t cookie,
- uint64_t notifier_id, bufferlist& bl) {
+ void handle_notify(uint64_t notify_id, uint64_t cookie,
+ uint64_t notifier_id, bufferlist& bl) override {
// received IMAGE_UPDATED notification from remove
m_notified = true;
m_ioctx.notify_ack(RBD_MIRRORING, notify_id, cookie, bl);
}
- virtual void handle_error(uint64_t cookie, int err) {
+ void handle_error(uint64_t cookie, int err) override {
}
librados::IoCtx &m_ioctx;
bool m_notified = false;
TestMockJournal() : m_lock("lock") {
}
- ~TestMockJournal() {
+ ~TestMockJournal() override {
assert(m_commit_contexts.empty());
}
const ReplayAction &replay_action)
: replay_handler(replay_handler), replay_action(replay_action) {
}
- virtual void finish(int r) {
+ void finish(int r) override {
if (replay_action) {
replay_action(*replay_handler);
}
struct Listener : public journal::Listener {
C_SaferCond ctx;
- virtual void handle_close() {
+ void handle_close() override {
ctx.complete(0);
}
- virtual void handle_resync() {
+ void handle_resync() override {
ADD_FAILURE() << "unexpected resync request";
}
- virtual void handle_promoted() {
+ void handle_promoted() override {
ADD_FAILURE() << "unexpected promotion event";
}
} listener;
struct Listener : public journal::Listener {
C_SaferCond ctx;
- virtual void handle_close() {
+ void handle_close() override {
ADD_FAILURE() << "unexpected close action";
}
- virtual void handle_resync() {
+ void handle_resync() override {
ctx.complete(0);
}
- virtual void handle_promoted() {
+ void handle_promoted() override {
ADD_FAILURE() << "unexpected promotion event";
}
} listener;
struct Listener : public journal::Listener {
C_SaferCond ctx;
- virtual void handle_close() {
+ void handle_close() override {
ADD_FAILURE() << "unexpected close action";
}
- virtual void handle_resync() {
+ void handle_resync() override {
ADD_FAILURE() << "unexpected resync event";
}
- virtual void handle_promoted() {
+ void handle_promoted() override {
ctx.complete(0);
}
} listener;
}
struct WatchCtx : public librados::WatchCtx2 {
- virtual void handle_notify(uint64_t, uint64_t, uint64_t,
- ceph::bufferlist&) {
+ void handle_notify(uint64_t, uint64_t, uint64_t,
+ ceph::bufferlist&) override {
assert(false);
}
- virtual void handle_error(uint64_t, int) {
+ void handle_error(uint64_t, int) override {
assert(false);
}
};
typedef OpenLocalImageRequest<librbd::MockTestImageCtx> MockOpenLocalImageRequest;
typedef std::list<cls::journal::Tag> Tags;
- void SetUp() {
+ void SetUp() override {
TestMockFixture::SetUp();
librbd::RBD rbd;
typedef OpenImageRequest<librbd::MockTestImageCtx> MockOpenImageRequest;
typedef CloseImageRequest<librbd::MockTestImageCtx> MockCloseImageRequest;
- virtual void SetUp() {
+ void SetUp() override {
TestMockFixture::SetUp();
librbd::RBD rbd;
public:
typedef EventPreprocessor<librbd::MockTestImageCtx> MockEventPreprocessor;
- virtual void SetUp() {
+ void SetUp() override {
TestMockFixture::SetUp();
librbd::RBD rbd;
typedef ImageCopyRequest<librbd::MockTestImageCtx> MockImageCopyRequest;
typedef ObjectCopyRequest<librbd::MockTestImageCtx> MockObjectCopyRequest;
- virtual void SetUp() {
+ void SetUp() override {
TestMockFixture::SetUp();
librbd::RBD rbd;
public:
typedef ObjectCopyRequest<librbd::MockTestImageCtx> MockObjectCopyRequest;
- virtual void SetUp() {
+ void SetUp() override {
TestMockFixture::SetUp();
librbd::RBD rbd;
typedef SnapshotCopyRequest<librbd::MockTestImageCtx> MockSnapshotCopyRequest;
typedef SnapshotCreateRequest<librbd::MockTestImageCtx> MockSnapshotCreateRequest;
- virtual void SetUp() {
+ void SetUp() override {
TestMockFixture::SetUp();
librbd::RBD rbd;
public:
typedef SnapshotCreateRequest<librbd::MockTestImageCtx> MockSnapshotCreateRequest;
- virtual void SetUp() {
+ void SetUp() override {
TestMockFixture::SetUp();
librbd::RBD rbd;
public:
typedef SyncPointCreateRequest<librbd::MockTestImageCtx> MockSyncPointCreateRequest;
- virtual void SetUp() {
+ void SetUp() override {
TestMockFixture::SetUp();
librbd::RBD rbd;
public:
typedef SyncPointPruneRequest<librbd::MockTestImageCtx> MockSyncPointPruneRequest;
- virtual void SetUp() {
+ void SetUp() override {
TestMockFixture::SetUp();
librbd::RBD rbd;
m_local_pool_id = _rados->pool_lookup(_local_pool_name.c_str());
}
- void SetUp() {
+ void SetUp() override {
TestFixture::SetUp();
librbd::mirror_mode_set(m_local_io_ctx, RBD_MIRROR_MODE_IMAGE);
EXPECT_EQ(0, ictx->state->close());
}
- void TearDown() {
+ void TearDown() override {
remove_image();
TestFixture::TearDown();
delete m_deleter;
: test(test), oid(oid), lock("C_WatchCtx::lock"), notified(false) {
}
- virtual void handle_notify(uint64_t notify_id, uint64_t cookie,
- uint64_t notifier_id, bufferlist& bl_) {
+ void handle_notify(uint64_t notify_id, uint64_t cookie,
+ uint64_t notifier_id, bufferlist& bl_) override {
bufferlist bl;
test->m_remote_ioctx.notify_ack(oid, notify_id, cookie, bl);
cond.Signal();
}
- virtual void handle_error(uint64_t cookie, int err) {
+ void handle_error(uint64_t cookie, int err) override {
ASSERT_EQ(0, err);
}
};
m_image_sync_throttler.reset(new rbd::mirror::ImageSyncThrottler<>());
}
- ~TestImageReplayer()
+ ~TestImageReplayer() override
{
unwatch();
class TestImageSync : public TestFixture {
public:
- virtual void SetUp() {
+ void SetUp() override {
TestFixture::SetUp();
create_and_open(m_local_io_ctx, &m_local_image_ctx);
create_and_open(m_remote_io_ctx, &m_remote_image_ctx);
ASSERT_EQ(0, m_remote_journaler->register_client(client_data_bl));
}
- virtual void TearDown() {
+ void TearDown() override {
TestFixture::TearDown();
delete m_remote_journaler;
}
return m_release_count;
}
- virtual void post_acquire_handler(Context *on_finish) {
+ void post_acquire_handler(Context *on_finish) override {
Mutex::Locker locker(m_test_lock);
m_acquire_count++;
on_finish->complete(m_on_acquire_r);
}
}
- virtual void pre_release_handler(Context *on_finish) {
+ void pre_release_handler(Context *on_finish) override {
Mutex::Locker locker(m_test_lock);
m_release_count++;
on_finish->complete(m_on_release_r);
std::list<std::unique_ptr<Connection> > m_connections;
- virtual void SetUp() {
+ void SetUp() override {
TestFixture::SetUp();
EXPECT_EQ(0, librbd::mirror_mode_set(m_local_io_ctx, RBD_MIRROR_MODE_POOL));
typedef librbd::journal::Replay<librbd::MockTestImageCtx> MockReplay;
typedef ImageReplayer<librbd::MockTestImageCtx> MockImageReplayer;
- virtual void SetUp() {
+ void SetUp() override {
TestMockFixture::SetUp();
librbd::RBD rbd;
m_remote_io_ctx.get_id(), m_remote_image_ctx->id, "global image id");
}
- virtual void TearDown() {
+ void TearDown() override {
delete m_image_replayer;
TestMockFixture::TearDown();
typedef image_sync::SyncPointCreateRequest<librbd::MockTestImageCtx> MockSyncPointCreateRequest;
typedef image_sync::SyncPointPruneRequest<librbd::MockTestImageCtx> MockSyncPointPruneRequest;
- virtual void SetUp() {
+ void SetUp() override {
TestMockFixture::SetUp();
librbd::RBD rbd;
public:
typedef ImageSyncThrottler<librbd::MockTestImageCtx> MockImageSyncThrottler;
- virtual void SetUp() {
+ void SetUp() override {
TestMockFixture::SetUp();
librbd::RBD rbd;
m_mock_journaler = new journal::MockJournaler();
}
- virtual void TearDown() {
+ void TearDown() override {
MockImageSync::instances.clear();
delete mock_sync_throttler;
delete m_mock_local_image_ctx;
}
}
- virtual void finish(int r)
+ void finish(int r) override
{
BOOST_SCOPE_EXIT((&m_throttle) (&r))
{
}
protected:
- virtual void finish(int r) {
+ void finish(int r) override {
if (r >= 0) {
if (m_exists) {
m_exists = !m_read_data.is_zero();
}
}
- virtual void finish(int r)
+ void finish(int r) override
{
if (r < 0) {
std::cerr << "rbd: error writing to destination image at offset "
JournalPlayer *journal;
explicit ReplayHandler(JournalPlayer *_journal) : journal(_journal) {}
- virtual void get() {}
- virtual void put() {}
+ void get() override {}
+ void put() override {}
- virtual void handle_entries_available() {
+ void handle_entries_available() override {
journal->handle_replay_ready();
}
- virtual void handle_complete(int r) {
+ void handle_complete(int r) override {
journal->handle_replay_complete(r);
}
};
m_s() {
}
- int exec() {
+ int exec() override {
int r = JournalPlayer::exec();
m_s.print();
return r;
};
int process_entry(::journal::ReplayEntry replay_entry,
- uint64_t tag_id) {
+ uint64_t tag_id) override {
m_s.total++;
if (m_verbose) {
std::cout << "Entry: tag_id=" << tag_id << ", commit_tid="
m_s() {
}
- int exec() {
+ int exec() override {
std::string header("# journal_id: " + m_journal_id + "\n");
int r;
r = safe_write(m_fd, header.c_str(), header.size());
};
int process_entry(::journal::ReplayEntry replay_entry,
- uint64_t tag_id) {
+ uint64_t tag_id) override {
m_s.total++;
int type = -1;
bufferlist entry = replay_entry.get_data();
{
}
- virtual ~RbdWatchCtx() {}
+ ~RbdWatchCtx() override {}
- virtual void handle_notify(uint64_t notify_id,
+ void handle_notify(uint64_t notify_id,
uint64_t cookie,
uint64_t notifier_id,
- bufferlist& bl) {
+ bufferlist& bl) override {
std::cout << m_image_name << " received notification: notify_id="
<< notify_id << ", cookie=" << cookie << ", notifier_id="
<< notifier_id << ", bl.length=" << bl.length() << std::endl;
m_io_ctx.notify_ack(m_header_oid, notify_id, cookie, reply);
}
- virtual void handle_error(uint64_t cookie, int err) {
+ void handle_error(uint64_t cookie, int err) override {
std::cerr << m_image_name << " received error: cookie=" << cookie << ", "
<< "err=" << cpp_strerror(err) << std::endl;
}
public:
explicit StatusCommand(ImageDeleter *image_del) : image_del(image_del) {}
- bool call(Formatter *f, stringstream *ss) {
+ bool call(Formatter *f, stringstream *ss) override {
image_del->print_status(f, ss);
return true;
}
};
struct DeleteJournalPolicy : public librbd::journal::Policy {
- virtual bool append_disabled() const {
+ bool append_disabled() const override {
return true;
}
- virtual bool journal_disabled() const {
+ bool journal_disabled() const override {
return false;
}
- virtual void allocate_tag_on_lock(Context *on_finish) {
+ void allocate_tag_on_lock(Context *on_finish) override {
on_finish->complete(0);
}
};
}
- ~ImageDeleterAdminSocketHook() {
+ ~ImageDeleterAdminSocketHook() override {
for (Commands::const_iterator i = commands.begin(); i != commands.end();
++i) {
(void)admin_socket->unregister_command(i->first);
}
bool call(std::string command, cmdmap_t& cmdmap, std::string format,
- bufferlist& out) {
+ bufferlist& out) override {
Commands::const_iterator i = commands.find(command);
assert(i != commands.end());
Formatter *f = Formatter::create(format);
struct ReplayHandler : public ::journal::ReplayHandler {
ImageReplayer<I> *replayer;
ReplayHandler(ImageReplayer<I> *replayer) : replayer(replayer) {}
- virtual void get() {}
- virtual void put() {}
+ void get() override {}
+ void put() override {}
- virtual void handle_entries_available() {
+ void handle_entries_available() override {
replayer->handle_replay_ready();
}
- virtual void handle_complete(int r) {
+ void handle_complete(int r) override {
std::stringstream ss;
if (r < 0) {
ss << "replay completed with error: " << cpp_strerror(r);
public:
explicit StatusCommand(ImageReplayer<I> *replayer) : replayer(replayer) {}
- bool call(Formatter *f, stringstream *ss) {
+ bool call(Formatter *f, stringstream *ss) override {
replayer->print_status(f, ss);
return true;
}
public:
explicit StartCommand(ImageReplayer<I> *replayer) : replayer(replayer) {}
- bool call(Formatter *f, stringstream *ss) {
+ bool call(Formatter *f, stringstream *ss) override {
replayer->start(nullptr, true);
return true;
}
public:
explicit StopCommand(ImageReplayer<I> *replayer) : replayer(replayer) {}
- bool call(Formatter *f, stringstream *ss) {
+ bool call(Formatter *f, stringstream *ss) override {
replayer->stop(nullptr, true);
return true;
}
public:
explicit RestartCommand(ImageReplayer<I> *replayer) : replayer(replayer) {}
- bool call(Formatter *f, stringstream *ss) {
+ bool call(Formatter *f, stringstream *ss) override {
replayer->restart();
return true;
}
public:
explicit FlushCommand(ImageReplayer<I> *replayer) : replayer(replayer) {}
- bool call(Formatter *f, stringstream *ss) {
+ bool call(Formatter *f, stringstream *ss) override {
C_SaferCond cond;
replayer->flush(&cond);
int r = cond.wait();
}
}
- ~ImageReplayerAdminSocketHook() {
+ ~ImageReplayerAdminSocketHook() override {
for (Commands::const_iterator i = commands.begin(); i != commands.end();
++i) {
(void)admin_socket->unregister_command(i->first);
}
bool call(std::string command, cmdmap_t& cmdmap, std::string format,
- bufferlist& out) {
+ bufferlist& out) override {
Commands::const_iterator i = commands.find(command);
assert(i != commands.end());
Formatter *f = Formatter::create(format);
m_local_pool_image_id(local_pool_image_id), m_on_finish(on_finish) {
}
- virtual void finish(int r) {
+ void finish(int r) override {
m_sync_throttler->handle_sync_finished(this);
m_on_finish->complete(r);
}
public:
explicit StatusCommand(Mirror *mirror) : mirror(mirror) {}
- bool call(Formatter *f, stringstream *ss) {
+ bool call(Formatter *f, stringstream *ss) override {
mirror->print_status(f, ss);
return true;
}
public:
explicit StartCommand(Mirror *mirror) : mirror(mirror) {}
- bool call(Formatter *f, stringstream *ss) {
+ bool call(Formatter *f, stringstream *ss) override {
mirror->start();
return true;
}
public:
explicit StopCommand(Mirror *mirror) : mirror(mirror) {}
- bool call(Formatter *f, stringstream *ss) {
+ bool call(Formatter *f, stringstream *ss) override {
mirror->stop();
return true;
}
public:
explicit RestartCommand(Mirror *mirror) : mirror(mirror) {}
- bool call(Formatter *f, stringstream *ss) {
+ bool call(Formatter *f, stringstream *ss) override {
mirror->restart();
return true;
}
public:
explicit FlushCommand(Mirror *mirror) : mirror(mirror) {}
- bool call(Formatter *f, stringstream *ss) {
+ bool call(Formatter *f, stringstream *ss) override {
mirror->flush();
return true;
}
public:
explicit LeaderReleaseCommand(Mirror *mirror) : mirror(mirror) {}
- bool call(Formatter *f, stringstream *ss) {
+ bool call(Formatter *f, stringstream *ss) override {
mirror->release_leader();
return true;
}
}
}
- ~MirrorAdminSocketHook() {
+ ~MirrorAdminSocketHook() override {
for (Commands::const_iterator i = commands.begin(); i != commands.end();
++i) {
(void)admin_socket->unregister_command(i->first);
}
bool call(std::string command, cmdmap_t& cmdmap, std::string format,
- bufferlist& out) {
+ bufferlist& out) override {
Commands::const_iterator i = commands.find(command);
assert(i != commands.end());
Formatter *f = Formatter::create(format);
public:
explicit StatusCommand(Replayer *replayer) : replayer(replayer) {}
- bool call(Formatter *f, stringstream *ss) {
+ bool call(Formatter *f, stringstream *ss) override {
replayer->print_status(f, ss);
return true;
}
public:
explicit StartCommand(Replayer *replayer) : replayer(replayer) {}
- bool call(Formatter *f, stringstream *ss) {
+ bool call(Formatter *f, stringstream *ss) override {
replayer->start();
return true;
}
public:
explicit StopCommand(Replayer *replayer) : replayer(replayer) {}
- bool call(Formatter *f, stringstream *ss) {
+ bool call(Formatter *f, stringstream *ss) override {
replayer->stop(true);
return true;
}
public:
explicit RestartCommand(Replayer *replayer) : replayer(replayer) {}
- bool call(Formatter *f, stringstream *ss) {
+ bool call(Formatter *f, stringstream *ss) override {
replayer->restart();
return true;
}
public:
explicit FlushCommand(Replayer *replayer) : replayer(replayer) {}
- bool call(Formatter *f, stringstream *ss) {
+ bool call(Formatter *f, stringstream *ss) override {
replayer->flush();
return true;
}
public:
explicit LeaderReleaseCommand(Replayer *replayer) : replayer(replayer) {}
- bool call(Formatter *f, stringstream *ss) {
+ bool call(Formatter *f, stringstream *ss) override {
replayer->release_leader();
return true;
}
}
}
- ~ReplayerAdminSocketHook() {
+ ~ReplayerAdminSocketHook() override {
for (Commands::const_iterator i = commands.begin(); i != commands.end();
++i) {
(void)admin_socket->unregister_command(i->first);
}
bool call(std::string command, cmdmap_t& cmdmap, std::string format,
- bufferlist& out) {
+ bufferlist& out) override {
Commands::const_iterator i = commands.find(command);
assert(i != commands.end());
Formatter *f = Formatter::create(format);
struct MirrorExclusiveLockPolicy : public librbd::exclusive_lock::Policy {
- virtual bool may_auto_request_lock() {
+ bool may_auto_request_lock() override {
return false;
}
- virtual int lock_requested(bool force) {
+ int lock_requested(bool force) override {
// TODO: interlock is being requested (e.g. local promotion)
// Wait for demote event from peer or abort replay on forced
// promotion.
MirrorJournalPolicy(ContextWQ *work_queue) : work_queue(work_queue) {
}
- virtual bool append_disabled() const {
+ bool append_disabled() const override {
// avoid recording any events to the local journal
return true;
}
- virtual bool journal_disabled() const {
+ bool journal_disabled() const override {
return false;
}
- virtual void allocate_tag_on_lock(Context *on_finish) {
+ void allocate_tag_on_lock(Context *on_finish) override {
// rbd-mirror will manually create tags by copying them from the peer
work_queue->queue(on_finish, 0);
}
,func(_func)
{}
protected:
- virtual void* entry()
+ void* entry() override
{
(server.*func)();
server.shutdown();
, size(_size)
{ }
- virtual ~NBDWatchCtx() {}
+ ~NBDWatchCtx() override {}
- virtual void handle_notify()
+ void handle_notify() override
{
librbd::image_info_t info;
if (image.stat(info, sizeof(info)) == 0) {