diff options
author | David Lehman <dlehman@redhat.com> | 2009-03-02 23:29:55 -0600 |
---|---|---|
committer | David Lehman <dlehman@redhat.com> | 2009-03-02 23:29:55 -0600 |
commit | 7bcb1e95d2dae520d11b444550dd41e009dd5bb8 (patch) | |
tree | 9d630e9948f336c6554915edf09ccb5f395eb561 | |
parent | 9fdbcd4b3304f5c7847a332687e58b35e75402d7 (diff) | |
download | anaconda-7bcb1e95d2dae520d11b444550dd41e009dd5bb8.tar.gz anaconda-7bcb1e95d2dae520d11b444550dd41e009dd5bb8.tar.xz anaconda-7bcb1e95d2dae520d11b444550dd41e009dd5bb8.zip |
Add exclusiveDisks kwarg to doPartitioning, other minor fixes.
- Check that we have a bootDev before checking if it exists.
- Don't try to do anything in growPartitions unless there are
some growable requests.
-rw-r--r-- | storage/partitioning.py | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/storage/partitioning.py b/storage/partitioning.py index dd31b81c8..a8ffc68a9 100644 --- a/storage/partitioning.py +++ b/storage/partitioning.py @@ -118,7 +118,8 @@ def doAutoPartition(anaconda): # run the autopart function to allocate and grow partitions try: - doPartitioning(anaconda) + doPartitioning(anaconda.id.storage, + exclusiveDisks=anaconda.id.storage.clearPartDisks) except PartitioningWarning as msg: if not anaconda.isKickstart: anaconda.intf.messageWindow(_("Warnings During Automatic " @@ -470,7 +471,7 @@ def getBestFreeSpaceRegion(disk, part_type, req_size, return best_free -def doPartitioning(storage): +def doPartitioning(storage, exclusiveDisks=None): """ Allocate and grow partitions. When this function returns without error, all PartitionDevice @@ -483,14 +484,21 @@ def doPartitioning(storage): storage - Main anaconda Storage instance + Keyword arguments: + + exclusiveDisks -- list of names of disks to use + """ anaconda = storage.anaconda - disks = [d for d in storage.disks if d.name in storage.clearPartDisks] + disks = storage.disks + if exclusiveDisks: + disks = [d for d in disks if d.name in exclusiveDisks] + partitions = storage.partitions # FIXME: isn't there a better place for this to happen? bootDev = anaconda.platform.bootDevice() - if not bootDev.exists: + if bootDev and not bootDev.exists: bootDev.req_bootable = True # FIXME: make sure non-existent partitions have empty parents list @@ -712,6 +720,8 @@ def growPartitions(disks, partitions): """ log.debug("growPartitions: disks=%s, partitions=%s" % ([d.name for d in disks], [p.name for p in partitions])) all_growable = [p for p in partitions if p.req_grow] + if not all_growable: + return # sort requests by base size in decreasing order all_growable.sort(key=lambda p: p.req_size, reverse=True) |