Compare commits

...

5 Commits
rawhide ... f31

Author SHA1 Message Date
Vojtech Trefny d3096aaa6a Add support for relabeling of the swap format (#1818508) 2020-03-30 12:59:15 +02:00
Vojtech Trefny d9a621d013 New version 3.1.7
- Use SHA256 instead of MD5 for /proc/mounts hash calculation (vtrefny)
- Fix udev test names so they actually get run. (dlehman)
- Add recognition of Dell FW RAID to udev.device_is_disk. (dlehman)
- Fix Blivet DBus service version in service and config files (vtrefny)
- Make sure _chrooted_mountpoint attribute is defined before using it (vtrefny)
- Allow running 'write_label' in dry run mode on non-existing devices (vtrefny)
- Make 'makeupdates' and 'makebumpver' scripts Python 3 compatible (vtrefny)
- Do not hardcode coverage executable name (vtrefny)
- Make sure LVs are writable before wiping. (dlehman)
- Override LVM skip-activation to allow for thorough removal. (dlehman)
- Add setters for requested_size/percent form LVMVolumeGroupDevice (vtrefny)
- Set min size for XFS to 16 MiB (vtrefny)
- Revert "Ignore invalid-overridden-method warning for abstract properties"
- Fix invalid-overridden-method in events_test (vtrefny)
2020-01-29 21:30:23 +01:00
Vojtech Trefny 1fa61867ff New version 3.1.6
- Do not allow creating VGs with PVs with different sector size (vtrefny)
- Add a new "sector_size" property to storage devices. (vtrefny)
- Ignore invalid-overridden-method warning for abstract properties (vtrefny)
- Change NFSMount._availability_errors to a property (vtrefny)
- Fix util.detect_virt function (vtrefny)
- Do not try to normalize size for zero size device factories (vtrefny)
- Always set default key size to 512 bits for ciphers with XTS mode (vtrefny)
2019-10-25 08:47:06 +02:00
Vojtech Trefny 702613215f Do not try to normalize size for zero size device factories
Resolves: rhbz#1743753
2019-08-27 12:46:13 +02:00
Vojtech Trefny 27e981cd2a New version 3.1.5
- Move dependencies code from StorageDevice to Device (vtrefny)
- Always use luks_data.min_entropy as a default minimum entropy (vponcova)
- Add 'protected' property setter to LVMVolumeGroupDevice (#1729363) (vtrefny)
- fix of LV max size calculation (japokorn)
- Added min size for partitions (japokorn)
- Improved non-unique UUID handling (japokorn)
- Check if disklabel supports partition names (#1723228) (vtrefny)
- format_device: Revert destroy action if create fails (#1727589) (vtrefny)
- Do not allow resizing of LUKS devices with integrity (vtrefny)
- Return underlying block device as 'slave' for LUKS with integrity (vtrefny)
- Fix removing LUKS devices with integrity (vtrefny)
- Check status before activating dmraid set in populate. (#1723979) (dlehman)
- Use DBus call to see if we're in a vm. (dlehman)
- Use dasd disklabel for vm disks backed by dasds. (dlehman)
- Add a function to detect if running in a vm. (dlehman)
- Remove teardown_all from the populate method (vponcova)
- Correctly handle non-unicode iSCSI initiator names (vtrefny)
- Add, test and use a new method to get size with reserve (vpodzime)
- Beware non-positive sizes in thpool metadata size calculations (vpodzime)
- Log sizes in MiB in thpool auto metadata size calculations (vpodzime)
- Recalculate thpool's metadata size on resize in LVMThinPFactory (vpodzime)
- Move the thpool reserve calculations to LVMFactory (vpodzime)
2019-08-15 08:51:37 +02:00
5 changed files with 218 additions and 5 deletions

6
.gitignore vendored
View File

@ -115,3 +115,9 @@
/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.1.7-tests.tar.gz
/blivet-3.1.7.tar.gz

View File

@ -0,0 +1,118 @@
From a45b33839a88572a9776deec61234917fb66fb4f Mon Sep 17 00:00:00 2001
From: Vojtech Trefny <vtrefny@redhat.com>
Date: Tue, 31 Dec 2019 15:37:32 +0100
Subject: [PATCH 1/2] Define the 'relabels' method for all formats
---
blivet/formats/__init__.py | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/blivet/formats/__init__.py b/blivet/formats/__init__.py
index 84657e01..0dbbae93 100644
--- a/blivet/formats/__init__.py
+++ b/blivet/formats/__init__.py
@@ -250,6 +250,10 @@ def labeling(self):
"""Returns False by default since most formats are non-labeling."""
return False
+ def relabels(self):
+ """Returns False by default since most formats are non-labeling."""
+ return False
+
def label_format_ok(self, label):
"""Checks whether the format of the label is OK for whatever
application is used by blivet to write a label for this format.
From 2e5e1b5f07be00a0b594742007bcadc2abdf2912 Mon Sep 17 00:00:00 2001
From: Vojtech Trefny <vtrefny@redhat.com>
Date: Tue, 31 Dec 2019 16:32:07 +0100
Subject: [PATCH 2/2] Add support for relabeling of the swap format
---
blivet/formats/swap.py | 39 ++++++++++++++++++++++++++++-
tests/formats_test/labeling_test.py | 6 +++++
2 files changed, 44 insertions(+), 1 deletion(-)
diff --git a/blivet/formats/swap.py b/blivet/formats/swap.py
index 36b50cb6..4b8a7edf 100644
--- a/blivet/formats/swap.py
+++ b/blivet/formats/swap.py
@@ -20,8 +20,10 @@
# Red Hat Author(s): Dave Lehman <dlehman@redhat.com>
#
+import os
+
from parted import PARTITION_SWAP, fileSystemType
-from ..errors import FSWriteUUIDError
+from ..errors import FSWriteUUIDError, SwapSpaceError
from ..storage_log import log_method_call
from ..tasks import availability
from ..tasks import fsuuid
@@ -53,6 +55,8 @@ class SwapSpace(DeviceFormat):
# see rhbz#744129 for details
_max_size = Size("128 GiB")
+ config_actions_map = {"label": "write_label"}
+
def __init__(self, **kwargs):
"""
:keyword device: path to the block device node
@@ -105,10 +109,43 @@ def labeling(self):
"""Returns True as mkswap can write a label to the swap space."""
return True
+ def relabels(self):
+ """Returns True as mkswap can write a label to the swap space."""
+ return True and self._plugin.available
+
def label_format_ok(self, label):
"""Returns True since no known restrictions on the label."""
return True
+ def write_label(self, dry_run=False):
+ """ Create a label for this format.
+
+ :raises: SwapSpaceError
+
+ If self.label is None, this means accept the default, so raise
+ an SwapSpaceError in this case.
+
+ Raises a SwapSpaceError if the label can not be set.
+ """
+
+ if not self._plugin.available:
+ raise SwapSpaceError("application to set label on swap format is not available")
+
+ if not dry_run:
+ if not self.exists:
+ raise SwapSpaceError("swap has not been created")
+
+ if not os.path.exists(self.device):
+ raise SwapSpaceError("device does not exist")
+
+ if self.label is None:
+ raise SwapSpaceError("makes no sense to write a label when accepting default label")
+
+ if not self.label_format_ok(self.label):
+ raise SwapSpaceError("bad label format")
+
+ blockdev.swap.mkswap(self.device, self.label)
+
label = property(lambda s: s._get_label(), lambda s, l: s._set_label(l),
doc="the label for this swap space")
diff --git a/tests/formats_test/labeling_test.py b/tests/formats_test/labeling_test.py
index e2569201..e26cb7df 100644
--- a/tests/formats_test/labeling_test.py
+++ b/tests/formats_test/labeling_test.py
@@ -113,3 +113,9 @@ def test_creating_swap_space_none(self):
def test_creating_swap_space_empty(self):
swp = swap.SwapSpace(device=self.loop_devices[0], label="")
self.assertIsNone(swp.create())
+
+ def test_relabel(self):
+ swp = swap.SwapSpace(device=self.loop_devices[0])
+ self.assertIsNone(swp.create())
+ swp.label = "label"
+ swp.write_label()

View File

@ -0,0 +1,33 @@
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,11 +19,11 @@
Summary: A python module for system storage configuration
Name: python-blivet
Url: https://storageapis.wordpress.com/projects/blivet
Version: 3.1.4
Version: 3.1.7
#%%global prerelease .b2
# prerelease, if defined, should be something like .a1, .b1, .b2.dev1, or .c2
Release: 3%{?prerelease}%{?dist}
Release: 2%{?prerelease}%{?dist}
Epoch: 1
License: LGPLv2+
%global realname blivet
@ -31,7 +31,7 @@ License: LGPLv2+
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-initial-PowerNV-class-support.patch
Patch1: 0002-Remove-teardown_all-from-the-populate-method.patch
Patch1: 0002-Add-support-for-relabeling-of-the-swap-format.patch
# Versions of required components (done so we make sure the buildrequires
# match the requires versions of things).
@ -193,6 +193,62 @@ configuration.
%endif
%changelog
* Mon Mar 30 2020 Vojtech Trefny <vtrefny@redhat.com> - 3.1.7-2
- Add support for relabeling of the swap format
* Wed Jan 29 2020 Vojtech Trefny <vtrefny@redhat.com> - 3.1.7-1
- Use SHA256 instead of MD5 for /proc/mounts hash calculation (vtrefny)
- Fix udev test names so they actually get run. (dlehman)
- Add recognition of Dell FW RAID to udev.device_is_disk. (dlehman)
- Fix Blivet DBus service version in service and config files (vtrefny)
- Make sure _chrooted_mountpoint attribute is defined before using it (vtrefny)
- Allow running 'write_label' in dry run mode on non-existing devices (vtrefny)
- Make 'makeupdates' and 'makebumpver' scripts Python 3 compatible (vtrefny)
- Do not hardcode coverage executable name (vtrefny)
- Make sure LVs are writable before wiping. (dlehman)
- Override LVM skip-activation to allow for thorough removal. (dlehman)
- Add setters for requested_size/percent form LVMVolumeGroupDevice (vtrefny)
- Set min size for XFS to 16 MiB (vtrefny)
- Revert "Ignore invalid-overridden-method warning for abstract properties"
(vtrefny)
- Fix invalid-overridden-method in events_test (vtrefny)
* Fri Oct 25 2019 Vojtech Trefny <vtrefny@redhat.com> - 3.1.6-1
- Do not allow creating VGs with PVs with different sector size (vtrefny)
- Add a new "sector_size" property to storage devices. (vtrefny)
- Ignore invalid-overridden-method warning for abstract properties (vtrefny)
- Change NFSMount._availability_errors to a property (vtrefny)
- Fix util.detect_virt function (vtrefny)
- Do not try to normalize size for zero size device factories (vtrefny)
- Always set default key size to 512 bits for ciphers with XTS mode (vtrefny)
* Tue Aug 27 2019 Vojtech Trefny <vtrefny@redhat.com> - 3.1.5-2
- Do not try to normalize size for zero size device factories (#1743753)
* Thu Aug 15 2019 Vojtech Trefny <vtrefny@redhat.com> - 3.1.5-1
- Move dependencies code from StorageDevice to Device (vtrefny)
- Always use luks_data.min_entropy as a default minimum entropy (vponcova)
- Add 'protected' property setter to LVMVolumeGroupDevice (#1729363) (vtrefny)
- fix of LV max size calculation (japokorn)
- Added min size for partitions (japokorn)
- Improved non-unique UUID handling (japokorn)
- Check if disklabel supports partition names (#1723228) (vtrefny)
- format_device: Revert destroy action if create fails (#1727589) (vtrefny)
- Do not allow resizing of LUKS devices with integrity (vtrefny)
- Return underlying block device as 'slave' for LUKS with integrity (vtrefny)
- Fix removing LUKS devices with integrity (vtrefny)
- Check status before activating dmraid set in populate. (#1723979) (dlehman)
- Use DBus call to see if we're in a vm. (dlehman)
- Use dasd disklabel for vm disks backed by dasds. (dlehman)
- Add a function to detect if running in a vm. (dlehman)
- Remove teardown_all from the populate method (vponcova)
- Correctly handle non-unicode iSCSI initiator names (vtrefny)
- Add, test and use a new method to get size with reserve (vpodzime)
- Beware non-positive sizes in thpool metadata size calculations (vpodzime)
- Log sizes in MiB in thpool auto metadata size calculations (vpodzime)
- Recalculate thpool's metadata size on resize in LVMThinPFactory (vpodzime)
- Move the thpool reserve calculations to LVMFactory (vpodzime)
* Fri Jul 26 2019 Fedora Release Engineering <releng@fedoraproject.org> - 1:3.1.4-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild

View File

@ -1,2 +1,2 @@
SHA512 (blivet-3.1.4-tests.tar.gz) = bf600b7256c24de514bdc86afa771b79ae283d9f20d7ef995d202a3ff18a1bcd6368524014582a5e6cc498529e58c3ebbc32427d7226420109a555a273f00b4b
SHA512 (blivet-3.1.4.tar.gz) = c4fa1e67824a0790640966aa9a4a4dec0d6464154c4e2010b9666df2d9e866051ab7809613cec779c19ba1bde46af74a9a1dbc9044144fa48910c7085fbd86ed
SHA512 (blivet-3.1.7-tests.tar.gz) = 700dc66c208b2da5083348eebfb75730735fa52382df30ab387ad657c2c8c9536bc13cd5d96e5e15e127b819d93adc5c08cc65c9df514f1a1e9aaacf60e224f3
SHA512 (blivet-3.1.7.tar.gz) = c98772bc423016e7a495d57f3c1f1fc32f325a442e5757cc391dcd67b4ef5ca32c9a115173fa5d584cfe768d4a6f709705b266273410bc7166962acb52dff898