[Libvirt-cim] [PATCH] Add sdl graphics device support

Kaitlin Rupert kaitlin at linux.vnet.ibm.com
Fri Nov 21 23:14:20 UTC 2008


# HG changeset patch
# User Kaitlin Rupert <karupert at us.ibm.com>
# Date 1227308913 28800
# Node ID 598515fe705be5738226bb0fe789d7645769e4f3
# Parent  f0d81cc3a08044b9d89854bd7070da163553031f
Add sdl graphics device support

This doesn't expose a template GraphicsRASD of sdl type.

Signed-off-by: Kaitlin Rupert <karupert at us.ibm.com>

diff -r f0d81cc3a080 -r 598515fe705b libxkutil/device_parsing.c
--- a/libxkutil/device_parsing.c	Wed Oct 29 15:31:42 2008 -0700
+++ b/libxkutil/device_parsing.c	Fri Nov 21 15:08:33 2008 -0800
@@ -440,11 +440,16 @@
         gdev->host = get_attr_value(node, "listen");
         gdev->keymap = get_attr_value(node, "keymap");
 
-        if ((gdev->type == NULL) || (gdev->port == NULL))
+        if (gdev->type == NULL)
                 goto err;
 
-        if (gdev->host == NULL)
-                gdev->host = strdup("127.0.0.1");
+        if (STREQC(gdev->type, "vnc")) {
+                if (gdev->port == NULL)
+                        goto err;
+
+                if (gdev->host == NULL)
+                        gdev->host = strdup("127.0.0.1");
+        }
 
         vdev->type = CIM_RES_TYPE_GRAPHICS;
         vdev->id = strdup("graphics");
diff -r f0d81cc3a080 -r 598515fe705b src/Virt_Device.c
--- a/src/Virt_Device.c	Wed Oct 29 15:31:42 2008 -0700
+++ b/src/Virt_Device.c	Fri Nov 21 15:08:33 2008 -0800
@@ -184,10 +184,16 @@
         int rc;
         char *vp_str = NULL;
 
-        rc = asprintf(&vp_str, "vnc:%s", dev->port);
-        if (rc == -1) {
+        if (STREQC(dev->type, "vnc"))
+                rc = asprintf(&vp_str, "%s/%s:%s", 
+                              dev->type, 
+                              dev->host, 
+                              dev->port);
+        else
+                rc = asprintf(&vp_str, "%s", dev->type); 
+
+        if (rc == -1)
                 return 0;
-        }
 
         CMSetProperty(instance, "VideoProcessor",
                       (CMPIValue *)vp_str, CMPI_chars);
diff -r f0d81cc3a080 -r 598515fe705b src/Virt_KVMRedirectionSAP.c
--- a/src/Virt_KVMRedirectionSAP.c	Wed Oct 29 15:31:42 2008 -0700
+++ b/src/Virt_KVMRedirectionSAP.c	Fri Nov 21 15:08:33 2008 -0800
@@ -230,6 +230,11 @@
 
         if ((*dominfo)->dev_graphics == NULL) {
                 CU_DEBUG("No graphics device associated with guest");
+                return false;
+        } 
+
+        if (!STREQC((*dominfo)->dev_graphics->dev.graphics.type, "vnc")) {
+                CU_DEBUG("Only vnc devices have console redirection sessions");
                 return false;
         }
 
diff -r f0d81cc3a080 -r 598515fe705b src/Virt_RASD.c
--- a/src/Virt_RASD.c	Wed Oct 29 15:31:42 2008 -0700
+++ b/src/Virt_RASD.c	Fri Nov 21 15:08:33 2008 -0800
@@ -270,17 +270,23 @@
         char *addr_str = NULL;
         CMPIStatus s = {CMPI_RC_OK, NULL};
 
-        rc = asprintf(&addr_str, 
-                      "%s:%s", 
-                      dev->dev.graphics.host, 
-                      dev->dev.graphics.port);
-        if (rc == -1) {
-                goto out;
+        CMSetProperty(inst, "ResourceSubType", 
+                       (CMPIValue *)dev->dev.graphics.type, CMPI_chars);
+         
+        if (STREQC(dev->dev.graphics.type, "vnc")) {
+                rc = asprintf(&addr_str, 
+                              "%s:%s", 
+                              dev->dev.graphics.host, 
+                              dev->dev.graphics.port);
+                if (rc == -1)
+                        goto out;
+
+                CMSetProperty(inst, "Address", 
+                              (CMPIValue *)addr_str, CMPI_chars);
+
+                CMSetProperty(inst, "KeyMap",
+                             (CMPIValue *)dev->dev.graphics.keymap, CMPI_chars);
         }
-
-        CMSetProperty(inst, "Address", (CMPIValue *)addr_str, CMPI_chars);
-        CMSetProperty(inst, "KeyMap", 
-                      (CMPIValue *)dev->dev.graphics.keymap, CMPI_chars);
 
  out:
         free(addr_str);
diff -r f0d81cc3a080 -r 598515fe705b src/Virt_SettingsDefineCapabilities.c
--- a/src/Virt_SettingsDefineCapabilities.c	Wed Oct 29 15:31:42 2008 -0700
+++ b/src/Virt_SettingsDefineCapabilities.c	Fri Nov 21 15:08:33 2008 -0800
@@ -749,6 +749,7 @@
         CMSetProperty(inst, "Address", (CMPIValue *)addr, CMPI_chars);
 
         CMSetProperty(inst, "KeyMap", (CMPIValue *)"en-us", CMPI_chars);
+        CMSetProperty(inst, "ResourceSubType", (CMPIValue *)"vnc", CMPI_chars);
 
         inst_list_add(list, inst);
 




More information about the Libvirt-cim mailing list