diff --git a/dbus_job_creation_timeout.patch b/dbus_job_creation_timeout.patch new file mode 100644 index 0000000..ad3141c --- /dev/null +++ b/dbus_job_creation_timeout.patch @@ -0,0 +1,30 @@ +From ad4679efb8ae455d984aa78bb7e264af9646ea29 Mon Sep 17 00:00:00 2001 +From: Vratislav Podzimek +Date: Fri, 30 Sep 2016 12:18:01 +0200 +Subject: [PATCH 1/2] Fix the number passed to LVM DBus as a job-creation + timeout + +It's in seconds not milliseconds like the DBus method call timeout. + +Resolves: rhbz#1378970 +Signed-off-by: Vratislav Podzimek +--- + src/plugins/lvm-dbus.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/plugins/lvm-dbus.c b/src/plugins/lvm-dbus.c +index 844e36e..9500dcb 100644 +--- a/src/plugins/lvm-dbus.c ++++ b/src/plugins/lvm-dbus.c +@@ -58,7 +58,7 @@ static gchar *global_config_str = NULL; + #define DBUS_PROPS_IFACE "org.freedesktop.DBus.Properties" + #define DBUS_INTRO_IFACE "org.freedesktop.DBus.Introspectable" + #define DBUS_LONG_CALL_TIMEOUT 10000 /* msecs */ +-#define METHOD_CALL_TIMEOUT (DBUS_LONG_CALL_TIMEOUT / 2) ++#define METHOD_CALL_TIMEOUT (DBUS_LONG_CALL_TIMEOUT / 2) / 1000 /* secs */ + + static GDBusConnection *bus = NULL; + +-- +2.7.4 + diff --git a/libblockdev.spec b/libblockdev.spec index 672c6a9..c3f44d8 100644 --- a/libblockdev.spec +++ b/libblockdev.spec @@ -1,12 +1,14 @@ Name: libblockdev Version: 1.9 -Release: 2%{?dist} +Release: 3%{?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: cast_numbers.patch +Patch1: dbus_job_creation_timeout.patch +Patch2: mdadm_raid_level_quirk.patch BuildRequires: glib2-devel BuildRequires: gobject-introspection-devel @@ -378,6 +380,8 @@ A meta-package that pulls all the libblockdev plugins as dependencies. %prep %setup -q -n %{name}-%{version} %patch0 -p1 +%patch1 -p1 +%patch2 -p1 %build %configure @@ -575,6 +579,12 @@ find %{buildroot} -type f -name "*.la" | xargs %{__rm} %files plugins-all %changelog +* Mon Oct 3 2016 Vratislav Podzimek - 1.9-3 +- Try to search for "RAID Level" in mdadm's output (vpodzime) + Resolves: rhbz#1379865 +- Fix the number passed to LVM DBus as a job-creation timeout (vpodzime) + Resolves: rhbz#1378970 + * Mon Aug 29 2016 Vratislav Podzimek - 1.9-2 - Explicitly cast number constants for GVariants (vpodzime) diff --git a/mdadm_raid_level_quirk.patch b/mdadm_raid_level_quirk.patch new file mode 100644 index 0000000..1f654e5 --- /dev/null +++ b/mdadm_raid_level_quirk.patch @@ -0,0 +1,121 @@ +From dc98c0d0eaf06af42c6f9eb3ee5ade9e237c5f40 Mon Sep 17 00:00:00 2001 +From: Vratislav Podzimek +Date: Fri, 30 Sep 2016 13:47:24 +0200 +Subject: [PATCH 2/2] Try to search for "RAID Level" in mdadm's output + (#1379865) + +mdadm's API (CLI) is ambiguous and may provide the RAID level as either the +"RAID Level" or "Raid Level" item. Since we store these items in a hashtable, +let's try to lookup both if the first one fails. Another approach would be to +cannonicalize all the items keys when creating the hash table, but that seems +like an overkill for one weird quirk. + +Signed-off-by: Vratislav Podzimek +--- + src/plugins/mdraid.c | 6 +++++ + tests/md_test.py | 9 +++++++ + tests/mdadm_fw_RAID_examine/mdadm | 53 +++++++++++++++++++++++++++++++++++++++ + 3 files changed, 68 insertions(+) + create mode 100755 tests/mdadm_fw_RAID_examine/mdadm + +diff --git a/src/plugins/mdraid.c b/src/plugins/mdraid.c +index abd97da..723b756 100644 +--- a/src/plugins/mdraid.c ++++ b/src/plugins/mdraid.c +@@ -184,8 +184,14 @@ static BDMDExamineData* get_examine_data_from_table (GHashTable *table, gboolean + char time_str[20]; + + data->level = g_strdup ((gchar*) g_hash_table_lookup (table, "Raid Level")); ++ if (!(data->level)) ++ /* BUG: mdadm outputs "RAID Level" for some metadata formats (rhbz#1380034) */ ++ data->level = g_strdup ((gchar*) g_hash_table_lookup (table, "RAID Level")); + + value = (gchar*) g_hash_table_lookup (table, "Raid Devices"); ++ if (!value) ++ /* BUG: mdadm outputs "RAID Devices" for some metadata formats (rhbz#1380034) */ ++ value = (gchar*) g_hash_table_lookup (table, "RAID Devices"); + if (value) + data->num_devices = g_ascii_strtoull (value, NULL, 0); + else +diff --git a/tests/md_test.py b/tests/md_test.py +index 6664e44..df90582 100644 +--- a/tests/md_test.py ++++ b/tests/md_test.py +@@ -404,6 +404,15 @@ class FakeMDADMutilTest(unittest.TestCase): + + self.assertEqual(ex_data.device, "/dev/md/Volume0") + ++ def test_fw_raid_uppercase_examine(self): ++ """Verify that md_examine works with output using "RAID" instead of "Raid" """ ++ ++ with fake_utils("tests/mdadm_fw_RAID_examine"): ++ ex_data = BlockDev.md_examine("fake_dev") ++ ++ self.assertEqual(ex_data.level, "0") ++ self.assertEqual(ex_data.num_devices, 1) ++ + def test_no_metadata_examine(self): + """Verify that md_examine works as expected with no metadata spec""" + +diff --git a/tests/mdadm_fw_RAID_examine/mdadm b/tests/mdadm_fw_RAID_examine/mdadm +new file mode 100755 +index 0000000..c939860 +--- /dev/null ++++ b/tests/mdadm_fw_RAID_examine/mdadm +@@ -0,0 +1,53 @@ ++#!/bin/bash ++ ++echo "$@"|grep -- "--brief" &>/dev/null ++is_brief=$? ++ ++if [ $is_brief -eq 0 ]; then ++ cat <