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

Re: [Libguestfs] [PATCH 2/2] v2v: -o rhv-upload: use same tmpdir for Python scripts



On Thu, Sep 19, 2019 at 02:30:05PM +0200, Pino Toscano wrote:
> Make use of the temporary directory of the rhv-upload mode also for the
> Python scripts that the mode creates, instead of creating new
> directories.
> ---
>  v2v/output_rhv_upload.ml | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/v2v/output_rhv_upload.ml b/v2v/output_rhv_upload.ml
> index eec9c5c79..78e9145c6 100644
> --- a/v2v/output_rhv_upload.ml
> +++ b/v2v/output_rhv_upload.ml
> @@ -106,19 +106,19 @@ class output_rhv_upload output_alloc output_conn
>  
>    (* Create Python scripts for precheck, vmcheck, plugin and create VM. *)
>    let precheck_script =
> -    Python_script.create ~name:"rhv-upload-precheck.py"
> +    Python_script.create ~name:"rhv-upload-precheck.py" ~tmpdir
>                           Output_rhv_upload_precheck_source.code in
>    let vmcheck_script =
> -    Python_script.create ~name:"rhv-upload-vmcheck.py"
> +    Python_script.create ~name:"rhv-upload-vmcheck.py" ~tmpdir
>                           Output_rhv_upload_vmcheck_source.code in
>    let plugin_script =
> -    Python_script.create ~name:"rhv-upload-plugin.py"
> +    Python_script.create ~name:"rhv-upload-plugin.py" ~tmpdir
>                           Output_rhv_upload_plugin_source.code in
>    let createvm_script =
> -    Python_script.create ~name:"rhv-upload-createvm.py"
> +    Python_script.create ~name:"rhv-upload-createvm.py" ~tmpdir
>                           Output_rhv_upload_createvm_source.code in
>    let deletedisks_script =
> -    Python_script.create ~name:"rhv-upload-deletedisks.py"
> +    Python_script.create ~name:"rhv-upload-deletedisks.py" ~tmpdir
>                           Output_rhv_upload_deletedisks_source.code in

Nice change, ACK.

It could even be shorter with:

  let create = Python_script.create ~tmpdir in
  let precheck_script = create "rhv-upload-precheck.py"
                               Output_rhv_upload_precheck_source.code in

etc.  (Labels can be omitted where they are non-ambiguous)

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-p2v converts physical machines to virtual machines.  Boot with a
live CD or over the network (PXE) and turn machines into KVM guests.
http://libguestfs.org/virt-v2v


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