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