Compare commits

...

4 Commits
rawhide ... f33

Author SHA1 Message Date
Vojtech Trefny ca540302ba Avoid using unnecessary udev.settle calls (#1876162) 2020-09-16 08:48:21 +02:00
Vojtech Trefny 7e0de0f6b6 Remove old unused patches 2020-08-21 07:55:03 +02:00
Vojtech Trefny 0303ff124a Fix disk names for gating tests
Disks we create for our gating tests are now 'vdb' and 'vdc'
instead of 'vda' and 'vdb'.
2020-08-21 07:54:45 +02:00
Vojtech Trefny 4ccccd7279 New version 3.3.0
- Account for pmspare grow when adjusting thinpool metadata size (vtrefny)
- Fix ignoring disk devices with parents or children (vtrefny)
- Terminology cleanup, part 3 (vtrefny)
- Terminology cleanups, part 2. (dlehman)
- Clean up some terminology. (dlehman)
- Add tests for udev.device_get_name for RAID devices (vtrefny)
- Fix name resolution for MD devices and partitions on them (vtrefny)
- Fix reading hidden sysfs attribute (vtrefny)
- Add support for specifying sector size for LUKS 2 devices (vtrefny)
- Do not ignore unknown/unsupported device mapper devices (vtrefny)
- Allow specifying custom hash function for LUKS 2 format (vtrefny)
- Ignore devices marked as hidden in sysfs (#1856974) (vtrefny)
- Add basic F2FS support (#1794950) (vtrefny)
- Make safe_device_name device type specific (vtrefny)
- Add exFAT to filesystems we recognize (vtrefny)
- Use xfs_db in read-only mode when getting XFS information (vtrefny)
- Add support for checking and fixing XFS using xfs_repair (vtrefny)
- Ignore zRAM devices in VMBackedTestCase (vtrefny)
- Add tests for XFS resize (vtrefny)
- Add support for XFS format grow (vtrefny)
- Typo fix (vtrefny)
- tests: Skip test_reset when running as non-root (vtrefny)
- tests: Patch LVM availability functions for some tests (vtrefny)
- tests: Patch LVM lvs call for some non-LVM tests (vtrefny)
- Do not propagate ped exception from add_partition (vtrefny)
- Do not use BlockDev.utils_have_kernel_module to check for modules (vtrefny)
- set allowed disk labels for s390x as standard ones (msdos + gpt) plus dasd (dan)
- Do not use FSAVAIL and FSUSE%% options when running lsblk (vtrefny)
- Rewrite README and add it as a long_description in setup.py (vtrefny)
- Round down to nearest MiB value when writing ks parittion info. (sbueno+anaconda)
- Add _teardown method to IntegrityDevice (vtrefny)
- Fix status for DM Integrity format (#1814005) (vtrefny)
- udev: Add function to get list of device's holders (vtrefny)
- Add basic support for LVM writecache devices (vtrefny)
- Add test for SwapSpace max size (vtrefny)
- Do not limit swap to 128 GiB (vtrefny)
- Fix possible UnicodeDecodeError when reading model from sysfs (vtrefny)
- Add install_requires and classifiers to setup.py (vtrefny)
- Import setuptools in setup.py to make bdist_wheel work (vtrefny)
- Set device.original_format to the new format in ActionCreateFormat (vtrefny)
- Fix resizable property for partitions (vtrefny)
- Update TODO. (dlehman)
- Ignore pycodestyle warning E741 (vtrefny)
- Skip test_mounting for filesystems that are not mountable (vtrefny)
- Sync specfile with downstream (japokorn)
- Make extended partitions resizable (vtrefny)
- Fix LV min size for resize in test_action_dependencies (vtrefny)
- Fix checking for filesystem support in action_test (vtrefny)
- Add basic support for LVM VDO devices (vtrefny)
- Update POT file in the Weblate repo during "make potfile" (vtrefny)
- Skip translation canary check if POT file is not available (vtrefny)
- Add blivet-weblate repository as a submodule (vtrefny)
- Remove Zanata from our build process (vtrefny)
- Remove po folder (vtrefny)
- More consistent lvm errors (API break) (japokorn)
- Added support for device tags (japokorn)
2020-08-20 14:12:39 +02:00
10 changed files with 222 additions and 176 deletions

2
.gitignore vendored
View File

@ -125,3 +125,5 @@
/blivet-3.2.1.tar.gz
/blivet-3.2.2.tar.gz
/blivet-3.2.2-tests.tar.gz
/blivet-3.3.0.tar.gz
/blivet-3.3.0-tests.tar.gz

View File

@ -0,0 +1,151 @@
From dae3375e720fe67870fe92e0aecd9638726c4d43 Mon Sep 17 00:00:00 2001
From: Vojtech Trefny <vtrefny@redhat.com>
Date: Wed, 9 Sep 2020 15:26:39 +0200
Subject: [PATCH 1/2] Try to not use udev.resolve_devspec when querying
MountsCache
udev.resolve_devspec is slow and uses udev.settle, we should avoid
using it if possible when getting system mountpoints.
---
blivet/mounts.py | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/blivet/mounts.py b/blivet/mounts.py
index 7ce41d77..ef2def89 100644
--- a/blivet/mounts.py
+++ b/blivet/mounts.py
@@ -27,6 +27,8 @@
import logging
log = logging.getLogger("blivet")
+import os
+
class _MountinfoCache(object):
@@ -113,6 +115,12 @@ def get_mountpoints(self, devspec, subvolspec=None):
# devspec == None means "get 'nodev' mount points"
if devspec not in (None, "tmpfs"):
+ if devspec.startswith("/dev"):
+ # try to avoid using resolve_devspec if possible
+ name = os.path.realpath(devspec).split("/")[-1]
+ if (name, subvolspec) in self.mountpoints.keys():
+ return self.mountpoints[(name, subvolspec)]
+
# use the canonical device path (if available)
canon_devspec = resolve_devspec(devspec, sysname=True)
if canon_devspec is not None:
From ae32d008e7425610d437c72bb284664ace7ce5b7 Mon Sep 17 00:00:00 2001
From: Vojtech Trefny <vtrefny@redhat.com>
Date: Wed, 9 Sep 2020 15:27:57 +0200
Subject: [PATCH 2/2] Do not run udev.settle in StorageDevice._pre_teardown
We currently run udev.settle for every _pre_teardown call even if
there is no change or format teardown. This commit moves the
udev.settle call to format classes so it is called only when
format.teardown calls in _pre_teardown change the format.
---
blivet/devices/storage.py | 1 -
blivet/formats/fs.py | 2 ++
blivet/formats/luks.py | 5 +++++
blivet/formats/swap.py | 3 +++
tests/devices_test/device_methods_test.py | 2 --
5 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/blivet/devices/storage.py b/blivet/devices/storage.py
index d47affca..bde0b7d6 100644
--- a/blivet/devices/storage.py
+++ b/blivet/devices/storage.py
@@ -425,7 +425,6 @@ def _pre_teardown(self, recursive=None):
self.original_format.teardown()
if self.format.exists:
self.format.teardown()
- udev.settle()
return True
def _teardown(self, recursive=None):
diff --git a/blivet/formats/fs.py b/blivet/formats/fs.py
index 9c14649e..d351dee1 100644
--- a/blivet/formats/fs.py
+++ b/blivet/formats/fs.py
@@ -614,6 +614,8 @@ def _teardown(self, **kwargs):
if mountpoint == self._chrooted_mountpoint:
self._chrooted_mountpoint = None
+ udev.settle()
+
def read_label(self):
"""Read this filesystem's label.
diff --git a/blivet/formats/luks.py b/blivet/formats/luks.py
index de9f1d32..0d036588 100644
--- a/blivet/formats/luks.py
+++ b/blivet/formats/luks.py
@@ -36,6 +36,7 @@
from ..tasks import availability, lukstasks
from ..size import Size, KiB
from ..static_data import luks_data
+from .. import udev
import logging
log = logging.getLogger("blivet")
@@ -275,6 +276,8 @@ def _teardown(self, **kwargs):
log.debug("unmapping %s", self.map_name)
blockdev.crypto.luks_close(self.map_name)
+ udev.settle()
+
def _pre_resize(self):
if self.luks_version == "luks2" and not self.has_key:
raise LUKSError("Passphrase or key needs to be set before resizing LUKS2 format.")
@@ -442,5 +445,7 @@ def _teardown(self, **kwargs):
# for all devices supported by cryptsetup
blockdev.crypto.luks_close(self.map_name)
+ udev.settle()
+
register_device_format(Integrity)
diff --git a/blivet/formats/swap.py b/blivet/formats/swap.py
index 3cc59138..2e4b07df 100644
--- a/blivet/formats/swap.py
+++ b/blivet/formats/swap.py
@@ -29,6 +29,7 @@
from ..tasks import fsuuid
from . import DeviceFormat, register_device_format
from ..size import Size
+from .. import udev
import gi
gi.require_version("BlockDev", "2.0")
@@ -206,6 +207,8 @@ def _teardown(self, **kwargs):
type=self.type, status=self.status)
blockdev.swap.swapoff(self.device)
+ udev.settle()
+
def _create(self, **kwargs):
log_method_call(self, device=self.device,
type=self.type, status=self.status)
diff --git a/tests/devices_test/device_methods_test.py b/tests/devices_test/device_methods_test.py
index e6718121..f00509be 100644
--- a/tests/devices_test/device_methods_test.py
+++ b/tests/devices_test/device_methods_test.py
@@ -161,7 +161,6 @@ def _destroy():
self.assertFalse(self.device.exists)
self.assertEqual(self.device.update_sysfs_path.called, self.destroy_updates_sysfs_path)
- self.assertEqual(self.patches["udev"].settle.called, self.destroy_calls_udev_settle)
self.patches["udev"].reset_mock()
self.device.update_sysfs_path.reset_mock()
@@ -228,7 +227,6 @@ def test_teardown(self):
self.device.teardown()
self.assertTrue(self.teardown_method_mock.called)
- self.assertEqual(self.patches["udev"].settle.called, self.teardown_calls_udev_settle)
self.assertEqual(self.device.update_sysfs_path.called, self.teardown_updates_sysfs_path)
self.patches["udev"].reset_mock()
self.device.update_sysfs_path.reset_mock()

View File

@ -1,22 +0,0 @@
From 97cdeb7ba3db01bcd510b35a44b21549703fe545 Mon Sep 17 00:00:00 2001
From: David Lehman <dlehman@redhat.com>
Date: Tue, 30 Apr 2019 12:49:39 -0400
Subject: [PATCH] Fix name resolution for md member partitions. (#1798792)
---
blivet/udev.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/blivet/udev.py b/blivet/udev.py
index 5063e733..7ebdbcb9 100644
--- a/blivet/udev.py
+++ b/blivet/udev.py
@@ -202,7 +202,7 @@ def device_get_name(udev_info):
""" Return the best name for a device based on the udev db data. """
if "DM_NAME" in udev_info:
name = udev_info["DM_NAME"]
- elif "MD_DEVNAME" in udev_info:
+ elif "MD_DEVNAME" in udev_info and os.path.exists(device_get_sysfs_path(udev_info) + "/md"):
mdname = udev_info["MD_DEVNAME"]
if device_is_partition(udev_info):
# for partitions on named RAID we want to use the raid name, not

View File

@ -1,41 +0,0 @@
From 394ff40554ab8b3ce9ff0aa5af0c8c2ead6522a3 Mon Sep 17 00:00:00 2001
From: Adam Williamson <awilliam@redhat.com>
Date: Mon, 20 Apr 2020 11:01:10 -0700
Subject: [PATCH] Invalidate LVM caches in blivet device discovery loop
(#1824418)
This should work around a problem where we sometimes fail to
correctly evaluate existing logical volumes, though it is not a
correct fix for the underlying problem (which we haven't exactly
identified yet) but a workaround for Fedora 32 release.
Signed-off-by: Adam Williamson <awilliam@redhat.com>
---
blivet/populator/populator.py | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/blivet/populator/populator.py b/blivet/populator/populator.py
index 465c272d..3e1d16f3 100644
--- a/blivet/populator/populator.py
+++ b/blivet/populator/populator.py
@@ -24,6 +24,7 @@ import os
import pprint
import copy
import parted
+import time
from six import add_metaclass
import gi
@@ -454,6 +455,9 @@ class PopulatorMixin(object):
callbacks.populate_started(n_devices=n_devices)
report = False
+ time.sleep(2)
+ self.drop_lvm_cache()
+ mpath_members.drop_cache()
log.info("devices to scan: %s", [udev.device_get_name(d) for d in devices])
for dev in devices:
self.handle_device(dev)
--
2.26.1

View File

@ -1,33 +0,0 @@
From fcc941289541a6667445b4c2104b697933b867e8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Dan=20Hor=C3=A1k?= <dan@danny.cz>
Date: Fri, 7 Jun 2019 09:31:01 +0200
Subject: [PATCH] initial PowerNV class support
---
blivet/arch.py | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/blivet/arch.py b/blivet/arch.py
index 55ce8108..2cd978e9 100644
--- a/blivet/arch.py
+++ b/blivet/arch.py
@@ -72,7 +72,7 @@ def get_ppc_machine():
'Cell': 'pSeries',
'Momentum': 'pSeries',
'PS3': 'PS3',
- 'PowerNV': 'pSeries'
+ 'PowerNV': 'PowerNV'
}
machine = None
platform = None
@@ -330,6 +330,10 @@ def is_ipseries():
return is_ppc() and get_ppc_machine() in ("iSeries", "pSeries")
+def is_powernv():
+ return is_ppc() and get_ppc_machine() == "PowerNV"
+
+
def get_arch():
"""
:return: The hardware architecture

View File

@ -1,39 +0,0 @@
From 462099a9137fb7997140360c07665a21615a0fea Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Dan=20Hor=C3=A1k?= <dan@danny.cz>
Date: Tue, 7 Jul 2020 13:19:02 +0200
Subject: [PATCH] set allowed disk labels for s390x as standard ones (msdos +
gpt) plus dasd
This will solve issues when a SCSI or NVMe disk with GPT partition table
is used with a s390x machine (rhbz#1827066, rhbz#1854110).
---
blivet/formats/disklabel.py | 2 +-
tests/formats_test/disklabel_test.py | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/blivet/formats/disklabel.py b/blivet/formats/disklabel.py
index 3dcac12b..53e2c010 100644
--- a/blivet/formats/disklabel.py
+++ b/blivet/formats/disklabel.py
@@ -230,7 +230,7 @@ def get_platform_label_types(cls):
elif arch.is_efi() and not arch.is_aarch64():
label_types = ["gpt", "msdos"]
elif arch.is_s390():
- label_types = ["msdos", "dasd"]
+ label_types += ["dasd"]
return label_types
diff --git a/tests/formats_test/disklabel_test.py b/tests/formats_test/disklabel_test.py
index 94f3775f..3068dc07 100644
--- a/tests/formats_test/disklabel_test.py
+++ b/tests/formats_test/disklabel_test.py
@@ -95,7 +95,7 @@ def test_platform_label_types(self, arch):
arch.is_arm.return_value = False
arch.is_s390.return_value = True
- self.assertEqual(disklabel_class.get_platform_label_types(), ["msdos", "dasd"])
+ self.assertEqual(disklabel_class.get_platform_label_types(), ["msdos", "gpt", "dasd"])
arch.is_s390.return_value = False
def test_label_type_size_check(self):

View File

@ -1,33 +0,0 @@
From 8b76e2d72cca787747a2c639edbdfa0af28f9878 Mon Sep 17 00:00:00 2001
From: Vojtech Trefny <vtrefny@redhat.com>
Date: Fri, 23 Aug 2019 09:47:32 +0200
Subject: [PATCH] Do not try to normalize size for zero size device factories
Factories with zero size are special cases for adjusting container
size after removing a device for it. We don't want to change size
of the factory in this case.
The recent change of filesystem minimal size to 2 MiB resulted
in changing of size of these factories from 0 to 2 MiB which
caused the "adjusting factory" to create a new LV after removing
one from the container.
Resolves: rhbz#1743753
---
blivet/devicefactory.py | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/blivet/devicefactory.py b/blivet/devicefactory.py
index e910c5bd..0eb548c7 100644
--- a/blivet/devicefactory.py
+++ b/blivet/devicefactory.py
@@ -462,6 +462,10 @@ def _get_free_disk_space(self):
def _normalize_size(self):
if self.size is None:
self._handle_no_size()
+ elif self.size == Size(0):
+ # zero size means we're adjusting the container after removing
+ # a device from it so we don't want to change the size here
+ return
size = self.size
fmt = get_format(self.fstype)

View File

@ -19,18 +19,18 @@
Summary: A python module for system storage configuration
Name: python-blivet
Url: https://storageapis.wordpress.com/projects/blivet
Version: 3.2.2
Version: 3.3.0
#%%global prerelease .b2
# prerelease, if defined, should be something like .a1, .b1, .b2.dev1, or .c2
Release: 4%{?prerelease}%{?dist}
Release: 2%{?prerelease}%{?dist}
Epoch: 1
License: LGPLv2+
%global realname blivet
%global realversion %{version}%{?prerelease}
Source0: http://github.com/storaged-project/blivet/archive/%{realname}-%{realversion}.tar.gz
Source1: http://github.com/storaged-project/blivet/archive/%{realname}-%{realversion}-tests.tar.gz
Patch0: 0001-set-allowed-disk-labels-for-s390x.patch
Patch0: 0001-Avoid-using-unnecessary-udev-settle-calls.patch
# Versions of required components (done so we make sure the buildrequires
# match the requires versions of things).
@ -180,18 +180,79 @@ configuration.
%if %{with python2}
%files -n python2-%{realname}
%license COPYING
%doc README ChangeLog examples
%doc README.md ChangeLog examples
%{python2_sitelib}/*
%endif
%if %{with python3}
%files -n python3-%{realname}
%license COPYING
%doc README ChangeLog examples
%doc README.md ChangeLog examples
%{python3_sitelib}/*
%endif
%changelog
* Wed Sep 16 2020 Vojtech Trefny <vtrefny@redhat.com> - 3.3.0-2
- Avoid using unnecessary udev.settle calls (#1876162)
* Thu Aug 20 2020 Vojtech Trefny <vtrefny@redhat.com> - 3.3.0-1
- Account for pmspare grow when adjusting thinpool metadata size (vtrefny)
- Fix ignoring disk devices with parents or children (vtrefny)
- Terminology cleanup, part 3 (vtrefny)
- Terminology cleanups, part 2. (dlehman)
- Clean up some terminology. (dlehman)
- Add tests for udev.device_get_name for RAID devices (vtrefny)
- Fix name resolution for MD devices and partitions on them (vtrefny)
- Fix reading hidden sysfs attribute (vtrefny)
- Add support for specifying sector size for LUKS 2 devices (vtrefny)
- Do not ignore unknown/unsupported device mapper devices (vtrefny)
- Allow specifying custom hash function for LUKS 2 format (vtrefny)
- Ignore devices marked as hidden in sysfs (#1856974) (vtrefny)
- Add basic F2FS support (#1794950) (vtrefny)
- Make safe_device_name device type specific (vtrefny)
- Add exFAT to filesystems we recognize (vtrefny)
- Use xfs_db in read-only mode when getting XFS information (vtrefny)
- Add support for checking and fixing XFS using xfs_repair (vtrefny)
- Ignore zRAM devices in VMBackedTestCase (vtrefny)
- Add tests for XFS resize (vtrefny)
- Add support for XFS format grow (vtrefny)
- Typo fix (vtrefny)
- tests: Skip test_reset when running as non-root (vtrefny)
- tests: Patch LVM availability functions for some tests (vtrefny)
- tests: Patch LVM lvs call for some non-LVM tests (vtrefny)
- Do not propagate ped exception from add_partition (vtrefny)
- Do not use BlockDev.utils_have_kernel_module to check for modules (vtrefny)
- set allowed disk labels for s390x as standard ones (msdos + gpt) plus dasd (dan)
- Do not use FSAVAIL and FSUSE%% options when running lsblk (vtrefny)
- Rewrite README and add it as a long_description in setup.py (vtrefny)
- Round down to nearest MiB value when writing ks parittion info. (sbueno+anaconda)
- Add _teardown method to IntegrityDevice (vtrefny)
- Fix status for DM Integrity format (#1814005) (vtrefny)
- udev: Add function to get list of device's holders (vtrefny)
- Add basic support for LVM writecache devices (vtrefny)
- Add test for SwapSpace max size (vtrefny)
- Do not limit swap to 128 GiB (vtrefny)
- Fix possible UnicodeDecodeError when reading model from sysfs (vtrefny)
- Add install_requires and classifiers to setup.py (vtrefny)
- Import setuptools in setup.py to make bdist_wheel work (vtrefny)
- Set device.original_format to the new format in ActionCreateFormat (vtrefny)
- Fix resizable property for partitions (vtrefny)
- Update TODO. (dlehman)
- Ignore pycodestyle warning E741 (vtrefny)
- Skip test_mounting for filesystems that are not mountable (vtrefny)
- Sync specfile with downstream (japokorn)
- Make extended partitions resizable (vtrefny)
- Fix LV min size for resize in test_action_dependencies (vtrefny)
- Fix checking for filesystem support in action_test (vtrefny)
- Add basic support for LVM VDO devices (vtrefny)
- Update POT file in the Weblate repo during "make potfile" (vtrefny)
- Skip translation canary check if POT file is not available (vtrefny)
- Add blivet-weblate repository as a submodule (vtrefny)
- Remove Zanata from our build process (vtrefny)
- Remove po folder (vtrefny)
- More consistent lvm errors (API break) (japokorn)
- Added support for device tags (japokorn)
* Wed Jul 29 2020 Vojtech Trefny <vtrefny@redhat.com> - 3.2.2-4
- set allowed disk labels for s390x as standard ones (msdos + gpt) plus dasd

View File

@ -1,2 +1,2 @@
SHA512 (blivet-3.2.2.tar.gz) = 6eebec62dae55c888156ce4de3285cc23a7fd6f41e8c2e7a951c172d35aa4e7a1450586f21173186db4eaa7876e42da9608e304f11496fd21b6ba64e15118a3e
SHA512 (blivet-3.2.2-tests.tar.gz) = 1c8e43139e17eff5e944718ffb3b5235492352e2f5c421b56dfdcce29f29c1aeef0fbfc13d54962198617de308c60e7e894d0954b66ffef8da3e5f8a969ac6c7
SHA512 (blivet-3.3.0.tar.gz) = 2e628c88e3a5872bd9db0aebb9fbc9a2db88ff7dfaf044e8df12936254d3dc3a723994579cbff98e1c300cd266a3ac223289217b67f6e749621041137ba4a50e
SHA512 (blivet-3.3.0-tests.tar.gz) = d68c5b536f4c1f9bbaf0bc5d11e9eb2df05df0b68497fd22798aabdcc2709e7e0c572f4726510b317ee062c90bfaf3dbacb03c4830d3099df942bcc91771021a

View File

@ -10,7 +10,7 @@
run: python3 /usr/share/doc/python3-blivet/examples/list_devices.py
- lvm-factory:
dir: .
run: python3 ./lvm_factory.py --disks=vda,vdb
run: python3 ./lvm_factory.py --disks=vdb,vdc
- list-devices-2:
dir: .
run: python3 /usr/share/doc/python3-blivet/examples/list_devices.py