|
|
97ae69 |
From b9b146315156b0debe6902cdcd93f0dbe49370f0 Mon Sep 17 00:00:00 2001
|
|
|
97ae69 |
From: Pino Toscano <ptoscano@redhat.com>
|
|
|
97ae69 |
Date: Wed, 4 Apr 2018 18:18:32 +0200
|
|
|
97ae69 |
Subject: [PATCH] v2v: OVF: write ovirt:id attribute for the OS in OVirt
|
|
|
97ae69 |
flavour
|
|
|
97ae69 |
|
|
|
97ae69 |
When writing the OVF in OVirt flavour, add a ovirt:id attribute to the
|
|
|
97ae69 |
OperatingSystemSection tag: this attribute represents the numeric value
|
|
|
97ae69 |
of the ostype ID, which is ignored by oVirt when parsing OVFs in API
|
|
|
97ae69 |
mode.
|
|
|
97ae69 |
|
|
|
97ae69 |
(cherry picked from commit 593a19cc86cfa8f24c66518c8ba21222550b066a)
|
|
|
97ae69 |
---
|
|
|
97ae69 |
v2v/create_ovf.ml | 202 +++++++++++++++++++++++++++++++++++++++++++++-
|
|
|
97ae69 |
1 file changed, 201 insertions(+), 1 deletion(-)
|
|
|
97ae69 |
|
|
|
97ae69 |
diff --git a/v2v/create_ovf.ml b/v2v/create_ovf.ml
|
|
|
97ae69 |
index bf3741e0f..ccde960df 100644
|
|
|
97ae69 |
--- a/v2v/create_ovf.ml
|
|
|
97ae69 |
+++ b/v2v/create_ovf.ml
|
|
|
97ae69 |
@@ -242,6 +242,203 @@ and get_ostype = function
|
|
|
97ae69 |
typ distro major minor arch product;
|
|
|
97ae69 |
"Unassigned"
|
|
|
97ae69 |
|
|
|
97ae69 |
+(* Determine the ovirt:id attribute from libguestfs inspection.
|
|
|
97ae69 |
+ * See ovirt-engine sources, file:
|
|
|
97ae69 |
+ * packaging/conf/osinfo-defaults.properties
|
|
|
97ae69 |
+ * and also:
|
|
|
97ae69 |
+ * https://bugzilla.redhat.com/show_bug.cgi?id=1219857#c9
|
|
|
97ae69 |
+ *)
|
|
|
97ae69 |
+and get_ovirt_osid = function
|
|
|
97ae69 |
+ | { i_type = "linux"; i_distro = ("rhel"|"centos"); i_major_version = 3;
|
|
|
97ae69 |
+ i_arch = "i386" } ->
|
|
|
97ae69 |
+ 9
|
|
|
97ae69 |
+
|
|
|
97ae69 |
+ | { i_type = "linux"; i_distro = ("rhel"|"centos"); i_major_version = 3;
|
|
|
97ae69 |
+ i_arch = "x86_64" } ->
|
|
|
97ae69 |
+ 15
|
|
|
97ae69 |
+
|
|
|
97ae69 |
+ | { i_type = "linux"; i_distro = ("rhel"|"centos"); i_major_version = 4;
|
|
|
97ae69 |
+ i_arch = "i386" } ->
|
|
|
97ae69 |
+ 8
|
|
|
97ae69 |
+
|
|
|
97ae69 |
+ | { i_type = "linux"; i_distro = ("rhel"|"centos"); i_major_version = 4;
|
|
|
97ae69 |
+ i_arch = "x86_64" } ->
|
|
|
97ae69 |
+ 14
|
|
|
97ae69 |
+
|
|
|
97ae69 |
+ | { i_type = "linux"; i_distro = ("rhel"|"centos"); i_major_version = 5;
|
|
|
97ae69 |
+ i_arch = "i386" } ->
|
|
|
97ae69 |
+ 7
|
|
|
97ae69 |
+
|
|
|
97ae69 |
+ | { i_type = "linux"; i_distro = ("rhel"|"centos"); i_major_version = 5;
|
|
|
97ae69 |
+ i_arch = "x86_64" } ->
|
|
|
97ae69 |
+ 13
|
|
|
97ae69 |
+
|
|
|
97ae69 |
+ | { i_type = "linux"; i_distro = ("rhel"|"centos"); i_major_version = 6;
|
|
|
97ae69 |
+ i_arch = "i386" } ->
|
|
|
97ae69 |
+ 18
|
|
|
97ae69 |
+
|
|
|
97ae69 |
+ | { i_type = "linux"; i_distro = ("rhel"|"centos"); i_major_version = 6;
|
|
|
97ae69 |
+ i_arch = "x86_64" } ->
|
|
|
97ae69 |
+ 19
|
|
|
97ae69 |
+
|
|
|
97ae69 |
+ | { i_type = "linux"; i_distro = ("rhel"|"centos"); i_major_version = 6;
|
|
|
97ae69 |
+ i_minor_version = min; i_arch = ("ppc64"|"ppc64le") } when min >= 9 ->
|
|
|
97ae69 |
+ 1007
|
|
|
97ae69 |
+
|
|
|
97ae69 |
+ | { i_type = "linux"; i_distro = ("rhel"|"centos"); i_major_version = 6;
|
|
|
97ae69 |
+ i_arch = ("ppc64"|"ppc64le") } ->
|
|
|
97ae69 |
+ 1003
|
|
|
97ae69 |
+
|
|
|
97ae69 |
+ | { i_type = "linux"; i_distro = ("rhel"|"centos"); i_major_version = 7;
|
|
|
97ae69 |
+ i_arch = "x86_64" } ->
|
|
|
97ae69 |
+ 24
|
|
|
97ae69 |
+
|
|
|
97ae69 |
+ | { i_type = "linux"; i_distro = ("rhel"|"centos"); i_major_version = 7;
|
|
|
97ae69 |
+ i_arch = ("ppc64"|"ppc64le") } ->
|
|
|
97ae69 |
+ 1006
|
|
|
97ae69 |
+
|
|
|
97ae69 |
+ | { i_type = "linux"; i_distro = ("rhel"|"centos"); i_major_version = 7;
|
|
|
97ae69 |
+ i_arch = "s390x" } ->
|
|
|
97ae69 |
+ 2003
|
|
|
97ae69 |
+
|
|
|
97ae69 |
+ | { i_type = "linux"; i_distro = "sles"; i_major_version = maj;
|
|
|
97ae69 |
+ i_arch = "x86_64" } when maj >= 11 ->
|
|
|
97ae69 |
+ 1193
|
|
|
97ae69 |
+
|
|
|
97ae69 |
+ | { i_type = "linux"; i_distro = "sles"; i_major_version = maj;
|
|
|
97ae69 |
+ i_arch = ("ppc64"|"ppc64le") } when maj >= 11 ->
|
|
|
97ae69 |
+ 1004
|
|
|
97ae69 |
+
|
|
|
97ae69 |
+ | { i_type = "linux"; i_distro = "sles"; i_major_version = maj;
|
|
|
97ae69 |
+ i_arch = "s390x" } when maj >= 12 ->
|
|
|
97ae69 |
+ 2004
|
|
|
97ae69 |
+
|
|
|
97ae69 |
+ (* Only Debian 7 is available, so use it for any 7+ version. *)
|
|
|
97ae69 |
+ | { i_type = "linux"; i_distro = "debian"; i_major_version = v }
|
|
|
97ae69 |
+ when v >= 7 ->
|
|
|
97ae69 |
+ 1300
|
|
|
97ae69 |
+
|
|
|
97ae69 |
+ (* Only Ubuntu 12.04 to 14.04 are available, so use them starting
|
|
|
97ae69 |
+ * from 12.04, and 14.04 for anything after it.
|
|
|
97ae69 |
+ *)
|
|
|
97ae69 |
+ | { i_type = "linux"; i_distro = "ubuntu"; i_major_version = v;
|
|
|
97ae69 |
+ i_arch = ("ppc64"|"ppc64le") } when v >= 14 ->
|
|
|
97ae69 |
+ 1005
|
|
|
97ae69 |
+
|
|
|
97ae69 |
+ | { i_type = "linux"; i_distro = "ubuntu"; i_major_version = v;
|
|
|
97ae69 |
+ i_arch = "s390x" } when v >= 16 ->
|
|
|
97ae69 |
+ 2005
|
|
|
97ae69 |
+
|
|
|
97ae69 |
+ | { i_type = "linux"; i_distro = "ubuntu"; i_major_version = v }
|
|
|
97ae69 |
+ when v >= 14 ->
|
|
|
97ae69 |
+ 1256
|
|
|
97ae69 |
+
|
|
|
97ae69 |
+ | { i_type = "linux"; i_distro = "ubuntu"; i_major_version = 12;
|
|
|
97ae69 |
+ i_minor_version = 4 } ->
|
|
|
97ae69 |
+ 1252
|
|
|
97ae69 |
+
|
|
|
97ae69 |
+ | { i_type = "linux"; i_distro = "ubuntu"; i_major_version = 12;
|
|
|
97ae69 |
+ i_minor_version = 10 } ->
|
|
|
97ae69 |
+ 1253
|
|
|
97ae69 |
+
|
|
|
97ae69 |
+ | { i_type = "linux"; i_distro = "ubuntu"; i_major_version = 13;
|
|
|
97ae69 |
+ i_minor_version = 4 } ->
|
|
|
97ae69 |
+ 1254
|
|
|
97ae69 |
+
|
|
|
97ae69 |
+ | { i_type = "linux"; i_distro = "ubuntu"; i_major_version = 13;
|
|
|
97ae69 |
+ i_minor_version = 10 } ->
|
|
|
97ae69 |
+ 1255
|
|
|
97ae69 |
+
|
|
|
97ae69 |
+ | { i_type = "linux"; i_arch = ("ppc64"|"ppc64le") } ->
|
|
|
97ae69 |
+ 1002
|
|
|
97ae69 |
+
|
|
|
97ae69 |
+ | { i_type = "linux"; i_arch = "s390x" } ->
|
|
|
97ae69 |
+ 2002
|
|
|
97ae69 |
+
|
|
|
97ae69 |
+ | { i_type = "linux" } ->
|
|
|
97ae69 |
+ 5
|
|
|
97ae69 |
+
|
|
|
97ae69 |
+ | { i_type = "windows"; i_major_version = 5; i_minor_version = 1 } ->
|
|
|
97ae69 |
+ 1 (* no architecture differentiation of XP on RHV *)
|
|
|
97ae69 |
+
|
|
|
97ae69 |
+ | { i_type = "windows"; i_major_version = 5; i_minor_version = 2;
|
|
|
97ae69 |
+ i_product_name = product } when String.find product "XP" >= 0 ->
|
|
|
97ae69 |
+ 1 (* no architecture differentiation of XP on RHV *)
|
|
|
97ae69 |
+
|
|
|
97ae69 |
+ | { i_type = "windows"; i_major_version = 5; i_minor_version = 2;
|
|
|
97ae69 |
+ i_arch = "i386" } ->
|
|
|
97ae69 |
+ 3
|
|
|
97ae69 |
+
|
|
|
97ae69 |
+ | { i_type = "windows"; i_major_version = 5; i_minor_version = 2;
|
|
|
97ae69 |
+ i_arch = "x86_64" } ->
|
|
|
97ae69 |
+ 10
|
|
|
97ae69 |
+
|
|
|
97ae69 |
+ | { i_type = "windows"; i_major_version = 6; i_minor_version = 0;
|
|
|
97ae69 |
+ i_arch = "i386" } ->
|
|
|
97ae69 |
+ 4
|
|
|
97ae69 |
+
|
|
|
97ae69 |
+ | { i_type = "windows"; i_major_version = 6; i_minor_version = 0;
|
|
|
97ae69 |
+ i_arch = "x86_64" } ->
|
|
|
97ae69 |
+ 16
|
|
|
97ae69 |
+
|
|
|
97ae69 |
+ | { i_type = "windows"; i_major_version = 6; i_minor_version = 1;
|
|
|
97ae69 |
+ i_arch = "i386" } ->
|
|
|
97ae69 |
+ 11
|
|
|
97ae69 |
+
|
|
|
97ae69 |
+ | { i_type = "windows"; i_major_version = 6; i_minor_version = 1;
|
|
|
97ae69 |
+ i_arch = "x86_64"; i_product_variant = "Client" } ->
|
|
|
97ae69 |
+ 12
|
|
|
97ae69 |
+
|
|
|
97ae69 |
+ | { i_type = "windows"; i_major_version = 6; i_minor_version = 1;
|
|
|
97ae69 |
+ i_arch = "x86_64" } ->
|
|
|
97ae69 |
+ 17
|
|
|
97ae69 |
+
|
|
|
97ae69 |
+ | { i_type = "windows"; i_major_version = 6; i_minor_version = 2;
|
|
|
97ae69 |
+ i_arch = "i386" } ->
|
|
|
97ae69 |
+ 20
|
|
|
97ae69 |
+
|
|
|
97ae69 |
+ | { i_type = "windows"; i_major_version = 6; i_minor_version = 2;
|
|
|
97ae69 |
+ i_arch = "x86_64"; i_product_variant = "Client" } ->
|
|
|
97ae69 |
+ 21
|
|
|
97ae69 |
+
|
|
|
97ae69 |
+ | { i_type = "windows"; i_major_version = 6; i_minor_version = 2;
|
|
|
97ae69 |
+ i_arch = "x86_64" } ->
|
|
|
97ae69 |
+ 23
|
|
|
97ae69 |
+
|
|
|
97ae69 |
+ (* Treat Windows 8.1 client like Windows 8. See:
|
|
|
97ae69 |
+ * https://bugzilla.redhat.com/show_bug.cgi?id=1309580#c4
|
|
|
97ae69 |
+ *)
|
|
|
97ae69 |
+ | { i_type = "windows"; i_major_version = 6; i_minor_version = 3;
|
|
|
97ae69 |
+ i_arch = "i386"; i_product_variant = "Client" } ->
|
|
|
97ae69 |
+ 20
|
|
|
97ae69 |
+
|
|
|
97ae69 |
+ | { i_type = "windows"; i_major_version = 6; i_minor_version = 3;
|
|
|
97ae69 |
+ i_arch = "x86_64"; i_product_variant = "Client" } ->
|
|
|
97ae69 |
+ 21
|
|
|
97ae69 |
+
|
|
|
97ae69 |
+ | { i_type = "windows"; i_major_version = 6; i_minor_version = 3;
|
|
|
97ae69 |
+ i_arch = "x86_64" } ->
|
|
|
97ae69 |
+ 23
|
|
|
97ae69 |
+
|
|
|
97ae69 |
+ | { i_type = "windows"; i_major_version = 10; i_minor_version = 0;
|
|
|
97ae69 |
+ i_arch = "i386" } ->
|
|
|
97ae69 |
+ 26
|
|
|
97ae69 |
+
|
|
|
97ae69 |
+ | { i_type = "windows"; i_major_version = 10; i_minor_version = 0;
|
|
|
97ae69 |
+ i_arch = "x86_64"; i_product_variant = "Client" } ->
|
|
|
97ae69 |
+ 27
|
|
|
97ae69 |
+
|
|
|
97ae69 |
+ | { i_type = "windows"; i_major_version = 10; i_minor_version = 0;
|
|
|
97ae69 |
+ i_arch = "x86_64" } ->
|
|
|
97ae69 |
+ 29
|
|
|
97ae69 |
+
|
|
|
97ae69 |
+ | { i_type = typ; i_distro = distro;
|
|
|
97ae69 |
+ i_major_version = major; i_minor_version = minor; i_arch = arch;
|
|
|
97ae69 |
+ i_product_name = product } ->
|
|
|
97ae69 |
+ warning (f_"unknown guest operating system: %s %s %d.%d %s (%s)")
|
|
|
97ae69 |
+ typ distro major minor arch product;
|
|
|
97ae69 |
+ 0
|
|
|
97ae69 |
+
|
|
|
97ae69 |
(* Set the <Origin/> element based on the source hypervisor.
|
|
|
97ae69 |
* https://bugzilla.redhat.com/show_bug.cgi?id=1342398#c6
|
|
|
97ae69 |
* https://gerrit.ovirt.org/#/c/59147/
|
|
|
97ae69 |
@@ -321,6 +518,7 @@ let rec create_ovf source targets guestcaps inspect
|
|
|
97ae69 |
"xmlns:vssd", "http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData";
|
|
|
97ae69 |
"xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance";
|
|
|
97ae69 |
"xmlns:ovf", "http://schemas.dmtf.org/ovf/envelope/1/";
|
|
|
97ae69 |
+ "xmlns:ovirt", "http://www.ovirt.org/ovf";
|
|
|
97ae69 |
"ovf:version", "0.9"
|
|
|
97ae69 |
] [
|
|
|
97ae69 |
Comment generated_by;
|
|
|
97ae69 |
@@ -383,8 +581,10 @@ let rec create_ovf source targets guestcaps inspect
|
|
|
97ae69 |
] in
|
|
|
97ae69 |
(match ovf_flavour with
|
|
|
97ae69 |
| OVirt ->
|
|
|
97ae69 |
+ let ovirt_osid = get_ovirt_osid inspect in
|
|
|
97ae69 |
e "OperatingSystemSection" ["ovf:id", vm_uuid;
|
|
|
97ae69 |
- "ovf:required", "false"]
|
|
|
97ae69 |
+ "ovf:required", "false";
|
|
|
97ae69 |
+ "ovirt:id", string_of_int ovirt_osid]
|
|
|
97ae69 |
osinfo_subnodes
|
|
|
97ae69 |
| RHVExportStorageDomain ->
|
|
|
97ae69 |
e "Section" ["ovf:id", vm_uuid; "ovf:required", "false";
|
|
|
97ae69 |
--
|
|
|
fd1da6 |
2.17.2
|
|
|
97ae69 |
|