[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-block] [PULL 10/11] rbd: make qemu's cache setting override any ce
From: |
Kevin Wolf |
Subject: |
[Qemu-block] [PULL 10/11] rbd: make qemu's cache setting override any ceph setting |
Date: |
Tue, 14 Jul 2015 17:39:31 +0200 |
From: Josh Durgin <address@hidden>
To be safe, when cache=none is used ceph settings should not be able
to override it to turn on caching. This was previously possible with
rbd_cache=true in the rbd device configuration or a ceph configuration
file. Similarly, rbd settings could have turned off caching when qemu
requested it, although this would just be a performance problem.
Fix this by changing rbd's cache setting to match qemu after all other
ceph settings have been applied.
Signed-off-by: Josh Durgin <address@hidden>
Reviewed-by: Jeff Cody <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>
---
block/rbd.c | 24 ++++++++++++------------
1 file changed, 12 insertions(+), 12 deletions(-)
diff --git a/block/rbd.c b/block/rbd.c
index 50b5f6b..00d027d 100644
--- a/block/rbd.c
+++ b/block/rbd.c
@@ -460,6 +460,18 @@ static int qemu_rbd_open(BlockDriverState *bs, QDict
*options, int flags,
s->snap = g_strdup(snap_buf);
}
+ if (strstr(conf, "conf=") == NULL) {
+ /* try default location, but ignore failure */
+ rados_conf_read_file(s->cluster, NULL);
+ }
+
+ if (conf[0] != '\0') {
+ r = qemu_rbd_set_conf(s->cluster, conf, errp);
+ if (r < 0) {
+ goto failed_shutdown;
+ }
+ }
+
/*
* Fallback to more conservative semantics if setting cache
* options fails. Ignore errors from setting rbd_cache because the
@@ -473,18 +485,6 @@ static int qemu_rbd_open(BlockDriverState *bs, QDict
*options, int flags,
rados_conf_set(s->cluster, "rbd_cache", "true");
}
- if (strstr(conf, "conf=") == NULL) {
- /* try default location, but ignore failure */
- rados_conf_read_file(s->cluster, NULL);
- }
-
- if (conf[0] != '\0') {
- r = qemu_rbd_set_conf(s->cluster, conf, errp);
- if (r < 0) {
- goto failed_shutdown;
- }
- }
-
r = rados_connect(s->cluster);
if (r < 0) {
error_setg(errp, "error connecting");
--
1.8.3.1
- [Qemu-block] [PULL 00/11] Block layer patches for 2.4.0-rc1, Kevin Wolf, 2015/07/14
- [Qemu-block] [PULL 02/11] nvme: properly report volatile write caches, Kevin Wolf, 2015/07/14
- [Qemu-block] [PULL 03/11] block: Move bdrv_attach_child() calls up the call chain, Kevin Wolf, 2015/07/14
- [Qemu-block] [PULL 01/11] nvme: implement the Flush command, Kevin Wolf, 2015/07/14
- [Qemu-block] [PULL 04/11] block: Introduce bdrv_open_child(), Kevin Wolf, 2015/07/14
- [Qemu-block] [PULL 05/11] block: Introduce bdrv_unref_child(), Kevin Wolf, 2015/07/14
- [Qemu-block] [PULL 06/11] block: Reorder cleanups in bdrv_close(), Kevin Wolf, 2015/07/14
- [Qemu-block] [PULL 08/11] rbd: remove unused constants and fields, Kevin Wolf, 2015/07/14
- [Qemu-block] [PULL 09/11] MAINTAINERS: update email address, Kevin Wolf, 2015/07/14
- [Qemu-block] [PULL 07/11] block: Fix backing file child when modifying graph, Kevin Wolf, 2015/07/14
- [Qemu-block] [PULL 10/11] rbd: make qemu's cache setting override any ceph setting,
Kevin Wolf <=
- [Qemu-block] [PULL 11/11] rbd: fix ceph settings precedence, Kevin Wolf, 2015/07/14
- Re: [Qemu-block] [Qemu-devel] [PULL 00/11] Block layer patches for 2.4.0-rc1, Peter Maydell, 2015/07/14