[PATCH 4/4] Virt: screendump thread - handle IOErrors on PPM conversion

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

 



Under some conditions, monitor screendumps can get truncated,
generating IOError exceptions during PIL conversion. So
handle those errors and log a warning rather than failing
the entire screendump thread.

Signed-off-by: Lucas Meneghel Rodrigues <lmr@xxxxxxxxxx>
---
 client/virt/virt_env_process.py |   14 +++++++++++---
 1 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/client/virt/virt_env_process.py b/client/virt/virt_env_process.py
index 3f996ca..ab2f77e 100644
--- a/client/virt/virt_env_process.py
+++ b/client/virt/virt_env_process.py
@@ -511,9 +511,17 @@ def _take_screendumps(test, params, env):
                     pass
             else:
                 try:
-                    image = PIL.Image.open(temp_filename)
-                    image.save(screendump_filename, format="JPEG", quality=quality)
-                    cache[hash] = screendump_filename
+                    try:
+                        image = PIL.Image.open(temp_filename)
+                        image.save(screendump_filename, format="JPEG",
+                                   quality=quality)
+                        cache[hash] = screendump_filename
+                    except IOError, error_detail:
+                        logging.warning("VM '%s' failed to produce a "
+                                        "screendump: %s", vm.name, error_detail)
+                        # Decrement the counter as we in fact failed to
+                        # produce a converted screendump
+                        counter[vm] -= 1
                 except NameError:
                     pass
             os.unlink(temp_filename)
-- 
1.7.7.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


[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