]> git.proxmox.com Git - pve-qemu-kvm.git/commitdiff
rbd : add writethrough/writeback option
authorAlexandre Derumier <aderumier@odiso.com>
Sat, 16 Jun 2012 14:02:50 +0000 (16:02 +0200)
committerDietmar Maurer <dietmar@proxmox.com>
Mon, 18 Jun 2012 04:14:19 +0000 (06:14 +0200)
This patch add writethrough/writeback support to qemu-rbd.
It'll be merge in qemu 1.2, as 1.1 in feature froze for the moment.

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
debian/patches/rbd-enable-cacheoption.patch [new file with mode: 0644]
debian/patches/series

diff --git a/debian/patches/rbd-enable-cacheoption.patch b/debian/patches/rbd-enable-cacheoption.patch
new file mode 100644 (file)
index 0000000..864b134
--- /dev/null
@@ -0,0 +1,37 @@
+Signed-off-by: Josh Durgin <address@hidden>
+---
+ block/rbd.c |   19 +++++++++++++++++++
+ 1 files changed, 19 insertions(+), 0 deletions(-)
+
+diff --git a/block/rbd.c b/block/rbd.c
+index 1280d66..eebc334 100644
+--- a/block/rbd.c
++++ b/block/rbd.c
+@@ -476,6 +476,25 @@ static int qemu_rbd_open(BlockDriverState *bs, const char *filename, int flags)
+         s->snap = g_strdup(snap_buf);
+     }
++    /*
++     * Fallback to more conservative semantics if setting cache
++     * options fails. Ignore errors from setting rbd_cache because the
++     * only possible error is that the option does not exist, and
++     * librbd defaults to no caching. If write through caching cannot
++     * be set up, fall back to no caching.
++     */
++    if (flags & BDRV_O_NOCACHE) {
++        rados_conf_set(s->cluster, "rbd_cache", "false");
++    } else {
++        rados_conf_set(s->cluster, "rbd_cache", "true");
++        if (!(flags & BDRV_O_CACHE_WB)) {
++            r = rados_conf_set(s->cluster, "rbd_cache_max_dirty", "0");
++            if (r < 0) {
++                rados_conf_set(s->cluster, "rbd_cache", "false");
++            }
++        }
++    }
++
+     if (strstr(conf, "conf=") == NULL) {
+         /* try default location, but ignore failure */
+         rados_conf_read_file(s->cluster, NULL);
+-- 
+1.7.5.4
index 4b5d221aa05ac67177c5f58a950443f63700d92a..ab59a91402761ae56f50e71594c09eb96525a4ed 100644 (file)
@@ -5,3 +5,4 @@ keymap.diff
 set-max-nics.patch
 pve-auth.patch
 update-cpus-x86_64.conf-to-rhel6.2-version.patch
+rbd-enable-cacheoption.patch