[Libvirt-cim] [PATCH 1 of 3] (#2) Add input support to xmlgen, add BusType attribute to InputRASD

Kaitlin Rupert kaitlin at linux.vnet.ibm.com
Mon Dec 1 18:20:13 UTC 2008


# HG changeset patch
# User Kaitlin Rupert <karupert at us.ibm.com>
# Date 1227634876 28800
# Node ID a68ad94610cd4681a93803f065be88f728c88d9d
# Parent  f21e9ebf0ad0573bf55be7c16a9d32a07d9ac899
(#2) Add input support to xmlgen, add BusType attribute to InputRASD

Updates from 1 to 2:
 -Instead of pulling the bus type from the RASD caption, add a BusType
  attribute to the InputRASD mof.

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

diff -r f21e9ebf0ad0 -r a68ad94610cd libxkutil/xmlgen.c
--- a/libxkutil/xmlgen.c	Mon Nov 24 13:06:18 2008 -0800
+++ b/libxkutil/xmlgen.c	Tue Nov 25 09:41:16 2008 -0800
@@ -383,6 +383,26 @@
         return true;
 }
 
+static bool input_to_xml(char **xml, struct virt_device *dev)
+{
+        int ret;
+        char *_xml;
+        struct input_device *input = &dev->dev.input;
+
+        ret = asprintf(&_xml,
+                       "<input type='%s' bus='%s'/>\n",
+                       input->type != NULL ? input->type: "mouse",
+                       input->bus != NULL ? input->bus : "ps2");
+        if (ret == -1)
+                return false;
+        else
+                astrcat(xml, _xml);
+
+        free(_xml);
+
+        return true;
+}
+
 static bool concat_devxml(char **xml,
                           struct virt_device *list,
                           int count,
@@ -430,6 +450,9 @@
                 break;
         case CIM_RES_TYPE_GRAPHICS:
                 func = graphics_to_xml;
+                break;
+        case CIM_RES_TYPE_INPUT:
+                func = input_to_xml;
                 break;
         default:
                 return NULL;
@@ -706,6 +729,12 @@
                               dominfo->dev_graphics_ct,
                               graphics_to_xml);
 
+        if (dominfo->dev_input)
+                concat_devxml(&devxml,
+                              dominfo->dev_input,
+                              dominfo->dev_input_ct,
+                              input_to_xml);
+
         console_xml(dominfo, &devxml);
 
         concat_devxml(&sysdevxml,
diff -r f21e9ebf0ad0 -r a68ad94610cd schema/ResourceAllocationSettingData.mof
--- a/schema/ResourceAllocationSettingData.mof	Mon Nov 24 13:06:18 2008 -0800
+++ b/schema/ResourceAllocationSettingData.mof	Tue Nov 25 09:41:16 2008 -0800
@@ -144,6 +144,7 @@
 ]
 class Xen_InputResourceAllocationSettingData : Xen_ResourceAllocationSettingData
 {
+      string BusType;
 };
 
 [Description ("KVM virtual input device"),
@@ -151,6 +152,7 @@
 ]
 class KVM_InputResourceAllocationSettingData : KVM_ResourceAllocationSettingData
 {
+      string BusType;
 };
 
 [Description ("LXC virtual input device"),
@@ -158,5 +160,6 @@
 ]
 class LXC_InputResourceAllocationSettingData : LXC_ResourceAllocationSettingData
 {
+      string BusType;
 };
 
diff -r f21e9ebf0ad0 -r a68ad94610cd src/Virt_RASD.c
--- a/src/Virt_RASD.c	Mon Nov 24 13:06:18 2008 -0800
+++ b/src/Virt_RASD.c	Tue Nov 25 09:41:16 2008 -0800
@@ -314,6 +314,9 @@
 
         CMSetProperty(inst, "ResourceSubType", 
                       (CMPIValue *)dev->dev.input.type, CMPI_chars);
+
+        CMSetProperty(inst, "BusType", 
+                      (CMPIValue *)dev->dev.input.bus, CMPI_chars);
 
         CMSetProperty(inst, "Caption", (CMPIValue *)cap, CMPI_chars);
 
diff -r f21e9ebf0ad0 -r a68ad94610cd src/Virt_SettingsDefineCapabilities.c
--- a/src/Virt_SettingsDefineCapabilities.c	Mon Nov 24 13:06:18 2008 -0800
+++ b/src/Virt_SettingsDefineCapabilities.c	Tue Nov 25 09:41:16 2008 -0800
@@ -793,6 +793,8 @@
 
         CMSetProperty(inst, "ResourceSubType", (CMPIValue *)type, CMPI_chars);
 
+        CMSetProperty(inst, "BusType", (CMPIValue *)bus, CMPI_chars);
+
         CMSetProperty(inst, "Caption", (CMPIValue *)cap, CMPI_chars);
 
         inst_list_add(list, inst);




More information about the Libvirt-cim mailing list