Shahar Havivi
2014-Dec-23 13:56 UTC
[Libguestfs] [PATCH] v2v: adding --vdsm-ovf-output option
This option is needed by vdsm for writing the ovf to a specific directory. The default is current directory. Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1176598 Signed-off-by: Shahar Havivi <shaharh@redhat.com> --- v2v/cmdline.ml | 5 +++++ v2v/output_vdsm.ml | 16 +++++++--------- v2v/output_vdsm.mli | 1 + v2v/test-v2v-o-vdsm-options.sh | 3 --- v2v/virt-v2v.pod | 10 ++++++++-- 5 files changed, 21 insertions(+), 14 deletions(-) diff --git a/v2v/cmdline.ml b/v2v/cmdline.ml index adea40c..489b4e8 100644 --- a/v2v/cmdline.ml +++ b/v2v/cmdline.ml @@ -45,6 +45,7 @@ let parse_cmdline () let quiet = ref false in let vdsm_image_uuid = ref "" in let vdsm_vm_uuid = ref "" in + let vdsm_ovf_output = ref "." in let verbose = ref false in let trace = ref false in let vmtype = ref "" in @@ -144,6 +145,8 @@ let parse_cmdline () Arg.String add_vdsm_vol_uuid, "uuid " ^ s_"Output vol UUID(s)"; "--vdsm-vm-uuid", Arg.Set_string vdsm_vm_uuid, "uuid " ^ s_"Output VM UUID"; + "--vdsm-ovf-output", + Arg.Set_string vdsm_ovf_output, " " ^ s_"Output OVF file"; "-v", Arg.Set verbose, " " ^ s_"Enable debugging messages"; "--verbose", Arg.Set verbose, ditto; "-V", Arg.Unit display_version, " " ^ s_"Display version and exit"; @@ -199,6 +202,7 @@ read the man page virt-v2v(1). let vdsm_image_uuid = !vdsm_image_uuid in let vdsm_vol_uuids = List.rev !vdsm_vol_uuids in let vdsm_vm_uuid = !vdsm_vm_uuid in + let vdsm_ovf_output = !vdsm_ovf_output in let verbose = !verbose in let trace = !trace in let vmtype @@ -320,6 +324,7 @@ read the man page virt-v2v(1). Output_vdsm.image_uuid = vdsm_image_uuid; vol_uuids = vdsm_vol_uuids; vm_uuid = vdsm_vm_uuid; + ovf_output = vdsm_ovf_output; } in Output_vdsm.output_vdsm verbose output_storage vdsm_params vmtype output_alloc in diff --git a/v2v/output_vdsm.ml b/v2v/output_vdsm.ml index 08d3f09..997466b 100644 --- a/v2v/output_vdsm.ml +++ b/v2v/output_vdsm.ml @@ -30,6 +30,7 @@ type vdsm_params = { image_uuid : string; vol_uuids : string list; vm_uuid : string; + ovf_output : string; } class output_vdsm verbose os vdsm_params vmtype output_alloc @@ -37,11 +38,12 @@ object inherit output verbose method as_options - sprintf "-o vdsm -os %s --vdsm-image-uuid %s%s --vdsm-vm-uuid %s%s" os + sprintf "-o vdsm -os %s --vdsm-image-uuid %s%s --vdsm-vm-uuid %s --vdsm-ovf-output %s%s" os vdsm_params.image_uuid (String.concat "" (List.map (sprintf " --vdsm-vol-uuid %s") vdsm_params.vol_uuids)) vdsm_params.vm_uuid + vdsm_params.ovf_output (match vmtype with | None -> "" | Some `Server -> " --vmtype server" @@ -59,9 +61,6 @@ object (* Target image directory. *) val mutable image_dir = "" - (* Target metadata directory. *) - val mutable ovf_dir = "" - (* This is called early on in the conversion and lets us choose the * name of the target files that eventually get written by the main * code. @@ -98,13 +97,12 @@ object eprintf "VDSM: image directory: %s\n%!" image_dir; (* Note that VDSM has to create this directory too. *) - ovf_dir <- dd_mp // dd_uuid // "master" // "vms" // vdsm_params.vm_uuid; - if not (is_directory ovf_dir) then + if not (is_directory vdsm_params.ovf_output) then error (f_"OVF (metadata) directory (%s) does not exist or is not a directory") - ovf_dir; + vdsm_params.ovf_output; if verbose then - eprintf "VDSM: OVF (metadata) directory: %s\n%!" ovf_dir; + eprintf "VDSM: OVF (metadata) directory: %s\n%!" vdsm_params.ovf_output; (* The final directory structure should look like this: * /<MP>/<ESD_UUID>/images/<IMAGE_UUID>/ @@ -146,7 +144,7 @@ object vdsm_params.vm_uuid in (* Write it to the metadata file. *) - let file = ovf_dir // vdsm_params.vm_uuid ^ ".ovf" in + let file = vdsm_params.ovf_output // vdsm_params.vm_uuid ^ ".ovf" in let chan = open_out file in doc_to_chan chan ovf; close_out chan diff --git a/v2v/output_vdsm.mli b/v2v/output_vdsm.mli index 56ddf55..3f63191 100644 --- a/v2v/output_vdsm.mli +++ b/v2v/output_vdsm.mli @@ -22,6 +22,7 @@ type vdsm_params = { image_uuid : string; (* --vdsm-image-uuid *) vol_uuids : string list; (* --vdsm-vol-uuid (multiple) *) vm_uuid : string; (* --vdsm-vm-uuid *) + ovf_output : string; (* --vdsm-ovf-output *) } (** Miscellaneous extra command line parameters used by VDSM. *) diff --git a/v2v/test-v2v-o-vdsm-options.sh b/v2v/test-v2v-o-vdsm-options.sh index e5bf764..61a9f5e 100755 --- a/v2v/test-v2v-o-vdsm-options.sh +++ b/v2v/test-v2v-o-vdsm-options.sh @@ -55,9 +55,6 @@ mkdir $d mkdir $d/12345678-1234-1234-1234-123456789abc mkdir $d/12345678-1234-1234-1234-123456789abc/images mkdir $d/12345678-1234-1234-1234-123456789abc/images/IMAGE -mkdir $d/12345678-1234-1234-1234-123456789abc/master -mkdir $d/12345678-1234-1234-1234-123456789abc/master/vms -mkdir $d/12345678-1234-1234-1234-123456789abc/master/vms/VM # The --vdsm-*-uuid options don't actually check that the # parameter is a UUID, which is useful here. diff --git a/v2v/virt-v2v.pod b/v2v/virt-v2v.pod index 05817ef..f17439c 100644 --- a/v2v/virt-v2v.pod +++ b/v2v/virt-v2v.pod @@ -421,8 +421,10 @@ OS which is not in the first VirtIO disk. =item B<--vdsm-vm-uuid> UUID +=item B<--vdsm-ovf-output> + Normally the RHEV output mode chooses random UUIDs for the target -guest. However VDSM needs to control the UUIDs and passes these +guest. However VDSM needs to control the UUIDs and passes these parameters when virt-v2v runs under VDSM control. The parameters control: @@ -439,7 +441,11 @@ is passed once for each guest disk) =item * -the VM and OVF file (I<--vdsm-vm-uuid>). +the OVF file name (I<--vdsm-vm-uuid>). + +=item * + +the OVF output directory (defalut current directory) (I<--vdsm-ovf-output>). =back -- 1.9.3
Shahar Havivi
2014-Dec-23 13:58 UTC
[Libguestfs] [PATCH] v2v: adding --vdsm-ovf-output option
This option is needed by vdsm for writing the ovf to a specific directory. The default is current directory. Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1176598 Signed-off-by: Shahar Havivi <shaharh@redhat.com> --- v2v/cmdline.ml | 5 +++++ v2v/output_vdsm.ml | 16 +++++++--------- v2v/output_vdsm.mli | 1 + v2v/test-v2v-o-vdsm-options.sh | 3 --- v2v/virt-v2v.pod | 10 ++++++++-- 5 files changed, 21 insertions(+), 14 deletions(-) diff --git a/v2v/cmdline.ml b/v2v/cmdline.ml index adea40c..489b4e8 100644 --- a/v2v/cmdline.ml +++ b/v2v/cmdline.ml @@ -45,6 +45,7 @@ let parse_cmdline () let quiet = ref false in let vdsm_image_uuid = ref "" in let vdsm_vm_uuid = ref "" in + let vdsm_ovf_output = ref "." in let verbose = ref false in let trace = ref false in let vmtype = ref "" in @@ -144,6 +145,8 @@ let parse_cmdline () Arg.String add_vdsm_vol_uuid, "uuid " ^ s_"Output vol UUID(s)"; "--vdsm-vm-uuid", Arg.Set_string vdsm_vm_uuid, "uuid " ^ s_"Output VM UUID"; + "--vdsm-ovf-output", + Arg.Set_string vdsm_ovf_output, " " ^ s_"Output OVF file"; "-v", Arg.Set verbose, " " ^ s_"Enable debugging messages"; "--verbose", Arg.Set verbose, ditto; "-V", Arg.Unit display_version, " " ^ s_"Display version and exit"; @@ -199,6 +202,7 @@ read the man page virt-v2v(1). let vdsm_image_uuid = !vdsm_image_uuid in let vdsm_vol_uuids = List.rev !vdsm_vol_uuids in let vdsm_vm_uuid = !vdsm_vm_uuid in + let vdsm_ovf_output = !vdsm_ovf_output in let verbose = !verbose in let trace = !trace in let vmtype @@ -320,6 +324,7 @@ read the man page virt-v2v(1). Output_vdsm.image_uuid = vdsm_image_uuid; vol_uuids = vdsm_vol_uuids; vm_uuid = vdsm_vm_uuid; + ovf_output = vdsm_ovf_output; } in Output_vdsm.output_vdsm verbose output_storage vdsm_params vmtype output_alloc in diff --git a/v2v/output_vdsm.ml b/v2v/output_vdsm.ml index 08d3f09..997466b 100644 --- a/v2v/output_vdsm.ml +++ b/v2v/output_vdsm.ml @@ -30,6 +30,7 @@ type vdsm_params = { image_uuid : string; vol_uuids : string list; vm_uuid : string; + ovf_output : string; } class output_vdsm verbose os vdsm_params vmtype output_alloc @@ -37,11 +38,12 @@ object inherit output verbose method as_options - sprintf "-o vdsm -os %s --vdsm-image-uuid %s%s --vdsm-vm-uuid %s%s" os + sprintf "-o vdsm -os %s --vdsm-image-uuid %s%s --vdsm-vm-uuid %s --vdsm-ovf-output %s%s" os vdsm_params.image_uuid (String.concat "" (List.map (sprintf " --vdsm-vol-uuid %s") vdsm_params.vol_uuids)) vdsm_params.vm_uuid + vdsm_params.ovf_output (match vmtype with | None -> "" | Some `Server -> " --vmtype server" @@ -59,9 +61,6 @@ object (* Target image directory. *) val mutable image_dir = "" - (* Target metadata directory. *) - val mutable ovf_dir = "" - (* This is called early on in the conversion and lets us choose the * name of the target files that eventually get written by the main * code. @@ -98,13 +97,12 @@ object eprintf "VDSM: image directory: %s\n%!" image_dir; (* Note that VDSM has to create this directory too. *) - ovf_dir <- dd_mp // dd_uuid // "master" // "vms" // vdsm_params.vm_uuid; - if not (is_directory ovf_dir) then + if not (is_directory vdsm_params.ovf_output) then error (f_"OVF (metadata) directory (%s) does not exist or is not a directory") - ovf_dir; + vdsm_params.ovf_output; if verbose then - eprintf "VDSM: OVF (metadata) directory: %s\n%!" ovf_dir; + eprintf "VDSM: OVF (metadata) directory: %s\n%!" vdsm_params.ovf_output; (* The final directory structure should look like this: * /<MP>/<ESD_UUID>/images/<IMAGE_UUID>/ @@ -146,7 +144,7 @@ object vdsm_params.vm_uuid in (* Write it to the metadata file. *) - let file = ovf_dir // vdsm_params.vm_uuid ^ ".ovf" in + let file = vdsm_params.ovf_output // vdsm_params.vm_uuid ^ ".ovf" in let chan = open_out file in doc_to_chan chan ovf; close_out chan diff --git a/v2v/output_vdsm.mli b/v2v/output_vdsm.mli index 56ddf55..3f63191 100644 --- a/v2v/output_vdsm.mli +++ b/v2v/output_vdsm.mli @@ -22,6 +22,7 @@ type vdsm_params = { image_uuid : string; (* --vdsm-image-uuid *) vol_uuids : string list; (* --vdsm-vol-uuid (multiple) *) vm_uuid : string; (* --vdsm-vm-uuid *) + ovf_output : string; (* --vdsm-ovf-output *) } (** Miscellaneous extra command line parameters used by VDSM. *) diff --git a/v2v/test-v2v-o-vdsm-options.sh b/v2v/test-v2v-o-vdsm-options.sh index e5bf764..61a9f5e 100755 --- a/v2v/test-v2v-o-vdsm-options.sh +++ b/v2v/test-v2v-o-vdsm-options.sh @@ -55,9 +55,6 @@ mkdir $d mkdir $d/12345678-1234-1234-1234-123456789abc mkdir $d/12345678-1234-1234-1234-123456789abc/images mkdir $d/12345678-1234-1234-1234-123456789abc/images/IMAGE -mkdir $d/12345678-1234-1234-1234-123456789abc/master -mkdir $d/12345678-1234-1234-1234-123456789abc/master/vms -mkdir $d/12345678-1234-1234-1234-123456789abc/master/vms/VM # The --vdsm-*-uuid options don't actually check that the # parameter is a UUID, which is useful here. diff --git a/v2v/virt-v2v.pod b/v2v/virt-v2v.pod index 05817ef..cbd7baf 100644 --- a/v2v/virt-v2v.pod +++ b/v2v/virt-v2v.pod @@ -421,8 +421,10 @@ OS which is not in the first VirtIO disk. =item B<--vdsm-vm-uuid> UUID +=item B<--vdsm-ovf-output> + Normally the RHEV output mode chooses random UUIDs for the target -guest. However VDSM needs to control the UUIDs and passes these +guest. However VDSM needs to control the UUIDs and passes these parameters when virt-v2v runs under VDSM control. The parameters control: @@ -439,7 +441,11 @@ is passed once for each guest disk) =item * -the VM and OVF file (I<--vdsm-vm-uuid>). +the OVF file name (I<--vdsm-vm-uuid>). + +=item * + +the OVF output directory (default current directory) (I<--vdsm-ovf-output>). =back -- 1.9.3
Shahar Havivi
2014-Dec-23 14:53 UTC
[Libguestfs] [PATCH] v2v: adding --vdsm-ovf-output option
This option is needed by vdsm for writing the ovf to a specific directory. The default is current directory. Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1176598 Signed-off-by: Shahar Havivi <shaharh@redhat.com> --- v2v/cmdline.ml | 5 +++++ v2v/output_vdsm.ml | 16 +++++++--------- v2v/output_vdsm.mli | 1 + v2v/test-v2v-o-vdsm-options.sh | 3 --- v2v/virt-v2v.pod | 10 ++++++++-- 5 files changed, 21 insertions(+), 14 deletions(-) diff --git a/v2v/cmdline.ml b/v2v/cmdline.ml index 420f897..cd00636 100644 --- a/v2v/cmdline.ml +++ b/v2v/cmdline.ml @@ -47,6 +47,7 @@ let parse_cmdline () let qemu_boot = ref false in let quiet = ref false in let vdsm_vm_uuid = ref "" in + let vdsm_ovf_output = ref "." in let verbose = ref false in let trace = ref false in let vmtype = ref "" in @@ -179,6 +180,8 @@ let parse_cmdline () Arg.String add_vdsm_vol_uuid, "uuid " ^ s_"Output vol UUID(s)"; "--vdsm-vm-uuid", Arg.Set_string vdsm_vm_uuid, "uuid " ^ s_"Output VM UUID"; + "--vdsm-ovf-output", + Arg.Set_string vdsm_ovf_output, " " ^ s_"Output OVF file"; "-v", Arg.Set verbose, " " ^ s_"Enable debugging messages"; "--verbose", Arg.Set verbose, ditto; "-V", Arg.Unit display_version, " " ^ s_"Display version and exit"; @@ -238,6 +241,7 @@ read the man page virt-v2v(1). let vdsm_image_uuids = List.rev !vdsm_image_uuids in let vdsm_vol_uuids = List.rev !vdsm_vol_uuids in let vdsm_vm_uuid = !vdsm_vm_uuid in + let vdsm_ovf_output = !vdsm_ovf_output in let verbose = !verbose in let trace = !trace in let vmtype @@ -385,6 +389,7 @@ read the man page virt-v2v(1). Output_vdsm.image_uuids = vdsm_image_uuids; vol_uuids = vdsm_vol_uuids; vm_uuid = vdsm_vm_uuid; + ovf_output = vdsm_ovf_output; } in Output_vdsm.output_vdsm verbose output_storage vdsm_params vmtype output_alloc in diff --git a/v2v/output_vdsm.ml b/v2v/output_vdsm.ml index 293f57f..492f586 100644 --- a/v2v/output_vdsm.ml +++ b/v2v/output_vdsm.ml @@ -30,6 +30,7 @@ type vdsm_params = { image_uuids : string list; vol_uuids : string list; vm_uuid : string; + ovf_output : string; } class output_vdsm verbose os vdsm_params vmtype output_alloc @@ -37,12 +38,13 @@ object inherit output verbose method as_options - sprintf "-o vdsm -os %s%s%s --vdsm-vm-uuid %s%s" os + sprintf "-o vdsm -os %s%s%s --vdsm-vm-uuid %s --vdsm-ovf-output %s%s" os (String.concat "" (List.map (sprintf " --vdsm-image-uuid %s") vdsm_params.image_uuids)) (String.concat "" (List.map (sprintf " --vdsm-vol-uuid %s") vdsm_params.vol_uuids)) vdsm_params.vm_uuid + vdsm_params.ovf_output (match vmtype with | None -> "" | Some `Server -> " --vmtype server" @@ -57,9 +59,6 @@ object val mutable dd_mp = "" val mutable dd_uuid = "" - (* Target metadata directory. *) - val mutable ovf_dir = "" - (* This is called early on in the conversion and lets us choose the * name of the target files that eventually get written by the main * code. @@ -98,13 +97,12 @@ object ) vdsm_params.image_uuids; (* Note that VDSM has to create this directory too. *) - ovf_dir <- dd_mp // dd_uuid // "master" // "vms" // vdsm_params.vm_uuid; - if not (is_directory ovf_dir) then + if not (is_directory vdsm_params.ovf_output) then error (f_"OVF (metadata) directory (%s) does not exist or is not a directory") - ovf_dir; + vdsm_params.ovf_output; if verbose then - eprintf "VDSM: OVF (metadata) directory: %s\n%!" ovf_dir; + eprintf "VDSM: OVF (metadata) directory: %s\n%!" vdsm_params.ovf_output; (* The final directory structure should look like this: * /<MP>/<ESD_UUID>/images/ @@ -164,7 +162,7 @@ object vdsm_params.vm_uuid in (* Write it to the metadata file. *) - let file = ovf_dir // vdsm_params.vm_uuid ^ ".ovf" in + let file = vdsm_params.ovf_output // vdsm_params.vm_uuid ^ ".ovf" in let chan = open_out file in doc_to_chan chan ovf; close_out chan diff --git a/v2v/output_vdsm.mli b/v2v/output_vdsm.mli index 3ee5425..26ac15d 100644 --- a/v2v/output_vdsm.mli +++ b/v2v/output_vdsm.mli @@ -22,6 +22,7 @@ type vdsm_params = { image_uuids : string list; (* --vdsm-image-uuid (multiple) *) vol_uuids : string list; (* --vdsm-vol-uuid (multiple) *) vm_uuid : string; (* --vdsm-vm-uuid *) + ovf_output : string; (* --vdsm-ovf-output *) } (** Miscellaneous extra command line parameters used by VDSM. *) diff --git a/v2v/test-v2v-o-vdsm-options.sh b/v2v/test-v2v-o-vdsm-options.sh index 8747d8a..c18dcde 100755 --- a/v2v/test-v2v-o-vdsm-options.sh +++ b/v2v/test-v2v-o-vdsm-options.sh @@ -55,9 +55,6 @@ mkdir $d mkdir $d/12345678-1234-1234-1234-123456789abc mkdir $d/12345678-1234-1234-1234-123456789abc/images mkdir $d/12345678-1234-1234-1234-123456789abc/images/IMAGE -mkdir $d/12345678-1234-1234-1234-123456789abc/master -mkdir $d/12345678-1234-1234-1234-123456789abc/master/vms -mkdir $d/12345678-1234-1234-1234-123456789abc/master/vms/VM # The --vdsm-*-uuid options don't actually check that the # parameter is a UUID, which is useful here. diff --git a/v2v/virt-v2v.pod b/v2v/virt-v2v.pod index 4e8942e..a623020 100644 --- a/v2v/virt-v2v.pod +++ b/v2v/virt-v2v.pod @@ -584,8 +584,10 @@ OS which is not in the first VirtIO disk. =item B<--vdsm-vm-uuid> UUID +=item B<--vdsm-ovf-output> + Normally the RHEV output mode chooses random UUIDs for the target -guest. However VDSM needs to control the UUIDs and passes these +guest. However VDSM needs to control the UUIDs and passes these parameters when virt-v2v runs under VDSM control. The parameters control: @@ -603,7 +605,11 @@ is passed once for each guest disk) =item * -the VM and OVF file (I<--vdsm-vm-uuid>). +the OVF file name (I<--vdsm-vm-uuid>). + +=item * + +the OVF output directory (default current directory) (I<--vdsm-ovf-output>). =back -- 1.9.3