Reviewed-by: ShaoHe Feng <shaohef(a)linux.vnet.ibm.com>
On 03/17/2014 04:48 PM, Mark Wu wrote:
It's observed that if a vm is created by external tool and
doesn't
have video device, libivrt will keep reporting the following error
message:
"internal error: unable to execute QEMU command 'screendump':
There is no QemuConsole I can screendump from."
This patch skips screendump for that kinds of vms to avoid the error
message and repeately sending the black images. On UI side, it changes
to display vm's icon instead of the black image if it doesn't have
video device.
Signed-off-by: Mark Wu <wudxw(a)linux.vnet.ibm.com>
---
src/kimchi/model/vms.py | 6 +++++-
ui/js/src/kimchi.guest_main.js | 2 +-
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/src/kimchi/model/vms.py b/src/kimchi/model/vms.py
index 3b8a666..79b335c 100644
--- a/src/kimchi/model/vms.py
+++ b/src/kimchi/model/vms.py
@@ -275,6 +275,10 @@ class VMModel(object):
def _live_vm_update(self, dom, params):
pass
+ def _has_video(self, dom):
+ dom = ElementTree.fromstring(dom.XMLDesc(0))
+ return dom.find('devices/video') is not None
+
def lookup(self, name):
dom = self.get_vm(name, self.conn)
info = dom.info()
@@ -284,7 +288,7 @@ class VMModel(object):
graphics_type, graphics_listen, graphics_port = graphics
graphics_port = graphics_port if state == 'running' else None
try:
- if state == 'running':
+ if 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
diff --git a/ui/js/src/kimchi.guest_main.js b/ui/js/src/kimchi.guest_main.js
index bdd5a69..8a20d07 100644
--- a/ui/js/src/kimchi.guest_main.js
+++ b/ui/js/src/kimchi.guest_main.js
@@ -186,7 +186,7 @@ kimchi.createGuestLi = function(vmObject, prevScreenImage, openMenu)
{
guestTitle.html(vmObject.name);
//Setup the VM console thumbnail display
- var curImg = vmObject.state == 'running' ? vmObject.screenshot :
vmObject.icon;
+ var curImg = vmObject.screenshot || vmObject.icon;
var load_src = curImg || 'images/icon-vm.png';
var tile_src = prevScreenImage || vmObject['load-src'];
var liveTile=result.find('div[name=guest-tile] > .tile');
--
Thanks and best regards!
Sheldon Feng(冯少合)<shaohef(a)linux.vnet.ibm.com>
IBM Linux Technology Center