# HG changeset patch
# User Kaitlin Rupert <karupert(a)us.ibm.com>
# Date 1224689317 25200
# Node ID a8e8c492537e87479011b393f424efd81eb5ea7d
# Parent 09bff95fb0a130f9c5e9ba45ace31de8240a9f6b
Add DisplayController device.
This represents the graphics device for the system.
Signed-off-by: Kaitlin Rupert <karupert(a)us.ibm.com>
diff -r 09bff95fb0a1 -r a8e8c492537e Makefile.am
--- a/Makefile.am Wed Oct 22 08:28:01 2008 -0700
+++ b/Makefile.am Wed Oct 22 08:28:37 2008 -0700
@@ -46,7 +46,8 @@
schema/ConsoleRedirectionService.mof \
schema/ConsoleRedirectionServiceCapabilities.mof \
schema/ServiceAffectsElement.mof \
- schema/KVMRedirectionSAP.mof
+ schema/KVMRedirectionSAP.mof \
+ schema/DisplayController.mof
INTEROP_MOFS = \
schema/ComputerSystem.mof \
@@ -103,7 +104,8 @@
schema/ConsoleRedirectionService.registration \
schema/ConsoleRedirectionServiceCapabilities.registration \
schema/ServiceAffectsElement.registration \
- schema/KVMRedirectionSAP.registration
+ schema/KVMRedirectionSAP.registration \
+ schema/DisplayController.registration
INTEROP_REGS = \
schema/RegisteredProfile.registration \
diff -r 09bff95fb0a1 -r a8e8c492537e libxkutil/device_parsing.c
--- a/libxkutil/device_parsing.c Wed Oct 22 08:28:01 2008 -0700
+++ b/libxkutil/device_parsing.c Wed Oct 22 08:28:37 2008 -0700
@@ -443,6 +443,7 @@
goto err;
vdev->type = CIM_RES_TYPE_GRAPHICS;
+ vdev->id = strdup("graphics");
*vdevs = vdev;
diff -r 09bff95fb0a1 -r a8e8c492537e schema/DisplayController.mof
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/schema/DisplayController.mof Wed Oct 22 08:28:37 2008 -0700
@@ -0,0 +1,17 @@
+// Copyright IBM Corp. 2007
+
+[ Provider("cmpi::Virt_Device") ]
+class Xen_DisplayController : CIM_DisplayController
+{
+};
+
+[ Provider("cmpi::Virt_Device") ]
+class KVM_DisplayController : CIM_DisplayController
+{
+};
+
+[ Provider("cmpi::Virt_Device") ]
+class LXC_DisplayController : CIM_DisplayController
+{
+};
+
diff -r 09bff95fb0a1 -r a8e8c492537e schema/DisplayController.registration
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/schema/DisplayController.registration Wed Oct 22 08:28:37 2008 -0700
@@ -0,0 +1,5 @@
+# Copyright IBM Corp. 2008
+# Classname Namespace ProviderName ProviderModule ProviderTypes
+Xen_DisplayController root/virt Virt_Device Virt_Device instance
+KVM_DisplayController root/virt Virt_Device Virt_Device instance
+LXC_DisplayController root/virt Virt_Device Virt_Device instance
diff -r 09bff95fb0a1 -r a8e8c492537e src/Virt_Device.c
--- a/src/Virt_Device.c Wed Oct 22 08:28:01 2008 -0700
+++ b/src/Virt_Device.c Wed Oct 22 08:28:37 2008 -0700
@@ -175,6 +175,45 @@
return inst;
}
+static int graphics_set_attr(CMPIInstance *instance,
+ struct graphics_device *dev)
+{
+ int rc;
+ char *vp_str = NULL;
+
+ rc = asprintf(&vp_str, "vnc:%s", dev->port);
+ if (rc == -1) {
+ return 0;
+ }
+
+ CMSetProperty(instance, "VideoProcessor",
+ (CMPIValue *)vp_str, CMPI_chars);
+
+ free(vp_str);
+
+ return 1;
+}
+
+static CMPIInstance *graphics_instance(const CMPIBroker *broker,
+ struct graphics_device *dev,
+ const virDomainPtr dom,
+ const char *ns)
+{
+ CMPIInstance *inst;
+ virConnectPtr conn;
+
+ conn = virDomainGetConnect(dom);
+ inst = get_typed_instance(broker,
+ pfx_from_conn(conn),
+ "DisplayController",
+ ns);
+
+ if (!graphics_set_attr(inst, dev))
+ return NULL;
+
+ return inst;
+}
+
static int device_set_devid(CMPIInstance *instance,
struct virt_device *dev,
const virDomainPtr dom)
@@ -314,7 +353,12 @@
else if (dev->type == CIM_RES_TYPE_PROC) {
proc_count = dev->dev.vcpu.quantity;
continue;
- } else
+ } else if (dev->type == CIM_RES_TYPE_GRAPHICS)
+ instance = graphics_instance(broker,
+ &dev->dev.graphics,
+ dom,
+ ns);
+ else
return false;
if (!instance)
@@ -346,6 +390,8 @@
return CIM_RES_TYPE_MEM;
else if (strstr(classname, "Processor"))
return CIM_RES_TYPE_PROC;
+ else if (strstr(classname, "DisplayController"))
+ return CIM_RES_TYPE_GRAPHICS;
else
return CIM_RES_TYPE_UNKNOWN;
}
diff -r 09bff95fb0a1 -r a8e8c492537e src/svpc_types.h
--- a/src/svpc_types.h Wed Oct 22 08:28:01 2008 -0700
+++ b/src/svpc_types.h Wed Oct 22 08:28:37 2008 -0700
@@ -31,12 +31,13 @@
#define CIM_RES_TYPE_GRAPHICS 24
#define CIM_RES_TYPE_UNKNOWN 1000
-#define CIM_RES_TYPE_COUNT 4
+#define CIM_RES_TYPE_COUNT 5
const static int cim_res_types[CIM_RES_TYPE_COUNT] =
{CIM_RES_TYPE_NET,
CIM_RES_TYPE_DISK,
CIM_RES_TYPE_MEM,
CIM_RES_TYPE_PROC,
+ CIM_RES_TYPE_GRAPHICS,
};
#define CIM_VSSD_RECOVERY_NONE 2