summaryrefslogtreecommitdiffstats
path: root/storage
diff options
context:
space:
mode:
authorDavid Lehman <dlehman@redhat.com>2009-12-21 19:17:13 -0600
committerDavid Lehman <dlehman@redhat.com>2009-12-22 15:02:37 -0600
commite6d7ff592ccb8034ebebd290718b5b87e0733862 (patch)
tree6ff92ce1394fbf20a847ee73dab3ba4a23421a5d /storage
parent0ac007dda15f2fefa59924e905a919828b8fd6a4 (diff)
downloadanaconda-e6d7ff592ccb8034ebebd290718b5b87e0733862.tar.gz
anaconda-e6d7ff592ccb8034ebebd290718b5b87e0733862.tar.xz
anaconda-e6d7ff592ccb8034ebebd290718b5b87e0733862.zip
Dump the initial and final state of the system's storage devices.
A timestamp in the keys will allow multiple installs (live media) as well as arbitrary amounts of back and forth, resetting, whatever.
Diffstat (limited to 'storage')
-rw-r--r--storage/__init__.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/storage/__init__.py b/storage/__init__.py
index 52d25b52d..d50987d07 100644
--- a/storage/__init__.py
+++ b/storage/__init__.py
@@ -53,6 +53,9 @@ import fcoe
import zfcp
import dasd
+import shelve
+import contextlib
+
import gettext
_ = lambda x: gettext.ldgettext("anaconda", x)
@@ -258,6 +261,7 @@ class Storage(object):
self._nextID = 0
self.defaultFSType = get_default_filesystem_type()
self.defaultBootFSType = get_default_filesystem_type(boot=True)
+ self._dumpFile = "/tmp/storage.state"
# these will both be empty until our reset method gets called
self.devicetree = DeviceTree(intf=self.anaconda.intf,
@@ -308,6 +312,8 @@ class Storage(object):
dev.disk.setup()
dev.disk.format.commitToDisk()
+ self.dumpState("final")
+
@property
def nextID(self):
id = self._nextID
@@ -364,6 +370,7 @@ class Storage(object):
self.fsset = FSSet(self.devicetree, self.anaconda.rootPath)
self.anaconda.id.rootParts = None
self.anaconda.id.upgradeRoot = None
+ self.dumpState("initial")
w.pop()
@property
@@ -1021,6 +1028,12 @@ class Storage(object):
return True
return False
+ def dumpState(self, suffix):
+ """ Dump the current device list to the storage shelf. """
+ key = "devices.%d.%s" % (time.time(), suffix)
+ with contextlib.closing(shelve.open(self._dumpFile)) as shelf:
+ shelf[key] = [d.dict for d in self.devices]
+
def write(self, instPath):
self.fsset.write(instPath)
self.iscsi.write(instPath, self.anaconda)