[Libguestfs] [PATCH v2 04/13] resize: introduce filter_part

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


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

diff --git a/resize/resize.ml b/resize/resize.ml
index e69e486..660ac86 100644
--- a/resize/resize.ml
+++ b/resize/resize.ml
@@ -453,14 +453,19 @@ read the man page virt-resize(1).
       error (f_"the source disk has no partitions");
 
     (* Filter out logical partitions.  See note above. *)
-    let parts =
+    let filter_part part_type parts =
       match parttype with
       | GPT -> parts
       | MBR ->
-        List.filter (function
-        | { G.part_num = part_num } when part_num >= 5_l -> false
-        | _ -> true
-        ) parts in
+        match part_type with
+        | PrimaryPartition ->
+          List.filter (function
+          | { G.part_num = part_num } when part_num >= 5_l -> false
+          | _ -> true
+          ) parts
+    in
+
+    let parts = filter_part PrimaryPartition parts in
 
     let partitions =
       List.map (
-- 
1.9.3




More information about the Libguestfs mailing list