RHEL 9.0.0 Alpha bootstrap

The content of this branch was automatically imported from Fedora ELN
with the following as its source:
https://src.fedoraproject.org/rpms/python-blivet#eaa02fcd8d2f8cfe6784072049eee49855230f1a
This commit is contained in:
Troy Dawson 2020-10-14 16:55:18 -07:00
parent 50f394b1bc
commit 29a9406e1b
8 changed files with 3645 additions and 0 deletions

129
.gitignore vendored
View File

@ -0,0 +1,129 @@
/blivet-0.4.tar.gz
/blivet-0.5.tar.gz
/blivet-0.6.tar.gz
/blivet-0.7.tar.gz
/blivet-0.8.tar.gz
/blivet-0.9.tar.gz
/blivet-0.10.tar.gz
/blivet-0.11.tar.gz
/blivet-0.12.tar.gz
/blivet-0.13.tar.gz
/blivet-0.14.tar.gz
/blivet-0.15.tar.gz
/blivet-0.16.tar.gz
/blivet-0.17.tar.gz
/blivet-0.18.tar.gz
/blivet-0.19.tar.gz
/blivet-0.20.tar.gz
/blivet-0.21.tar.gz
/blivet-0.22.tar.gz
/blivet-0.23.tar.gz
/blivet-0.24.tar.gz
/blivet-0.25.tar.gz
/blivet-0.26.tar.gz
/blivet-0.27.tar.gz
/blivet-0.28.tar.gz
/blivet-0.29.tar.gz
/blivet-0.30.tar.gz
/blivet-0.31.tar.gz
/blivet-0.32.tar.gz
/blivet-0.33.tar.gz
/blivet-0.34.tar.gz
/blivet-0.35.tar.gz
/blivet-0.36.tar.gz
/blivet-0.37.tar.gz
/blivet-0.38.tar.gz
/blivet-0.39.tar.gz
/blivet-0.40.tar.gz
/blivet-0.41.tar.gz
/blivet-0.42.tar.gz
/blivet-0.43.tar.gz
/blivet-0.44.tar.gz
/blivet-0.45.tar.gz
/blivet-0.46.tar.gz
/blivet-0.47.tar.gz
/blivet-0.48.tar.gz
/blivet-0.49.tar.gz
/blivet-0.50.tar.gz
/blivet-0.51.tar.gz
/blivet-0.52.tar.gz
/blivet-0.53.tar.gz
/blivet-0.54.tar.gz
/blivet-0.55.tar.gz
/blivet-0.56.tar.gz
/blivet-0.57.tar.gz
/blivet-0.58.tar.gz
/blivet-0.59.tar.gz
/blivet-0.60.tar.gz
/blivet-0.61.tar.gz
/blivet-0.62.tar.gz
/blivet-0.63.tar.gz
/blivet-0.64.tar.gz
/blivet-0.65.tar.gz
/blivet-0.66.tar.gz
/blivet-0.67.tar.gz
/blivet-0.68.tar.gz
/blivet-0.69.tar.gz
/blivet-0.70.tar.gz
/blivet-0.71.tar.gz
/blivet-0.72.tar.gz
/blivet-0.73.tar.gz
/blivet-0.74.tar.gz
/blivet-0.75.tar.gz
/blivet-0.76.tar.gz
/blivet-1.0.tar.gz
/blivet-1.1.tar.gz
/blivet-1.2.tar.gz
/blivet-1.3.tar.gz
/blivet-1.4.tar.gz
/blivet-1.5.tar.gz
/blivet-1.6.tar.gz
/blivet-1.7.tar.gz
/blivet-1.8.tar.gz
/blivet-1.9.tar.gz
/blivet-1.10.tar.gz
/blivet-1.11.tar.gz
/blivet-1.12.tar.gz
/blivet-1.13.tar.gz
/blivet-1.14.tar.gz
/blivet-1.15.tar.gz
/blivet-1.16.tar.gz
/blivet-1.17.tar.gz
/blivet-1.18.tar.gz
/blivet-1.19.tar.gz
/blivet-2.0.1.tar.gz
/blivet-2.0.2.tar.gz
/blivet-2.0.3.tar.gz
/blivet-2.1.0.tar.gz
/blivet-2.1.1.tar.gz
/blivet-2.1.2.tar.gz
/blivet-2.1.3.tar.gz
/blivet-2.1.4.tar.gz
/blivet-2.1.5.tar.gz
/blivet-2.1.6.tar.gz
/blivet-2.1.7.tar.gz
/blivet-2.1.8.tar.gz
/blivet-2.1.9.tar.gz
/blivet-2.1.10.tar.gz
/blivet-2.1.11.tar.gz
/blivet-3.0.0.b1.tar.gz
/blivet-3.1.0.b1.tar.gz
/blivet-3.1.0.b2.tar.gz
/blivet-3.1.0.tar.gz
/blivet-3.1.1.tar.gz
/blivet-3.1.2.tar.gz
/blivet-3.1.3.tar.gz
/blivet-3.1.4-tests.tar.gz
/blivet-3.1.4.tar.gz
/blivet-3.1.5-tests.tar.gz
/blivet-3.1.5.tar.gz
/blivet-3.1.6.tar.gz
/blivet-3.1.6-tests.tar.gz
/blivet-3.2.0-tests.tar.gz
/blivet-3.2.0.tar.gz
/blivet-3.2.1-tests.tar.gz
/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()

3296
python-blivet.spec Normal file

File diff suppressed because it is too large Load Diff

2
sources Normal file
View File

@ -0,0 +1,2 @@
SHA512 (blivet-3.3.0.tar.gz) = 2e628c88e3a5872bd9db0aebb9fbc9a2db88ff7dfaf044e8df12936254d3dc3a723994579cbff98e1c300cd266a3ac223289217b67f6e749621041137ba4a50e
SHA512 (blivet-3.3.0-tests.tar.gz) = d68c5b536f4c1f9bbaf0bc5d11e9eb2df05df0b68497fd22798aabdcc2709e7e0c572f4726510b317ee062c90bfaf3dbacb03c4830d3099df942bcc91771021a

1
tests/.fmf/version Normal file
View File

@ -0,0 +1 @@
1

42
tests/lvm_factory.py Normal file
View File

@ -0,0 +1,42 @@
#!/usr/bin/python3
import argparse
import sys
import blivet
POOL_NAME = "blivet_test"
parser = argparse.ArgumentParser()
parser.add_argument('-d', '--disks', default='')
args = parser.parse_args()
b = blivet.Blivet()
b.reset()
disks = list()
for disk_id in args.disks.split(','):
disk = b.devicetree.resolve_device(disk_id)
if not disk.is_disk:
sys.stderr.write("specified disk '%s' is not a disk\n" % disk_id)
sys.exit(1)
disks.append(disk)
b.initialize_disk(disk)
if len(disks) > 1:
container_raid_level = "raid1"
total_size = min(d.size for d in disks)
else:
container_raid_level = None
total_size = sum(d.size for d in disks)
lv1 = b.factory_device(size=total_size*0.8, disks=disks,
name="lv1", container_name=POOL_NAME,
fstype='xfs', device_type=blivet.devicefactory.DEVICE_TYPE_LVM)
lv2 = b.factory_device(disks=disks, name="lv2",
container_name=POOL_NAME, container_raid_level='raid1',
fstype='ext4', device_type=blivet.devicefactory.DEVICE_TYPE_LVM)
b.do_it()

8
tests/provision.fmf Normal file
View File

@ -0,0 +1,8 @@
---
standard-inventory-qcow2:
qemu:
m: 1G
drive:
- size: 10737418240
- size: 10737418240

16
tests/tests.yml Normal file
View File

@ -0,0 +1,16 @@
---
- hosts: all
roles:
- role: standard-test-basic
tags:
- classic
tests:
- list-devices-1:
dir: .
run: python3 /usr/share/doc/python3-blivet/examples/list_devices.py
- lvm-factory:
dir: .
run: python3 ./lvm_factory.py --disks=vdb,vdc
- list-devices-2:
dir: .
run: python3 /usr/share/doc/python3-blivet/examples/list_devices.py