---
anaconda | 2 +-
pyanaconda/errors.py | 3 +++
pyanaconda/rescue.py | 3 ++-
pyanaconda/storage_utils.py | 33 +++++++++++++++++++++++++++++++++
pyanaconda/ui/gui/spokes/lib/refresh.py | 3 +--
5 files changed, 40 insertions(+), 4 deletions(-)
diff --git a/anaconda b/anaconda
index 59046a9..d9bb79e 100755
--- a/anaconda
+++ b/anaconda
@@ -1304,7 +1304,7 @@ if __name__ == "__main__":
signal.signal(signal.SIGUSR2, lambda signum, frame: anaconda.dumpState())
atexit.register(exitHandler, ksdata.reboot, anaconda.storage)
- from blivet import storageInitialize
+ from pyanaconda.storage_utils import storageInitialize
from pyanaconda.packaging import payloadMgr
from pyanaconda.network import networkInitialize, wait_for_connecting_NM_thread
from pyanaconda.timezone import time_initialize
diff --git a/pyanaconda/errors.py b/pyanaconda/errors.py
index 02704f9..29c15a9 100644
--- a/pyanaconda/errors.py
+++ b/pyanaconda/errors.py
@@ -58,6 +58,9 @@ class RemovedModuleError(ImportError):
class ZIPLError(Exception):
pass
+class UnknownSourceDeviceError(Exception):
+ pass
+
# These constants are returned by the callback in the ErrorHandler class.
# Each represents a different kind of action the caller can take:
#
diff --git a/pyanaconda/rescue.py b/pyanaconda/rescue.py
index 63bc0c1..0940f8d 100644
--- a/pyanaconda/rescue.py
+++ b/pyanaconda/rescue.py
@@ -36,6 +36,7 @@ from pyanaconda.flags import flags
from pyanaconda.installinterfacebase import InstallInterfaceBase
from pyanaconda.i18n import _
from pyanaconda.kickstart import runPostScripts
+from pyanaconda.storage_utils import storageInitialize
from blivet import mountExistingSystem
from blivet.errors import StorageError, DirtyFSError
@@ -307,7 +308,7 @@ def doRescue(intf, rescue_mount, ksdata):
break
sto = blivet.Blivet(ksdata=ksdata)
- blivet.storageInitialize(sto, ksdata, [])
+ storageInitialize(sto, ksdata, [])
_unlock_devices(intf, sto)
roots = blivet.findExistingInstallations(sto.devicetree)
diff --git a/pyanaconda/storage_utils.py b/pyanaconda/storage_utils.py
index 410dfea..bb3a5ee 100644
--- a/pyanaconda/storage_utils.py
+++ b/pyanaconda/storage_utils.py
@@ -39,6 +39,8 @@ from blivet.devicefactory import DEVICE_TYPE_DISK
from pyanaconda.i18n import _, N_
from pyanaconda import isys
from pyanaconda.constants import productName
+from pyanaconda.errors import UnknownSourceDeviceError
+from pyanaconda.flags import flags
from pykickstart.constants import AUTOPART_TYPE_PLAIN, AUTOPART_TYPE_BTRFS
from pykickstart.constants import AUTOPART_TYPE_LVM, AUTOPART_TYPE_LVM_THINP
@@ -90,6 +92,37 @@ AUTOPART_DEVICE_TYPES = {AUTOPART_TYPE_LVM: DEVICE_TYPE_LVM,
NAMED_DEVICE_TYPES = (DEVICE_TYPE_BTRFS, DEVICE_TYPE_LVM, DEVICE_TYPE_MD,
DEVICE_TYPE_LVM_THINP)
CONTAINER_DEVICE_TYPES = (DEVICE_TYPE_LVM, DEVICE_TYPE_BTRFS, DEVICE_TYPE_LVM_THINP)
+def storageInitialize(storage, ksdata, protected):
+ """ Perform installer-specific storage initialization.
"""
+ from blivet.flags import flags as blivet_flags
+ blivet_flags.update_from_anaconda_flags(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.livecdInstall and \
+ not any(d.protected for d in storage.devices):
+ raise UnknownSourceDeviceError(protected)
+
+ # kickstart uses all the disks
+ if flags.automatedInstall:
+ 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 size_from_input(input_str):
"""Get size from user's input"""
diff --git a/pyanaconda/ui/gui/spokes/lib/refresh.py
b/pyanaconda/ui/gui/spokes/lib/refresh.py
index 396c38f..e82a4c1 100644
--- a/pyanaconda/ui/gui/spokes/lib/refresh.py
+++ b/pyanaconda/ui/gui/spokes/lib/refresh.py
@@ -24,8 +24,7 @@ from gi.repository import GLib
from pyanaconda.threads import threadMgr, AnacondaThread
from pyanaconda.ui.gui import GUIObject
from pyanaconda import constants
-
-from blivet import storageInitialize
+from pyanaconda.storage_utils import storageInitialize
__all__ = ["RefreshDialog"]
--
1.9.3