提交 84678267 编写于 作者: W Wido den Hollander 提交者: John Ferlan

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: NWido den Hollander <wido@widodh.nl>
上级 0b15f920
......@@ -284,7 +284,7 @@ static int volStorageBackendRBDRefreshVolInfo(virStorageVolDefPtr vol,
int r = 0;
rbd_image_t image = NULL;
r = rbd_open(ptr->ioctx, vol->name, &image, NULL);
r = rbd_open_read_only(ptr->ioctx, vol->name, &image, NULL);
if (r < 0) {
ret = -r;
virReportSystemError(-r, _("failed to open the RBD image '%s'"),
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册