diff --git a/create_cache_pool_first.patch b/create_cache_pool_first.patch new file mode 100644 index 0000000..6a0d402 --- /dev/null +++ b/create_cache_pool_first.patch @@ -0,0 +1,46 @@ +From 546d495b13553f9d20be0b421e1cc4a9087b4b08 Mon Sep 17 00:00:00 2001 +From: Vratislav Podzimek +Date: Tue, 24 Nov 2015 13:03:43 +0100 +Subject: [PATCH] Create the cache pool before the to-be-cached LV + +Cache pool typically has harder restrictions for PV space (where it should be +allocated) than the LV. + +Signed-off-by: Vratislav Podzimek +--- + src/plugins/lvm.c | 12 ++++++------ + 1 file changed, 6 insertions(+), 6 deletions(-) + +diff --git a/src/plugins/lvm.c b/src/plugins/lvm.c +index 30818c6..ead0d68 100644 +--- a/src/plugins/lvm.c ++++ b/src/plugins/lvm.c +@@ -1736,12 +1736,6 @@ gboolean bd_lvm_cache_create_cached_lv (gchar *vg_name, gchar *lv_name, guint64 + gboolean success = FALSE; + gchar *name = NULL; + +- success = bd_lvm_lvcreate (vg_name, lv_name, data_size, NULL, slow_pvs, error); +- if (!success) { +- g_prefix_error (error, "Failed to create the data LV: "); +- return FALSE; +- } +- + name = g_strdup_printf ("%s_cache", lv_name); + success = bd_lvm_cache_create_pool (vg_name, name, cache_size, md_size, mode, flags, fast_pvs, error); + if (!success) { +@@ -1750,6 +1744,12 @@ gboolean bd_lvm_cache_create_cached_lv (gchar *vg_name, gchar *lv_name, guint64 + return FALSE; + } + ++ success = bd_lvm_lvcreate (vg_name, lv_name, data_size, NULL, slow_pvs, error); ++ if (!success) { ++ g_prefix_error (error, "Failed to create the data LV: "); ++ return FALSE; ++ } ++ + success = bd_lvm_cache_attach (vg_name, lv_name, name, error); + if (!success) { + g_prefix_error (error, "Failed to attach the cache pool '%s' to the data LV: ", name); +-- +2.5.0 + diff --git a/libblockdev.spec b/libblockdev.spec index f81ebe3..8b9e946 100644 --- a/libblockdev.spec +++ b/libblockdev.spec @@ -1,12 +1,13 @@ Name: libblockdev Version: 1.3 -Release: 2%{?dist} +Release: 4%{?dist} Summary: A library for low-level manipulation with block devices License: LGPLv2+ URL: https://github.com/rhinstaller/libblockdev Source0: https://github.com/rhinstaller/libblockdev/archive/%{name}-%{version}.tar.gz Patch0: blockdev_c_annotation_fix.patch +Patch1: create_cache_pool_first.patch BuildRequires: glib2-devel BuildRequires: gobject-introspection-devel @@ -316,6 +317,7 @@ A meta-package that pulls all the libblockdev plugins as dependencies. %prep %setup -q -n %{name}-%{version} %patch0 -p1 +%patch1 -p1 %build %configure @@ -480,6 +482,9 @@ find %{buildroot} -type f -name "*.la" | xargs %{__rm} %files plugins-all %changelog +* Wed Nov 25 2015 Vratislav Podzimek - 1.3-4 +- Create the cache pool before the to-be-cached LV (vpodzime) + * Wed Nov 18 2015 Vratislav Podzimek - 1.3-2 - Fix the annotation of bd_try_init in blockdev.c (vpodzime) - Add missing python GI requires (vpodzime)