From 06d0d7df9b359a39f62db5226cee4b6e217302a9 Mon Sep 17 00:00:00 2001 From: ss23 Date: Tue, 8 May 2018 14:31:28 +1200 Subject: [PATCH] Add a configuration option for disabling taking a screenshot On my system with 23 running VMs, this takes 1.5 minutes to load /plugins/kimchi/vm beforehand, and 2 seconds when disabled. --- kimchi.conf | 3 +++ model/vms.py | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/kimchi.conf b/kimchi.conf index 5e85e2b8e..d0e3c23de 100644 --- a/kimchi.conf +++ b/kimchi.conf @@ -5,3 +5,6 @@ enable = True [kimchi] # Automatically create ISO pool on server start up create_iso_pool = True +# Toggles whether to take a screenshot for the web-interface +# Warning: Screenshots include a massive performance penalty +take_screenshot = True diff --git a/model/vms.py b/model/vms.py index d97790c78..71cad235c 100644 --- a/model/vms.py +++ b/model/vms.py @@ -1291,8 +1291,10 @@ def lookup(self, name): graphics = self.get_graphics(name, self.conn) graphics_port = graphics[2] graphics_port = graphics_port if state == 'running' else None + # only take a screenshot if configured to do so + take_screenshot = config.get('kimchi', {}).get('take_screenshot', True) try: - if state == 'running' and self._has_video(dom): + if take_screenshot and state == 'running' and self._has_video(dom): screenshot = self.vmscreenshot.lookup(name) elif state == 'shutoff': # reset vm stats when it is powered off to avoid sending