summaryrefslogtreecommitdiffstats
path: root/storage
diff options
context:
space:
mode:
authorChris Lumens <clumens@redhat.com>2010-02-08 10:30:02 -0500
committerChris Lumens <clumens@redhat.com>2010-02-08 10:30:02 -0500
commit6e2b508fb660e679611a7793d6a240015b9c060d (patch)
tree6ed26e28386d9714876edce18e826c6288d8cd27 /storage
parent2a0907636de04d1ea712730d972bcb1b3b7e27bb (diff)
parentbdf00bc0dd36d7bd6c4cca5c2ec4b5780330ff4e (diff)
downloadanaconda-6e2b508fb660e679611a7793d6a240015b9c060d.tar.gz
anaconda-6e2b508fb660e679611a7793d6a240015b9c060d.tar.xz
anaconda-6e2b508fb660e679611a7793d6a240015b9c060d.zip
Merge branch 'no-instdata'
Diffstat (limited to 'storage')
-rw-r--r--storage/__init__.py47
-rw-r--r--storage/iscsi.py4
-rw-r--r--storage/partitioning.py114
3 files changed, 83 insertions, 82 deletions
diff --git a/storage/__init__.py b/storage/__init__.py
index a808acda6..e23e82641 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()
@@ -97,7 +97,7 @@ def storageInitialize(anaconda):
storage.reset()
if not storage.protectedDevices:
- if anaconda.id.getUpgrade():
+ if anaconda.upgrade:
return
else:
anaconda.intf.messageWindow(_("Unknown Device"),
@@ -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,16 +153,16 @@ 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.isKickstart:
+ if anaconda.ksdata:
return
rc = anaconda.intf.messageWindow(_("Writing storage configuration to disk"),
@@ -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
@@ -249,6 +249,7 @@ class Storage(object):
self.clearPartDisks = []
self.encryptedAutoPart = False
self.encryptionPassphrase = None
+ self.escrowCertificates = {}
self.autoPartEscrowCert = None
self.autoPartAddBackupPassphrase = False
self.encryptionRetrofit = False
@@ -356,7 +357,7 @@ class Storage(object):
self.fcoe.startup(self.anaconda.intf)
self.zfcp.startup()
self.dasd.startup(intf=self.anaconda.intf, zeroMbr=self.zeroMbr)
- if self.anaconda.id.getUpgrade():
+ if self.anaconda.upgrade:
clearPartType = CLEARPART_TYPE_NONE
else:
clearPartType = self.clearPartType
@@ -376,8 +377,8 @@ class Storage(object):
self.devicetree.populate()
self.fsset = FSSet(self.devicetree, self.anaconda.rootPath)
self.eddDict = get_edd_dict(self.partitioned)
- self.anaconda.id.rootParts = None
- self.anaconda.id.upgradeRoot = None
+ self.anaconda.rootParts = None
+ self.anaconda.upgradeRoot = None
self.dumpState("initial")
w.pop()
@@ -735,7 +736,7 @@ class Storage(object):
if kwargs.has_key("name"):
name = kwargs.pop("name")
else:
- name = self.createSuggestedVGName(self.anaconda.id.network)
+ name = self.createSuggestedVGName(self.anaconda.network)
if name in [d.name for d in self.devices]:
raise ValueError("name already in use")
@@ -1249,7 +1250,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
@@ -1275,7 +1276,7 @@ def findExistingRootDevices(anaconda, upgradeany=False):
if os.access(anaconda.rootPath + "/etc/fstab", os.R_OK):
(product, version) = getReleaseString(anaconda.rootPath)
if upgradeany or \
- anaconda.id.instClass.productUpgradable(product, version):
+ anaconda.instClass.productUpgradable(product, version):
rootDevs.append((device, "%s %s" % (product, version)))
else:
log.info("product %s version %s found on %s is not upgradable"
@@ -1292,7 +1293,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 +1337,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 bad28f108..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,41 +153,41 @@ 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 == []:
- if anaconda.isKickstart:
+ if anaconda.ksdata:
msg = _("Could not find enough free space for automatic "
"partitioning. Press 'OK' to exit the installer.")
else:
@@ -197,10 +197,10 @@ def doAutoPartition(anaconda):
anaconda.intf.messageWindow(_("Error Partitioning"), msg,
custom_icon='error')
- if anaconda.isKickstart:
+ if anaconda.ksdata:
sys.exit(0)
- anaconda.id.storage.reset()
+ anaconda.storage.reset()
return DISPATCH_BACK
_schedulePartitions(anaconda, disks)
@@ -210,16 +210,16 @@ 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.isKickstart:
+ if not anaconda.ksdata:
anaconda.intf.messageWindow(_("Warnings During Automatic "
"Partitioning"),
_("Following warnings occurred during automatic "
@@ -229,8 +229,8 @@ def doAutoPartition(anaconda):
log.warning(msg)
except PartitioningError as msg:
# restore drives to original state
- anaconda.id.storage.reset()
- if not anaconda.isKickstart:
+ anaconda.storage.reset()
+ if not anaconda.ksdata:
extra = ""
anaconda.dispatch.skipStep("partition", skip = 0)
else:
@@ -240,7 +240,7 @@ def doAutoPartition(anaconda):
"%(msg)s.%(extra)s") % {'msg': msg, 'extra': extra},
custom_icon='error')
- if anaconda.isKickstart:
+ if anaconda.ksdata:
sys.exit(0)
else:
return
@@ -248,13 +248,13 @@ 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)
if errors:
errortxt = "\n".join(errors)
- if anaconda.isKickstart:
+ if anaconda.ksdata:
extra = _("\n\nPress 'OK' to exit the installer.")
else:
extra = _("\n\nPress 'OK' to choose a different partitioning option.")
@@ -270,11 +270,11 @@ def doAutoPartition(anaconda):
#
# XXX if in kickstart we reboot
#
- if anaconda.isKickstart:
+ if anaconda.ksdata:
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):