]> xenbits.xensource.com Git - libvirt.git/commitdiff
rbd: Open in Read-Only mode when refreshing a volume
authorWido den Hollander <wido@widodh.nl>
Thu, 28 Jan 2016 10:20:23 +0000 (11:20 +0100)
committerJohn Ferlan <jferlan@redhat.com>
Fri, 29 Jan 2016 19:09:34 +0000 (14:09 -0500)
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 <wido@widodh.nl>
src/storage/storage_backend_rbd.c

index 6a6f82160e484d489520ecb669bf5b744932cfa3..80a1d339faf1fc03b2ff98d4b819cbc517cb74e5 100644 (file)
@@ -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'"),