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. --- booty/bootloaderInfo.py | 2 +- iw/cleardisks_gui.py | 2 +- kickstart.py | 8 ++++++-- storage/__init__.py | 2 +- storage/devices.py | 2 -- storage/partitioning.py | 5 +++-- 6 files changed, 12 insertions(+), 9 deletions(-) diff --git a/booty/bootloaderInfo.py b/booty/bootloaderInfo.py index b92549b..8368e54 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 9151244..e60d6a8 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 = cleardisks self.anaconda.id.bootloader.updateDriveList([bootDisk]) diff --git a/kickstart.py b/kickstart.py index 5396fd4..a6768ed 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 91a75de..adbcd4d 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 d5ca22b..9e95084 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 b645933..d912db9 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, -- 1.6.5.2 _______________________________________________ Anaconda-devel-list mailing list Anaconda-devel-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/anaconda-devel-list