[Pkg-libvirt-commits] [libguestfs] 01/17: resize: show sector infor in debug_partition

Hilko Bengen bengen at moszumanska.debian.org
Sun Nov 1 17:12:14 UTC 2015


This is an automated email from the git hooks/post-receive script.

bengen pushed a commit to annotated tag upstream/1.29.43
in repository libguestfs.

commit 7eb1ed8cb4c686f24809dd7904227b5e33d02f9d
Author: Chen Hanxiao <chenhanxiao at cn.fujitsu.com>
Date:   Thu May 14 01:19:36 2015 -0400

    resize: show sector infor in debug_partition
    
    Show partition sector data and target partition sector data
    in debug_partition.
    Also, if --verbose, call debug_partition again before
    parted partitions.
    
    Signed-off-by: Chen Hanxiao <chenhanxiao at cn.fujitsu.com>
    
    RWMJ: Changed ~sectsize:sectsize => ~sectsize
---
 resize/resize.ml | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/resize/resize.ml b/resize/resize.ml
index 8e69d44..40a777c 100644
--- a/resize/resize.ml
+++ b/resize/resize.ml
@@ -80,11 +80,15 @@ and partition_type =
   | LogicalPartition
   | NoTypePartition
 
-let rec debug_partition p =
+let rec debug_partition ?(sectsize=512L) p =
   printf "%s:\n" p.p_name;
   printf "\tpartition data: %ld %Ld-%Ld (%Ld bytes)\n"
     p.p_part.G.part_num p.p_part.G.part_start p.p_part.G.part_end
     p.p_part.G.part_size;
+  printf "\tpartition sector data: %Ld-%Ld\n"
+    (p.p_part.G.part_start /^ sectsize) (p.p_part.G.part_end /^ sectsize);
+  printf "\ttarget partition sector data: %Ld-%Ld \n"
+    p.p_target_start p.p_target_end;
   printf "\tbootable: %b\n" p.p_bootable;
   printf "\tpartition ID: %s\n"
     (match p.p_id with
@@ -545,7 +549,7 @@ read the man page virt-resize(1).
 
   if verbose then (
     printf "%d partitions found\n" (List.length partitions);
-    List.iter debug_partition partitions
+    List.iter (debug_partition ~sectsize) partitions
     );
 
   (* Build a data structure describing LVs on the source disk. *)
@@ -1119,6 +1123,11 @@ read the man page virt-resize(1).
 
     calculate_target_partitions 1 start ~create_surplus:true partitions in
 
+  if verbose then (
+    printf "After calculate target partitions:\n";
+    List.iter (debug_partition ~sectsize) partitions
+  );
+
   let mbr_part_type x =
     match parttype, x.p_part.G.part_num <= 4_l, x.p_type with
     (* for GPT, all partitions are regarded as Primary Partition. *)

-- 
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