[PATCH 3/4] Move storageInitialize into anaconda.

David Lehman dlehman at redhat.com
Fri Jan 9 21:32:32 UTC 2015


It is specific to anaconda. Also, this makes it easy for anaconda to add
things like a retry/quit handler when problems are encountered during
the storage scan.

Related: rhbz#1123450
---
 blivet/__init__.py | 33 +--------------------------------
 blivet/errors.py   |  4 ----
 2 files changed, 1 insertion(+), 36 deletions(-)

diff --git a/blivet/__init__.py b/blivet/__init__.py
index 6bcccd6..52cacd9 100644
--- a/blivet/__init__.py
+++ b/blivet/__init__.py
@@ -66,7 +66,7 @@ import parted
 from pykickstart.constants import AUTOPART_TYPE_LVM, CLEARPART_TYPE_ALL, CLEARPART_TYPE_LINUX, CLEARPART_TYPE_LIST, CLEARPART_TYPE_NONE
 
 from .storage_log import log_exception_info, log_method_call
-from .errors import DeviceError, FSResizeError, FSTabTypeMismatchError, UnknownSourceDeviceError, StorageError, UnrecognizedFSTabEntryError
+from .errors import DeviceError, FSResizeError, FSTabTypeMismatchError, StorageError, UnrecognizedFSTabEntryError
 from .devices import BTRFSDevice, BTRFSSubVolumeDevice, BTRFSVolumeDevice, DirectoryDevice, FileDevice, LVMLogicalVolumeDevice, LVMThinLogicalVolumeDevice, LVMThinPoolDevice, LVMVolumeGroupDevice, MDRaidArrayDevice, NetworkStorageDevice, NFSDevice, NoDevice, OpticalDevice, PartitionDevice, TmpFSDevice, devicePathToName
 from .devicetree import DeviceTree
 from .deviceaction import ActionCreateDevice, ActionCreateFormat, ActionDestroyDevice, ActionDestroyFormat, ActionResizeDevice, ActionResizeFormat
@@ -153,37 +153,6 @@ def setSysroot(storageRoot, sysroot=None):
     if sysroot is not None:
         _sysroot = sysroot
 
-def storageInitialize(storage, ksdata, protected):
-    """ Perform installer-specific storage initialization. """
-    from pyanaconda.flags import flags as anaconda_flags
-    flags.update_from_anaconda_flags(anaconda_flags)
-
-    # Platform class setup depends on flags, re-initialize it.
-    _platform.update_from_flags()
-
-    storage.shutdown()
-
-    # Before we set up the storage system, we need to know which disks to
-    # ignore, etc.  Luckily that's all in the kickstart data.
-    storage.config.update(ksdata)
-
-    # Set up the protected partitions list now.
-    if protected:
-        storage.config.protectedDevSpecs.extend(protected)
-
-    storage.reset()
-
-    if protected and not flags.live_install and \
-       not any(d.protected for d in storage.devices):
-        raise UnknownSourceDeviceError(protected)
-
-    # kickstart uses all the disks
-    if flags.automated_install:
-        if not ksdata.ignoredisk.onlyuse:
-            ksdata.ignoredisk.onlyuse = [d.name for d in storage.disks \
-                                         if d.name not in ksdata.ignoredisk.ignoredisk]
-            log.debug("onlyuse is now: %s", ",".join(ksdata.ignoredisk.onlyuse))
-
 def turnOnFilesystems(storage, mountOnly=False, callbacks=None):
     """
     Perform installer-specific activation of storage configuration.
diff --git a/blivet/errors.py b/blivet/errors.py
index 7b87c7e..71fb7c8 100644
--- a/blivet/errors.py
+++ b/blivet/errors.py
@@ -181,10 +181,6 @@ class DasdFormatError(StorageError):
 class SizePlacesError(StorageError):
     pass
 
-# probing
-class UnknownSourceDeviceError(StorageError):
-    pass
-
 # factories
 class DeviceFactoryError(StorageError):
     pass
-- 
1.9.3



More information about the anaconda-patches mailing list