[Pkg-libvirt-commits] [libguestfs] 144/165: v2v: Dump out 'source' structure when debugging.

Hilko Bengen bengen at moszumanska.debian.org
Sat Aug 30 08:25:24 UTC 2014


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

bengen pushed a commit to branch experimental
in repository libguestfs.

commit beef28fe9687c962ea095776288c6a90ffef92cf
Author: Richard W.M. Jones <rjones at redhat.com>
Date:   Wed Jun 18 14:18:41 2014 +0100

    v2v: Dump out 'source' structure when debugging.
---
 v2v/types.ml  | 24 ++++++++++++++++++++++++
 v2v/types.mli |  3 +++
 v2v/v2v.ml    |  2 ++
 3 files changed, 29 insertions(+)

diff --git a/v2v/types.ml b/v2v/types.ml
index 0f5ae86..9a41f18 100644
--- a/v2v/types.ml
+++ b/v2v/types.ml
@@ -40,6 +40,30 @@ type source = {
 }
 and source_disk = string * string option
 
+let rec string_of_source s =
+  sprintf "\
+s_dom_type = %s
+s_name = %s
+s_memory = %Ld
+s_vcpu = %d
+s_arch = %s
+s_features = [%s]
+s_disks = [%s]
+"
+    s.s_dom_type
+    s.s_name
+    s.s_memory
+    s.s_vcpu
+    s.s_arch
+    (String.concat "," s.s_features)
+    (String.concat "," (List.map string_of_source_disk s.s_disks))
+
+and string_of_source_disk (path, format) =
+  path ^
+    match format with
+    | None -> ""
+    | Some format -> " (" ^ format ^ ")"
+
 type overlay = {
   ov_overlay : string;
   ov_target_file : string;
diff --git a/v2v/types.mli b/v2v/types.mli
index e7e72e0..87ba291 100644
--- a/v2v/types.mli
+++ b/v2v/types.mli
@@ -43,6 +43,9 @@ type source = {
 and source_disk = string * string option
 (** A source file is a qemu URI and a format. *)
 
+val string_of_source : source -> string
+val string_of_source_disk : source_disk -> string
+
 type overlay = {
   ov_overlay : string;       (** Local overlay file (qcow2 format). *)
   ov_target_file : string;   (** Destination file (real). *)
diff --git a/v2v/v2v.ml b/v2v/v2v.ml
index fd6c049..838354f 100644
--- a/v2v/v2v.ml
+++ b/v2v/v2v.ml
@@ -45,6 +45,8 @@ let rec main () =
     | InputLibvirtXML filename ->
       Source_libvirt.create_from_xml filename in
 
+  if verbose then printf "%s%!" (string_of_source source);
+
   (* Create a qcow2 v3 overlay to protect the source image(s).  There
    * is a specific reason to use the newer qcow2 variant: Because the
    * L2 table can store zero clusters efficiently, and because

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