Fixes for rhbz#2030647 and rhbz#2028113
- tests: Wait for raid and mirrored LVs to be synced before removing Resolves: rhbz#2030647 - spec: Require the same version of utils for lvm-devel and lvm-dbus-devel Resolves: rhbz#2028113
This commit is contained in:
parent
22b10e5b01
commit
1a538d2748
278
0011-tests-Wait-for-raid-and-mirrored-LVs-to-be-synced-be.patch
Normal file
278
0011-tests-Wait-for-raid-and-mirrored-LVs-to-be-synced-be.patch
Normal file
@ -0,0 +1,278 @@
|
||||
From d0ba031e679d480855bea61060acea597d5ffbbd Mon Sep 17 00:00:00 2001
|
||||
From: Vojtech Trefny <vtrefny@redhat.com>
|
||||
Date: Wed, 15 Dec 2021 14:14:19 +0100
|
||||
Subject: [PATCH 1/2] tests: Wait for raid and mirrored LVs to be synced before
|
||||
removing
|
||||
|
||||
Resolves: rhbz#2030647
|
||||
---
|
||||
tests/lvm_dbus_tests.py | 31 +++++++++++++++++++++++++------
|
||||
tests/lvm_test.py | 31 +++++++++++++++++++++++++------
|
||||
2 files changed, 50 insertions(+), 12 deletions(-)
|
||||
|
||||
diff --git a/tests/lvm_dbus_tests.py b/tests/lvm_dbus_tests.py
|
||||
index 5516afe..5ce653e 100644
|
||||
--- a/tests/lvm_dbus_tests.py
|
||||
+++ b/tests/lvm_dbus_tests.py
|
||||
@@ -7,6 +7,8 @@ import six
|
||||
import re
|
||||
import shutil
|
||||
import subprocess
|
||||
+import time
|
||||
+from contextlib import contextmanager
|
||||
from distutils.version import LooseVersion
|
||||
from itertools import chain
|
||||
|
||||
@@ -18,6 +20,21 @@ sb = dbus.SystemBus()
|
||||
lvm_dbus_running = any("lvmdbus" in name for name in chain(sb.list_names(), sb.list_activatable_names()))
|
||||
|
||||
|
||||
+@contextmanager
|
||||
+def wait_for_sync(vg_name, lv_name):
|
||||
+ try:
|
||||
+ yield
|
||||
+ finally:
|
||||
+ time.sleep(2)
|
||||
+ while True:
|
||||
+ ret, out, _err = run_command("LC_ALL=C lvs -o copy_percent --noheadings %s/%s" % (vg_name, lv_name))
|
||||
+ if ret != 0:
|
||||
+ break
|
||||
+ if int(float(out)) == 100:
|
||||
+ break
|
||||
+ time.sleep(1)
|
||||
+
|
||||
+
|
||||
class LVMTestCase(unittest.TestCase):
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
@@ -801,9 +818,10 @@ class LvmTestLVcreateType(LvmPVVGLVTestCase):
|
||||
succ = BlockDev.lvm_lvremove("testVG", "testLV", True, None)
|
||||
self.assertTrue(succ)
|
||||
|
||||
- # try to create a mirrored LV
|
||||
- succ = BlockDev.lvm_lvcreate("testVG", "testLV", 512 * 1024**2, "mirror", [self.loop_dev, self.loop_dev2], None)
|
||||
- self.assertTrue(succ)
|
||||
+ with wait_for_sync("testVG", "testLV"):
|
||||
+ # try to create a mirrored LV
|
||||
+ succ = BlockDev.lvm_lvcreate("testVG", "testLV", 512 * 1024**2, "mirror", [self.loop_dev, self.loop_dev2], None)
|
||||
+ self.assertTrue(succ)
|
||||
|
||||
# verify that the LV has the requested segtype
|
||||
info = BlockDev.lvm_lvinfo("testVG", "testLV")
|
||||
@@ -812,9 +830,10 @@ class LvmTestLVcreateType(LvmPVVGLVTestCase):
|
||||
succ = BlockDev.lvm_lvremove("testVG", "testLV", True, None)
|
||||
self.assertTrue(succ)
|
||||
|
||||
- # try to create a raid1 LV
|
||||
- succ = BlockDev.lvm_lvcreate("testVG", "testLV", 512 * 1024**2, "raid1", [self.loop_dev, self.loop_dev2], None)
|
||||
- self.assertTrue(succ)
|
||||
+ with wait_for_sync("testVG", "testLV"):
|
||||
+ # try to create a raid1 LV
|
||||
+ succ = BlockDev.lvm_lvcreate("testVG", "testLV", 512 * 1024**2, "raid1", [self.loop_dev, self.loop_dev2], None)
|
||||
+ self.assertTrue(succ)
|
||||
|
||||
# verify that the LV has the requested segtype
|
||||
info = BlockDev.lvm_lvinfo("testVG", "testLV")
|
||||
diff --git a/tests/lvm_test.py b/tests/lvm_test.py
|
||||
index e349817..12b78ca 100644
|
||||
--- a/tests/lvm_test.py
|
||||
+++ b/tests/lvm_test.py
|
||||
@@ -7,12 +7,29 @@ import six
|
||||
import re
|
||||
import shutil
|
||||
import subprocess
|
||||
+import time
|
||||
+from contextlib import contextmanager
|
||||
from distutils.version import LooseVersion
|
||||
|
||||
from utils import create_sparse_tempfile, create_lio_device, delete_lio_device, fake_utils, fake_path, TestTags, tag_test, run_command, read_file
|
||||
from gi.repository import BlockDev, GLib
|
||||
|
||||
|
||||
+@contextmanager
|
||||
+def wait_for_sync(vg_name, lv_name):
|
||||
+ try:
|
||||
+ yield
|
||||
+ finally:
|
||||
+ time.sleep(2)
|
||||
+ while True:
|
||||
+ info = BlockDev.lvm_lvinfo(vg_name, lv_name)
|
||||
+ if not info:
|
||||
+ break
|
||||
+ if info.copy_percent == 100:
|
||||
+ break
|
||||
+ time.sleep(1)
|
||||
+
|
||||
+
|
||||
class LVMTestCase(unittest.TestCase):
|
||||
|
||||
@classmethod
|
||||
@@ -737,9 +754,10 @@ class LvmTestLVcreateType(LvmPVVGLVTestCase):
|
||||
succ = BlockDev.lvm_lvremove("testVG", "testLV", True, None)
|
||||
self.assertTrue(succ)
|
||||
|
||||
- # try to create a mirrored LV
|
||||
- succ = BlockDev.lvm_lvcreate("testVG", "testLV", 512 * 1024**2, "mirror", [self.loop_dev, self.loop_dev2], None)
|
||||
- self.assertTrue(succ)
|
||||
+ with wait_for_sync("testVG", "testLV"):
|
||||
+ # try to create a mirrored LV
|
||||
+ succ = BlockDev.lvm_lvcreate("testVG", "testLV", 512 * 1024**2, "mirror", [self.loop_dev, self.loop_dev2], None)
|
||||
+ self.assertTrue(succ)
|
||||
|
||||
# verify that the LV has the requested segtype
|
||||
info = BlockDev.lvm_lvinfo("testVG", "testLV")
|
||||
@@ -748,9 +766,10 @@ class LvmTestLVcreateType(LvmPVVGLVTestCase):
|
||||
succ = BlockDev.lvm_lvremove("testVG", "testLV", True, None)
|
||||
self.assertTrue(succ)
|
||||
|
||||
- # try to create a raid1 LV
|
||||
- succ = BlockDev.lvm_lvcreate("testVG", "testLV", 512 * 1024**2, "raid1", [self.loop_dev, self.loop_dev2], None)
|
||||
- self.assertTrue(succ)
|
||||
+ with wait_for_sync("testVG", "testLV"):
|
||||
+ # try to create a raid1 LV
|
||||
+ succ = BlockDev.lvm_lvcreate("testVG", "testLV", 512 * 1024**2, "raid1", [self.loop_dev, self.loop_dev2], None)
|
||||
+ self.assertTrue(succ)
|
||||
|
||||
# verify that the LV has the requested segtype
|
||||
info = BlockDev.lvm_lvinfo("testVG", "testLV")
|
||||
--
|
||||
2.31.1
|
||||
|
||||
|
||||
From 36dbac970bc4a052dbd97f51eb47379036d15b6e Mon Sep 17 00:00:00 2001
|
||||
From: Vojtech Trefny <vtrefny@redhat.com>
|
||||
Date: Thu, 16 Dec 2021 12:27:33 +0100
|
||||
Subject: [PATCH 2/2] tests: Make smaller images for test_lvcreate_type
|
||||
|
||||
We are now waiting for the initial resync for the RAID/mirror LVs
|
||||
which means we are trying to overwrite the entire 1 GB image which
|
||||
doesn't fit in /tmp on our CI machines.
|
||||
---
|
||||
tests/lvm_dbus_tests.py | 16 +++++++++++-----
|
||||
tests/lvm_test.py | 15 ++++++++++-----
|
||||
2 files changed, 21 insertions(+), 10 deletions(-)
|
||||
|
||||
diff --git a/tests/lvm_dbus_tests.py b/tests/lvm_dbus_tests.py
|
||||
index 5ce653e..723aabb 100644
|
||||
--- a/tests/lvm_dbus_tests.py
|
||||
+++ b/tests/lvm_dbus_tests.py
|
||||
@@ -313,14 +313,17 @@ class LvmNoDevTestCase(LVMTestCase):
|
||||
|
||||
@unittest.skipUnless(lvm_dbus_running, "LVM DBus not running")
|
||||
class LvmPVonlyTestCase(LVMTestCase):
|
||||
+
|
||||
+ _sparse_size = 1024**3
|
||||
+
|
||||
# :TODO:
|
||||
# * test pvmove (must create two PVs, a VG, a VG and some data in it
|
||||
# first)
|
||||
# * some complex test for pvs, vgs, lvs, pvinfo, vginfo and lvinfo
|
||||
def setUp(self):
|
||||
self.addCleanup(self._clean_up)
|
||||
- self.dev_file = create_sparse_tempfile("lvm_test", 1024**3)
|
||||
- self.dev_file2 = create_sparse_tempfile("lvm_test", 1024**3)
|
||||
+ self.dev_file = create_sparse_tempfile("lvm_test", self._sparse_size)
|
||||
+ self.dev_file2 = create_sparse_tempfile("lvm_test", self._sparse_size)
|
||||
try:
|
||||
self.loop_dev = create_lio_device(self.dev_file)
|
||||
except RuntimeError as e:
|
||||
@@ -795,6 +798,9 @@ class LvmTestLVcreateWithExtra(LvmPVVGLVTestCase):
|
||||
|
||||
@unittest.skipUnless(lvm_dbus_running, "LVM DBus not running")
|
||||
class LvmTestLVcreateType(LvmPVVGLVTestCase):
|
||||
+
|
||||
+ _sparse_size = 200 * 1024**2
|
||||
+
|
||||
def test_lvcreate_type(self):
|
||||
"""Verify it's possible to create LVs with various types"""
|
||||
|
||||
@@ -808,7 +814,7 @@ class LvmTestLVcreateType(LvmPVVGLVTestCase):
|
||||
self.assertTrue(succ)
|
||||
|
||||
# try to create a striped LV
|
||||
- succ = BlockDev.lvm_lvcreate("testVG", "testLV", 512 * 1024**2, "striped", [self.loop_dev, self.loop_dev2], None)
|
||||
+ succ = BlockDev.lvm_lvcreate("testVG", "testLV", 100 * 1024**2, "striped", [self.loop_dev, self.loop_dev2], None)
|
||||
self.assertTrue(succ)
|
||||
|
||||
# verify that the LV has the requested segtype
|
||||
@@ -820,7 +826,7 @@ class LvmTestLVcreateType(LvmPVVGLVTestCase):
|
||||
|
||||
with wait_for_sync("testVG", "testLV"):
|
||||
# try to create a mirrored LV
|
||||
- succ = BlockDev.lvm_lvcreate("testVG", "testLV", 512 * 1024**2, "mirror", [self.loop_dev, self.loop_dev2], None)
|
||||
+ succ = BlockDev.lvm_lvcreate("testVG", "testLV", 100 * 1024**2, "mirror", [self.loop_dev, self.loop_dev2], None)
|
||||
self.assertTrue(succ)
|
||||
|
||||
# verify that the LV has the requested segtype
|
||||
@@ -832,7 +838,7 @@ class LvmTestLVcreateType(LvmPVVGLVTestCase):
|
||||
|
||||
with wait_for_sync("testVG", "testLV"):
|
||||
# try to create a raid1 LV
|
||||
- succ = BlockDev.lvm_lvcreate("testVG", "testLV", 512 * 1024**2, "raid1", [self.loop_dev, self.loop_dev2], None)
|
||||
+ succ = BlockDev.lvm_lvcreate("testVG", "testLV", 100 * 1024**2, "raid1", [self.loop_dev, self.loop_dev2], None)
|
||||
self.assertTrue(succ)
|
||||
|
||||
# verify that the LV has the requested segtype
|
||||
diff --git a/tests/lvm_test.py b/tests/lvm_test.py
|
||||
index 12b78ca..97f6c69 100644
|
||||
--- a/tests/lvm_test.py
|
||||
+++ b/tests/lvm_test.py
|
||||
@@ -302,14 +302,17 @@ class LvmNoDevTestCase(LVMTestCase):
|
||||
BlockDev.lvm_cache_get_mode_from_str("bla")
|
||||
|
||||
class LvmPVonlyTestCase(LVMTestCase):
|
||||
+
|
||||
+ _sparse_size = 1024**3
|
||||
+
|
||||
# :TODO:
|
||||
# * test pvmove (must create two PVs, a VG, a VG and some data in it
|
||||
# first)
|
||||
# * some complex test for pvs, vgs, lvs, pvinfo, vginfo and lvinfo
|
||||
def setUp(self):
|
||||
self.addCleanup(self._clean_up)
|
||||
- self.dev_file = create_sparse_tempfile("lvm_test", 1024**3)
|
||||
- self.dev_file2 = create_sparse_tempfile("lvm_test", 1024**3)
|
||||
+ self.dev_file = create_sparse_tempfile("lvm_test", self._sparse_size)
|
||||
+ self.dev_file2 = create_sparse_tempfile("lvm_test", self._sparse_size)
|
||||
try:
|
||||
self.loop_dev = create_lio_device(self.dev_file)
|
||||
except RuntimeError as e:
|
||||
@@ -731,6 +734,8 @@ class LvmTestLVcreateWithExtra(LvmPVVGLVTestCase):
|
||||
self.assertTrue(succ)
|
||||
|
||||
class LvmTestLVcreateType(LvmPVVGLVTestCase):
|
||||
+ _sparse_size = 200 * 1024**2
|
||||
+
|
||||
def test_lvcreate_type(self):
|
||||
"""Verify it's possible to create LVs with various types"""
|
||||
|
||||
@@ -744,7 +749,7 @@ class LvmTestLVcreateType(LvmPVVGLVTestCase):
|
||||
self.assertTrue(succ)
|
||||
|
||||
# try to create a striped LV
|
||||
- succ = BlockDev.lvm_lvcreate("testVG", "testLV", 512 * 1024**2, "striped", [self.loop_dev, self.loop_dev2], None)
|
||||
+ succ = BlockDev.lvm_lvcreate("testVG", "testLV", 100 * 1024**2, "striped", [self.loop_dev, self.loop_dev2], None)
|
||||
self.assertTrue(succ)
|
||||
|
||||
# verify that the LV has the requested segtype
|
||||
@@ -756,7 +761,7 @@ class LvmTestLVcreateType(LvmPVVGLVTestCase):
|
||||
|
||||
with wait_for_sync("testVG", "testLV"):
|
||||
# try to create a mirrored LV
|
||||
- succ = BlockDev.lvm_lvcreate("testVG", "testLV", 512 * 1024**2, "mirror", [self.loop_dev, self.loop_dev2], None)
|
||||
+ succ = BlockDev.lvm_lvcreate("testVG", "testLV", 100 * 1024**2, "mirror", [self.loop_dev, self.loop_dev2], None)
|
||||
self.assertTrue(succ)
|
||||
|
||||
# verify that the LV has the requested segtype
|
||||
@@ -768,7 +773,7 @@ class LvmTestLVcreateType(LvmPVVGLVTestCase):
|
||||
|
||||
with wait_for_sync("testVG", "testLV"):
|
||||
# try to create a raid1 LV
|
||||
- succ = BlockDev.lvm_lvcreate("testVG", "testLV", 512 * 1024**2, "raid1", [self.loop_dev, self.loop_dev2], None)
|
||||
+ succ = BlockDev.lvm_lvcreate("testVG", "testLV", 100 * 1024**2, "raid1", [self.loop_dev, self.loop_dev2], None)
|
||||
self.assertTrue(succ)
|
||||
|
||||
# verify that the LV has the requested segtype
|
||||
--
|
||||
2.31.1
|
||||
|
@ -125,7 +125,7 @@
|
||||
|
||||
Name: libblockdev
|
||||
Version: 2.25
|
||||
Release: 10%{?dist}
|
||||
Release: 11%{?dist}
|
||||
Summary: A library for low-level manipulation with block devices
|
||||
License: LGPLv2+
|
||||
URL: https://github.com/storaged-project/libblockdev
|
||||
@ -141,6 +141,7 @@ Patch7: 0007-lvm-devices-file-support.patch
|
||||
Patch8: 0008-lvm-Fix-reading-statistics-for-VDO-pools-with-VDO-8.patch
|
||||
Patch9: 0009-vdo_stats-Default-to-100-savings-for-invalid-savings.patch
|
||||
Patch10: 0010-Add-support-for-creating-and-activating-integrity-de.patch
|
||||
Patch11: 0011-tests-Wait-for-raid-and-mirrored-LVs-to-be-synced-be.patch
|
||||
|
||||
BuildRequires: make
|
||||
BuildRequires: glib2-devel
|
||||
@ -409,7 +410,7 @@ providing the LVM-related functionality.
|
||||
%package lvm-devel
|
||||
Summary: Development files for the libblockdev-lvm plugin/library
|
||||
Requires: %{name}-lvm%{?_isa} = %{version}-%{release}
|
||||
Requires: %{name}-utils-devel%{?_isa}
|
||||
Requires: %{name}-utils-devel%{?_isa} = %{version}-%{release}
|
||||
Requires: glib2-devel
|
||||
|
||||
%description lvm-devel
|
||||
@ -433,7 +434,7 @@ providing the LVM-related functionality utilizing the LVM DBus API.
|
||||
%package lvm-dbus-devel
|
||||
Summary: Development files for the libblockdev-lvm-dbus plugin/library
|
||||
Requires: %{name}-lvm-dbus%{?_isa} = %{version}-%{release}
|
||||
Requires: %{name}-utils-devel%{?_isa} >= 1.4
|
||||
Requires: %{name}-utils-devel%{?_isa} = %{version}-%{release}
|
||||
Requires: glib2-devel
|
||||
|
||||
%description lvm-dbus-devel
|
||||
@ -703,6 +704,7 @@ A meta-package that pulls all the libblockdev plugins as dependencies.
|
||||
%patch8 -p1
|
||||
%patch9 -p1
|
||||
%patch10 -p1
|
||||
%patch11 -p1
|
||||
|
||||
%build
|
||||
autoreconf -ivf
|
||||
@ -1006,6 +1008,12 @@ find %{buildroot} -type f -name "*.la" | xargs %{__rm}
|
||||
%files plugins-all
|
||||
|
||||
%changelog
|
||||
* Mon Jan 10 2022 Vojtech Trefny <vtrefny@redhat.com> - 2.25-11
|
||||
- tests: Wait for raid and mirrored LVs to be synced before removing
|
||||
Resolves: rhbz#2030647
|
||||
- spec: Require the same version of utils for lvm-devel and lvm-dbus-devel
|
||||
Resolves: rhbz#2028113
|
||||
|
||||
* Wed Dec 08 2021 Vojtech Trefny <vtrefny@redhat.com> - 2.25-10
|
||||
- Fix reading statistics for VDO pools with VDO 8
|
||||
Resolves: rhbz#1994220
|
||||
|
Loading…
Reference in New Issue
Block a user