Re: [PATCH KVM-AUTOTEST 2/2] Convert images to JPEG using PIL instead of an external program

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

 



----- "Avi Kivity" <avi@xxxxxxxxxx> wrote:

> This is faster since we don't need to fork/exec/wait for an external
> program each time.
> 
> Signed-off-by: Avi Kivity <avi@xxxxxxxxxx>
> ---
>  client/tests/kvm/kvm_guest_wizard.py |    6 +++---
>  1 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/client/tests/kvm/kvm_guest_wizard.py
> b/client/tests/kvm/kvm_guest_wizard.py
> index 73b830e..f9e5476 100644
> --- a/client/tests/kvm/kvm_guest_wizard.py
> +++ b/client/tests/kvm/kvm_guest_wizard.py
> @@ -1,6 +1,7 @@
>  import os, time, md5, re, shutil, logging
>  from autotest_lib.client.common_lib import utils, error
>  import kvm_utils, ppm_utils, kvm_subprocess
> +import PIL.Image
>  
>  """
>  Utilities to perform automatic guest installation using step files.
> @@ -110,9 +111,8 @@ def barrier_2(vm, words, params, debug_dir,
> data_scrdump_filename,
>              history_scrdump_filename = os.path.join(history_dir,
>                      "scrdump-step_%s-%s.jpg" % (current_step_num,
>                                                 
> time.strftime("%Y%m%d-%H%M%S")))
> -            kvm_subprocess.run_fg("convert -quality 30 %s %s" %
> -                                  (scrdump_filename,
> history_scrdump_filename),
> -                                  logging.debug, "(convert) ",
> timeout=30)
> +            image = PIL.Image.open(scrdump_filename)
> +            image.save(history_scrdump_filename, format = 'JPEG',
> quality = 30)

OK, makes sense -- assuming PIL is as common as ImageMagick, this
should be fine.

(I personally prefer to conform to PEP 8, and the spacing around the
keyword arguments doesn't as far as I know, but that is really a very
minor issue.)

>  
>          # Compare md5sum of barrier region with the expected md5sum
>          calced_md5sum = ppm_utils.get_region_md5sum(w, h, data, x1,
> y1, dx, dy,
> -- 
> 1.6.3.3
> 
> --
> To unsubscribe from this list: send the line "unsubscribe kvm" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux