[Libguestfs] [PATCH 02/10] resize: don't count new size of logical and extended partition

Chen Hanxiao chenhanxiao at cn.fujitsu.com
Thu Apr 23 06:14:14 UTC 2015


It will should be count seperately later.

Signed-off-by: Chen Hanxiao <chenhanxiao at cn.fujitsu.com>
---
 resize/resize.ml | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/resize/resize.ml b/resize/resize.ml
index 42d39c9..9b4b49f 100644
--- a/resize/resize.ml
+++ b/resize/resize.ml
@@ -755,10 +755,12 @@ read the man page virt-resize(1).
     let required = List.fold_left (
       fun total p ->
         let newsize =
-          match p.p_operation with
-          | OpCopy | OpIgnore -> p.p_part.G.part_size
-          | OpDelete -> 0L
-          | OpResize newsize -> newsize in
+          (* size of extended partition and logical partition is calculated seperately *)
+          if p.p_type = ContentExtendedPartition || p.p_mbr_p_type = LogicalPartition then 0L else
+            match p.p_operation with
+            | OpCopy | OpIgnore -> p.p_part.G.part_size
+            | OpDelete -> 0L
+            | OpResize newsize -> newsize in
         total +^ newsize
     ) 0L partitions in
 
-- 
2.1.0




More information about the Libguestfs mailing list