libblockdev: upgrade 2.26 -> 2.27

0001-lvm-Do-not-include-duplicate-entries-in-bd_lvm_lvs-o.patch
removed since it's included in 2.27

Changelog:
=========
 fs: Return BD_FS_ERROR_UNKNOWN_FS on mounting unknown filesystem
 overrides: Fix translating exceptions in ErrorProxy
 tests: Do not check that swap flag is not supported on DOS table
 tests: Lower expected free space on newly created Ext filesystems
 tests: Remove test for NTFS read-only mounting
 vdo_stats: Default to 100 % savings for invalid savings values
 lvm: Fix reading statistics for VDO pools with VDO 8
 tests: Fix creating loop device for CryptoTestLuksSectorSize
 tests: Use losetup to create 4k sector size loop device for testing
 s390: Remove double fclose in bd_s390_dasd_online (#2045784)
 lvm-dbus: Add support for changing compression and deduplication
 tests: Skip test_lvcreate_type on CentOS/RHEL 9
 tests: Fix expected extended partition flags with new parted
 lvm: Do not set global config to and empty string
 lvm: Do not include duplicate entries in bd_lvm_lvs output
 lvm: Use correct integer type in for comparison
 crypto: Remove useless comparison in progress report in luks_format
 boilerplate_generator: Remove unused variable assignment
 kbd: Add missing progress reporting to bd_kbd_bcache_create
 kbd: Fix leaking error in bd_kbd_bcache_detach
 kbd: Fix potential NULL pointer dereference in bd_kbd_bcache_create
 crypto: Remove unused and leaking error in write_escrow_data_file

Signed-off-by: Wang Mingyu <wangmy@fujitsu.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
This commit is contained in:
Wang Mingyu 2022-09-05 19:15:54 +08:00 committed by Khem Raj
parent 05110a0ab4
commit 4fdcfdec80
2 changed files with 1 additions and 102 deletions

View File

@ -1,100 +0,0 @@
From d10fb2c0ee60c97f4dfeab4506a347c26cb389df Mon Sep 17 00:00:00 2001
From: Vojtech Trefny <vtrefny@redhat.com>
Date: Tue, 7 Dec 2021 15:50:45 +0800
Subject: [PATCH] lvm: Do not include duplicate entries in bd_lvm_lvs output
We use "-o segtypes" for the "lvs" command which means multisegment
LVs will be twice in the output.
Signed-off-by: Vojtech Trefny <vtrefny@redhat.com>
Upstream-Status: Backport [https://github.com/storaged-project/libblockdev/pull/671]
Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
---
src/plugins/lvm.c | 17 +++++++++++++++--
tests/lvm_test.py | 41 +++++++++++++++++++++++++++++++++++++++++
2 files changed, 56 insertions(+), 2 deletions(-)
diff --git a/src/plugins/lvm.c b/src/plugins/lvm.c
index 2be1dbd..acd5b84 100644
--- a/src/plugins/lvm.c
+++ b/src/plugins/lvm.c
@@ -1810,8 +1810,21 @@ BDLVMLVdata** bd_lvm_lvs (const gchar *vg_name, GError **error) {
if (table && (num_items == 15)) {
/* valid line, try to parse and record it */
lvdata = get_lv_data_from_table (table, TRUE);
- if (lvdata)
- g_ptr_array_add (lvs, lvdata);
+ if (lvdata) {
+ /* ignore duplicate entries in lvs output, these are caused by multi segments LVs */
+ for (gsize i = 0; i < lvs->len; i++) {
+ if (g_strcmp0 (((BDLVMLVdata *) g_ptr_array_index (lvs, i))->lv_name, lvdata->lv_name) == 0) {
+ g_debug("Duplicate LV entry for '%s' found in lvs output",
+ lvdata->lv_name);
+ bd_lvm_lvdata_free (lvdata);
+ lvdata = NULL;
+ break;
+ }
+ }
+
+ if (lvdata)
+ g_ptr_array_add (lvs, lvdata);
+ }
} else
if (table)
g_hash_table_destroy (table);
diff --git a/tests/lvm_test.py b/tests/lvm_test.py
index eb94c91..ab0de21 100644
--- a/tests/lvm_test.py
+++ b/tests/lvm_test.py
@@ -915,6 +915,47 @@ class LvmTestLVs(LvmPVVGLVTestCase):
lvs = BlockDev.lvm_lvs("testVG")
self.assertEqual(len(lvs), 1)
+class LvmTestLVsMultiSegment(LvmPVVGLVTestCase):
+ def _clean_up(self):
+ try:
+ BlockDev.lvm_lvremove("testVG", "testLV2", True, None)
+ except:
+ pass
+
+ LvmPVVGLVTestCase._clean_up(self)
+
+ def test_lvs(self):
+ """Verify that it's possible to gather info about LVs"""
+
+ succ = BlockDev.lvm_pvcreate(self.loop_dev, 0, 0, None)
+ self.assertTrue(succ)
+
+ succ = BlockDev.lvm_vgcreate("testVG", [self.loop_dev], 0, None)
+ self.assertTrue(succ)
+
+ succ = BlockDev.lvm_lvcreate("testVG", "testLV", 10 * 1024**2)
+ self.assertTrue(succ)
+
+ lvs = BlockDev.lvm_lvs("testVG")
+ self.assertEqual(len(lvs), 1)
+ self.assertListEqual([lv.lv_name for lv in lvs], ["testLV"])
+
+ # add second LV
+ succ = BlockDev.lvm_lvcreate("testVG", "testLV2", 10 * 1024**2)
+ self.assertTrue(succ)
+
+ lvs = BlockDev.lvm_lvs("testVG")
+ self.assertEqual(len(lvs), 2)
+ self.assertListEqual([lv.lv_name for lv in lvs], ["testLV", "testLV2"])
+
+ # by resizing the first LV we will create two segments
+ succ = BlockDev.lvm_lvresize("testVG", "testLV", 20 * 1024**2, None)
+ self.assertTrue(succ)
+
+ lvs = BlockDev.lvm_lvs("testVG")
+ self.assertEqual(len(lvs), 2)
+ self.assertListEqual([lv.lv_name for lv in lvs], ["testLV", "testLV2"])
+
class LvmPVVGthpoolTestCase(LvmPVVGTestCase):
def _clean_up(self):
try:
--
2.27.0

View File

@ -11,9 +11,8 @@ LIC_FILES_CHKSUM = "file://LICENSE;md5=c07cb499d259452f324bb90c3067d85c"
inherit autotools gobject-introspection pkgconfig inherit autotools gobject-introspection pkgconfig
SRC_URI = "git://github.com/storaged-project/libblockdev;branch=2.x-branch;protocol=https \ SRC_URI = "git://github.com/storaged-project/libblockdev;branch=2.x-branch;protocol=https \
file://0001-lvm-Do-not-include-duplicate-entries-in-bd_lvm_lvs-o.patch \
" "
SRCREV = "47ff12242c89e36a33259d18b7068b26c3bb1c64" SRCREV = "2a651c1366bc3a56982d97ebeec03744b5f9dcd0"
S = "${WORKDIR}/git" S = "${WORKDIR}/git"
FILES:${PN} += "${libdir}/python2.7/dist-packages ${libdir}/python3.*/site-packages" FILES:${PN} += "${libdir}/python2.7/dist-packages ${libdir}/python3.*/site-packages"