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

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