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

[PATCH] Once a partition is part of another device it cannot be modified. (#496760)



---
 storage/partitioning.py |   13 ++++++++++---
 1 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/storage/partitioning.py b/storage/partitioning.py
index 66be38b..1a6ee0e 100644
--- a/storage/partitioning.py
+++ b/storage/partitioning.py
@@ -555,9 +555,16 @@ def doPartitioning(storage, exclusiveDisks=None):
     for disk in disks:
         disk.setup()
 
-    partitions = storage.partitions
-    for part in partitions:
+    partitions = storage.partitions[:]
+    for part in storage.partitions:
         part.req_bootable = False
+
+        if part.exists or storage.deviceImmutable(part):
+            # if the partition is preexisting or part of a complex device
+            # then we shouldn't modify it
+            partitions.remove(part)
+            continue
+
         if not part.exists:
             # start over with flexible-size requests
             part.req_size = part.req_base_size
@@ -577,7 +584,7 @@ def doPartitioning(storage, exclusiveDisks=None):
     # The number and thus the name of partitions may have changed now,
     # allocatePartitions() takes care of this for new partitions, but not
     # for pre-existing ones, so we update the name of all partitions here
-    for part in partitions:
+    for part in storage.partitions:
         # needed because of XXX hack below
         if part.isExtended:
             continue
-- 
1.6.0.6


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