[Pkg-libvirt-commits] [libguestfs] 19/40: resize: add function mbr_part_type
Hilko Bengen
bengen at moszumanska.debian.org
Fri Oct 3 14:49:12 UTC 2014
This is an automated email from the git hooks/post-receive script.
bengen pushed a commit to annotated tag debian/1%1.27.57-1
in repository libguestfs.
commit fc34e2d16c2d13d6ae7a381ba931e345ab5ae56d
Author: Hu Tao <hutao at cn.fujitsu.com>
Date: Fri Sep 26 11:04:07 2014 +0800
resize: add function mbr_part_type
Function mbr_part_type returns one of "primary", "extended" and
"logical". The type is used by parted when adding partitions.
Signed-off-by: Hu Tao <hutao at cn.fujitsu.com>
---
resize/resize.ml | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/resize/resize.ml b/resize/resize.ml
index 56be6f3..daa8232 100644
--- a/resize/resize.ml
+++ b/resize/resize.ml
@@ -1095,10 +1095,17 @@ read the man page virt-resize(1).
calculate_target_partitions 1 start ~create_surplus:true partitions in
+ let mbr_part_type x =
+ (* for GPT, all partitions are regarded as Primary Partition. *)
+ if parttype = GPT then "primary"
+ else if x.p_part.G.part_num <= 4l && x.p_type <> ContentExtendedPartition then "primary"
+ else if x.p_part.G.part_num <= 4l && x.p_type = ContentExtendedPartition then "extended"
+ else "logical" in
+
(* Now partition the target disk. *)
List.iter (
fun p ->
- g#part_add "/dev/sdb" "primary" p.p_target_start p.p_target_end
+ g#part_add "/dev/sdb" (mbr_part_type p) p.p_target_start p.p_target_end
) partitions;
(* Copy over the data. *)
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-libvirt/libguestfs.git
More information about the Pkg-libvirt-commits
mailing list