SOURCES/kvm-rbd-fix-ceph-settings-precedence.patch | ●●●●● patch | view | raw | blame | history | |
SOURCES/kvm-rbd-make-qemu-s-cache-setting-override-any-ceph-sett.patch | ●●●●● patch | view | raw | blame | history | |
SPECS/qemu-kvm.spec | ●●●●● patch | view | raw | blame | history |
SOURCES/kvm-rbd-fix-ceph-settings-precedence.patch
New file @@ -0,0 +1,113 @@ From a66fe0ea2e09b8d82a2d8940632ac06ee8bcc579 Mon Sep 17 00:00:00 2001 From: Stefan Hajnoczi <stefanha@redhat.com> Date: Thu, 5 Nov 2015 15:20:58 +0100 Subject: [PATCH 2/2] rbd: fix ceph settings precedence Message-id: <1446736858-29005-3-git-send-email-stefanha@redhat.com> Patchwork-id: 68294 O-Subject: [RHEL-7.2.z qemu-kvm PATCH 2/2] rbd: fix ceph settings precedence Bugzilla: 1279389 RH-Acked-by: Max Reitz <mreitz@redhat.com> RH-Acked-by: Jeffrey Cody <jcody@redhat.com> RH-Acked-by: Kevin Wolf <kwolf@redhat.com> From: Josh Durgin <jdurgin@redhat.com> Apply the ceph settings from a config file before any ceph settings from the command line. Since the ceph config file location may be specified on the command line, parse it once to read the config file, and do a second pass to apply the rest of the command line ceph options. Signed-off-by: Josh Durgin <jdurgin@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com> (cherry picked from commit e34d8f297d51b7ffa5dce72df1e45fa94cff989c) Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> Conflicts: block/rbd.c - downstream does not use Error* Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> --- block/rbd.c | 34 +++++++++++++++++++++++++--------- 1 file changed, 25 insertions(+), 9 deletions(-) diff --git a/block/rbd.c b/block/rbd.c index 11a39ac..b982658 100644 --- a/block/rbd.c +++ b/block/rbd.c @@ -235,7 +235,8 @@ static char *qemu_rbd_parse_clientname(const char *conf, char *clientname) return NULL; } -static int qemu_rbd_set_conf(rados_t cluster, const char *conf) +static int qemu_rbd_set_conf(rados_t cluster, const char *conf, + bool only_read_conf_file) { char *p, *buf; char name[RBD_MAX_CONF_NAME_SIZE]; @@ -267,14 +268,18 @@ static int qemu_rbd_set_conf(rados_t cluster, const char *conf) qemu_rbd_unescape(value); if (strcmp(name, "conf") == 0) { - ret = rados_conf_read_file(cluster, value); - if (ret < 0) { - error_report("error reading conf file %s", value); - break; + /* read the conf file alone, so it doesn't override more + specific settings for a particular device */ + if (only_read_conf_file) { + ret = rados_conf_read_file(cluster, value); + if (ret < 0) { + error_report("error reading conf file %s", value); + break; + } } } else if (strcmp(name, "id") == 0) { /* ignore, this is parsed by qemu_rbd_parse_clientname() */ - } else { + } else if (!only_read_conf_file) { ret = rados_conf_set(cluster, name, value); if (ret < 0) { error_report("invalid conf option %s", name); @@ -341,12 +346,17 @@ static int qemu_rbd_create(const char *filename, QEMUOptionParameter *options, if (strstr(conf, "conf=") == NULL) { /* try default location, but ignore failure */ rados_conf_read_file(cluster, NULL); + } else if (conf[0] != '\0' && + qemu_rbd_set_conf(cluster, conf, true) < 0) { + rados_shutdown(cluster); + error_report("error setting config options"); + return -EIO; } if (conf[0] != '\0' && - qemu_rbd_set_conf(cluster, conf) < 0) { - error_report("error setting config options"); + qemu_rbd_set_conf(cluster, conf, false) < 0) { rados_shutdown(cluster); + error_report("error setting config options"); return -EIO; } @@ -504,10 +514,16 @@ static int qemu_rbd_open(BlockDriverState *bs, QDict *options, int flags, if (strstr(conf, "conf=") == NULL) { /* try default location, but ignore failure */ rados_conf_read_file(s->cluster, NULL); + } else if (conf[0] != '\0') { + r = qemu_rbd_set_conf(s->cluster, conf, true); + if (r < 0) { + error_report("error setting config options"); + goto failed_shutdown; + } } if (conf[0] != '\0') { - r = qemu_rbd_set_conf(s->cluster, conf); + r = qemu_rbd_set_conf(s->cluster, conf, false); if (r < 0) { error_report("error setting config options"); goto failed_shutdown; -- 1.8.3.1 SOURCES/kvm-rbd-make-qemu-s-cache-setting-override-any-ceph-sett.patch
New file @@ -0,0 +1,85 @@ From 6f293e47850a873d0ccc39882be7b3ef6e1043b6 Mon Sep 17 00:00:00 2001 From: Stefan Hajnoczi <stefanha@redhat.com> Date: Thu, 5 Nov 2015 15:20:57 +0100 Subject: [PATCH 1/2] rbd: make qemu's cache setting override any ceph setting Message-id: <1446736858-29005-2-git-send-email-stefanha@redhat.com> Patchwork-id: 68293 O-Subject: [RHEL-7.2.z qemu-kvm PATCH 1/2] rbd: make qemu's cache setting override any ceph setting Bugzilla: 1279389 RH-Acked-by: Max Reitz <mreitz@redhat.com> RH-Acked-by: Jeffrey Cody <jcody@redhat.com> RH-Acked-by: Kevin Wolf <kwolf@redhat.com> From: Josh Durgin <jdurgin@redhat.com> 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> (cherry picked from commit 99a3c89d5d538dc6c360e35dffb797cfe06e9cda) Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> Conflicts: block/rbd.c - downstream doesn't use Error **errp Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> --- block/rbd.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/block/rbd.c b/block/rbd.c index 4eea455..11a39ac 100644 --- a/block/rbd.c +++ b/block/rbd.c @@ -501,19 +501,6 @@ static int qemu_rbd_open(BlockDriverState *bs, QDict *options, 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 (strstr(conf, "conf=") == NULL) { /* try default location, but ignore failure */ rados_conf_read_file(s->cluster, NULL); @@ -527,6 +514,19 @@ static int qemu_rbd_open(BlockDriverState *bs, QDict *options, int flags, } } + /* + * 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"); + } + r = rados_connect(s->cluster); if (r < 0) { error_report("error connecting"); -- 1.8.3.1 SPECS/qemu-kvm.spec
@@ -76,7 +76,7 @@ Summary: QEMU is a FAST! processor emulator Name: %{pkgname}%{?pkgsuffix} Version: 1.5.3 Release: 105%{?dist} Release: 105%{?dist}.1 # Epoch because we pushed a qemu-1.0 package. AIUI this can't ever be dropped Epoch: 10 License: GPLv2+ and LGPLv2+ and BSD @@ -3161,6 +3161,10 @@ Patch1552: kvm-qemu-iotests-Filter-qemu-io-output-in-025.patch # For bz#1270341 - qemu-kvm build failure race condition in tests/ide-test Patch1553: kvm-qtest-ide-test-disable-flush-test.patch # For bz#1279389 - ceph.conf properties override qemu's command-line properties Patch1554: kvm-rbd-make-qemu-s-cache-setting-override-any-ceph-sett.patch # For bz#1279389 - ceph.conf properties override qemu's command-line properties Patch1555: kvm-rbd-fix-ceph-settings-precedence.patch BuildRequires: zlib-devel @@ -4927,6 +4931,8 @@ %patch1551 -p1 %patch1552 -p1 %patch1553 -p1 %patch1554 -p1 %patch1555 -p1 %build buildarch="%{kvm_target}-softmmu" @@ -5383,6 +5389,12 @@ %{_libdir}/pkgconfig/libcacard.pc %changelog * Tue Nov 17 2015 Miroslav Rezanina <mrezanin@redhat.com> - 1.5.3-105.el7_2.1 - kvm-rbd-make-qemu-s-cache-setting-override-any-ceph-sett.patch [bz#1279389] - kvm-rbd-fix-ceph-settings-precedence.patch [bz#1279389] - Resolves: bz#1279389 (ceph.conf properties override qemu's command-line properties) * Fri Oct 16 2015 Jeff E. Nelson <jen@redhat.com> - 1.5.3-105.el7 - kvm-qtest-ide-test-disable-flush-test.patch [bz#1270341] - Resolves: bz#1270341