Blame SOURCES/libvirt-cim-0.6.3-242ddaa6.patch

9c78f5
From 242ddaa613c4d41cbdd063b73d20292049944b47 Mon Sep 17 00:00:00 2001
9c78f5
From: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
9c78f5
Date: Mon, 7 Oct 2013 16:02:37 +0200
9c78f5
Subject: [PATCH 24/60] KVMRedirectionSAP: Only return redirection SAPs for VNC
9c78f5
 graphics
9c78f5
9c78f5
Since pty consoles still show up as GraphicsRASDs the check for
9c78f5
VNC redirection proved to be too rigid. Instead of failing the
9c78f5
associator call, PTY consoles will just be ignored now.
9c78f5
This is an old bug, but will be exposed when cimtest is extended
9c78f5
to handle consoles.
9c78f5
9c78f5
Signed-off-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
9c78f5
Reviewed-by: Daniel Hansel <daniel.hansel@linux.vnet.ibm.com>
9c78f5
Signed-off-by: John Ferlan <jferlan@redhat.com>
9c78f5
---
9c78f5
 src/Virt_KVMRedirectionSAP.c | 26 +++++++++++++++-----------
9c78f5
 1 file changed, 15 insertions(+), 11 deletions(-)
9c78f5
9c78f5
diff --git a/src/Virt_KVMRedirectionSAP.c b/src/Virt_KVMRedirectionSAP.c
9c78f5
index 708b0d1..1533e52 100644
9c78f5
--- a/src/Virt_KVMRedirectionSAP.c
9c78f5
+++ b/src/Virt_KVMRedirectionSAP.c
9c78f5
@@ -264,28 +264,31 @@ static CMPIStatus get_vnc_sessions(const CMPIBroker *broker,
9c78f5
         return s;
9c78f5
 }
9c78f5
 
9c78f5
-static bool check_graphics(virDomainPtr dom,
9c78f5
-                           struct domain **dominfo)
9c78f5
+static int check_graphics(virDomainPtr dom,
9c78f5
+                          struct domain **dominfo)
9c78f5
 {
9c78f5
         int ret = 0;
9c78f5
+        int i;
9c78f5
 
9c78f5
         ret = get_dominfo(dom, dominfo);
9c78f5
         if (!ret) {
9c78f5
                 CU_DEBUG("Unable to get domain info");
9c78f5
-                return false;
9c78f5
+                return -1;
9c78f5
         }
9c78f5
 
9c78f5
         if ((*dominfo)->dev_graphics == NULL) {
9c78f5
                 CU_DEBUG("No graphics device associated with guest");
9c78f5
-                return false;
9c78f5
+                return -1;
9c78f5
         } 
9c78f5
 
9c78f5
-        if (!STREQC((*dominfo)->dev_graphics->dev.graphics.type, "vnc")) {
9c78f5
-                CU_DEBUG("Only vnc devices have console redirection sessions");
9c78f5
-                return false;
9c78f5
+        for (i = 0; i < (*dominfo)->dev_graphics_ct; i++) {
9c78f5
+                if (STREQC((*dominfo)->dev_graphics[i].dev.graphics.type, "vnc")) {
9c78f5
+                        return i;
9c78f5
+                }
9c78f5
         }
9c78f5
 
9c78f5
-        return true;
9c78f5
+        CU_DEBUG("Only vnc devices have console redirection sessions");
9c78f5
+        return -1;
9c78f5
 }
9c78f5
 
9c78f5
 static CMPIStatus return_console_sap(const CMPIObjectPath *ref,
9c78f5
@@ -362,12 +365,13 @@ CMPIStatus enum_console_sap(const CMPIBroker *broker,
9c78f5
         }
9c78f5
 
9c78f5
         for (i = 0; i < count; i++) {
9c78f5
-                if (!check_graphics(domain_list[i], &dominfo)) {
9c78f5
+                int pos = check_graphics(domain_list[i], &dominfo);
9c78f5
+                if (pos < 0) {
9c78f5
                         cleanup_dominfo(&dominfo);
9c78f5
                         continue;
9c78f5
                 }
9c78f5
 
9c78f5
-                ret = sscanf(dominfo->dev_graphics->dev.graphics.dev.vnc.port,
9c78f5
+                ret = sscanf(dominfo->dev_graphics[pos].dev.graphics.dev.vnc.port,
9c78f5
                              "%d",
9c78f5
                              &lport);
9c78f5
                 if (ret != 1) {
9c78f5
@@ -449,7 +453,7 @@ CMPIStatus get_console_sap_by_name(const CMPIBroker *broker,
9c78f5
                 goto out;
9c78f5
         }
9c78f5
 
9c78f5
-        if (!check_graphics(dom, &dominfo)) {
9c78f5
+        if (check_graphics(dom, &dominfo) < 0) {
9c78f5
                 virt_set_status(broker, &s,
9c78f5
                                 CMPI_RC_ERR_FAILED,
9c78f5
                                 conn,
9c78f5
-- 
9c78f5
2.1.0
9c78f5