FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Ubuntu > Kubuntu User

 
 
LinkBack Thread Tools
 
Old 01-26-2010, 02:16 PM
Hans de Goede
 
Default 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.
---
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 dfad7d6..4f26560 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.compareDi sks)

self.anaconda.id.storage.clearPartDisks.extend(cle ardisks + [bootDisk])
self.anaconda.id.bootloader.drivelist = [bootDisk] + cleardisks
diff --git a/kickstart.py b/kickstart.py
index 5396fd4..719d3eb 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.com pareDrives)
+ 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 in storage.edd_dict:
+ if str(storage.edd_dict[disk]) == 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 39b7706..58128e0 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 ;
"
"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@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 
Old 01-27-2010, 02:42 PM
Chris Lumens
 
Default 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.

This patch makes me wonder if Storage really is the right place for
compareDisks. It doesn't look like compareDisks does anything that
needs knowledge of the storage module, and leads to some pretty awkward
paths to access it.

- Chris

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 
Old 01-27-2010, 02:45 PM
Chris Lumens
 
Default Hookup new python EDD code (#478996)

> @@ -599,7 +600,10 @@ class PartitionData(commands.partition.F12_PartData):
> storage.doAutoPart = False
>
> if self.onbiosdisk != "":
> - self.disk = isys.doGetBiosDisk(self.onbiosdisk)
> + for disk in storage.edd_dict:
> + if str(storage.edd_dict[disk]) == self.onbiosdisk:
> + self.disk = disk
> + break
>
> if self.disk == "":
> raise KickstartValueError, formatErrorMsg(self.lineno, msg="Specified BIOS disk %s cannot be determined" % self.onbiosdisk)

A more pythonish way of writing this would be:

for (disk, biosdisk) in storage.edd_dict.iteritems():
if str(biosdisk) == self.onbiosdisk:
self.disk = disk
break

- Chris

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 
Old 01-27-2010, 04:28 PM
Hans de Goede
 
Default Hookup new python EDD code (#478996)

Hi,

On 01/27/2010 04:42 PM, Chris Lumens wrote:

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.


This patch makes me wonder if Storage really is the right place for
compareDisks. It doesn't look like compareDisks does anything that
needs knowledge of the storage module, and leads to some pretty awkward
paths to access it.



One of the main reasons to rewrite the EDD code is python is to have access
to the devicetree topology and thus avoid probing both BIOS RAID members
and the set and then complain about duplicate mbr signatures.

This means that the edd dict needs to get populated after the devicetree
has been populated, and populating the dict needs access to storage.partitioned
so storage itself seems like a logical place to do the populating from, which
in turn makes it a good place to store the dict, and thus to have
the compareDisks method.

Regards,

Hans

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 
Old 01-27-2010, 04:35 PM
Hans de Goede
 
Default Hookup new python EDD code (#478996)

Hi,

On 01/27/2010 04:45 PM, Chris Lumens wrote:

@@ -599,7 +600,10 @@ class PartitionData(commands.partition.F12_PartData):
storage.doAutoPart = False

if self.onbiosdisk != "":
- self.disk = isys.doGetBiosDisk(self.onbiosdisk)
+ for disk in storage.edd_dict:
+ if str(storage.edd_dict[disk]) == self.onbiosdisk:
+ self.disk = disk
+ break

if self.disk == "":
raise KickstartValueError, formatErrorMsg(self.lineno, msg="Specified BIOS disk %s cannot be determined" % self.onbiosdisk)


A more pythonish way of writing this would be:

for (disk, biosdisk) in storage.edd_dict.iteritems():
if str(biosdisk) == self.onbiosdisk:
self.disk = disk
break



Good one, will change.

Regards,

Hans

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 
Old 01-28-2010, 11:46 AM
Hans de Goede
 
Default 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.
---
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.compareDi sks)

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.com pareDrives)
+ 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 ;
"
"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@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 

Thread Tools




All times are GMT. The time now is 06:43 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org