Skip to content

Commit 738ac44

Browse files
authored
Merge pull request ceph#61150 from idryomov/wip-69319
rbd: open images in read-only mode for "rbd mirror pool status --verbose" Reviewed-by: Ramana Raja <[email protected]>
2 parents 30103a0 + 650e21d commit 738ac44

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

src/tools/rbd/action/MirrorPool.cc

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -355,6 +355,10 @@ class ImageRequestBase {
355355
virtual ~ImageRequestBase() {
356356
}
357357

358+
virtual bool open_read_only() const {
359+
return false;
360+
}
361+
358362
virtual bool skip_get_info() const {
359363
return false;
360364
}
@@ -429,8 +433,13 @@ class ImageRequestBase {
429433
librbd::RBD rbd;
430434
auto aio_completion = utils::create_aio_completion<
431435
ImageRequestBase, &ImageRequestBase::handle_open_image>(this);
432-
rbd.aio_open(m_io_ctx, m_image, m_image_name.c_str(), nullptr,
433-
aio_completion);
436+
if (open_read_only()) {
437+
rbd.aio_open_read_only(m_io_ctx, m_image, m_image_name.c_str(), nullptr,
438+
aio_completion);
439+
} else {
440+
rbd.aio_open(m_io_ctx, m_image, m_image_name.c_str(), nullptr,
441+
aio_completion);
442+
}
434443
}
435444

436445
void handle_open_image(int r) {
@@ -604,6 +613,10 @@ class StatusImageRequest : public ImageRequestBase {
604613
}
605614

606615
protected:
616+
bool open_read_only() const override {
617+
return true;
618+
}
619+
607620
bool skip_get_info() const override {
608621
return true;
609622
}

0 commit comments

Comments
 (0)