aboutsummaryrefslogtreecommitdiff
path: root/block
diff options
context:
space:
mode:
authorJosh Durgin <jdurgin@redhat.com>2015-06-10 20:28:45 -0700
committerKevin Wolf <kwolf@redhat.com>2015-07-14 17:15:23 +0200
commit99a3c89d5d538dc6c360e35dffb797cfe06e9cda (patch)
treeecc78e8ffae9bfe7c26c110af69878cde2db86f1 /block
parent5a8ac6d9d70e1a078d04ad75a5c055b00a041d70 (diff)
downloadqemu-99a3c89d5d538dc6c360e35dffb797cfe06e9cda.zip
qemu-99a3c89d5d538dc6c360e35dffb797cfe06e9cda.tar.gz
qemu-99a3c89d5d538dc6c360e35dffb797cfe06e9cda.tar.bz2
rbd: make qemu's cache setting override any ceph setting
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 <jdurgin@redhat.com> Reviewed-by: Jeff Cody <jcody@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'block')
-rw-r--r--block/rbd.c24
1 files 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");