Merged update from upstream sources

This is an automated DistroBaker update from upstream sources.
If you do not know what this is about or would like to opt out,
contact the OSCI team.

Source: https://src.fedoraproject.org/rpms/python-blivet.git#7e7a4c765538a3bf7bbc73b0eafcef01c58de93d
This commit is contained in:
DistroBaker 2020-10-27 21:54:18 +01:00 committed by Petr Šabata
parent 29a9406e1b
commit 5844e41f11
4 changed files with 23 additions and 156 deletions

2
.gitignore vendored
View File

@ -127,3 +127,5 @@
/blivet-3.2.2-tests.tar.gz
/blivet-3.3.0.tar.gz
/blivet-3.3.0-tests.tar.gz
/blivet-3.3.1.tar.gz
/blivet-3.3.1-tests.tar.gz

View File

@ -1,151 +0,0 @@
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

@ -19,18 +19,17 @@
Summary: A python module for system storage configuration
Name: python-blivet
Url: https://storageapis.wordpress.com/projects/blivet
Version: 3.3.0
Version: 3.3.1
#%%global prerelease .b2
# prerelease, if defined, should be something like .a1, .b1, .b2.dev1, or .c2
Release: 2%{?prerelease}%{?dist}
Release: 1%{?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-Avoid-using-unnecessary-udev-settle-calls.patch
# Versions of required components (done so we make sure the buildrequires
# match the requires versions of things).
@ -192,6 +191,23 @@ configuration.
%endif
%changelog
* Tue Oct 20 2020 Vojtech Trefny <vtrefny@redhat.com> - 3.3.1-1
- Make sure the product name is safe when using it for device name (vtrefny)
- Run packit RPM builds on Fedora ELN (vtrefny)
- Allow specifying 'mode' for the sdist command (vtrefny)
- Enable packit RPM builds on pull requests (vtrefny)
- Start the iscsi-init service (#1880673) (vponcova)
- Let parted fix fixable issues with partition table (vtrefny)
- edd: Fix UnboundLocalError when trying to close fd in collect_mbrs (vtrefny)
- Use UnusableConfigurationError for partially hidden multipath devices (vtrefny)
- Close fd if it fails to read the device (nashok)
- Do not run udev.settle in StorageDevice._pre_teardown (vtrefny)
- Try to not use udev.resolve_devspec when querying MountsCache (vtrefny)
- Remove Zanata config file (vtrefny)
- Ignore new pylint warning W0707 "raise-missing-from" (vtrefny)
- Use SSH "link" for l10n repository in Makefile (vtrefny)
- Fix source tarball cleanup in srpm and rpm Makefile targets (vtrefny)
* Wed Sep 16 2020 Vojtech Trefny <vtrefny@redhat.com> - 3.3.0-2
- Avoid using unnecessary udev.settle calls (#1876162)

View File

@ -1,2 +1,2 @@
SHA512 (blivet-3.3.0.tar.gz) = 2e628c88e3a5872bd9db0aebb9fbc9a2db88ff7dfaf044e8df12936254d3dc3a723994579cbff98e1c300cd266a3ac223289217b67f6e749621041137ba4a50e
SHA512 (blivet-3.3.0-tests.tar.gz) = d68c5b536f4c1f9bbaf0bc5d11e9eb2df05df0b68497fd22798aabdcc2709e7e0c572f4726510b317ee062c90bfaf3dbacb03c4830d3099df942bcc91771021a
SHA512 (blivet-3.3.1.tar.gz) = 5cfbaf363f8d4ae8501d7ec2bb102c2ceb063ec42627939f5acb164a08ec4767a91793f517be35293fcad65adf7be4605c827d3550457b21f6ab3da08c27babb
SHA512 (blivet-3.3.1-tests.tar.gz) = 423f7fc72ac15961d8cc53710b9d8882df1f0f0b42268c30d57bc76c4c6a4f68bcf97be026fccbbf4e85f6d5e2e89e71af99437b732adc90dba766203d053c21