[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [Libguestfs] [PATCH] v2v: make virsh command quiet if v2v is quiet (RHBZ#1358142)



On Wed, Jul 20, 2016 at 11:26:04AM +0200, Pino Toscano wrote:
> Pass -q to virsh if virt-v2v was run with -q, to reduce its output in
> quiet mode.
> 
> Unfortunately this does not currently work in virsh as it should, see
> RHBZ#1358179, so only after that bug is fixed this change can actually
> take effect.
> ---
>  v2v/output_libvirt.ml | 20 ++++++++++++--------
>  1 file changed, 12 insertions(+), 8 deletions(-)
> 
> diff --git a/v2v/output_libvirt.ml b/v2v/output_libvirt.ml
> index d1e9346..1f66d6a 100644
> --- a/v2v/output_libvirt.ml
> +++ b/v2v/output_libvirt.ml
> @@ -394,10 +394,12 @@ class output_libvirt oc output_pool = object
>      (* We copied directly into the final pool directory.  However we
>       * have to tell libvirt.
>       *)
> -    let cmd =
> -      match oc with
> -      | None -> [ "virsh"; "pool-refresh"; output_pool ]
> -      | Some uri -> [ "virsh"; "-c"; uri; "pool-refresh"; output_pool ] in
> +    let cmd = [ "virsh" ] @
> +      (if quiet () then [ "-q" ] else []) @
> +      (match oc with
> +      | None -> []
> +      | Some uri -> [ "-c"; uri; ]) @
> +      [ "pool-refresh"; output_pool ] in
>      if run_command cmd <> 0 then
>        warning (f_"could not refresh libvirt pool %s") output_pool;
>  
> @@ -425,10 +427,12 @@ class output_libvirt oc output_pool = object
>      );
>  
>      (* Define the domain in libvirt. *)
> -    let cmd =
> -      match oc with
> -      | None -> [ "virsh"; "define"; tmpfile ]
> -      | Some uri -> [ "virsh"; "-c"; uri; "define"; tmpfile ] in
> +    let cmd = [ "virsh" ] @
> +      (if quiet () then [ "-q" ] else []) @
> +      (match oc with
> +      | None -> []
> +      | Some uri -> [ "-c"; uri; ]) @
> +      [ "define"; tmpfile ] in
>      if run_command cmd = 0 then (
>        try Unix.unlink tmpfile with _ -> ()
>      ) else (
> -- 
> 2.7.4

Looks good, ACK.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-df lists disk usage of guests without needing to install any
software inside the virtual machine.  Supports Linux and Windows.
http://people.redhat.com/~rjones/virt-df/


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]