[Libguestfs] [PATCH 2/2] v2v: Add --print-target to display overlay and target information.

Tomáš Golembiovský tgolembi at redhat.com
Fri Mar 16 11:29:15 UTC 2018


On Thu, 15 Mar 2018 17:37:46 +0000
"Richard W.M. Jones" <rjones at redhat.com> wrote:

> This is analogous to --print-source, except that it prints the overlay
> and target disk information.
> 
> The output looks like below.  Note there is one overlay and one target
> section per disk.
> 
> Overlay and Target information (--print-target option):
> 
>              overlay file: /home/rjones/d/libguestfs/tmp/v2vovlc687fe.qcow2
>       overlay device name: sda
> overlay virtual disk size: 6442450944
>   overlay source qemu URI: /var/tmp/fedora-27.img
> 
>           target file: [qemu] json:{ "file.driver": "nbd", "file.path": "/home/rjones/d/libguestfs/tmp/rhvupload.IWrzO6/nbdkit0.sock", "file.export": "/" }
>         target format: raw
> target estimated size: 2274060540
> ---
>  v2v/cmdline.ml   | 14 +++++++++++++-
>  v2v/cmdline.mli  |  1 +
>  v2v/types.ml     | 20 +++++++-------------
>  v2v/v2v.ml       | 17 +++++++++++++++++
>  v2v/virt-v2v.pod |  5 +++++
>  5 files changed, 43 insertions(+), 14 deletions(-)
> 
> diff --git a/v2v/cmdline.ml b/v2v/cmdline.ml
> index 4f651825a..6aba4afb5 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
> @@ -233,6 +235,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"rhv-cafile" ], Getopt.String ("ca.pem", set_string_option_once "--rhv-cafile" rhv_cafile),
>                                      s_"For -o rhv-upload, set ‘ca.pem’ file";
> @@ -330,6 +334,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 rhv_cafile = !rhv_cafile in
>    let rhv_direct = !rhv_direct in
> @@ -371,6 +376,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
> @@ -620,6 +631,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;

Not print_target = print_target?

Otherwise LGTM.

    Tomas

-- 
Tomáš Golembiovský <tgolembi at redhat.com>




More information about the Libguestfs mailing list