[PATCH 1/3] Only access storage.bootDisk once (#1155984)
Samantha N. Bueno
sbueno+anaconda at redhat.com
Fri Aug 21 17:25:39 UTC 2015
This just sets boot_disk right at the beginning of allocateParttions
and calls that through the rest of the function. Otherwise,
storage.bootDisk is accessed n times, where n is the number of disks
present, calling one of various getDeviceBy$something each time.
Resolves: rhbz#1155984
---
blivet/partitioning.py | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/blivet/partitioning.py b/blivet/partitioning.py
index 76a53b4..c991402 100644
--- a/blivet/partitioning.py
+++ b/blivet/partitioning.py
@@ -1026,6 +1026,10 @@ def allocatePartitions(storage, disks, partitions, freespace):
new_partitions = [p for p in partitions if not p.exists]
new_partitions.sort(cmp=partitionCompare)
+ # set this here instead of repeatedly calling storage.bootDisk further on,
+ # which adds a lot of noise in the logs
+ boot_disk = storage.bootDisk
+
# the following dicts all use device path strings as keys
disklabels = {} # DiskLabel instances for each disk
all_disks = {} # StorageDevice for each disk
@@ -1053,7 +1057,7 @@ def allocatePartitions(storage, disks, partitions, freespace):
# sort the disks, making sure the boot disk is first
req_disks.sort(key=lambda d: d.name, cmp=storage.compareDisks)
for disk in req_disks:
- if storage.bootDisk and disk == storage.bootDisk:
+ if boot_disk and disk == boot_disk:
boot_index = req_disks.index(disk)
req_disks.insert(0, req_disks.pop(boot_index))
--
2.1.0
More information about the anaconda-patches
mailing list