summaryrefslogtreecommitdiffstats
path: root/storage
diff options
context:
space:
mode:
authorChris Lumens <clumens@redhat.com>2009-12-21 13:10:13 -0500
committerChris Lumens <clumens@redhat.com>2010-02-04 15:07:53 -0500
commit7ea42d120f84005dce27a9d3ca98732c929999ab (patch)
tree1690eebaaf94f14182ee9f66c179ee6d1de13da1 /storage
parent7959758242dfbed72be1376daeecb2132a1b5f23 (diff)
downloadanaconda-7ea42d120f84005dce27a9d3ca98732c929999ab.tar.gz
anaconda-7ea42d120f84005dce27a9d3ca98732c929999ab.tar.xz
anaconda-7ea42d120f84005dce27a9d3ca98732c929999ab.zip
Move storage into the Anaconda class.
Diffstat (limited to 'storage')
-rw-r--r--storage/__init__.py32
-rw-r--r--storage/iscsi.py4
-rw-r--r--storage/partitioning.py100
3 files changed, 68 insertions, 68 deletions
diff --git a/storage/__init__.py b/storage/__init__.py
index 14ab49d7f..70eda0dba 100644
--- a/storage/__init__.py
+++ b/storage/__init__.py
@@ -65,7 +65,7 @@ import logging
log = logging.getLogger("storage")
def storageInitialize(anaconda):
- storage = anaconda.id.storage
+ storage = anaconda.storage
storage.shutdown()
@@ -123,7 +123,7 @@ def storageComplete(anaconda):
sys.exit(0)
return DISPATCH_FORWARD
- devs = anaconda.id.storage.devicetree.getDevicesByType("luks/dm-crypt")
+ devs = anaconda.storage.devicetree.getDevicesByType("luks/dm-crypt")
existing_luks = False
new_luks = False
for dev in devs:
@@ -132,13 +132,13 @@ def storageComplete(anaconda):
else:
new_luks = True
- if (anaconda.id.storage.encryptedAutoPart or new_luks) and \
- not anaconda.id.storage.encryptionPassphrase:
+ if (anaconda.storage.encryptedAutoPart or new_luks) and \
+ not anaconda.storage.encryptionPassphrase:
while True:
(passphrase, retrofit) = anaconda.intf.getLuksPassphrase(preexist=existing_luks)
if passphrase:
- anaconda.id.storage.encryptionPassphrase = passphrase
- anaconda.id.storage.encryptionRetrofit = retrofit
+ anaconda.storage.encryptionPassphrase = passphrase
+ anaconda.storage.encryptionRetrofit = retrofit
break
else:
rc = anaconda.intf.messageWindow(_("Encrypt device?"),
@@ -153,14 +153,14 @@ def storageComplete(anaconda):
default=0)
if rc == 1:
log.info("user elected to not encrypt any devices.")
- undoEncryption(anaconda.id.storage)
- anaconda.id.storage.encryptedAutoPart = False
+ undoEncryption(anaconda.storage)
+ anaconda.storage.encryptedAutoPart = False
break
- if anaconda.id.storage.encryptionPassphrase:
- for dev in anaconda.id.storage.devices:
+ if anaconda.storage.encryptionPassphrase:
+ for dev in anaconda.storage.devices:
if dev.format.type == "luks" and not dev.format.exists:
- dev.format.passphrase = anaconda.id.storage.encryptionPassphrase
+ dev.format.passphrase = anaconda.storage.encryptionPassphrase
if anaconda.ksdata:
return
@@ -176,7 +176,7 @@ def storageComplete(anaconda):
default = 0)
# Make sure that all is down, even the disks that we setup after popluate.
- anaconda.id.storage.devicetree.teardownAll()
+ anaconda.storage.devicetree.teardownAll()
if rc == 0:
return DISPATCH_BACK
@@ -184,7 +184,7 @@ def storageComplete(anaconda):
def writeEscrowPackets(anaconda):
escrowDevices = filter(lambda d: d.format.type == "luks" and \
d.format.escrow_cert,
- anaconda.id.storage.devices)
+ anaconda.storage.devices)
if not escrowDevices:
return
@@ -1249,7 +1249,7 @@ def findExistingRootDevices(anaconda, upgradeany=False):
iutil.mkdirChain(anaconda.rootPath)
roots = []
- for device in anaconda.id.storage.devicetree.leaves:
+ for device in anaconda.storage.devicetree.leaves:
if not device.format.linuxNative or not device.format.mountable:
continue
@@ -1292,7 +1292,7 @@ def mountExistingSystem(anaconda, rootEnt,
""" Mount filesystems specified in rootDevice's /etc/fstab file. """
rootDevice = rootEnt[0]
rootPath = anaconda.rootPath
- fsset = anaconda.id.storage.fsset
+ fsset = anaconda.storage.fsset
if readOnly:
readOnly = "ro"
else:
@@ -1336,7 +1336,7 @@ def mountExistingSystem(anaconda, rootEnt,
"Linux installation, let the file systems be "
"checked and shut down cleanly to upgrade.\n"
"%s") % "\n".join(dirtyDevs))
- anaconda.id.storage.devicetree.teardownAll()
+ anaconda.storage.devicetree.teardownAll()
sys.exit(0)
elif warnDirty and dirtyDevs:
rc = messageWindow(_("Dirty File Systems"),
diff --git a/storage/iscsi.py b/storage/iscsi.py
index 68c2c9d53..a1c6198db 100644
--- a/storage/iscsi.py
+++ b/storage/iscsi.py
@@ -283,10 +283,10 @@ class iscsi(object):
return
# set iscsi nodes to autostart
- root = anaconda.id.storage.rootDevice
+ root = anaconda.storage.rootDevice
for node in self.nodes:
autostart = True
- disks = self.getNodeDisks(node, anaconda.id.storage)
+ disks = self.getNodeDisks(node, anaconda.storage)
for disk in disks:
# nodes used for root get started by the initrd
if root.dependsOn(disk):
diff --git a/storage/partitioning.py b/storage/partitioning.py
index 36f26a06c..87154ee32 100644
--- a/storage/partitioning.py
+++ b/storage/partitioning.py
@@ -44,9 +44,9 @@ def _createFreeSpacePartitions(anaconda):
# get a list of disks that have at least one free space region of at
# least 100MB
disks = []
- for disk in anaconda.id.storage.partitioned:
- if anaconda.id.storage.clearPartDisks and \
- (disk.name not in anaconda.id.storage.clearPartDisks):
+ for disk in anaconda.storage.partitioned:
+ if anaconda.storage.clearPartDisks and \
+ (disk.name not in anaconda.storage.clearPartDisks):
continue
part = disk.format.firstPartition
@@ -64,19 +64,19 @@ def _createFreeSpacePartitions(anaconda):
# create a separate pv partition for each disk with free space
devs = []
for disk in disks:
- if anaconda.id.storage.encryptedAutoPart:
+ if anaconda.storage.encryptedAutoPart:
fmt_type = "luks"
- fmt_args = {"escrow_cert": anaconda.id.storage.autoPartEscrowCert,
- "add_backup_passphrase": anaconda.id.storage.autoPartAddBackupPassphrase}
+ fmt_args = {"escrow_cert": anaconda.storage.autoPartEscrowCert,
+ "add_backup_passphrase": anaconda.storage.autoPartAddBackupPassphrase}
else:
fmt_type = "lvmpv"
fmt_args = {}
- part = anaconda.id.storage.newPartition(fmt_type=fmt_type,
+ part = anaconda.storage.newPartition(fmt_type=fmt_type,
fmt_args=fmt_args,
size=1,
grow=True,
disks=[disk])
- anaconda.id.storage.createDevice(part)
+ anaconda.storage.createDevice(part)
devs.append(part)
return (disks, devs)
@@ -88,33 +88,33 @@ def _schedulePartitions(anaconda, disks):
#
# First pass is for partitions only. We'll do LVs later.
#
- for request in anaconda.id.storage.autoPartitionRequests:
+ for request in anaconda.storage.autoPartitionRequests:
if request.asVol:
continue
if request.fstype is None:
- request.fstype = anaconda.id.storage.defaultFSType
+ request.fstype = anaconda.storage.defaultFSType
# This is a little unfortunate but let the backend dictate the rootfstype
# so that things like live installs can do the right thing
if request.mountpoint == "/" and anaconda.backend.rootFsType != None:
request.fstype = anaconda.backend.rootFsType
- dev = anaconda.id.storage.newPartition(fmt_type=request.fstype,
- size=request.size,
- grow=request.grow,
- maxsize=request.maxSize,
- mountpoint=request.mountpoint,
- disks=disks,
- weight=request.weight)
+ dev = anaconda.storage.newPartition(fmt_type=request.fstype,
+ size=request.size,
+ grow=request.grow,
+ maxsize=request.maxSize,
+ mountpoint=request.mountpoint,
+ disks=disks,
+ weight=request.weight)
# schedule the device for creation
- anaconda.id.storage.createDevice(dev)
+ anaconda.storage.createDevice(dev)
# make sure preexisting broken lvm/raid configs get out of the way
return
def _scheduleLVs(anaconda, devs):
- if anaconda.id.storage.encryptedAutoPart:
+ if anaconda.storage.encryptedAutoPart:
pvs = []
for dev in devs:
pv = LUKSDevice("luks-%s" % dev.name,
@@ -122,13 +122,13 @@ def _scheduleLVs(anaconda, devs):
size=dev.size,
parents=dev)
pvs.append(pv)
- anaconda.id.storage.createDevice(pv)
+ anaconda.storage.createDevice(pv)
else:
pvs = devs
# create a vg containing all of the autopart pvs
- vg = anaconda.id.storage.newVG(pvs=pvs)
- anaconda.id.storage.createDevice(vg)
+ vg = anaconda.storage.newVG(pvs=pvs)
+ anaconda.storage.createDevice(vg)
initialVGSize = vg.size
@@ -137,7 +137,7 @@ def _scheduleLVs(anaconda, devs):
# schedule them for creation.
#
# Second pass, for LVs only.
- for request in anaconda.id.storage.autoPartitionRequests:
+ for request in anaconda.storage.autoPartitionRequests:
if not request.asVol:
continue
@@ -145,7 +145,7 @@ def _scheduleLVs(anaconda, devs):
continue
if request.fstype is None:
- request.fstype = anaconda.id.storage.defaultFSType
+ request.fstype = anaconda.storage.defaultFSType
# This is a little unfortunate but let the backend dictate the rootfstype
# so that things like live installs can do the right thing
@@ -153,37 +153,37 @@ def _scheduleLVs(anaconda, devs):
request.fstype = anaconda.backend.rootFsType
# FIXME: move this to a function and handle exceptions
- dev = anaconda.id.storage.newLV(vg=vg,
- fmt_type=request.fstype,
- mountpoint=request.mountpoint,
- grow=request.grow,
- maxsize=request.maxSize,
- size=request.size)
+ dev = anaconda.storage.newLV(vg=vg,
+ fmt_type=request.fstype,
+ mountpoint=request.mountpoint,
+ grow=request.grow,
+ maxsize=request.maxSize,
+ size=request.size)
# schedule the device for creation
- anaconda.id.storage.createDevice(dev)
+ anaconda.storage.createDevice(dev)
def doAutoPartition(anaconda):
log.debug("doAutoPartition(%s)" % anaconda)
- log.debug("doAutoPart: %s" % anaconda.id.storage.doAutoPart)
- log.debug("clearPartType: %s" % anaconda.id.storage.clearPartType)
- log.debug("clearPartDisks: %s" % anaconda.id.storage.clearPartDisks)
- log.debug("autoPartitionRequests: %s" % anaconda.id.storage.autoPartitionRequests)
- log.debug("storage.disks: %s" % [d.name for d in anaconda.id.storage.disks])
- log.debug("storage.partitioned: %s" % [d.name for d in anaconda.id.storage.partitioned])
- log.debug("all names: %s" % [d.name for d in anaconda.id.storage.devices])
+ log.debug("doAutoPart: %s" % anaconda.storage.doAutoPart)
+ log.debug("clearPartType: %s" % anaconda.storage.clearPartType)
+ log.debug("clearPartDisks: %s" % anaconda.storage.clearPartDisks)
+ log.debug("autoPartitionRequests: %s" % anaconda.storage.autoPartitionRequests)
+ log.debug("storage.disks: %s" % [d.name for d in anaconda.storage.disks])
+ log.debug("storage.partitioned: %s" % [d.name for d in anaconda.storage.partitioned])
+ log.debug("all names: %s" % [d.name for d in anaconda.storage.devices])
if anaconda.dir == DISPATCH_BACK:
- anaconda.id.storage.reset()
+ anaconda.storage.reset()
return
disks = []
devs = []
- if anaconda.id.storage.doAutoPart:
- clearPartitions(anaconda.id.storage)
+ if anaconda.storage.doAutoPart:
+ clearPartitions(anaconda.storage)
- if anaconda.id.storage.doAutoPart:
+ if anaconda.storage.doAutoPart:
(disks, devs) = _createFreeSpacePartitions(anaconda)
if disks == []:
@@ -200,7 +200,7 @@ def doAutoPartition(anaconda):
if anaconda.ksdata:
sys.exit(0)
- anaconda.id.storage.reset()
+ anaconda.storage.reset()
return DISPATCH_BACK
_schedulePartitions(anaconda, disks)
@@ -210,14 +210,14 @@ def doAutoPartition(anaconda):
# run the autopart function to allocate and grow partitions
try:
- doPartitioning(anaconda.id.storage,
- exclusiveDisks=anaconda.id.storage.clearPartDisks)
+ doPartitioning(anaconda.storage,
+ exclusiveDisks=anaconda.storage.clearPartDisks)
- if anaconda.id.storage.doAutoPart:
+ if anaconda.storage.doAutoPart:
_scheduleLVs(anaconda, devs)
# grow LVs
- growLVM(anaconda.id.storage)
+ growLVM(anaconda.storage)
except PartitioningWarning as msg:
if not anaconda.ksdata:
anaconda.intf.messageWindow(_("Warnings During Automatic "
@@ -229,7 +229,7 @@ def doAutoPartition(anaconda):
log.warning(msg)
except PartitioningError as msg:
# restore drives to original state
- anaconda.id.storage.reset()
+ anaconda.storage.reset()
if not anaconda.ksdata:
extra = ""
anaconda.dispatch.skipStep("partition", skip = 0)
@@ -248,7 +248,7 @@ def doAutoPartition(anaconda):
# sanity check the collection of devices
log.warning("not sanity checking storage config because I don't know how yet")
# now do a full check of the requests
- (errors, warnings) = anaconda.id.storage.sanityCheck()
+ (errors, warnings) = anaconda.storage.sanityCheck()
if warnings:
for warning in warnings:
log.warning(warning)
@@ -274,7 +274,7 @@ def doAutoPartition(anaconda):
anaconda.intf.messageWindow(_("Unrecoverable Error"),
_("The system will now reboot."))
sys.exit(0)
- anaconda.id.storage.reset()
+ anaconda.storage.reset()
return DISPATCH_BACK
def shouldClear(device, clearPartType, clearPartDisks=None):