|
|
ffd6ed |
From 93c2eb23dacc9ffa226c92777c498792d7f5a6cf Mon Sep 17 00:00:00 2001
|
|
|
ffd6ed |
From: Shahar Havivi <shaharh@redhat.com>
|
|
|
ffd6ed |
Date: Thu, 25 Dec 2014 11:57:12 +0200
|
|
|
ffd6ed |
Subject: [PATCH] v2v: adding --vdsm-ovf-output option
|
|
|
ffd6ed |
|
|
|
ffd6ed |
This option is needed by vdsm for writing the ovf to a specific directory.
|
|
|
ffd6ed |
The default is current directory.
|
|
|
ffd6ed |
|
|
|
ffd6ed |
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1176598
|
|
|
ffd6ed |
Signed-off-by: Shahar Havivi <shaharh@redhat.com>
|
|
|
ffd6ed |
(cherry picked from commit 14d11916faf68afb672d1626348931f2b90afd08)
|
|
|
ffd6ed |
---
|
|
|
ffd6ed |
v2v/cmdline.ml | 5 +++++
|
|
|
ffd6ed |
v2v/output_vdsm.ml | 16 +++++++---------
|
|
|
ffd6ed |
v2v/output_vdsm.mli | 1 +
|
|
|
ffd6ed |
v2v/test-v2v-o-vdsm-options.sh | 1 +
|
|
|
ffd6ed |
v2v/virt-v2v.pod | 8 +++++++-
|
|
|
ffd6ed |
5 files changed, 21 insertions(+), 10 deletions(-)
|
|
|
ffd6ed |
|
|
|
ffd6ed |
diff --git a/v2v/cmdline.ml b/v2v/cmdline.ml
|
|
|
ffd6ed |
index 14c3fb9..97167b4 100644
|
|
|
ffd6ed |
--- a/v2v/cmdline.ml
|
|
|
ffd6ed |
+++ b/v2v/cmdline.ml
|
|
|
ffd6ed |
@@ -47,6 +47,7 @@ let parse_cmdline () =
|
|
|
ffd6ed |
let qemu_boot = ref false in
|
|
|
ffd6ed |
let quiet = ref false in
|
|
|
ffd6ed |
let vdsm_vm_uuid = ref "" in
|
|
|
ffd6ed |
+ let vdsm_ovf_output = ref "." in
|
|
|
ffd6ed |
let verbose = ref false in
|
|
|
ffd6ed |
let trace = ref false in
|
|
|
ffd6ed |
let vmtype = ref "" in
|
|
|
ffd6ed |
@@ -178,6 +179,8 @@ let parse_cmdline () =
|
|
|
ffd6ed |
Arg.String add_vdsm_vol_uuid, "uuid " ^ s_"Output vol UUID(s)";
|
|
|
ffd6ed |
"--vdsm-vm-uuid",
|
|
|
ffd6ed |
Arg.Set_string vdsm_vm_uuid, "uuid " ^ s_"Output VM UUID";
|
|
|
ffd6ed |
+ "--vdsm-ovf-output",
|
|
|
ffd6ed |
+ Arg.Set_string vdsm_ovf_output, " " ^ s_"Output OVF file";
|
|
|
ffd6ed |
"-v", Arg.Set verbose, " " ^ s_"Enable debugging messages";
|
|
|
ffd6ed |
"--verbose", Arg.Set verbose, ditto;
|
|
|
ffd6ed |
"-V", Arg.Unit display_version, " " ^ s_"Display version and exit";
|
|
|
ffd6ed |
@@ -237,6 +240,7 @@ read the man page virt-v2v(1).
|
|
|
ffd6ed |
let vdsm_image_uuids = List.rev !vdsm_image_uuids in
|
|
|
ffd6ed |
let vdsm_vol_uuids = List.rev !vdsm_vol_uuids in
|
|
|
ffd6ed |
let vdsm_vm_uuid = !vdsm_vm_uuid in
|
|
|
ffd6ed |
+ let vdsm_ovf_output = !vdsm_ovf_output in
|
|
|
ffd6ed |
let verbose = !verbose in
|
|
|
ffd6ed |
let trace = !trace in
|
|
|
ffd6ed |
let vmtype =
|
|
|
ffd6ed |
@@ -386,6 +390,7 @@ read the man page virt-v2v(1).
|
|
|
ffd6ed |
Output_vdsm.image_uuids = vdsm_image_uuids;
|
|
|
ffd6ed |
vol_uuids = vdsm_vol_uuids;
|
|
|
ffd6ed |
vm_uuid = vdsm_vm_uuid;
|
|
|
ffd6ed |
+ ovf_output = vdsm_ovf_output;
|
|
|
ffd6ed |
} in
|
|
|
ffd6ed |
Output_vdsm.output_vdsm verbose output_storage vdsm_params
|
|
|
ffd6ed |
vmtype output_alloc in
|
|
|
ffd6ed |
diff --git a/v2v/output_vdsm.ml b/v2v/output_vdsm.ml
|
|
|
ffd6ed |
index 293f57f..492f586 100644
|
|
|
ffd6ed |
--- a/v2v/output_vdsm.ml
|
|
|
ffd6ed |
+++ b/v2v/output_vdsm.ml
|
|
|
ffd6ed |
@@ -30,6 +30,7 @@ type vdsm_params = {
|
|
|
ffd6ed |
image_uuids : string list;
|
|
|
ffd6ed |
vol_uuids : string list;
|
|
|
ffd6ed |
vm_uuid : string;
|
|
|
ffd6ed |
+ ovf_output : string;
|
|
|
ffd6ed |
}
|
|
|
ffd6ed |
|
|
|
ffd6ed |
class output_vdsm verbose os vdsm_params vmtype output_alloc =
|
|
|
ffd6ed |
@@ -37,12 +38,13 @@ object
|
|
|
ffd6ed |
inherit output verbose
|
|
|
ffd6ed |
|
|
|
ffd6ed |
method as_options =
|
|
|
ffd6ed |
- sprintf "-o vdsm -os %s%s%s --vdsm-vm-uuid %s%s" os
|
|
|
ffd6ed |
+ sprintf "-o vdsm -os %s%s%s --vdsm-vm-uuid %s --vdsm-ovf-output %s%s" os
|
|
|
ffd6ed |
(String.concat ""
|
|
|
ffd6ed |
(List.map (sprintf " --vdsm-image-uuid %s") vdsm_params.image_uuids))
|
|
|
ffd6ed |
(String.concat ""
|
|
|
ffd6ed |
(List.map (sprintf " --vdsm-vol-uuid %s") vdsm_params.vol_uuids))
|
|
|
ffd6ed |
vdsm_params.vm_uuid
|
|
|
ffd6ed |
+ vdsm_params.ovf_output
|
|
|
ffd6ed |
(match vmtype with
|
|
|
ffd6ed |
| None -> ""
|
|
|
ffd6ed |
| Some `Server -> " --vmtype server"
|
|
|
ffd6ed |
@@ -57,9 +59,6 @@ object
|
|
|
ffd6ed |
val mutable dd_mp = ""
|
|
|
ffd6ed |
val mutable dd_uuid = ""
|
|
|
ffd6ed |
|
|
|
ffd6ed |
- (* Target metadata directory. *)
|
|
|
ffd6ed |
- val mutable ovf_dir = ""
|
|
|
ffd6ed |
-
|
|
|
ffd6ed |
(* This is called early on in the conversion and lets us choose the
|
|
|
ffd6ed |
* name of the target files that eventually get written by the main
|
|
|
ffd6ed |
* code.
|
|
|
ffd6ed |
@@ -98,13 +97,12 @@ object
|
|
|
ffd6ed |
) vdsm_params.image_uuids;
|
|
|
ffd6ed |
|
|
|
ffd6ed |
(* Note that VDSM has to create this directory too. *)
|
|
|
ffd6ed |
- ovf_dir <- dd_mp // dd_uuid // "master" // "vms" // vdsm_params.vm_uuid;
|
|
|
ffd6ed |
- if not (is_directory ovf_dir) then
|
|
|
ffd6ed |
+ if not (is_directory vdsm_params.ovf_output) then
|
|
|
ffd6ed |
error (f_"OVF (metadata) directory (%s) does not exist or is not a directory")
|
|
|
ffd6ed |
- ovf_dir;
|
|
|
ffd6ed |
+ vdsm_params.ovf_output;
|
|
|
ffd6ed |
|
|
|
ffd6ed |
if verbose then
|
|
|
ffd6ed |
- eprintf "VDSM: OVF (metadata) directory: %s\n%!" ovf_dir;
|
|
|
ffd6ed |
+ eprintf "VDSM: OVF (metadata) directory: %s\n%!" vdsm_params.ovf_output;
|
|
|
ffd6ed |
|
|
|
ffd6ed |
(* The final directory structure should look like this:
|
|
|
ffd6ed |
* /<MP>/<ESD_UUID>/images/
|
|
|
ffd6ed |
@@ -164,7 +162,7 @@ object
|
|
|
ffd6ed |
vdsm_params.vm_uuid in
|
|
|
ffd6ed |
|
|
|
ffd6ed |
(* Write it to the metadata file. *)
|
|
|
ffd6ed |
- let file = ovf_dir // vdsm_params.vm_uuid ^ ".ovf" in
|
|
|
ffd6ed |
+ let file = vdsm_params.ovf_output // vdsm_params.vm_uuid ^ ".ovf" in
|
|
|
ffd6ed |
let chan = open_out file in
|
|
|
ffd6ed |
doc_to_chan chan ovf;
|
|
|
ffd6ed |
close_out chan
|
|
|
ffd6ed |
diff --git a/v2v/output_vdsm.mli b/v2v/output_vdsm.mli
|
|
|
ffd6ed |
index 3ee5425..26ac15d 100644
|
|
|
ffd6ed |
--- a/v2v/output_vdsm.mli
|
|
|
ffd6ed |
+++ b/v2v/output_vdsm.mli
|
|
|
ffd6ed |
@@ -22,6 +22,7 @@ type vdsm_params = {
|
|
|
ffd6ed |
image_uuids : string list; (* --vdsm-image-uuid (multiple) *)
|
|
|
ffd6ed |
vol_uuids : string list; (* --vdsm-vol-uuid (multiple) *)
|
|
|
ffd6ed |
vm_uuid : string; (* --vdsm-vm-uuid *)
|
|
|
ffd6ed |
+ ovf_output : string; (* --vdsm-ovf-output *)
|
|
|
ffd6ed |
}
|
|
|
ffd6ed |
(** Miscellaneous extra command line parameters used by VDSM. *)
|
|
|
ffd6ed |
|
|
|
ffd6ed |
diff --git a/v2v/test-v2v-o-vdsm-options.sh b/v2v/test-v2v-o-vdsm-options.sh
|
|
|
ffd6ed |
index 8747d8a..e2098fa 100755
|
|
|
ffd6ed |
--- a/v2v/test-v2v-o-vdsm-options.sh
|
|
|
ffd6ed |
+++ b/v2v/test-v2v-o-vdsm-options.sh
|
|
|
ffd6ed |
@@ -69,6 +69,7 @@ $VG virt-v2v --debug-gc \
|
|
|
ffd6ed |
--vdsm-image-uuid IMAGE \
|
|
|
ffd6ed |
--vdsm-vol-uuid VOL \
|
|
|
ffd6ed |
--vdsm-vm-uuid VM \
|
|
|
ffd6ed |
+ --vdsm-ovf-output $d/12345678-1234-1234-1234-123456789abc/master/vms/VM \
|
|
|
ffd6ed |
|
|
|
ffd6ed |
# Test the OVF metadata was created.
|
|
|
ffd6ed |
test -f $d/12345678-1234-1234-1234-123456789abc/master/vms/VM/VM.ovf
|
|
|
ffd6ed |
diff --git a/v2v/virt-v2v.pod b/v2v/virt-v2v.pod
|
|
|
ffd6ed |
index 933955a..7ed2dda 100644
|
|
|
ffd6ed |
--- a/v2v/virt-v2v.pod
|
|
|
ffd6ed |
+++ b/v2v/virt-v2v.pod
|
|
|
ffd6ed |
@@ -483,6 +483,8 @@ OS which is not in the first VirtIO disk.
|
|
|
ffd6ed |
|
|
|
ffd6ed |
=item B<--vdsm-vm-uuid> UUID
|
|
|
ffd6ed |
|
|
|
ffd6ed |
+=item B<--vdsm-ovf-output>
|
|
|
ffd6ed |
+
|
|
|
ffd6ed |
Normally the RHEV output mode chooses random UUIDs for the target
|
|
|
ffd6ed |
guest. However VDSM needs to control the UUIDs and passes these
|
|
|
ffd6ed |
parameters when virt-v2v runs under VDSM control. The parameters
|
|
|
ffd6ed |
@@ -502,7 +504,11 @@ is passed once for each guest disk)
|
|
|
ffd6ed |
|
|
|
ffd6ed |
=item *
|
|
|
ffd6ed |
|
|
|
ffd6ed |
-the VM and OVF file (I<--vdsm-vm-uuid>).
|
|
|
ffd6ed |
+the OVF file name (I<--vdsm-vm-uuid>).
|
|
|
ffd6ed |
+
|
|
|
ffd6ed |
+=item *
|
|
|
ffd6ed |
+
|
|
|
ffd6ed |
+the OVF output directory (default current directory) (I<--vdsm-ovf-output>).
|
|
|
ffd6ed |
|
|
|
ffd6ed |
=back
|
|
|
ffd6ed |
|
|
|
ffd6ed |
--
|
|
|
ffd6ed |
1.8.3.1
|
|
|
ffd6ed |
|