[PATCH 5/6][blivet] Raise ConfigurationError when unusable configuration is detected.
Vratislav Podzimek
vpodzime at redhat.com
Thu Nov 6 07:38:23 UTC 2014
On Wed, 2014-11-05 at 09:49 -0600, David Lehman wrote:
> 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")
> +
> 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
> +
"ConfigurationError" sounds to me more like if it was an error during
configuration of something by us. What about "UnsupportedConfiguration"
or "UnsupportedSetup"?
--
Vratislav Podzimek
Anaconda Rider | Red Hat, Inc. | Brno - Czech Republic
More information about the anaconda-patches
mailing list