New subject: [PATCH 1/6] Make sure container changes worked before applying device changes. (#965805)
---
blivet/devicefactory.py | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/blivet/devicefactory.py b/blivet/devicefactory.py
index d427335..08adee0 100644
--- a/blivet/devicefactory.py
+++ b/blivet/devicefactory.py
@@ -432,6 +432,10 @@ class DeviceFactory(object):
""" Type-specific container device instantiation.
"""
pass
+ def _check_container_size(self):
+ """ Raise an exception if the container cannot hold its devices.
"""
+ pass
+
def _reconfigure_container(self):
""" Reconfigure a defined container required by this factory
device. """
if getattr(self.container, "exists", False):
@@ -440,6 +444,10 @@ class DeviceFactory(object):
self._set_container_members()
self._set_container_raid_level()
+ # check that the container is still large enough to contain whatever
+ # other devices it previously contained
+ self._check_container_size()
+
def _set_container_members(self):
if not self.child_factory:
return
@@ -1141,6 +1149,16 @@ class LVMFactory(DeviceFactory):
def _get_new_container(self, *args, **kwargs):
return self.storage.newVG(*args, **kwargs)
+ def _check_container_size(self):
+ """ Raise an exception if the container cannot hold its devices.
"""
+ if not self.container:
+ return
+
+ free_space = self.container.freeSpace + getattr(self.device, "size",
0)
+ if free_space < 0:
+ raise DeviceFactoryError("container changes impossible due to "
+ "the devices it already contains")
+
#
# methods to configure the factory's device
#
--
1.8.1.4
New subject: [PATCH 2/6] Open as many luks devs as possible with any given passphrase. (#965754)
---
blivet/devicetree.py | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/blivet/devicetree.py b/blivet/devicetree.py
index 691f1b2..f8db987 100644
--- a/blivet/devicetree.py
+++ b/blivet/devicetree.py
@@ -1153,8 +1153,11 @@ class DeviceTree(object):
# this makes device.configured return True
device.format.passphrase = 'yabbadabbadoo'
else:
- # Try each known passphrase.
- for passphrase in self.__passphrases:
+ # Try each known passphrase. Include luksDevs values in case a
+ # passphrase has been set for a specific device without a full
+ # reset/populate, in which case the new passphrase would not be
+ # in self.__passphrases.
+ for passphrase in self.__passphrases + self.__luksDevs.values():
device.format.passphrase = passphrase
try:
device.format.setup()
--
1.8.1.4
New subject: [PATCH 3/6] Set a non-zero size for new btrfs subvols in an existing volume.
A size of zero means you're adjusting a container after removing a device
from it, and short-circuits the code that actually creates/modifies the
subvol.
---
blivet/devicefactory.py | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/blivet/devicefactory.py b/blivet/devicefactory.py
index 08adee0..5857969 100644
--- a/blivet/devicefactory.py
+++ b/blivet/devicefactory.py
@@ -1292,6 +1292,12 @@ class BTRFSFactory(DeviceFactory):
else:
self.size_set_class = SameSizeSet
+ def _handle_no_size(self):
+ """ Set device size so that it grows to the largest size possible.
"""
+ super(BTRFSFactory, self)._handle_no_size()
+ if self.container and self.container.exists:
+ self.size = self.container.size
+
def _get_total_space(self):
""" Return the total space needed for the specified container.
"""
size = 0
--
1.8.1.4
New subject: [PATCH 6/6] Clear md arrays' sysfs path after deactivating them. (#954062)
Without an mdadm.conf to refer to, mdadm makes no effort to associate
minors with specific arrays.
---
blivet/devices.py | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/blivet/devices.py b/blivet/devices.py
index 2bb7289..1587b91 100644
--- a/blivet/devices.py
+++ b/blivet/devices.py
@@ -3094,6 +3094,13 @@ class MDRaidArrayDevice(StorageDevice):
members=disks,
uuid=self.uuid)
+ def _postTeardown(self, recursive=False):
+ super(MDRaidArrayDevice, self)._postTeardown(recursive=recursive)
+ # mdadm reuses minors indiscriminantly when there is no mdadm.conf, so
+ # we need to clear the sysfs path now so our status method continues to
+ # give valid results
+ self.updateSysfsPath()
+
def teardown(self, recursive=None):
""" Close, or tear down, a device. """
log_method_call(self, self.name, status=self.status,
--
1.8.1.4