summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHans de Goede <hdegoede@redhat.com>2010-01-26 14:58:36 +0100
committerHans de Goede <hdegoede@redhat.com>2010-01-28 22:08:47 +0100
commite32b33c0e1eb2d7b99affa8c1f683626e13e1d2f (patch)
tree1f7a4cf1cf2cdff2bf07e0003f2e64db42b04f10
parent91598d0cd60f92e7a6e8c279df0a72baff31c661 (diff)
downloadanaconda-e32b33c0e1eb2d7b99affa8c1f683626e13e1d2f.tar.gz
anaconda-e32b33c0e1eb2d7b99affa8c1f683626e13e1d2f.tar.xz
anaconda-e32b33c0e1eb2d7b99affa8c1f683626e13e1d2f.zip
Hookup new python EDD code (#478996)
Replace all usage of the isys C EDD code with the new storage python EDD code. Note that this moves the sorting of partition.req_disks from devices.py to paritioning.py, because sorting now needs access to the storage object, this also has the added advantange that now we always allocatePartitions in sorted drive order, even in interactive mode.
-rw-r--r--booty/bootloaderInfo.py2
-rw-r--r--iw/cleardisks_gui.py2
-rw-r--r--kickstart.py8
-rw-r--r--storage/__init__.py2
-rw-r--r--storage/devices.py2
-rw-r--r--storage/partitioning.py5
6 files changed, 12 insertions, 9 deletions
diff --git a/booty/bootloaderInfo.py b/booty/bootloaderInfo.py
index b92549bd0..8368e54fa 100644
--- a/booty/bootloaderInfo.py
+++ b/booty/bootloaderInfo.py
@@ -503,7 +503,7 @@ class bootloaderInfo(object):
disks = self.storage.disks
partitioned = self.storage.partitioned
self._drivelist = [d.name for d in disks if d in partitioned]
- self._drivelist.sort(isys.compareDrives)
+ self._drivelist.sort(self.storage.compareDisks)
# If we're given a sort order, make sure the drives listed in it
# are put at the head of the drivelist in that order. All other
diff --git a/iw/cleardisks_gui.py b/iw/cleardisks_gui.py
index dfad7d611..4f26560ef 100644
--- a/iw/cleardisks_gui.py
+++ b/iw/cleardisks_gui.py
@@ -58,7 +58,7 @@ class ClearDisksWindow (InstallWindow):
bootDisk = selected[0][OBJECT_COL].name
- cleardisks.sort(isys.compareDrives)
+ cleardisks.sort(self.anaconda.id.storage.compareDisks)
self.anaconda.id.storage.clearPartDisks.extend(cleardisks + [bootDisk])
self.anaconda.id.bootloader.drivelist = [bootDisk] + cleardisks
diff --git a/kickstart.py b/kickstart.py
index 5396fd4ba..a6768ed41 100644
--- a/kickstart.py
+++ b/kickstart.py
@@ -255,7 +255,8 @@ class Bootloader(commands.bootloader.F12_Bootloader):
elif disk.name in anaconda.id.bootloader.drivelist:
# remove unpartitioned disks from the drivelist
anaconda.id.bootloader.drivelist.remove(disk.name)
- anaconda.id.bootloader.drivelist.sort(cmp=isys.compareDrives)
+ anaconda.id.bootloader.drivelist.sort(
+ cmp=anaconda.id.storage.compareDisks)
# Throw out drives specified that don't exist.
if self.driveorder and len(self.driveorder) > 0:
@@ -599,7 +600,10 @@ class PartitionData(commands.partition.F12_PartData):
storage.doAutoPart = False
if self.onbiosdisk != "":
- self.disk = isys.doGetBiosDisk(self.onbiosdisk)
+ for (disk, biosdisk) in storage.eddDict.iteritems():
+ if str(biosdisk) == self.onbiosdisk:
+ self.disk = disk
+ break
if self.disk == "":
raise KickstartValueError, formatErrorMsg(self.lineno, msg="Specified BIOS disk %s cannot be determined" % self.onbiosdisk)
diff --git a/storage/__init__.py b/storage/__init__.py
index 91a75de78..adbcd4d16 100644
--- a/storage/__init__.py
+++ b/storage/__init__.py
@@ -405,7 +405,7 @@ class Storage(object):
log.info("Skipping disk: %s: No media present" % device.name)
continue
disks.append(device)
- disks.sort(key=lambda d: d.name, cmp=isys.compareDrives)
+ disks.sort(key=lambda d: d.name, cmp=self.compareDisks)
return disks
@property
diff --git a/storage/devices.py b/storage/devices.py
index d5ca22bbf..9e9508466 100644
--- a/storage/devices.py
+++ b/storage/devices.py
@@ -112,7 +112,6 @@ from iutil import notify_kernel, numeric_type
from .storage_log import log_method_call
from udev import *
from formats import get_device_format_class, getFormat, DeviceFormat
-from isys import compareDrives
import gettext
_ = lambda x: gettext.ldgettext("anaconda", x)
@@ -917,7 +916,6 @@ class PartitionDevice(StorageDevice):
if not exists:
# this is a request, not a partition -- it has no parents
self.req_disks = self.parents[:]
- self.req_disks.sort(key=lambda d: d.name, cmp=compareDrives)
for dev in self.parents:
dev.removeChild()
self.parents = []
diff --git a/storage/partitioning.py b/storage/partitioning.py
index b6459339b..d912db93f 100644
--- a/storage/partitioning.py
+++ b/storage/partitioning.py
@@ -792,7 +792,7 @@ def doPartitioning(storage, exclusiveDisks=None):
removeNewPartitions(disks, partitions)
free = getFreeRegions(disks)
- allocatePartitions(disks, partitions, free)
+ allocatePartitions(storage, disks, partitions, free)
growPartitions(disks, partitions, free)
# The number and thus the name of partitions may have changed now,
@@ -840,7 +840,7 @@ def doPartitioning(storage, exclusiveDisks=None):
# moment to simplify things
storage.devicetree._addDevice(device)
-def allocatePartitions(disks, partitions, freespace):
+def allocatePartitions(storage, disks, partitions, freespace):
""" Allocate partitions based on requested features.
Non-existing partitions are sorted according to their requested
@@ -888,6 +888,7 @@ def allocatePartitions(disks, partitions, freespace):
# no disks specified means any disk will do
req_disks = disks
+ req_disks.sort(key=lambda d: d.name, cmp=storage.compareDisks)
log.debug("allocating partition: %s ; id: %d ; disks: %s ;\n"
"boot: %s ; primary: %s ; size: %dMB ; grow: %s ; "
"max_size: %s" % (_part.name, _part.id, req_disks,