diff --git a/v2v/cmdline.ml b/v2v/cmdline.ml index d725ae022..faa637aaf 100644 --- a/v2v/cmdline.ml +++ b/v2v/cmdline.ml @@ -44,6 +44,7 @@ type cmdline = { output_format : string option; output_name : string option; print_source : bool; + print_target : bool; root_choice : root_choice; } @@ -53,6 +54,7 @@ let parse_cmdline () = let do_copy = ref true in let machine_readable = ref false in let print_source = ref false in + let print_target = ref false in let qemu_boot = ref false in let input_conn = ref None in @@ -228,6 +230,8 @@ let parse_cmdline () = s_"Use password from file"; [ L"print-source" ], Getopt.Set print_source, s_"Print source and stop"; + [ L"print-target" ], Getopt.Set print_target, + s_"Print target and stop"; [ L"qemu-boot" ], Getopt.Set qemu_boot, s_"Boot in qemu (-o qemu only)"; [ L"root" ], Getopt.String ("ask|... ", set_root_choice), s_"How to choose root filesystem"; @@ -321,6 +325,7 @@ read the man page virt-v2v(1). let output_storage = !output_storage in let password_file = !password_file in let print_source = !print_source in + let print_target = !print_target in let qemu_boot = !qemu_boot in let root_choice = !root_choice in let vddk_options = @@ -359,6 +364,12 @@ read the man page virt-v2v(1). exit 0 ); + (* Some options cannot be used with --in-place. *) + if in_place then ( + if print_target then + error (f_"--in-place and --print-target cannot be used together") + ); + (* Parse out the password from the password file. *) let password = match password_file with @@ -579,6 +590,7 @@ read the man page virt-v2v(1). do_copy = do_copy; in_place = in_place; network_map = network_map; output_alloc = output_alloc; output_format = output_format; output_name = output_name; - print_source = print_source; root_choice = root_choice; + print_source = print_source; print_target; + root_choice = root_choice; }, input, output diff --git a/v2v/cmdline.mli b/v2v/cmdline.mli index 7d88f0f54..0e1d54f40 100644 --- a/v2v/cmdline.mli +++ b/v2v/cmdline.mli @@ -42,6 +42,7 @@ type cmdline = { output_format : string option; output_name : string option; print_source : bool; + print_target : bool; root_choice : Types.root_choice; } diff --git a/v2v/types.ml b/v2v/types.ml index b89bd2fe2..c1f36fdb1 100644 --- a/v2v/types.ml +++ b/v2v/types.ml @@ -281,11 +281,10 @@ type overlay = { } let string_of_overlay ov = - sprintf "\ -ov_overlay_file = %s -ov_sd = %s -ov_virtual_size = %Ld -ov_source = %s + sprintf " overlay file: %s + overlay device name: %s +overlay virtual disk size: %Ld + overlay source qemu URI: %s " ov.ov_overlay_file ov.ov_sd @@ -304,12 +303,9 @@ and target_file = | TargetURI of string let string_of_target t = - sprintf "\ -target_file = %s -target_format = %s -target_estimated_size = %s -target_overlay = %s -target_overlay.ov_source = %s + sprintf " target file: %s + target format: %s +target estimated size: %s " (match t.target_file with | TargetFile s -> "[file] " ^ s @@ -317,8 +313,6 @@ target_overlay.ov_source = %s t.target_format (match t.target_estimated_size with | None -> "None" | Some i -> Int64.to_string i) - t.target_overlay.ov_overlay_file - t.target_overlay.ov_source.s_qemu_uri type target_firmware = TargetBIOS | TargetUEFI diff --git a/v2v/v2v.ml b/v2v/v2v.ml index 2288c2a34..ce48e99f2 100644 --- a/v2v/v2v.ml +++ b/v2v/v2v.ml @@ -150,6 +150,22 @@ let rec main () = g#shutdown (); g#close (); + (match conversion_mode with + | In_place -> () + | Copying (overlays, targets) -> + (* Print overlays/targets and stop. *) + if cmdline.print_target then ( + printf (f_"Overlay and Target information (--print-target option):\n"); + printf "\n"; + List.iter ( + fun (ov, t) -> + printf "%s\n" (string_of_overlay ov); + printf "%s\n" (string_of_target t) + ) (List.combine overlays targets); + exit 0 + ) + ); + (* Copy overlays to target (for [--in-place] this does nothing). *) (match conversion_mode with | In_place -> () @@ -684,6 +700,7 @@ and copy_targets cmdline targets input output = message (f_"Copying disk %d/%d to qemu URI %s (%s)") (i+1) nr_disks s t.target_format ); + debug "%s" (string_of_overlay t.target_overlay); debug "%s" (string_of_target t); (* We noticed that qemu sometimes corrupts the qcow2 file on diff --git a/v2v/virt-v2v.pod b/v2v/virt-v2v.pod index 61f0cb6d7..890b8f55c 100644 --- a/v2v/virt-v2v.pod +++ b/v2v/virt-v2v.pod @@ -616,6 +616,11 @@ Print information about the source guest and stop. This option is useful when you are setting up network and bridge maps. See L. +=item B<--print-target> + +Print information about the target disk(s) and overlay file(s), and +stop. + =item B<--qemu-boot> When using I<-o qemu> only, this boots the guest immediately after