[Pkg-libvirt-commits] [libguestfs] 169/266: v2v: -o rhev: Move inspection functions.

Hilko Bengen bengen at moszumanska.debian.org
Fri Oct 3 14:41:57 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.35-1
in repository libguestfs.

commit 613ae49319245189c085136371957cf110b9224e
Author: Richard W.M. Jones <rjones at redhat.com>
Date:   Mon Aug 25 20:08:56 2014 +0100

    v2v: -o rhev: Move inspection functions.
    
    This is pure refactoring, no functional change.
---
 v2v/output_RHEV.ml | 216 +++++++++++++++++++++++++++--------------------------
 1 file changed, 109 insertions(+), 107 deletions(-)

diff --git a/v2v/output_RHEV.ml b/v2v/output_RHEV.ml
index 735eab2..2005ab9 100644
--- a/v2v/output_RHEV.ml
+++ b/v2v/output_RHEV.ml
@@ -55,6 +55,115 @@ let iso_time =
     (tm.tm_year + 1900) (tm.tm_mon + 1) tm.tm_mday
     tm.tm_hour tm.tm_min tm.tm_sec
 
+(* Guess vmtype based on the guest inspection data.  This is used
+ * when the [--vmtype] parameter is NOT passed.
+ *)
+let get_vmtype = function
+  | { i_type = "linux"; i_distro = "rhel"; i_major_version = major;
+      i_product_name = product }
+      when major >= 5 && string_find product "Server" >= 0 ->
+    `Server
+
+  | { i_type = "linux"; i_distro = "rhel"; i_major_version = major }
+      when major >= 5 ->
+    `Desktop
+
+  | { i_type = "linux"; i_distro = "rhel"; i_major_version = major;
+      i_product_name = product }
+      when major >= 3 && string_find product "ES" >= 0 ->
+    `Server
+
+  | { i_type = "linux"; i_distro = "rhel"; i_major_version = major;
+      i_product_name = product }
+      when major >= 3 && string_find product "AS" >= 0 ->
+    `Server
+
+  | { i_type = "linux"; i_distro = "rhel"; i_major_version = major }
+      when major >= 3 ->
+    `Desktop
+
+  | { i_type = "linux"; i_distro = "fedora" } -> `Desktop
+
+  | { i_type = "windows"; i_major_version = 5; i_minor_version = 1 } ->
+    `Desktop                            (* Windows XP *)
+
+  | { i_type = "windows"; i_major_version = 5; i_minor_version = 2;
+      i_product_name = product } when string_find product "XP" >= 0 ->
+    `Desktop                            (* Windows XP *)
+
+  | { i_type = "windows"; i_major_version = 5; i_minor_version = 2 } ->
+    `Server                             (* Windows 2003 *)
+
+  | { i_type = "windows"; i_major_version = 6; i_minor_version = 0;
+      i_product_name = product } when string_find product "Server" >= 0 ->
+    `Server                             (* Windows 2008 *)
+
+  | { i_type = "windows"; i_major_version = 6; i_minor_version = 0 } ->
+    `Desktop                            (* Vista *)
+
+  | { i_type = "windows"; i_major_version = 6; i_minor_version = 1;
+      i_product_name = product } when string_find product "Server" >= 0 ->
+    `Server                             (* Windows 2008R2 *)
+
+  | { i_type = "windows"; i_major_version = 6; i_minor_version = 1 } ->
+    `Server                             (* Windows 7 *)
+
+  | _ -> `Server
+
+(* Determine the ovf:OperatingSystemSection_Type from libguestfs inspection. *)
+and get_ostype = function
+  | { i_type = "linux"; i_distro = "rhel"; i_major_version = v;
+      i_arch = "i386" } ->
+    sprintf "RHEL%d" v
+
+  | { i_type = "linux"; i_distro = "rhel"; i_major_version = v;
+      i_arch = "x86_64" } ->
+    sprintf "RHEL%dx64" v
+
+  | { i_type = "linux" } -> "OtherLinux"
+
+  | { i_type = "windows"; i_major_version = 5; i_minor_version = 1 } ->
+    "WindowsXP" (* no architecture differentiation of XP on RHEV *)
+
+  | { i_type = "windows"; i_major_version = 5; i_minor_version = 2;
+      i_product_name = product } when string_find product "XP" >= 0 ->
+    "WindowsXP" (* no architecture differentiation of XP on RHEV *)
+
+  | { i_type = "windows"; i_major_version = 5; i_minor_version = 2;
+      i_arch = "i386" } ->
+    "Windows2003"
+
+  | { i_type = "windows"; i_major_version = 5; i_minor_version = 2;
+      i_arch = "x86_64" } ->
+    "Windows2003x64"
+
+  | { i_type = "windows"; i_major_version = 6; i_minor_version = 0;
+      i_arch = "i386" } ->
+    "Windows2008"
+
+  | { i_type = "windows"; i_major_version = 6; i_minor_version = 0;
+      i_arch = "x86_64" } ->
+    "Windows2008x64"
+
+  | { i_type = "windows"; i_major_version = 6; i_minor_version = 1;
+      i_arch = "i386" } ->
+    "Windows7"
+
+  | { i_type = "windows"; i_major_version = 6; i_minor_version = 1;
+      i_arch = "x86_64"; i_product_variant = "Client" } ->
+    "Windows7x64"
+
+  | { i_type = "windows"; i_major_version = 6; i_minor_version = 1;
+      i_arch = "x86_64" } ->
+    "Windows2008R2x64"
+
+  | { i_type = typ; i_distro = distro;
+      i_major_version = major; i_minor_version = minor;
+      i_product_name = product } ->
+    warning ~prog (f_"unknown guest operating system: %s %s %d.%d (%s)")
+      typ distro major minor product;
+    "Unassigned"
+
 class output_rhev verbose os rhev_params output_alloc =
 object
   inherit output verbose
@@ -321,113 +430,6 @@ object
 
   (* This is called after conversion to write the OVF metadata. *)
   method create_metadata source overlays guestcaps inspect =
-    (* Guess vmtype based on the guest inspection data. *)
-    let get_vmtype = function
-      | { i_type = "linux"; i_distro = "rhel"; i_major_version = major;
-          i_product_name = product }
-          when major >= 5 && string_find product "Server" >= 0 ->
-        `Server
-
-      | { i_type = "linux"; i_distro = "rhel"; i_major_version = major }
-          when major >= 5 ->
-        `Desktop
-
-      | { i_type = "linux"; i_distro = "rhel"; i_major_version = major;
-          i_product_name = product }
-          when major >= 3 && string_find product "ES" >= 0 ->
-        `Server
-
-      | { i_type = "linux"; i_distro = "rhel"; i_major_version = major;
-          i_product_name = product }
-          when major >= 3 && string_find product "AS" >= 0 ->
-        `Server
-
-      | { i_type = "linux"; i_distro = "rhel"; i_major_version = major }
-          when major >= 3 ->
-        `Desktop
-
-      | { i_type = "linux"; i_distro = "fedora" } -> `Desktop
-
-      | { i_type = "windows"; i_major_version = 5; i_minor_version = 1 } ->
-        `Desktop                            (* Windows XP *)
-
-      | { i_type = "windows"; i_major_version = 5; i_minor_version = 2;
-          i_product_name = product } when string_find product "XP" >= 0 ->
-        `Desktop                            (* Windows XP *)
-
-      | { i_type = "windows"; i_major_version = 5; i_minor_version = 2 } ->
-        `Server                            (* Windows 2003 *)
-
-      | { i_type = "windows"; i_major_version = 6; i_minor_version = 0;
-          i_product_name = product } when string_find product "Server" >= 0 ->
-        `Server                            (* Windows 2008 *)
-
-      | { i_type = "windows"; i_major_version = 6; i_minor_version = 0 } ->
-        `Desktop                            (* Vista *)
-
-      | { i_type = "windows"; i_major_version = 6; i_minor_version = 1;
-          i_product_name = product } when string_find product "Server" >= 0 ->
-        `Server                             (* Windows 2008R2 *)
-
-      | { i_type = "windows"; i_major_version = 6; i_minor_version = 1 } ->
-        `Server                             (* Windows 7 *)
-
-      | _ -> `Server
-
-    and get_ostype = function
-      | { i_type = "linux"; i_distro = "rhel"; i_major_version = v;
-          i_arch = "i386" } ->
-        sprintf "RHEL%d" v
-
-      | { i_type = "linux"; i_distro = "rhel"; i_major_version = v;
-          i_arch = "x86_64" } ->
-        sprintf "RHEL%dx64" v
-
-      | { i_type = "linux" } -> "OtherLinux"
-
-      | { i_type = "windows"; i_major_version = 5; i_minor_version = 1 } ->
-        "WindowsXP" (* no architecture differentiation of XP on RHEV *)
-
-      | { i_type = "windows"; i_major_version = 5; i_minor_version = 2;
-          i_product_name = product } when string_find product "XP" >= 0 ->
-        "WindowsXP" (* no architecture differentiation of XP on RHEV *)
-
-      | { i_type = "windows"; i_major_version = 5; i_minor_version = 2;
-          i_arch = "i386" } ->
-        "Windows2003"
-
-      | { i_type = "windows"; i_major_version = 5; i_minor_version = 2;
-          i_arch = "x86_64" } ->
-        "Windows2003x64"
-
-      | { i_type = "windows"; i_major_version = 6; i_minor_version = 0;
-          i_arch = "i386" } ->
-        "Windows2008"
-
-      | { i_type = "windows"; i_major_version = 6; i_minor_version = 0;
-          i_arch = "x86_64" } ->
-        "Windows2008x64"
-
-      | { i_type = "windows"; i_major_version = 6; i_minor_version = 1;
-          i_arch = "i386" } ->
-        "Windows7"
-
-      | { i_type = "windows"; i_major_version = 6; i_minor_version = 1;
-          i_arch = "x86_64"; i_product_variant = "Client" } ->
-        "Windows7x64"
-
-      | { i_type = "windows"; i_major_version = 6; i_minor_version = 1;
-          i_arch = "x86_64" } ->
-        "Windows2008R2x64"
-
-      | { i_type = typ; i_distro = distro;
-          i_major_version = major; i_minor_version = minor;
-          i_product_name = product } ->
-        warning ~prog (f_"unknown guest operating system: %s %s %d.%d (%s)")
-          typ distro major minor product;
-        "Unassigned"
-    in
-
     (* This modifies the OVF DOM, adding a section for each disk. *)
     let rec add_disks ovf =
       let references =

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