|
|
97ae69 |
From 7566786efa4e67b64c4160baccbc5be136e485e1 Mon Sep 17 00:00:00 2001
|
|
|
97ae69 |
From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Golembiovsk=C3=BD?= <tgolembi@redhat.com>
|
|
|
97ae69 |
Date: Thu, 22 Feb 2018 11:41:08 +0100
|
|
|
97ae69 |
Subject: [PATCH] v2v: vdsm: add --vdsm-fixed-ovf option
|
|
|
97ae69 |
MIME-Version: 1.0
|
|
|
97ae69 |
Content-Type: text/plain; charset=UTF-8
|
|
|
97ae69 |
Content-Transfer-Encoding: 8bit
|
|
|
97ae69 |
|
|
|
97ae69 |
Add option for -o vdsm that enables output of the modified OVF. oVirt
|
|
|
97ae69 |
engine should already be able to consume the OVF, but let's not take any
|
|
|
97ae69 |
chances and enable it only by command line argument. It can be made
|
|
|
97ae69 |
default later when it receives proper testing.
|
|
|
97ae69 |
|
|
|
97ae69 |
Signed-off-by: Tomáš Golembiovský <tgolembi@redhat.com>
|
|
|
97ae69 |
(cherry picked from commit 285014b290507865fd2020e44ea453af0262b624)
|
|
|
97ae69 |
---
|
|
|
97ae69 |
v2v/cmdline.ml | 10 ++++++++++
|
|
|
97ae69 |
v2v/create_ovf.ml | 7 +++++++
|
|
|
97ae69 |
v2v/create_ovf.mli | 9 +++++++++
|
|
|
97ae69 |
v2v/output_vdsm.ml | 9 +++++++--
|
|
|
97ae69 |
v2v/output_vdsm.mli | 1 +
|
|
|
97ae69 |
v2v/test-v2v-o-vdsm-options.sh | 3 ++-
|
|
|
97ae69 |
v2v/virt-v2v.pod | 20 ++++++++++++++++++++
|
|
|
97ae69 |
7 files changed, 56 insertions(+), 3 deletions(-)
|
|
|
97ae69 |
|
|
|
97ae69 |
diff --git a/v2v/cmdline.ml b/v2v/cmdline.ml
|
|
|
97ae69 |
index 0bc5e9055..e80b0689b 100644
|
|
|
97ae69 |
--- a/v2v/cmdline.ml
|
|
|
97ae69 |
+++ b/v2v/cmdline.ml
|
|
|
97ae69 |
@@ -79,6 +79,11 @@ let parse_cmdline () =
|
|
|
97ae69 |
let vdsm_compat = ref "0.10" in
|
|
|
97ae69 |
let set_vdsm_compat s = vdsm_compat := s in
|
|
|
97ae69 |
|
|
|
97ae69 |
+ let vdsm_ovf_flavour = ref Create_ovf.RHVExportStorageDomain in
|
|
|
97ae69 |
+ let ovf_flavours_str = String.concat "|" Create_ovf.ovf_flavours in
|
|
|
97ae69 |
+ let set_vdsm_ovf_flavour arg =
|
|
|
97ae69 |
+ vdsm_ovf_flavour := Create_ovf.ovf_flavour_of_string arg in
|
|
|
97ae69 |
+
|
|
|
97ae69 |
let set_string_option_once optname optref arg =
|
|
|
97ae69 |
match !optref with
|
|
|
97ae69 |
| Some _ ->
|
|
|
97ae69 |
@@ -249,6 +254,8 @@ let parse_cmdline () =
|
|
|
97ae69 |
s_"Output VM UUID";
|
|
|
97ae69 |
[ L"vdsm-ovf-output" ], Getopt.String ("-", set_string_option_once "--vdsm-ovf-output" vdsm_ovf_output),
|
|
|
97ae69 |
s_"Output OVF file";
|
|
|
97ae69 |
+ [ L"vdsm-ovf-flavour" ], Getopt.Symbol (ovf_flavours_str, Create_ovf.ovf_flavours, set_vdsm_ovf_flavour),
|
|
|
97ae69 |
+ s_"Set the type of generated OVF (default rhvexp)";
|
|
|
97ae69 |
[ L"vmtype" ], Getopt.String ("-", vmtype_warning),
|
|
|
97ae69 |
s_"Ignored for backwards compatibility";
|
|
|
97ae69 |
] in
|
|
|
97ae69 |
@@ -325,6 +332,7 @@ read the man page virt-v2v(1).
|
|
|
97ae69 |
let vdsm_vol_uuids = List.rev !vdsm_vol_uuids in
|
|
|
97ae69 |
let vdsm_vm_uuid = !vdsm_vm_uuid in
|
|
|
97ae69 |
let vdsm_ovf_output = Option.default "." !vdsm_ovf_output in
|
|
|
97ae69 |
+ let vdsm_ovf_flavour = !vdsm_ovf_flavour in
|
|
|
97ae69 |
|
|
|
97ae69 |
(* No arguments and machine-readable mode? Print out some facts
|
|
|
97ae69 |
* about what this binary supports.
|
|
|
97ae69 |
@@ -340,6 +348,7 @@ read the man page virt-v2v(1).
|
|
|
97ae69 |
List.iter (printf "input:%s\n") (Modules_list.input_modules ());
|
|
|
97ae69 |
List.iter (printf "output:%s\n") (Modules_list.output_modules ());
|
|
|
97ae69 |
List.iter (printf "convert:%s\n") (Modules_list.convert_modules ());
|
|
|
97ae69 |
+ List.iter (printf "ovf:%s\n") Create_ovf.ovf_flavours;
|
|
|
97ae69 |
exit 0
|
|
|
97ae69 |
);
|
|
|
97ae69 |
|
|
|
97ae69 |
@@ -545,6 +554,7 @@ read the man page virt-v2v(1).
|
|
|
97ae69 |
vm_uuid = vdsm_vm_uuid;
|
|
|
97ae69 |
ovf_output = vdsm_ovf_output;
|
|
|
97ae69 |
compat = vdsm_compat;
|
|
|
97ae69 |
+ ovf_flavour = vdsm_ovf_flavour;
|
|
|
97ae69 |
} in
|
|
|
97ae69 |
Output_vdsm.output_vdsm os vdsm_options output_alloc,
|
|
|
97ae69 |
output_format, output_alloc in
|
|
|
97ae69 |
diff --git a/v2v/create_ovf.ml b/v2v/create_ovf.ml
|
|
|
97ae69 |
index b9858ff93..f1985ea86 100644
|
|
|
97ae69 |
--- a/v2v/create_ovf.ml
|
|
|
97ae69 |
+++ b/v2v/create_ovf.ml
|
|
|
97ae69 |
@@ -33,6 +33,13 @@ type ovf_flavour =
|
|
|
97ae69 |
| OVirt
|
|
|
97ae69 |
| RHVExportStorageDomain
|
|
|
97ae69 |
|
|
|
97ae69 |
+let ovf_flavours = ["ovirt"; "rhvexp"]
|
|
|
97ae69 |
+
|
|
|
97ae69 |
+let ovf_flavour_of_string = function
|
|
|
97ae69 |
+ | "ovirt" -> OVirt
|
|
|
97ae69 |
+ | "rhvexp" -> RHVExportStorageDomain
|
|
|
97ae69 |
+ | flav -> invalid_arg flav
|
|
|
97ae69 |
+
|
|
|
97ae69 |
(* We set the creation time to be the same for all dates in
|
|
|
97ae69 |
* all metadata files. All dates in OVF are UTC.
|
|
|
97ae69 |
*)
|
|
|
97ae69 |
diff --git a/v2v/create_ovf.mli b/v2v/create_ovf.mli
|
|
|
97ae69 |
index 8a8c7dd12..2d80660e3 100644
|
|
|
97ae69 |
--- a/v2v/create_ovf.mli
|
|
|
97ae69 |
+++ b/v2v/create_ovf.mli
|
|
|
97ae69 |
@@ -20,6 +20,15 @@ type ovf_flavour =
|
|
|
97ae69 |
| OVirt
|
|
|
97ae69 |
| RHVExportStorageDomain
|
|
|
97ae69 |
|
|
|
97ae69 |
+(** The string representation of available OVF flavours. *)
|
|
|
97ae69 |
+val ovf_flavours : string list
|
|
|
97ae69 |
+
|
|
|
97ae69 |
+(** Convert from a string to the corresponding OVF flavour.
|
|
|
97ae69 |
+
|
|
|
97ae69 |
+ Throw [Invalid_argument] if the string does not match any
|
|
|
97ae69 |
+ valid flavour. *)
|
|
|
97ae69 |
+val ovf_flavour_of_string : string -> ovf_flavour
|
|
|
97ae69 |
+
|
|
|
97ae69 |
(** Create OVF and related files for RHV.
|
|
|
97ae69 |
|
|
|
97ae69 |
The format for RHV export storage domain is described in:
|
|
|
97ae69 |
diff --git a/v2v/output_vdsm.ml b/v2v/output_vdsm.ml
|
|
|
97ae69 |
index ce286d327..b76a2e930 100644
|
|
|
97ae69 |
--- a/v2v/output_vdsm.ml
|
|
|
97ae69 |
+++ b/v2v/output_vdsm.ml
|
|
|
97ae69 |
@@ -32,6 +32,7 @@ type vdsm_options = {
|
|
|
97ae69 |
vm_uuid : string;
|
|
|
97ae69 |
ovf_output : string;
|
|
|
97ae69 |
compat : string;
|
|
|
97ae69 |
+ ovf_flavour : Create_ovf.ovf_flavour;
|
|
|
97ae69 |
}
|
|
|
97ae69 |
|
|
|
97ae69 |
class output_vdsm os vdsm_options output_alloc =
|
|
|
97ae69 |
@@ -39,7 +40,7 @@ object
|
|
|
97ae69 |
inherit output
|
|
|
97ae69 |
|
|
|
97ae69 |
method as_options =
|
|
|
97ae69 |
- sprintf "-o vdsm -os %s%s%s --vdsm-vm-uuid %s --vdsm-ovf-output %s%s" os
|
|
|
97ae69 |
+ sprintf "-o vdsm -os %s%s%s --vdsm-vm-uuid %s --vdsm-ovf-output %s%s%s" os
|
|
|
97ae69 |
(String.concat ""
|
|
|
97ae69 |
(List.map (sprintf " --vdsm-image-uuid %s") vdsm_options.image_uuids))
|
|
|
97ae69 |
(String.concat ""
|
|
|
97ae69 |
@@ -49,6 +50,10 @@ object
|
|
|
97ae69 |
(match vdsm_options.compat with
|
|
|
97ae69 |
| "0.10" -> "" (* currently this is the default, so don't print it *)
|
|
|
97ae69 |
| s -> sprintf " --vdsm-compat=%s" s)
|
|
|
97ae69 |
+ (match vdsm_options.ovf_flavour with
|
|
|
97ae69 |
+ | Create_ovf.OVirt -> "--vdsm-ovf-flavour=ovf"
|
|
|
97ae69 |
+ (* currently this is the default, so don't print it *)
|
|
|
97ae69 |
+ | Create_ovf.RHVExportStorageDomain -> "")
|
|
|
97ae69 |
|
|
|
97ae69 |
method supported_firmware = [ TargetBIOS ]
|
|
|
97ae69 |
|
|
|
97ae69 |
@@ -176,7 +181,7 @@ object
|
|
|
97ae69 |
vdsm_options.image_uuids
|
|
|
97ae69 |
vdsm_options.vol_uuids
|
|
|
97ae69 |
vdsm_options.vm_uuid
|
|
|
97ae69 |
- Create_ovf.RHVExportStorageDomain in
|
|
|
97ae69 |
+ vdsm_options.ovf_flavour in
|
|
|
97ae69 |
|
|
|
97ae69 |
(* Write it to the metadata file. *)
|
|
|
97ae69 |
let file = vdsm_options.ovf_output // vdsm_options.vm_uuid ^ ".ovf" in
|
|
|
97ae69 |
diff --git a/v2v/output_vdsm.mli b/v2v/output_vdsm.mli
|
|
|
97ae69 |
index 401a71ec4..6ed684638 100644
|
|
|
97ae69 |
--- a/v2v/output_vdsm.mli
|
|
|
97ae69 |
+++ b/v2v/output_vdsm.mli
|
|
|
97ae69 |
@@ -24,6 +24,7 @@ type vdsm_options = {
|
|
|
97ae69 |
vm_uuid : string; (* --vdsm-vm-uuid *)
|
|
|
97ae69 |
ovf_output : string; (* --vdsm-ovf-output *)
|
|
|
97ae69 |
compat : string; (* --vdsm-compat=0.10|1.1 *)
|
|
|
97ae69 |
+ ovf_flavour : Create_ovf.ovf_flavour;
|
|
|
97ae69 |
}
|
|
|
97ae69 |
(** Miscellaneous extra command line parameters used by VDSM. *)
|
|
|
97ae69 |
|
|
|
97ae69 |
diff --git a/v2v/test-v2v-o-vdsm-options.sh b/v2v/test-v2v-o-vdsm-options.sh
|
|
|
97ae69 |
index 753efc4e7..4ad5d4aad 100755
|
|
|
97ae69 |
--- a/v2v/test-v2v-o-vdsm-options.sh
|
|
|
97ae69 |
+++ b/v2v/test-v2v-o-vdsm-options.sh
|
|
|
97ae69 |
@@ -55,7 +55,8 @@ $VG virt-v2v --debug-gc \
|
|
|
97ae69 |
--vdsm-vol-uuid VOL \
|
|
|
97ae69 |
--vdsm-vm-uuid VM \
|
|
|
97ae69 |
--vdsm-ovf-output $d/12345678-1234-1234-1234-123456789abc/master/vms/VM \
|
|
|
97ae69 |
- --vdsm-compat=1.1
|
|
|
97ae69 |
+ --vdsm-compat=1.1 \
|
|
|
97ae69 |
+ --vdsm-ovf-flavour=ovirt
|
|
|
97ae69 |
|
|
|
97ae69 |
# Test the OVF metadata was created.
|
|
|
97ae69 |
test -f $d/12345678-1234-1234-1234-123456789abc/master/vms/VM/VM.ovf
|
|
|
97ae69 |
diff --git a/v2v/virt-v2v.pod b/v2v/virt-v2v.pod
|
|
|
97ae69 |
index f8a937960..d81a2339c 100644
|
|
|
97ae69 |
--- a/v2v/virt-v2v.pod
|
|
|
97ae69 |
+++ b/v2v/virt-v2v.pod
|
|
|
97ae69 |
@@ -627,6 +627,26 @@ hex digit can be C<0-9> or C<a-f>), conforming to S<OSF DCE 1.1>.
|
|
|
97ae69 |
|
|
|
97ae69 |
These options can only be used with I<-o vdsm>.
|
|
|
97ae69 |
|
|
|
97ae69 |
+=item B<--vdsm-ovf-flavour> flavour
|
|
|
97ae69 |
+
|
|
|
97ae69 |
+This option controls the format of the OVF generated at the end of conversion.
|
|
|
97ae69 |
+Currently there are two possible flavours:
|
|
|
97ae69 |
+
|
|
|
97ae69 |
+=over 4
|
|
|
97ae69 |
+
|
|
|
97ae69 |
+=item rhevexp
|
|
|
97ae69 |
+
|
|
|
97ae69 |
+The OVF format used in RHV export storage domain.
|
|
|
97ae69 |
+
|
|
|
97ae69 |
+=item ovirt
|
|
|
97ae69 |
+
|
|
|
97ae69 |
+The OVF format understood by oVirt REST API.
|
|
|
97ae69 |
+
|
|
|
97ae69 |
+=back
|
|
|
97ae69 |
+
|
|
|
97ae69 |
+For backward compatibility the default is I<rhevexp>, but this may change in
|
|
|
97ae69 |
+the future.
|
|
|
97ae69 |
+
|
|
|
97ae69 |
=item B<-v>
|
|
|
97ae69 |
|
|
|
97ae69 |
=item B<--verbose>
|
|
|
97ae69 |
--
|
|
|
97ae69 |
2.17.1
|
|
|
97ae69 |
|