[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[PATCH] Fix KeyError when partition numbers change during allocation. (#497911)



---
 storage/partitioning.py |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/storage/partitioning.py b/storage/partitioning.py
index c478be6..a330133 100644
--- a/storage/partitioning.py
+++ b/storage/partitioning.py
@@ -898,7 +898,7 @@ def growPartitions(disks, partitions):
             share = float(req_sectors) / float(disk_total)
             max_grow = (share * disk_free)
             max_sectors = req_sectors + max_grow
-            limited[part.name] = False
+            limited[id(part)] = False
 
             if part.req_max_size:
                 req_max_sect = (part.req_max_size * (1024 * 1024)) / sectorSize
@@ -908,9 +908,9 @@ def growPartitions(disks, partitions):
                     log.debug("adding %dMB to leftovers from %s"
                                 % (mb, part.name))
                     leftover += (max_sectors - req_max_sect)
-                    limited[part.name] = True
+                    limited[id(part)] = True
 
-            if not limited[part.name]:
+            if not limited[id(part)]:
                 unlimited_total += req_sectors
 
         # now we loop through the partitions...
@@ -919,7 +919,7 @@ def growPartitions(disks, partitions):
             req_sectors = part.partedPartition.geometry.length
             share = float(req_sectors) / float(disk_total)
             max_grow = (share * disk_free)
-            if not limited[part.name]:
+            if not limited[id(part)]:
                 leftover_share = float(req_sectors) / float(unlimited_total)
                 max_grow += leftover_share * leftover
             max_sectors = req_sectors + max_grow
-- 
1.6.0.6


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]