Skip to content

Commit 8467826

Browse files
widojferlan
authored andcommitted
rbd: Open in Read-Only mode when refreshing a volume
By opening a RBD volume in Read-Only we do not register a watcher on the header object inside the Ceph cluster. Refreshing a volume only calls rbd_stat() which is a operation which does not write to a RBD image. This allows us to use a cephx user which has no write permissions if we would want to use the libvirt storage pool for informational purposes only. It also saves us a write into the Ceph cluster which should speed up refreshing a RBD pool. rbd_open_read_only() is available in all librbd versions which also support rbd_open(). Signed-off-by: Wido den Hollander <[email protected]>
1 parent 0b15f92 commit 8467826

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/storage/storage_backend_rbd.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ static int volStorageBackendRBDRefreshVolInfo(virStorageVolDefPtr vol,
284284
int r = 0;
285285
rbd_image_t image = NULL;
286286

287-
r = rbd_open(ptr->ioctx, vol->name, &image, NULL);
287+
r = rbd_open_read_only(ptr->ioctx, vol->name, &image, NULL);
288288
if (r < 0) {
289289
ret = -r;
290290
virReportSystemError(-r, _("failed to open the RBD image '%s'"),

0 commit comments

Comments
 (0)