[Libguestfs] [PATCH v2 12/13] resize: add partition type LogicalPartition

Hu Tao hutao at cn.fujitsu.com
Fri Sep 19 07:39:14 UTC 2014


Signed-off-by: Hu Tao <hutao at cn.fujitsu.com>
---
 resize/resize.ml | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/resize/resize.ml b/resize/resize.ml
index 3290ba0..6113095 100644
--- a/resize/resize.ml
+++ b/resize/resize.ml
@@ -76,6 +76,7 @@ and partition_id =
 
 type partition_type =
   | PrimaryPartition
+  | LogicalPartition
 
 let rec debug_partition p =
   eprintf "%s:\n" p.p_name;
@@ -461,6 +462,11 @@ read the man page virt-resize(1).
           | { G.part_num = part_num } when part_num >= 5_l -> false
           | _ -> true
           ) parts
+        | LogicalPartition ->
+            List.filter (function
+            | { G.part_num = part_num } when part_num >= 5_l -> true
+            | _ -> false
+            ) parts
     in
 
     let parts = filter_part part_type parts in
@@ -525,10 +531,12 @@ read the man page virt-resize(1).
     partitions in
 
   let partitions = find_partitions PrimaryPartition in
+  let logical_partitions = find_partitions LogicalPartition in
 
   if verbose then (
-    eprintf "%d partitions found\n" (List.length partitions);
-    List.iter debug_partition partitions
+    eprintf "%d partitions found\n" (List.length partitions + List.length logical_partitions);
+    List.iter debug_partition partitions;
+    List.iter debug_partition logical_partitions
     );
 
   (* Build a data structure describing LVs on the source disk. *)
-- 
1.9.3




More information about the Libguestfs mailing list