Since pty consoles still show up as GraphicsRASDs the check for
VNC redirection proved to be too rigid. Instead of failing the
associator call, PTY consoles will just be ignored now.
This is an old bug, but will be exposed when cimtest is extended
to handle consoles.
Signed-off-by: Viktor Mihajlovski <mihajlov(a)linux.vnet.ibm.com>
Reviewed-by: Daniel Hansel <daniel.hansel(a)linux.vnet.ibm.com>
---
src/Virt_KVMRedirectionSAP.c | 23 +++++++++++++++--------
1 file changed, 15 insertions(+), 8 deletions(-)
diff --git a/src/Virt_KVMRedirectionSAP.c b/src/Virt_KVMRedirectionSAP.c
index 708b0d1..1a2aa69 100644
--- a/src/Virt_KVMRedirectionSAP.c
+++ b/src/Virt_KVMRedirectionSAP.c
@@ -265,9 +265,11 @@ static CMPIStatus get_vnc_sessions(const CMPIBroker *broker,
}
static bool check_graphics(virDomainPtr dom,
- struct domain **dominfo)
+ struct domain **dominfo,
+ int *pos)
{
int ret = 0;
+ int i;
ret = get_dominfo(dom, dominfo);
if (!ret) {
@@ -280,12 +282,16 @@ static bool check_graphics(virDomainPtr dom,
return false;
}
- if (!STREQC((*dominfo)->dev_graphics->dev.graphics.type, "vnc"))
{
- CU_DEBUG("Only vnc devices have console redirection
sessions");
- return false;
+ for (i = 0; i < (*dominfo)->dev_graphics_ct; i++) {
+ if (STREQC((*dominfo)->dev_graphics[i].dev.graphics.type,
"vnc")) {
+ if (pos)
+ *pos = i;
+ return true;
+ }
}
- return true;
+ CU_DEBUG("Only vnc devices have console redirection sessions");
+ return false;
}
static CMPIStatus return_console_sap(const CMPIObjectPath *ref,
@@ -362,12 +368,13 @@ CMPIStatus enum_console_sap(const CMPIBroker *broker,
}
for (i = 0; i < count; i++) {
- if (!check_graphics(domain_list[i], &dominfo)) {
+ int pos;
+ if (!check_graphics(domain_list[i], &dominfo, &pos)) {
cleanup_dominfo(&dominfo);
continue;
}
- ret = sscanf(dominfo->dev_graphics->dev.graphics.dev.vnc.port,
+ ret = sscanf(dominfo->dev_graphics[pos].dev.graphics.dev.vnc.port,
"%d",
&lport);
if (ret != 1) {
@@ -449,7 +456,7 @@ CMPIStatus get_console_sap_by_name(const CMPIBroker *broker,
goto out;
}
- if (!check_graphics(dom, &dominfo)) {
+ if (!check_graphics(dom, &dominfo, NULL)) {
virt_set_status(broker, &s,
CMPI_RC_ERR_FAILED,
conn,
--
1.7.9.5