----- Original Message -----
From: "David Lehman" <dlehman(a)redhat.com>
To: anaconda-patches(a)lists.fedorahosted.org
Sent: Wednesday, November 5, 2014 10:49:18 AM
Subject: [PATCH 5/6][blivet] Raise ConfigurationError when unusable configuration is
detected.
The two cases included initially are a corrupt gpt disklabel and
multiple lvm volume groups with the same name.
Blivet cannot proceed in the corrupt gpt case because pyparted doesn't
support instantiating a parted.Disk if the underlying gpt disklabel is
corrupt.
The lvm case has several issues, the most basic being that lvm is not
designed to handle multiple volume groups with the same name. A user
would have to rename one of the same-named vgs manually in order to
make it possible to use both vgs.
---
blivet/devicetree.py | 10 ++++++++--
blivet/errors.py | 4 ++++
2 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/blivet/devicetree.py b/blivet/devicetree.py
index 7af4c8e..a9c70b4 100644
--- a/blivet/devicetree.py
+++ b/blivet/devicetree.py
@@ -27,7 +27,7 @@ import shutil
import pprint
import copy
-from .errors import CryptoError, DeviceError, DeviceTreeError,
DiskLabelCommitError, DMError, FSError, InvalidDiskLabelError, LUKSError,
MDRaidError, StorageError
+from .errors import ConfigurationError, CryptoError, DeviceError,
DeviceTreeError, DiskLabelCommitError, DMError, FSError,
InvalidDiskLabelError, LUKSError, MDRaidError, StorageError
from .devices import BTRFSDevice, BTRFSSubVolumeDevice, BTRFSVolumeDevice,
BTRFSSnapShotDevice
from .devices import DASDDevice, DMDevice, DMLinearDevice,
DMRaidArrayDevice, DiskDevice
from .devices import FcoeDiskDevice, FileDevice, LoopDevice, LUKSDevice
@@ -948,7 +948,7 @@ class DeviceTree(object):
if (disk.partitionable and not
(disk.format.type == "iso9660" or disk.format.hidden) and
(flags.installer_mode and not self._isIgnoredDisk(disk))):
- raise DeviceTreeError("failed to scan disk %s" % disk.name)
+ raise ConfigurationError("failed to scan disk %s" %
disk.name)
# there's no need to filter partitions on members of multipaths
or
# fwraid members from lvm since multipath and dmraid are already
@@ -1534,6 +1534,12 @@ class DeviceTree(object):
if vg_device:
vg_device.parents.append(device)
else:
+ same_name = self.getDeviceByName(vg_name)
+ if isinstance(same_name, LVMVolumeGroupDevice) and \
+ not (all(self._isIgnoredDisk(d) for d in same_name.disks) or
+ all(self._isIgnoredDisk(d) for d in device.disks)):
+ raise ConfigurationError("multiple LVM volume groups with
the same name")
+
It's not clear to me how you can be certain that the device you get
by getDeviceByName() lookup is not the device you're processing.
Should you be checking equality of same_name and device?
try:
vg_size = udev.device_get_vg_size(info)
vg_free = udev.device_get_vg_free(info)
diff --git a/blivet/errors.py b/blivet/errors.py
index a359b67..f39e4d9 100644
--- a/blivet/errors.py
+++ b/blivet/errors.py
@@ -153,6 +153,10 @@ class DeviceTreeError(StorageError):
class DeviceNotFoundError(StorageError):
pass
+class ConfigurationError(StorageError):
+ """ User has an unusable initial storage configuration.
"""
+ pass
+
# DeviceAction
class DeviceActionError(StorageError):
pass
--
1.9.3
_______________________________________________
anaconda-patches mailing list
anaconda-patches(a)lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/anaconda-patches
- mulhern