[PATCH V2 0/5] Add Controller Device Support

These patches are based on V1. An unexpectable accident makes me only one hand could work now so sorry everything from me takes so long time. Updates from V1: 1. Added 2 break logic in switch. 2. Changed CIM_RES_TYPE_CONTROLLER into 32771. 3. Added XEN/KVM/LXC_Controller classes for cimtest. Most of cimtest testcases have passed except the following: -------------------------------------------------------------------- HostSystem - 02_hostsystem_to_rasd.py: FAIL ERROR - Failed to get associators information for KVM_SettingsDefineState ERROR - Exception: u'KVM_Controller' -------------------------------------------------------------------- -------------------------------------------------------------------- RASD - 03_rasd_errs.py: FAIL ERROR - Expected 6 RASDs, got 7 -------------------------------------------------------------------- -------------------------------------------------------------------- ResourceAllocationFromPool - 01_forward.py: FAIL ERROR - 7 RASD insts != 6 pool insts -------------------------------------------------------------------- ResourceAllocationFromPool - 02_reverse.py: FAIL ERROR - 7 RASD insts != 6 pool insts -------------------------------------------------------------------- -------------------------------------------------------------------- SettingsDefine - 01_forward.py: FAIL ERROR - 6 device insts != 7 RASD insts -------------------------------------------------------------------- SettingsDefine - 02_reverse.py: FAIL ERROR - u'KVM_Controller' -------------------------------------------------------------------- -------------------------------------------------------------------- SystemDevice - 01_forward.py: FAIL 01_forward.py:29: DeprecationWarning: the sets module is deprecated from sets import Set ERROR - Device Class mismatch ERROR - Exception Expected Device class list: ['KVM_DisplayController', 'KVM_LogicalDisk', 'KVM_Memory', 'KVM_NetworkPort', 'KVM_PointingDevice', 'KVM_Processor'] Got: [u'KVM_Controller', u'KVM_DisplayController', u'KVM_LogicalDisk', u'KVM_Memory', u'KVM_NetworkPort', u'KVM_PointingDevice', u'KVM_Processor'] -------------------------------------------------------------------- -------------------------------------------------------------------- VirtualSystemSettingDataComponent - 02_reverse.py: FAIL ERROR - Unexpected RASD instance type ERROR - Mistmatching association value -------------------------------------------------------------------- I think they are caused by the parameter set of cimtest (such as KVM_Controller or ControllerResourceAllocationSettingData should be added into some arrays. But if you find they are caused by my coding errors, please let me know, thanks). I'll fix these issues of cimtest later. Dear John and Boris, could you help me testing it on RHEL6.5? I just have an upgraded version and introduced some packages from CentOS source (I am worried about they may influence the testing result). I'll rebuild my developing environment later using pure RHEL 6.5 version. Xu Wang (5): libxutil: Controller Support RASD: Schema and Provider Support for Controller RASDs VSMS: Support for domains with controller devices Device: CIM_LogicalDevice for controllers Virt_Device: Add a device class for controllers Makefile.am | 2 + libvirt-cim.spec.in | 2 + libxkutil/device_parsing.c | 70 ++++++++++++++++++++- libxkutil/device_parsing.h | 9 +++ libxkutil/xmlgen.c | 30 +++++++++ schema/Controller.mof | 16 +++++ schema/Controller.registration | 5 ++ schema/ResourceAllocationSettingData.mof | 27 ++++++++ schema/ResourceAllocationSettingData.registration | 3 + src/Virt_Device.c | 36 ++++++++++- src/Virt_ElementAllocatedFromPool.c | 6 ++ src/Virt_ElementSettingData.c | 3 + src/Virt_RASD.c | 24 +++++++ src/Virt_ServiceAffectsElement.c | 6 ++- src/Virt_SettingsDefineState.c | 6 ++ src/Virt_SystemDevice.c | 3 + src/Virt_VSSDComponent.c | 3 + src/Virt_VirtualSystemManagementService.c | 44 +++++++++++++ src/svpc_types.h | 4 +- 19 files changed, 295 insertions(+), 4 deletions(-) create mode 100644 schema/Controller.mof create mode 100644 schema/Controller.registration

Signed-off-by: Xu Wang <gesaint@linux.vnet.ibm.com> --- libxkutil/device_parsing.c | 70 +++++++++++++++++++++++++++++++++++++++++++- libxkutil/device_parsing.h | 9 +++++ libxkutil/xmlgen.c | 30 +++++++++++++++++++ src/svpc_types.h | 4 ++- 4 files changed, 111 insertions(+), 2 deletions(-) diff --git a/libxkutil/device_parsing.c b/libxkutil/device_parsing.c index d2d3859..4240243 100644 --- a/libxkutil/device_parsing.c +++ b/libxkutil/device_parsing.c @@ -1,5 +1,5 @@ /* - * Copyright IBM Corp. 2007, 2013 + * Copyright IBM Corp. 2007, 2014 * * Authors: * Dan Smith <danms@us.ibm.com> @@ -49,6 +49,7 @@ #define GRAPHICS_XPATH (xmlChar *)"/domain/devices/graphics | "\ "/domain/devices/console" #define INPUT_XPATH (xmlChar *)"/domain/devices/input" +#define CONTROLLER_XPATH (xmlChar *)"/domain/devices/controller" #define DEFAULT_BRIDGE "xenbr0" #define DEFAULT_NETWORK "default" @@ -308,6 +309,15 @@ static void cleanup_input_device(struct input_device *dev) free(dev->bus); } +static void cleanup_controller_device(struct controller_device *dev) +{ + if (dev == NULL) + return; + + free(dev->type); + free(dev->model); +} + void cleanup_virt_device(struct virt_device *dev) { if (dev == NULL) @@ -325,6 +335,8 @@ void cleanup_virt_device(struct virt_device *dev) cleanup_input_device(&dev->dev.input); else if (dev->type == CIM_RES_TYPE_CONSOLE) cleanup_console_device(&dev->dev.console); + else if (dev->type == CIM_RES_TYPE_CONTROLLER) + cleanup_controller_device(&dev->dev.controller); free(dev->id); @@ -1107,6 +1119,49 @@ static int parse_input_device(xmlNode *node, struct virt_device **vdevs) return 0; } +static int parse_controller_device(xmlNode *node, struct virt_device **vdevs) +{ + struct virt_device *vdev = NULL; + struct controller_device *cdev = NULL; + char *index = NULL; + int ret; + + vdev = calloc(1, sizeof(*vdev)); + if (vdev == NULL) + goto err; + + cdev = &(vdev->dev.controller); + + cdev->type = get_attr_value(node, "type"); + cdev->model = get_attr_value(node, "model"); + if (cdev->model == NULL) { + cdev->model = strdup(""); + } + index = get_attr_value(node, "index"); + + if (cdev->type == NULL) + goto err; + + vdev->type = CIM_RES_TYPE_CONTROLLER; + + ret = asprintf(&vdev->id, "%s:%s", cdev->type, index); + if (ret == -1) { + CU_DEBUG("Failed to create controller id string"); + goto err; + } + + *vdevs = vdev; + free(index); + + return 1; + err: + free(index); + cleanup_controller_device(cdev); + free(vdev); + + return 0; +} + static bool resize_devlist(struct virt_device **list, int newsize) { struct virt_device *_list; @@ -1230,6 +1285,11 @@ static int parse_devices(const char *xml, struct virt_device **_list, int type) func = &parse_input_device; break; + case CIM_RES_TYPE_CONTROLLER: + xpathstr = CONTROLLER_XPATH; + func = &parse_controller_device; + break; + default: CU_DEBUG("Unrecognized device type. Returning."); goto err1; @@ -1351,7 +1411,11 @@ struct virt_device *virt_device_dup(struct virt_device *_dev) } else if (dev->type == CIM_RES_TYPE_CONSOLE) { console_device_dup(&dev->dev.console, &_dev->dev.console); + } else if (dev->type == CIM_RES_TYPE_CONTROLLER) { + DUP_FIELD(dev, _dev, dev.controller.type); + DUP_FIELD(dev, _dev, dev.controller.model); } + return dev; } @@ -1731,6 +1795,9 @@ int get_dominfo_from_xml(const char *xml, struct domain **dominfo) (*dominfo)->dev_vcpu_ct = parse_devices(xml, &(*dominfo)->dev_vcpu, CIM_RES_TYPE_PROC); + (*dominfo)->dev_controller_ct = parse_devices(xml, + &(*dominfo)->dev_controller, + CIM_RES_TYPE_CONTROLLER); return ret; @@ -1819,6 +1886,7 @@ void cleanup_dominfo(struct domain **dominfo) cleanup_virt_devices(&dom->dev_graphics, dom->dev_graphics_ct); cleanup_virt_devices(&dom->dev_input, dom->dev_input_ct); cleanup_virt_devices(&dom->dev_console, dom->dev_console_ct); + cleanup_virt_devices(&dom->dev_controller, dom->dev_controller_ct); free(dom); diff --git a/libxkutil/device_parsing.h b/libxkutil/device_parsing.h index a92e223..cc58970 100644 --- a/libxkutil/device_parsing.h +++ b/libxkutil/device_parsing.h @@ -163,6 +163,11 @@ struct input_device { char *bus; }; +struct controller_device { + char *type; + char *model; +}; + struct virt_device { uint16_t type; union { @@ -174,6 +179,7 @@ struct virt_device { struct graphics_device graphics; struct console_device console; struct input_device input; + struct controller_device controller; } dev; char *id; }; @@ -249,6 +255,9 @@ struct domain { struct virt_device *dev_vcpu; int dev_vcpu_ct; + + struct virt_device *dev_controller; + int dev_controller_ct; }; struct virt_device *virt_device_dup(struct virt_device *dev); diff --git a/libxkutil/xmlgen.c b/libxkutil/xmlgen.c index 18c4765..529c946 100644 --- a/libxkutil/xmlgen.c +++ b/libxkutil/xmlgen.c @@ -798,6 +798,30 @@ static const char *input_xml(xmlNodePtr root, struct domain *dominfo) return NULL; } +static const char *controller_xml(xmlNodePtr root, struct domain *dominfo) +{ + int i; + + for (i = 0; i < dominfo->dev_controller_ct; i++) { + xmlNodePtr tmp; + struct virt_device *_dev = &dominfo->dev_controller[i]; + if (_dev->type == CIM_RES_TYPE_UNKNOWN) + continue; + + struct controller_device *dev = &_dev->dev.controller; + + tmp = xmlNewChild(root, NULL, BAD_CAST "controller", NULL); + if (tmp == NULL) + return XML_ERROR; + + xmlNewProp(tmp, BAD_CAST "type", BAD_CAST dev->type); + if (!STREQC(dev->model, "")) + xmlNewProp(tmp, BAD_CAST "model", BAD_CAST dev->model); + } + + return NULL; +} + static char *system_xml(xmlNodePtr root, struct domain *domain) { xmlNodePtr tmp; @@ -1129,6 +1153,11 @@ char *device_to_xml(struct virt_device *_dev) dominfo->dev_input_ct = 1; dominfo->dev_input = dev; break; + case CIM_RES_TYPE_CONTROLLER: + func = controller_xml; + dominfo->dev_controller_ct = 1; + dominfo->dev_controller = dev; + break; default: cleanup_virt_devices(&dev, 1); goto out; @@ -1167,6 +1196,7 @@ char *system_to_xml(struct domain *dominfo) &console_xml, &graphics_xml, &emu_xml, + &controller_xml, NULL }; diff --git a/src/svpc_types.h b/src/svpc_types.h index 404e428..7a2b653 100644 --- a/src/svpc_types.h +++ b/src/svpc_types.h @@ -36,8 +36,9 @@ #define CIM_RES_TYPE_IMAGE 32768 #define CIM_RES_TYPE_CONSOLE 32769 #define CIM_RES_TYPE_EMU 32770 +#define CIM_RES_TYPE_CONTROLLER 32771 -#define CIM_RES_TYPE_COUNT 7 +#define CIM_RES_TYPE_COUNT 8 const static int cim_res_types[CIM_RES_TYPE_COUNT] = {CIM_RES_TYPE_NET, CIM_RES_TYPE_DISK, @@ -46,6 +47,7 @@ const static int cim_res_types[CIM_RES_TYPE_COUNT] = CIM_RES_TYPE_GRAPHICS, CIM_RES_TYPE_INPUT, CIM_RES_TYPE_CONSOLE, + CIM_RES_TYPE_CONTROLLER, }; #define CIM_VSSD_RECOVERY_NONE 2 -- 1.7.1

Precursor to review - I'll merge your changes with what I posted last week so we can then work off one common set of changes. They're pretty close anyway since what I did was based on your v1. My "goal" is to make breaks in the changes such that it's possible to bisect history and reduce cimtest failures - it's not easy to accomplish, but I'll try. ... This patch will be split into two - the two .h files in one and the two .c files in the other. It's more for easier review since I've added quite a few new properties. On 03/25/2014 03:20 AM, Xu Wang wrote:
Signed-off-by: Xu Wang <gesaint@linux.vnet.ibm.com> --- libxkutil/device_parsing.c | 70 +++++++++++++++++++++++++++++++++++++++++++- libxkutil/device_parsing.h | 9 +++++ libxkutil/xmlgen.c | 30 +++++++++++++++++++ src/svpc_types.h | 4 ++- 4 files changed, 111 insertions(+), 2 deletions(-)
diff --git a/libxkutil/device_parsing.c b/libxkutil/device_parsing.c index d2d3859..4240243 100644 --- a/libxkutil/device_parsing.c +++ b/libxkutil/device_parsing.c @@ -1,5 +1,5 @@ /* - * Copyright IBM Corp. 2007, 2013 + * Copyright IBM Corp. 2007, 2014
Oh yea... Although I'll make it 2007-2014
* * Authors: * Dan Smith <danms@us.ibm.com> @@ -49,6 +49,7 @@ #define GRAPHICS_XPATH (xmlChar *)"/domain/devices/graphics | "\ "/domain/devices/console" #define INPUT_XPATH (xmlChar *)"/domain/devices/input" +#define CONTROLLER_XPATH (xmlChar *)"/domain/devices/controller"
#define DEFAULT_BRIDGE "xenbr0" #define DEFAULT_NETWORK "default" @@ -308,6 +309,15 @@ static void cleanup_input_device(struct input_device *dev) free(dev->bus); }
+static void cleanup_controller_device(struct controller_device *dev) +{ + if (dev == NULL) + return; + + free(dev->type); + free(dev->model);
See .h comments, but while we're at it - may as well add other properties too (queues, ports, vectors, address) as well as storing the index which we'll need.
+} + void cleanup_virt_device(struct virt_device *dev) { if (dev == NULL) @@ -325,6 +335,8 @@ void cleanup_virt_device(struct virt_device *dev) cleanup_input_device(&dev->dev.input); else if (dev->type == CIM_RES_TYPE_CONSOLE) cleanup_console_device(&dev->dev.console); + else if (dev->type == CIM_RES_TYPE_CONTROLLER) + cleanup_controller_device(&dev->dev.controller);
free(dev->id);
@@ -1107,6 +1119,49 @@ static int parse_input_device(xmlNode *node, struct virt_device **vdevs) return 0; }
+static int parse_controller_device(xmlNode *node, struct virt_device **vdevs) +{ + struct virt_device *vdev = NULL; + struct controller_device *cdev = NULL; + char *index = NULL; + int ret; + + vdev = calloc(1, sizeof(*vdev)); + if (vdev == NULL) + goto err; + + cdev = &(vdev->dev.controller); + + cdev->type = get_attr_value(node, "type"); + cdev->model = get_attr_value(node, "model"); + if (cdev->model == NULL) { + cdev->model = strdup(""); + }
I disagree here - if the model doesn't exist, don't save it an empty string, because then we'll write out an empty string which isn't expected. If not found, then keep model as NULL and handle that later.
+ index = get_attr_value(node, "index");
We must save the index because if it exists, we need to write it out. If it doesn't exist on input - that's a problem. As pointed out by Boris in one of his reviews we'll have to handle this specially on the create from a nonXML description path, see: http://www.redhat.com/archives/libvirt-cim/2014-March/msg00037.html search for CONTROLLER_INDEX_NOT_SET
+ + if (cdev->type == NULL) + goto err; + + vdev->type = CIM_RES_TYPE_CONTROLLER; + + ret = asprintf(&vdev->id, "%s:%s", cdev->type, index); + if (ret == -1) { + CU_DEBUG("Failed to create controller id string"); + goto err; + } + + *vdevs = vdev; + free(index); + + return 1; + err: + free(index); + cleanup_controller_device(cdev); + free(vdev); + + return 0; +} + static bool resize_devlist(struct virt_device **list, int newsize) { struct virt_device *_list; @@ -1230,6 +1285,11 @@ static int parse_devices(const char *xml, struct virt_device **_list, int type) func = &parse_input_device; break;
+ case CIM_RES_TYPE_CONTROLLER: + xpathstr = CONTROLLER_XPATH; + func = &parse_controller_device; + break; + default: CU_DEBUG("Unrecognized device type. Returning."); goto err1; @@ -1351,7 +1411,11 @@ struct virt_device *virt_device_dup(struct virt_device *_dev) } else if (dev->type == CIM_RES_TYPE_CONSOLE) { console_device_dup(&dev->dev.console, &_dev->dev.console); + } else if (dev->type == CIM_RES_TYPE_CONTROLLER) { + DUP_FIELD(dev, _dev, dev.controller.type); + DUP_FIELD(dev, _dev, dev.controller.model);
There will be more fields here too
} + return dev; }
@@ -1731,6 +1795,9 @@ int get_dominfo_from_xml(const char *xml, struct domain **dominfo) (*dominfo)->dev_vcpu_ct = parse_devices(xml, &(*dominfo)->dev_vcpu, CIM_RES_TYPE_PROC); + (*dominfo)->dev_controller_ct = parse_devices(xml, + &(*dominfo)->dev_controller, + CIM_RES_TYPE_CONTROLLER);
return ret;
@@ -1819,6 +1886,7 @@ void cleanup_dominfo(struct domain **dominfo) cleanup_virt_devices(&dom->dev_graphics, dom->dev_graphics_ct); cleanup_virt_devices(&dom->dev_input, dom->dev_input_ct); cleanup_virt_devices(&dom->dev_console, dom->dev_console_ct); + cleanup_virt_devices(&dom->dev_controller, dom->dev_controller_ct);
free(dom);
diff --git a/libxkutil/device_parsing.h b/libxkutil/device_parsing.h index a92e223..cc58970 100644 --- a/libxkutil/device_parsing.h +++ b/libxkutil/device_parsing.h @@ -163,6 +163,11 @@ struct input_device { char *bus; };
+struct controller_device { + char *type;
The index should be saved too... I've also converted the type to an int and added API's to handle converting from type to string and back.
+ char *model;
While we're at it we should grab/store/restore other fields (ports, vectors, queues, address)
+}; + struct virt_device { uint16_t type; union { @@ -174,6 +179,7 @@ struct virt_device { struct graphics_device graphics; struct console_device console; struct input_device input; + struct controller_device controller; } dev; char *id; }; @@ -249,6 +255,9 @@ struct domain {
struct virt_device *dev_vcpu; int dev_vcpu_ct; + + struct virt_device *dev_controller; + int dev_controller_ct; };
struct virt_device *virt_device_dup(struct virt_device *dev); diff --git a/libxkutil/xmlgen.c b/libxkutil/xmlgen.c index 18c4765..529c946 100644 --- a/libxkutil/xmlgen.c +++ b/libxkutil/xmlgen.c @@ -798,6 +798,30 @@ static const char *input_xml(xmlNodePtr root, struct domain *dominfo) return NULL; }
+static const char *controller_xml(xmlNodePtr root, struct domain *dominfo) +{ + int i; + + for (i = 0; i < dominfo->dev_controller_ct; i++) { + xmlNodePtr tmp; + struct virt_device *_dev = &dominfo->dev_controller[i]; + if (_dev->type == CIM_RES_TYPE_UNKNOWN) + continue; + + struct controller_device *dev = &_dev->dev.controller; + + tmp = xmlNewChild(root, NULL, BAD_CAST "controller", NULL); + if (tmp == NULL) + return XML_ERROR; + + xmlNewProp(tmp, BAD_CAST "type", BAD_CAST dev->type); + if (!STREQC(dev->model, "")) + xmlNewProp(tmp, BAD_CAST "model", BAD_CAST dev->model);
Also need to output other fields here if they exist as well.
+ } + + return NULL; +} + static char *system_xml(xmlNodePtr root, struct domain *domain) { xmlNodePtr tmp; @@ -1129,6 +1153,11 @@ char *device_to_xml(struct virt_device *_dev) dominfo->dev_input_ct = 1; dominfo->dev_input = dev; break; + case CIM_RES_TYPE_CONTROLLER: + func = controller_xml; + dominfo->dev_controller_ct = 1; + dominfo->dev_controller = dev; + break; default: cleanup_virt_devices(&dev, 1); goto out; @@ -1167,6 +1196,7 @@ char *system_to_xml(struct domain *dominfo) &console_xml, &graphics_xml, &emu_xml, + &controller_xml, NULL };
diff --git a/src/svpc_types.h b/src/svpc_types.h index 404e428..7a2b653 100644 --- a/src/svpc_types.h +++ b/src/svpc_types.h @@ -36,8 +36,9 @@ #define CIM_RES_TYPE_IMAGE 32768 #define CIM_RES_TYPE_CONSOLE 32769 #define CIM_RES_TYPE_EMU 32770 +#define CIM_RES_TYPE_CONTROLLER 32771
-#define CIM_RES_TYPE_COUNT 7 +#define CIM_RES_TYPE_COUNT 8
Avoid doing too early - causes cimtest failures since not all the plumbing is available. So in the changes you see from me, this will not be in the first patch - rather it'll be in a later patch.
const static int cim_res_types[CIM_RES_TYPE_COUNT] = {CIM_RES_TYPE_NET, CIM_RES_TYPE_DISK, @@ -46,6 +47,7 @@ const static int cim_res_types[CIM_RES_TYPE_COUNT] = CIM_RES_TYPE_GRAPHICS, CIM_RES_TYPE_INPUT, CIM_RES_TYPE_CONSOLE, + CIM_RES_TYPE_CONTROLLER,
Avoid adding in this patch since alone it causes cimtest failures if done too early.
};
#define CIM_VSSD_RECOVERY_NONE 2
The bottom of this will get a list of enum controller types and the string/type conversion routines. John

Signed-off-by: Xu Wang <gesaint@linux.vnet.ibm.com> --- schema/ResourceAllocationSettingData.mof | 27 +++++++++++++++++++++ schema/ResourceAllocationSettingData.registration | 3 ++ src/Virt_RASD.c | 24 ++++++++++++++++++ 3 files changed, 54 insertions(+), 0 deletions(-) diff --git a/schema/ResourceAllocationSettingData.mof b/schema/ResourceAllocationSettingData.mof index 6b649de..3512170 100644 --- a/schema/ResourceAllocationSettingData.mof +++ b/schema/ResourceAllocationSettingData.mof @@ -328,6 +328,33 @@ class LXC_InputResourceAllocationSettingData : LXC_ResourceAllocationSettingData string BusType; }; +[Description ("Xen virtual controller device"), + Provider("cmpi::Virt_RASD") +] +class Xen_ControllerResourceAllocationSettingData : Xen_ResourceAllocationSettingData +{ + string Type; + string Model; +}; + +[Description ("KVM virtual controller device"), + Provider("cmpi::Virt_RASD") +] +class KVM_ControllerResourceAllocationSettingData : KVM_ResourceAllocationSettingData +{ + string Type; + string Model; +}; + +[Description ("LXC virtual controller device"), + Provider("cmpi::Virt_RASD") +] +class LXC_ControllerResourceAllocationSettingData : LXC_ResourceAllocationSettingData +{ + string Type; + string Model; +}; + [Description ("Xen virtual network pool settings"), Provider("cmpi::Virt_RASD") ] diff --git a/schema/ResourceAllocationSettingData.registration b/schema/ResourceAllocationSettingData.registration index b969bfe..1142376 100644 --- a/schema/ResourceAllocationSettingData.registration +++ b/schema/ResourceAllocationSettingData.registration @@ -7,6 +7,7 @@ Xen_MemResourceAllocationSettingData root/virt Virt_RASD Virt_RASD instance Xen_GraphicsResourceAllocationSettingData root/virt Virt_RASD Virt_RASD instance Xen_InputResourceAllocationSettingData root/virt Virt_RASD Virt_RASD instance Xen_ConsoleResourceAllocationSettingData root/virt Virt_RASD Virt_RASD instance +Xen_ControllerResourceAllocationSettingData root/virt Virt_RASD Virt_RASD instance KVM_DiskResourceAllocationSettingData root/virt Virt_RASD Virt_RASD instance KVM_NetResourceAllocationSettingData root/virt Virt_RASD Virt_RASD instance KVM_ProcResourceAllocationSettingData root/virt Virt_RASD Virt_RASD instance @@ -14,9 +15,11 @@ KVM_MemResourceAllocationSettingData root/virt Virt_RASD Virt_RASD instance KVM_GraphicsResourceAllocationSettingData root/virt Virt_RASD Virt_RASD instance KVM_InputResourceAllocationSettingData root/virt Virt_RASD Virt_RASD instance KVM_ConsoleResourceAllocationSettingData root/virt Virt_RASD Virt_RASD instance +KVM_ControllerResourceAllocationSettingData root/virt Virt_RASD Virt_RASD instance LXC_MemResourceAllocationSettingData root/virt Virt_RASD Virt_RASD instance LXC_DiskResourceAllocationSettingData root/virt Virt_RASD Virt_RASD instance LXC_ProcResourceAllocationSettingData root/virt Virt_RASD Virt_RASD instance LXC_GraphicsResourceAllocationSettingData root/virt Virt_RASD Virt_RASD instance LXC_InputResourceAllocationSettingData root/virt Virt_RASD Virt_RASD instance LXC_ConsoleResourceAllocationSettingData root/virt Virt_RASD Virt_RASD instance +LXC_ControllerResourceAllocationSettingData root/virt Virt_RASD Virt_RASD instance diff --git a/src/Virt_RASD.c b/src/Virt_RASD.c index abfb09f..594fe83 100644 --- a/src/Virt_RASD.c +++ b/src/Virt_RASD.c @@ -915,6 +915,20 @@ static CMPIStatus set_input_rasd_params(const struct virt_device *dev, return s; } +static CMPIStatus set_controller_rasd_params(const struct virt_device *dev, + CMPIInstance *inst) +{ + CMPIStatus s = {CMPI_RC_OK, NULL}; + + CMSetProperty(inst, "Type", + (CMPIValue *)dev->dev.controller.type, CMPI_chars); + + CMSetProperty(inst, "Model", + (CMPIValue *)dev->dev.controller.model, CMPI_chars); + + return s; +} + CMPIInstance *rasd_from_vdev(const CMPIBroker *broker, struct virt_device *dev, const char *host, @@ -949,6 +963,9 @@ CMPIInstance *rasd_from_vdev(const CMPIBroker *broker, } else if (dev->type == CIM_RES_TYPE_INPUT) { type = CIM_RES_TYPE_INPUT; base = "InputResourceAllocationSettingData"; + } else if (dev->type == CIM_RES_TYPE_CONTROLLER) { + type = CIM_RES_TYPE_CONTROLLER; + base = "ControllerResourceAllocationSettingData"; } else { return NULL; } @@ -1004,6 +1021,8 @@ CMPIInstance *rasd_from_vdev(const CMPIBroker *broker, s = set_input_rasd_params(dev, inst); } else if (dev->type == CIM_RES_TYPE_CONSOLE) { s = set_console_rasd_params(dev, inst); + } else if (dev->type == CIM_RES_TYPE_CONTROLLER) { + s = set_controller_rasd_params(dev, inst); } /* FIXME: Put the HostResource in place */ @@ -1138,6 +1157,8 @@ CMPIrc res_type_from_rasd_classname(const char *cn, uint16_t *type) *type = CIM_RES_TYPE_IMAGE; else if (STREQ(base, "ConsoleResourceAllocationSettingData")) *type = CIM_RES_TYPE_CONSOLE; + else if (STREQ(base, "ControllerResourceAllocationSettingData")) + *type = CIM_RES_TYPE_CONTROLLER; else goto out; @@ -1175,6 +1196,9 @@ CMPIrc rasd_classname_from_type(uint16_t type, const char **classname) case CIM_RES_TYPE_INPUT: *classname = "InputResourceAllocationSettingData"; break; + case CIM_RES_TYPE_CONTROLLER: + *classname = "ControllerResourceAllocationSettingData"; + break; default: rc = CMPI_RC_ERR_FAILED; } -- 1.7.1

As it stands now - this will end up in one "final" mega patch. As it turned out - there's no way one can add the mofs without affecting how cimtest runs. Naturally vice versa applies - the code cannot be there first and then the mofs just appear. So pretty much everything in your patches 2-5 will end up in one patch from me (unfortunately). On 03/25/2014 03:20 AM, Xu Wang wrote:
Signed-off-by: Xu Wang <gesaint@linux.vnet.ibm.com> --- schema/ResourceAllocationSettingData.mof | 27 +++++++++++++++++++++ schema/ResourceAllocationSettingData.registration | 3 ++ src/Virt_RASD.c | 24 ++++++++++++++++++ 3 files changed, 54 insertions(+), 0 deletions(-)
diff --git a/schema/ResourceAllocationSettingData.mof b/schema/ResourceAllocationSettingData.mof index 6b649de..3512170 100644 --- a/schema/ResourceAllocationSettingData.mof +++ b/schema/ResourceAllocationSettingData.mof @@ -328,6 +328,33 @@ class LXC_InputResourceAllocationSettingData : LXC_ResourceAllocationSettingData string BusType; };
+[Description ("Xen virtual controller device"), + Provider("cmpi::Virt_RASD") +] +class Xen_ControllerResourceAllocationSettingData : Xen_ResourceAllocationSettingData +{ + string Type; + string Model; +};
Does Xen have one? I'm following Boris' advice and removing Xen and LXC defs, see: http://www.redhat.com/archives/libvirt-cim/2014-March/msg00021.html
+ +[Description ("KVM virtual controller device"), + Provider("cmpi::Virt_RASD") +] +class KVM_ControllerResourceAllocationSettingData : KVM_ResourceAllocationSettingData +{ + string Type; + string Model;
As you'll see I have many more definitions.
+}; + +[Description ("LXC virtual controller device"), + Provider("cmpi::Virt_RASD") +] +class LXC_ControllerResourceAllocationSettingData : LXC_ResourceAllocationSettingData +{ + string Type; + string Model; +}; + [Description ("Xen virtual network pool settings"), Provider("cmpi::Virt_RASD") ] diff --git a/schema/ResourceAllocationSettingData.registration b/schema/ResourceAllocationSettingData.registration index b969bfe..1142376 100644 --- a/schema/ResourceAllocationSettingData.registration +++ b/schema/ResourceAllocationSettingData.registration @@ -7,6 +7,7 @@ Xen_MemResourceAllocationSettingData root/virt Virt_RASD Virt_RASD instance Xen_GraphicsResourceAllocationSettingData root/virt Virt_RASD Virt_RASD instance Xen_InputResourceAllocationSettingData root/virt Virt_RASD Virt_RASD instance Xen_ConsoleResourceAllocationSettingData root/virt Virt_RASD Virt_RASD instance +Xen_ControllerResourceAllocationSettingData root/virt Virt_RASD Virt_RASD instance
Again no Xen/LXC
KVM_DiskResourceAllocationSettingData root/virt Virt_RASD Virt_RASD instance KVM_NetResourceAllocationSettingData root/virt Virt_RASD Virt_RASD instance KVM_ProcResourceAllocationSettingData root/virt Virt_RASD Virt_RASD instance @@ -14,9 +15,11 @@ KVM_MemResourceAllocationSettingData root/virt Virt_RASD Virt_RASD instance KVM_GraphicsResourceAllocationSettingData root/virt Virt_RASD Virt_RASD instance KVM_InputResourceAllocationSettingData root/virt Virt_RASD Virt_RASD instance KVM_ConsoleResourceAllocationSettingData root/virt Virt_RASD Virt_RASD instance +KVM_ControllerResourceAllocationSettingData root/virt Virt_RASD Virt_RASD instance LXC_MemResourceAllocationSettingData root/virt Virt_RASD Virt_RASD instance LXC_DiskResourceAllocationSettingData root/virt Virt_RASD Virt_RASD instance LXC_ProcResourceAllocationSettingData root/virt Virt_RASD Virt_RASD instance LXC_GraphicsResourceAllocationSettingData root/virt Virt_RASD Virt_RASD instance LXC_InputResourceAllocationSettingData root/virt Virt_RASD Virt_RASD instance LXC_ConsoleResourceAllocationSettingData root/virt Virt_RASD Virt_RASD instance +LXC_ControllerResourceAllocationSettingData root/virt Virt_RASD Virt_RASD instance diff --git a/src/Virt_RASD.c b/src/Virt_RASD.c index abfb09f..594fe83 100644 --- a/src/Virt_RASD.c +++ b/src/Virt_RASD.c @@ -915,6 +915,20 @@ static CMPIStatus set_input_rasd_params(const struct virt_device *dev, return s; }
+static CMPIStatus set_controller_rasd_params(const struct virt_device *dev, + CMPIInstance *inst) +{ + CMPIStatus s = {CMPI_RC_OK, NULL}; + + CMSetProperty(inst, "Type", + (CMPIValue *)dev->dev.controller.type, CMPI_chars); + + CMSetProperty(inst, "Model", + (CMPIValue *)dev->dev.controller.model, CMPI_chars); +
There will be many more fields to handle here.
+ return s; +} + CMPIInstance *rasd_from_vdev(const CMPIBroker *broker, struct virt_device *dev, const char *host, @@ -949,6 +963,9 @@ CMPIInstance *rasd_from_vdev(const CMPIBroker *broker, } else if (dev->type == CIM_RES_TYPE_INPUT) { type = CIM_RES_TYPE_INPUT; base = "InputResourceAllocationSettingData"; + } else if (dev->type == CIM_RES_TYPE_CONTROLLER) { + type = CIM_RES_TYPE_CONTROLLER; + base = "ControllerResourceAllocationSettingData"; } else { return NULL; } @@ -1004,6 +1021,8 @@ CMPIInstance *rasd_from_vdev(const CMPIBroker *broker, s = set_input_rasd_params(dev, inst); } else if (dev->type == CIM_RES_TYPE_CONSOLE) { s = set_console_rasd_params(dev, inst); + } else if (dev->type == CIM_RES_TYPE_CONTROLLER) { + s = set_controller_rasd_params(dev, inst); }
/* FIXME: Put the HostResource in place */ @@ -1138,6 +1157,8 @@ CMPIrc res_type_from_rasd_classname(const char *cn, uint16_t *type) *type = CIM_RES_TYPE_IMAGE; else if (STREQ(base, "ConsoleResourceAllocationSettingData")) *type = CIM_RES_TYPE_CONSOLE; + else if (STREQ(base, "ControllerResourceAllocationSettingData")) + *type = CIM_RES_TYPE_CONTROLLER; else goto out;
@@ -1175,6 +1196,9 @@ CMPIrc rasd_classname_from_type(uint16_t type, const char **classname) case CIM_RES_TYPE_INPUT: *classname = "InputResourceAllocationSettingData"; break; + case CIM_RES_TYPE_CONTROLLER: + *classname = "ControllerResourceAllocationSettingData"; + break; default: rc = CMPI_RC_ERR_FAILED; }

Signed-off-by: Xu Wang <gesaint@linux.vnet.ibm.com> --- src/Virt_VirtualSystemManagementService.c | 44 +++++++++++++++++++++++++++++ 1 files changed, 44 insertions(+), 0 deletions(-) diff --git a/src/Virt_VirtualSystemManagementService.c b/src/Virt_VirtualSystemManagementService.c index e146470..1a34ff8 100644 --- a/src/Virt_VirtualSystemManagementService.c +++ b/src/Virt_VirtualSystemManagementService.c @@ -1848,6 +1848,28 @@ static const char *input_rasd_to_vdev(CMPIInstance *inst, return NULL; } +static const char *controller_rasd_to_vdev(CMPIInstance *inst, + struct virt_device *dev) +{ + const char *val; + + if (cu_get_str_prop(inst, "Type", &val) != CMPI_RC_OK) { + CU_DEBUG("ControllerRASD Type field not valid"); + goto out; + } + dev->dev.controller.type = strdup(val); + + if (cu_get_str_prop(inst, "Model", &val) != CMPI_RC_OK) { + CU_DEBUG("Invalid value for Model in ControllerRASD"); + goto out; + } + dev->dev.controller.model = strdup(val); + + out: + + return NULL; +} + static const char *_sysvirt_rasd_to_vdev(CMPIInstance *inst, struct virt_device *dev, uint16_t type, @@ -1868,6 +1890,8 @@ static const char *_sysvirt_rasd_to_vdev(CMPIInstance *inst, return console_rasd_to_vdev(inst, dev); } else if (type == CIM_RES_TYPE_INPUT) { return input_rasd_to_vdev(inst, dev); + } else if (type == CIM_RES_TYPE_CONTROLLER) { + return controller_rasd_to_vdev(inst, dev); } return "Resource type not supported on this platform"; @@ -1888,6 +1912,8 @@ static const char *_container_rasd_to_vdev(CMPIInstance *inst, return lxc_proc_rasd_to_vdev(inst, dev); } else if (type == CIM_RES_TYPE_INPUT) { return input_rasd_to_vdev(inst, dev); + } else if (type == CIM_RES_TYPE_CONTROLLER) { + return controller_rasd_to_vdev(inst, dev); } return "Resource type not supported on this platform"; @@ -1997,6 +2023,9 @@ static const char *classify_resources(CMPIArray *resources, if (!make_space(&domain->dev_input, domain->dev_input_ct, count)) return "Failed to alloc input list"; + if (!make_space(&domain->dev_controller, domain->dev_controller_ct, count)) + return "Failed to alloc controller list"; + for (i = 0; i < count; i++) { CMPIObjectPath *op; CMPIData item; @@ -2111,7 +2140,16 @@ static const char *classify_resources(CMPIArray *resources, &domain->dev_input[0], ns, p_error); + } else if (type == CIM_RES_TYPE_CONTROLLER) { + msg = rasd_to_vdev(inst, + domain, + &domain->dev_controller[domain->dev_controller_ct], + ns, + p_error); + if (msg == NULL) + domain->dev_controller_ct += 1; } + if (msg != NULL) return msg; @@ -2918,6 +2956,9 @@ static struct virt_device **find_list(struct domain *dominfo, } else if (type == CIM_RES_TYPE_INPUT) { list = &dominfo->dev_input; *count = &dominfo->dev_input_ct; + } else if (type == CIM_RES_TYPE_CONTROLLER) { + list = &dominfo->dev_controller; + *count = &dominfo->dev_controller_ct; } return list; @@ -3039,6 +3080,7 @@ static CMPIStatus resource_del(struct domain *dominfo, if (STREQ(dev->id, devid)) { if ((type == CIM_RES_TYPE_GRAPHICS) || (type == CIM_RES_TYPE_CONSOLE) || + (type == CIM_RES_TYPE_CONTROLLER) || (type == CIM_RES_TYPE_INPUT)) cu_statusf(_BROKER, &s, CMPI_RC_OK, ""); else { @@ -3121,6 +3163,7 @@ static CMPIStatus resource_add(struct domain *dominfo, if ((type == CIM_RES_TYPE_GRAPHICS) || (type == CIM_RES_TYPE_INPUT) || + (type == CIM_RES_TYPE_CONTROLLER) || (type == CIM_RES_TYPE_CONSOLE)) { (*count)++; cu_statusf(_BROKER, &s, CMPI_RC_OK, ""); @@ -3198,6 +3241,7 @@ static CMPIStatus resource_mod(struct domain *dominfo, if ((type == CIM_RES_TYPE_GRAPHICS) || (type == CIM_RES_TYPE_INPUT) || + (type == CIM_RES_TYPE_CONTROLLER) || (type == CIM_RES_TYPE_CONSOLE)) cu_statusf(_BROKER, &s, CMPI_RC_OK, ""); else { -- 1.7.1

On 03/25/2014 03:20 AM, Xu Wang wrote:
Signed-off-by: Xu Wang <gesaint@linux.vnet.ibm.com> --- src/Virt_VirtualSystemManagementService.c | 44 +++++++++++++++++++++++++++++ 1 files changed, 44 insertions(+), 0 deletions(-)
diff --git a/src/Virt_VirtualSystemManagementService.c b/src/Virt_VirtualSystemManagementService.c index e146470..1a34ff8 100644 --- a/src/Virt_VirtualSystemManagementService.c +++ b/src/Virt_VirtualSystemManagementService.c @@ -1848,6 +1848,28 @@ static const char *input_rasd_to_vdev(CMPIInstance *inst, return NULL; }
+static const char *controller_rasd_to_vdev(CMPIInstance *inst, + struct virt_device *dev) +{ + const char *val; + + if (cu_get_str_prop(inst, "Type", &val) != CMPI_RC_OK) { + CU_DEBUG("ControllerRASD Type field not valid"); + goto out; + } + dev->dev.controller.type = strdup(val); + + if (cu_get_str_prop(inst, "Model", &val) != CMPI_RC_OK) { + CU_DEBUG("Invalid value for Model in ControllerRASD"); + goto out; + } + dev->dev.controller.model = strdup(val);
Based on the changes I've made there will need to be some adjustments here.
+ + out: + + return NULL; +} + static const char *_sysvirt_rasd_to_vdev(CMPIInstance *inst, struct virt_device *dev, uint16_t type, @@ -1868,6 +1890,8 @@ static const char *_sysvirt_rasd_to_vdev(CMPIInstance *inst, return console_rasd_to_vdev(inst, dev); } else if (type == CIM_RES_TYPE_INPUT) { return input_rasd_to_vdev(inst, dev); + } else if (type == CIM_RES_TYPE_CONTROLLER) { + return controller_rasd_to_vdev(inst, dev); }
return "Resource type not supported on this platform"; @@ -1888,6 +1912,8 @@ static const char *_container_rasd_to_vdev(CMPIInstance *inst, return lxc_proc_rasd_to_vdev(inst, dev); } else if (type == CIM_RES_TYPE_INPUT) { return input_rasd_to_vdev(inst, dev); + } else if (type == CIM_RES_TYPE_CONTROLLER) { + return controller_rasd_to_vdev(inst, dev); }
return "Resource type not supported on this platform"; @@ -1997,6 +2023,9 @@ static const char *classify_resources(CMPIArray *resources, if (!make_space(&domain->dev_input, domain->dev_input_ct, count)) return "Failed to alloc input list";
+ if (!make_space(&domain->dev_controller, domain->dev_controller_ct, count)) + return "Failed to alloc controller list"; + for (i = 0; i < count; i++) { CMPIObjectPath *op; CMPIData item; @@ -2111,7 +2140,16 @@ static const char *classify_resources(CMPIArray *resources, &domain->dev_input[0], ns, p_error); + } else if (type == CIM_RES_TYPE_CONTROLLER) { + msg = rasd_to_vdev(inst, + domain, + &domain->dev_controller[domain->dev_controller_ct], + ns, + p_error); + if (msg == NULL) + domain->dev_controller_ct += 1; } + if (msg != NULL) return msg;
@@ -2918,6 +2956,9 @@ static struct virt_device **find_list(struct domain *dominfo, } else if (type == CIM_RES_TYPE_INPUT) { list = &dominfo->dev_input; *count = &dominfo->dev_input_ct; + } else if (type == CIM_RES_TYPE_CONTROLLER) { + list = &dominfo->dev_controller; + *count = &dominfo->dev_controller_ct; }
return list; @@ -3039,6 +3080,7 @@ static CMPIStatus resource_del(struct domain *dominfo, if (STREQ(dev->id, devid)) { if ((type == CIM_RES_TYPE_GRAPHICS) || (type == CIM_RES_TYPE_CONSOLE) || + (type == CIM_RES_TYPE_CONTROLLER) || (type == CIM_RES_TYPE_INPUT)) cu_statusf(_BROKER, &s, CMPI_RC_OK, ""); else { @@ -3121,6 +3163,7 @@ static CMPIStatus resource_add(struct domain *dominfo,
if ((type == CIM_RES_TYPE_GRAPHICS) || (type == CIM_RES_TYPE_INPUT) || + (type == CIM_RES_TYPE_CONTROLLER) || (type == CIM_RES_TYPE_CONSOLE)) { (*count)++; cu_statusf(_BROKER, &s, CMPI_RC_OK, ""); @@ -3198,6 +3241,7 @@ static CMPIStatus resource_mod(struct domain *dominfo,
if ((type == CIM_RES_TYPE_GRAPHICS) || (type == CIM_RES_TYPE_INPUT) || + (type == CIM_RES_TYPE_CONTROLLER) || (type == CIM_RES_TYPE_CONSOLE)) cu_statusf(_BROKER, &s, CMPI_RC_OK, ""); else {

Signed-off-by: Xu Wang <gesaint@linux.vnet.ibm.com> --- src/Virt_Device.c | 34 +++++++++++++++++++++++++++++++++- 1 files changed, 33 insertions(+), 1 deletions(-) diff --git a/src/Virt_Device.c b/src/Virt_Device.c index 12ae6bd..f100f6b 100644 --- a/src/Virt_Device.c +++ b/src/Virt_Device.c @@ -366,6 +366,33 @@ static CMPIInstance *input_instance(const CMPIBroker *broker, return inst; } +static CMPIInstance *controller_instance(const CMPIBroker *broker, + struct controller_device *dev, + const virDomainPtr dom, + const char *ns) +{ + CMPIInstance *inst; + virConnectPtr conn; + + conn = virDomainGetConnect(dom); + inst = get_typed_instance(broker, + pfx_from_conn(conn), + "Controller", + ns, + true); + if (inst == NULL) { + CU_DEBUG("Failed to get instance of ControllerDevice"); + return NULL; + } + + CMSetProperty(inst, "Controller", + (CMPIValue *)dev->type, CMPI_chars); + CMSetProperty(inst, "Controller", + (CMPIValue *)dev->model, CMPI_chars); + + return inst; +} + static int device_set_devid(CMPIInstance *instance, struct virt_device *dev, const virDomainPtr dom) @@ -516,11 +543,16 @@ static bool device_instances(const CMPIBroker *broker, &dev->dev.console, dom, ns); - else if (dev->type == CIM_RES_TYPE_INPUT) + else if (dev->type == CIM_RES_TYPE_INPUT) instance = input_instance(broker, &dev->dev.input, dom, ns); + else if (dev->type == CIM_RES_TYPE_CONTROLLER) + instance = controller_instance(broker, + &dev->dev.controller, + dom, + ns); else return false; -- 1.7.1

On 03/25/2014 03:20 AM, Xu Wang wrote:
Signed-off-by: Xu Wang <gesaint@linux.vnet.ibm.com> --- src/Virt_Device.c | 34 +++++++++++++++++++++++++++++++++- 1 files changed, 33 insertions(+), 1 deletions(-)
diff --git a/src/Virt_Device.c b/src/Virt_Device.c index 12ae6bd..f100f6b 100644 --- a/src/Virt_Device.c +++ b/src/Virt_Device.c @@ -366,6 +366,33 @@ static CMPIInstance *input_instance(const CMPIBroker *broker, return inst; }
+static CMPIInstance *controller_instance(const CMPIBroker *broker, + struct controller_device *dev, + const virDomainPtr dom, + const char *ns) +{ + CMPIInstance *inst; + virConnectPtr conn; + + conn = virDomainGetConnect(dom); + inst = get_typed_instance(broker, + pfx_from_conn(conn), + "Controller", + ns, + true); + if (inst == NULL) { + CU_DEBUG("Failed to get instance of ControllerDevice");
CU_DEBUG("Failed to get instance of %s_Controller", pfx_from_conn(conn));
+ return NULL; + } + + CMSetProperty(inst, "Controller", + (CMPIValue *)dev->type, CMPI_chars); + CMSetProperty(inst, "Controller", + (CMPIValue *)dev->model, CMPI_chars);
Not sure what you were setting here as there's not a "Controller" property from what I read... In any case, these will become: const char *type_str; type_str = controller_protocol_type_IDToStr(dev->type); if (type_str == NULL) { CU_DEBUG("controller type=%d fails to return string", dev->type); return 0; } CMSetProperty(inst, "ProtocolSupported", (CMPIValue *)dev->type, CMPI_uint16); if (dev->model) CMSetProperty(inst, "ProtocolDescription", (CMPIValue *)dev->model, CMPI_chars); Where the ProtocolSupported type will come from a new enum list in svpc_types.h as taken from the docs. The ProtocolDescription is the free form description with more detail
+ + return inst; +} + static int device_set_devid(CMPIInstance *instance, struct virt_device *dev, const virDomainPtr dom) @@ -516,11 +543,16 @@ static bool device_instances(const CMPIBroker *broker, &dev->dev.console, dom, ns); - else if (dev->type == CIM_RES_TYPE_INPUT) + else if (dev->type == CIM_RES_TYPE_INPUT) instance = input_instance(broker, &dev->dev.input, dom, ns); + else if (dev->type == CIM_RES_TYPE_CONTROLLER) + instance = controller_instance(broker, + &dev->dev.controller, + dom, + ns); else return false;

Signed-off-by: Xu Wang <gesaint@linux.vnet.ibm.com> --- Makefile.am | 2 ++ libvirt-cim.spec.in | 2 ++ schema/Controller.mof | 16 ++++++++++++++++ schema/Controller.registration | 5 +++++ src/Virt_Device.c | 4 +++- src/Virt_ElementAllocatedFromPool.c | 6 ++++++ src/Virt_ElementSettingData.c | 3 +++ src/Virt_ServiceAffectsElement.c | 6 +++++- src/Virt_SettingsDefineState.c | 6 ++++++ src/Virt_SystemDevice.c | 3 +++ src/Virt_VSSDComponent.c | 3 +++ 11 files changed, 54 insertions(+), 2 deletions(-) create mode 100644 schema/Controller.mof create mode 100644 schema/Controller.registration diff --git a/Makefile.am b/Makefile.am index 69b65cf..f38c8fc 100644 --- a/Makefile.am +++ b/Makefile.am @@ -52,6 +52,7 @@ MOFS = \ $(top_srcdir)/schema/ServiceAffectsElement.mof \ $(top_srcdir)/schema/KVMRedirectionSAP.mof \ $(top_srcdir)/schema/DisplayController.mof \ + $(top_srcdir)/schema/Controller.mof \ $(top_srcdir)/schema/PointingDevice.mof \ $(top_srcdir)/schema/GraphicsPool.mof \ $(top_srcdir)/schema/InputPool.mof \ @@ -142,6 +143,7 @@ REGS = \ $(top_srcdir)/schema/ServiceAffectsElement.registration \ $(top_srcdir)/schema/KVMRedirectionSAP.registration \ $(top_srcdir)/schema/DisplayController.registration \ + $(top_srcdir)/schema/Controller.registration \ $(top_srcdir)/schema/PointingDevice.registration \ $(top_srcdir)/schema/GraphicsPool.registration \ $(top_srcdir)/schema/InputPool.registration \ diff --git a/libvirt-cim.spec.in b/libvirt-cim.spec.in index 01ee329..809b9db 100644 --- a/libvirt-cim.spec.in +++ b/libvirt-cim.spec.in @@ -121,6 +121,7 @@ rm -fr $RPM_BUILD_ROOT %{_datadir}/%{name}/EntriesInFilterList.registration \\\ %{_datadir}/%{name}/NestedFilterList.registration \\\ %{_datadir}/%{name}/AppliedFilterList.registration \\\ + %{_datadir}/%{name}/Controller.registration \\\ %{_datadir}/%{name}/HostedFilterList.registration %define SCHEMA %{_datadir}/%{name}/ComputerSystem.mof \\\ @@ -182,6 +183,7 @@ rm -fr $RPM_BUILD_ROOT %{_datadir}/%{name}/EntriesInFilterList.mof \\\ %{_datadir}/%{name}/NestedFilterList.mof \\\ %{_datadir}/%{name}/AppliedFilterList.mof \\\ + %{_datadir}/%{name}/Controller.mof \\\ %{_datadir}/%{name}/HostedFilterList.mof %define INTEROP_REG %{_datadir}/%{name}/RegisteredProfile.registration \\\ diff --git a/schema/Controller.mof b/schema/Controller.mof new file mode 100644 index 0000000..91475a9 --- /dev/null +++ b/schema/Controller.mof @@ -0,0 +1,16 @@ +// Copyright IBM Corp. 2014 + +[ Provider("cmpi::Virt_Device") ] +class Xen_Controller : CIM_Controller +{ +}; + +[ Provider("cmpi::Virt_Device") ] +class KVM_Controller : CIM_Controller +{ +}; + +[ Provider("cmpi::Virt_Device") ] +class LXC_Controller : CIM_Controller +{ +}; diff --git a/schema/Controller.registration b/schema/Controller.registration new file mode 100644 index 0000000..cc73b7a --- /dev/null +++ b/schema/Controller.registration @@ -0,0 +1,5 @@ +# Copyright IBM Corp. 2014 +# Classname Namespace ProviderName ProviderModule ProviderTypes +Xen_Controller root/virt Virt_Device Virt_Device instance +KVM_Controller root/virt Virt_Device Virt_Device instance +LXC_Controller root/virt Virt_Device Virt_Device instance diff --git a/src/Virt_Device.c b/src/Virt_Device.c index f100f6b..3f73a76 100644 --- a/src/Virt_Device.c +++ b/src/Virt_Device.c @@ -381,7 +381,7 @@ static CMPIInstance *controller_instance(const CMPIBroker *broker, ns, true); if (inst == NULL) { - CU_DEBUG("Failed to get instance of ControllerDevice"); + CU_DEBUG("Failed to get instance of Controller"); return NULL; } @@ -587,6 +587,8 @@ uint16_t res_type_from_device_classname(const char *classname) return CIM_RES_TYPE_GRAPHICS; else if (strstr(classname, "PointingDevice")) return CIM_RES_TYPE_INPUT; + else if (strstr(classname, "Controller")) + return CIM_RES_TYPE_CONTROLLER; else return CIM_RES_TYPE_UNKNOWN; } diff --git a/src/Virt_ElementAllocatedFromPool.c b/src/Virt_ElementAllocatedFromPool.c index 2c2f2d1..7ba3a53 100644 --- a/src/Virt_ElementAllocatedFromPool.c +++ b/src/Virt_ElementAllocatedFromPool.c @@ -269,18 +269,21 @@ static char* device[] = { "Xen_LogicalDisk", "Xen_DisplayController", "Xen_PointingDevice", + "Xen_Controller", "KVM_Processor", "KVM_Memory", "KVM_NetworkPort", "KVM_LogicalDisk", "KVM_DisplayController", "KVM_PointingDevice", + "KVM_Controller", "LXC_Processor", "LXC_Memory", "LXC_NetworkPort", "LXC_LogicalDisk", "LXC_DisplayController", "LXC_PointingDevice", + "LXC_Controller", NULL }; @@ -291,18 +294,21 @@ static char* device_or_pool[] = { "Xen_LogicalDisk", "Xen_DisplayController", "Xen_PointingDevice", + "Xen_Controller", "KVM_Processor", "KVM_Memory", "KVM_NetworkPort", "KVM_LogicalDisk", "KVM_DisplayController", "KVM_PointingDevice", + "KVM_Controller", "LXC_Processor", "LXC_Memory", "LXC_NetworkPort", "LXC_LogicalDisk", "LXC_DisplayController", "LXC_PointingDevice", + "LXC_Controller", "Xen_ProcessorPool", "Xen_MemoryPool", "Xen_NetworkPool", diff --git a/src/Virt_ElementSettingData.c b/src/Virt_ElementSettingData.c index c088e49..38d7821 100644 --- a/src/Virt_ElementSettingData.c +++ b/src/Virt_ElementSettingData.c @@ -130,6 +130,7 @@ static char* resource_allocation_setting_data[] = { "Xen_GraphicsResourceAllocationSettingData", "Xen_ConsoleResourceAllocationSettingData", "Xen_InputResourceAllocationSettingData", + "Xen_ControllerResourceAllocationSettingData", "KVM_DiskResourceAllocationSettingData", "KVM_MemResourceAllocationSettingData", "KVM_NetResourceAllocationSettingData", @@ -137,6 +138,7 @@ static char* resource_allocation_setting_data[] = { "KVM_GraphicsResourceAllocationSettingData", "KVM_ConsoleResourceAllocationSettingData", "KVM_InputResourceAllocationSettingData", + "KVM_ControllerResourceAllocationSettingData", "LXC_DiskResourceAllocationSettingData", "LXC_MemResourceAllocationSettingData", "LXC_NetResourceAllocationSettingData", @@ -144,6 +146,7 @@ static char* resource_allocation_setting_data[] = { "LXC_GraphicsResourceAllocationSettingData", "LXC_ConsoleResourceAllocationSettingData", "LXC_InputResourceAllocationSettingData", + "LXC_ControllerResourceAllocationSettingData", NULL }; diff --git a/src/Virt_ServiceAffectsElement.c b/src/Virt_ServiceAffectsElement.c index 9810e02..ff63ab2 100644 --- a/src/Virt_ServiceAffectsElement.c +++ b/src/Virt_ServiceAffectsElement.c @@ -102,7 +102,8 @@ static CMPIStatus validate_cs_or_dev_ref(const CMPIContext *context, if (STREQC(classname, "ComputerSystem")) { s = get_domain_by_ref(_BROKER, ref, &inst); } else if ((STREQC(classname, "PointingDevice")) || - (STREQC(classname, "DisplayController"))) { + (STREQC(classname, "DisplayController")) || + (STREQC(classname, "Controller"))) { s = get_device_by_ref(_BROKER, ref, &inst); } @@ -146,6 +147,9 @@ static char* affected_ele[] = { "Xen_DisplayController", "KVM_DisplayController", "LXC_DisplayController", + "Xen_Controller", + "KVM_Controller", + "LXC_Controller", NULL }; diff --git a/src/Virt_SettingsDefineState.c b/src/Virt_SettingsDefineState.c index c8cda97..9024fda 100644 --- a/src/Virt_SettingsDefineState.c +++ b/src/Virt_SettingsDefineState.c @@ -329,6 +329,7 @@ static char* logical_device[] = { "Xen_DisplayController", "Xen_ConsoleDisplayController", "Xen_PointingDevice", + "Xen_Controller", "KVM_Processor", "KVM_Memory", "KVM_NetworkPort", @@ -336,6 +337,7 @@ static char* logical_device[] = { "KVM_DisplayController", "KVM_ConsoleDisplayController", "KVM_PointingDevice", + "KVM_Controller", "LXC_Processor", "LXC_Memory", "LXC_NetworkPort", @@ -343,6 +345,7 @@ static char* logical_device[] = { "LXC_DisplayController", "LXC_ConsoleDisplayController", "LXC_PointingDevice", + "LXC_Controller", NULL }; @@ -354,6 +357,7 @@ static char* resource_allocation_setting_data[] = { "Xen_GraphicsResourceAllocationSettingData", "Xen_InputResourceAllocationSettingData", "Xen_ConsoleResourceAllocationSettingData", + "Xen_ControllerResourceAllocationSettingData", "KVM_DiskResourceAllocationSettingData", "KVM_MemResourceAllocationSettingData", "KVM_NetResourceAllocationSettingData", @@ -361,6 +365,7 @@ static char* resource_allocation_setting_data[] = { "KVM_GraphicsResourceAllocationSettingData", "KVM_InputResourceAllocationSettingData", "KVM_ConsoleResourceAllocationSettingData", + "KVM_ControllerResourceAllocationSettingData", "LXC_DiskResourceAllocationSettingData", "LXC_MemResourceAllocationSettingData", "LXC_NetResourceAllocationSettingData", @@ -368,6 +373,7 @@ static char* resource_allocation_setting_data[] = { "LXC_GraphicsResourceAllocationSettingData", "LXC_InputResourceAllocationSettingData", "LXC_ConsoleResourceAllocationSettingData", + "LXC_ControllerResourceAllocationSettingData", NULL }; diff --git a/src/Virt_SystemDevice.c b/src/Virt_SystemDevice.c index d2e526d..92dfe19 100644 --- a/src/Virt_SystemDevice.c +++ b/src/Virt_SystemDevice.c @@ -137,6 +137,7 @@ static char* part_component[] = { "Xen_DisplayController", "Xen_ConsoleDisplayController", "Xen_PointingDevice", + "Xen_Controller", "KVM_Processor", "KVM_Memory", "KVM_NetworkPort", @@ -144,6 +145,7 @@ static char* part_component[] = { "KVM_DisplayController", "KVM_ConsoleDisplayController", "KVM_PointingDevice", + "KVM_Controller", "LXC_Processor", "LXC_Memory", "LXC_NetworkPort", @@ -151,6 +153,7 @@ static char* part_component[] = { "LXC_DisplayController", "LXC_ConsoleDisplayController", "LXC_PointingDevice", + "LXC_Controller", NULL }; diff --git a/src/Virt_VSSDComponent.c b/src/Virt_VSSDComponent.c index 35bffde..1fd1221 100644 --- a/src/Virt_VSSDComponent.c +++ b/src/Virt_VSSDComponent.c @@ -134,6 +134,7 @@ static char* part_component[] = { "Xen_GraphicsResourceAllocationSettingData", "Xen_ConsoleResourceAllocationSettingData", "Xen_InputResourceAllocationSettingData", + "Xen_ControllerResourceAllocationSettingData", "KVM_DiskResourceAllocationSettingData", "KVM_MemResourceAllocationSettingData", "KVM_NetResourceAllocationSettingData", @@ -141,6 +142,7 @@ static char* part_component[] = { "KVM_GraphicsResourceAllocationSettingData", "KVM_InputResourceAllocationSettingData", "KVM_ConsoleResourceAllocationSettingData", + "KVM_ControllerResourceAllocationSettingData", "LXC_DiskResourceAllocationSettingData", "LXC_MemResourceAllocationSettingData", "LXC_NetResourceAllocationSettingData", @@ -148,6 +150,7 @@ static char* part_component[] = { "LXC_GraphicsResourceAllocationSettingData", "LXC_InputResourceAllocationSettingData", "LXC_ConsoleResourceAllocationSettingData", + "LXC_ControllerResourceAllocationSettingData", NULL }; -- 1.7.1

I'm still working my way through merging - I've had some fat finger moments and some not paying attention moments which caused me some git grief, but I'm working my way through it. I will post something tomorrow at some point... It's late for me now. On 03/25/2014 03:21 AM, Xu Wang wrote:
Signed-off-by: Xu Wang <gesaint@linux.vnet.ibm.com> --- Makefile.am | 2 ++ libvirt-cim.spec.in | 2 ++ schema/Controller.mof | 16 ++++++++++++++++ schema/Controller.registration | 5 +++++ src/Virt_Device.c | 4 +++- src/Virt_ElementAllocatedFromPool.c | 6 ++++++ src/Virt_ElementSettingData.c | 3 +++ src/Virt_ServiceAffectsElement.c | 6 +++++- src/Virt_SettingsDefineState.c | 6 ++++++ src/Virt_SystemDevice.c | 3 +++ src/Virt_VSSDComponent.c | 3 +++ 11 files changed, 54 insertions(+), 2 deletions(-) create mode 100644 schema/Controller.mof create mode 100644 schema/Controller.registration
diff --git a/Makefile.am b/Makefile.am index 69b65cf..f38c8fc 100644 --- a/Makefile.am +++ b/Makefile.am @@ -52,6 +52,7 @@ MOFS = \ $(top_srcdir)/schema/ServiceAffectsElement.mof \ $(top_srcdir)/schema/KVMRedirectionSAP.mof \ $(top_srcdir)/schema/DisplayController.mof \ + $(top_srcdir)/schema/Controller.mof \ $(top_srcdir)/schema/PointingDevice.mof \ $(top_srcdir)/schema/GraphicsPool.mof \ $(top_srcdir)/schema/InputPool.mof \ @@ -142,6 +143,7 @@ REGS = \ $(top_srcdir)/schema/ServiceAffectsElement.registration \ $(top_srcdir)/schema/KVMRedirectionSAP.registration \ $(top_srcdir)/schema/DisplayController.registration \ + $(top_srcdir)/schema/Controller.registration \ $(top_srcdir)/schema/PointingDevice.registration \ $(top_srcdir)/schema/GraphicsPool.registration \ $(top_srcdir)/schema/InputPool.registration \ diff --git a/libvirt-cim.spec.in b/libvirt-cim.spec.in index 01ee329..809b9db 100644 --- a/libvirt-cim.spec.in +++ b/libvirt-cim.spec.in @@ -121,6 +121,7 @@ rm -fr $RPM_BUILD_ROOT %{_datadir}/%{name}/EntriesInFilterList.registration \\\ %{_datadir}/%{name}/NestedFilterList.registration \\\ %{_datadir}/%{name}/AppliedFilterList.registration \\\ + %{_datadir}/%{name}/Controller.registration \\\ %{_datadir}/%{name}/HostedFilterList.registration
%define SCHEMA %{_datadir}/%{name}/ComputerSystem.mof \\\ @@ -182,6 +183,7 @@ rm -fr $RPM_BUILD_ROOT %{_datadir}/%{name}/EntriesInFilterList.mof \\\ %{_datadir}/%{name}/NestedFilterList.mof \\\ %{_datadir}/%{name}/AppliedFilterList.mof \\\ + %{_datadir}/%{name}/Controller.mof \\\ %{_datadir}/%{name}/HostedFilterList.mof
%define INTEROP_REG %{_datadir}/%{name}/RegisteredProfile.registration \\\ diff --git a/schema/Controller.mof b/schema/Controller.mof new file mode 100644 index 0000000..91475a9 --- /dev/null +++ b/schema/Controller.mof @@ -0,0 +1,16 @@ +// Copyright IBM Corp. 2014 + +[ Provider("cmpi::Virt_Device") ] +class Xen_Controller : CIM_Controller +{ +}; + +[ Provider("cmpi::Virt_Device") ] +class KVM_Controller : CIM_Controller +{ +}; + +[ Provider("cmpi::Virt_Device") ] +class LXC_Controller : CIM_Controller +{ +};
Again, not sure if Xen makes sense and definitely LXC doesn't
diff --git a/schema/Controller.registration b/schema/Controller.registration new file mode 100644 index 0000000..cc73b7a --- /dev/null +++ b/schema/Controller.registration @@ -0,0 +1,5 @@ +# Copyright IBM Corp. 2014 +# Classname Namespace ProviderName ProviderModule ProviderTypes +Xen_Controller root/virt Virt_Device Virt_Device instance +KVM_Controller root/virt Virt_Device Virt_Device instance +LXC_Controller root/virt Virt_Device Virt_Device instance
Adjustments here too.
diff --git a/src/Virt_Device.c b/src/Virt_Device.c index f100f6b..3f73a76 100644 --- a/src/Virt_Device.c +++ b/src/Virt_Device.c @@ -381,7 +381,7 @@ static CMPIInstance *controller_instance(const CMPIBroker *broker, ns, true); if (inst == NULL) { - CU_DEBUG("Failed to get instance of ControllerDevice"); + CU_DEBUG("Failed to get instance of Controller"); return NULL; }
@@ -587,6 +587,8 @@ uint16_t res_type_from_device_classname(const char *classname) return CIM_RES_TYPE_GRAPHICS; else if (strstr(classname, "PointingDevice")) return CIM_RES_TYPE_INPUT; + else if (strstr(classname, "Controller")) + return CIM_RES_TYPE_CONTROLLER; else return CIM_RES_TYPE_UNKNOWN; } diff --git a/src/Virt_ElementAllocatedFromPool.c b/src/Virt_ElementAllocatedFromPool.c index 2c2f2d1..7ba3a53 100644 --- a/src/Virt_ElementAllocatedFromPool.c +++ b/src/Virt_ElementAllocatedFromPool.c @@ -269,18 +269,21 @@ static char* device[] = { "Xen_LogicalDisk", "Xen_DisplayController", "Xen_PointingDevice", + "Xen_Controller", "KVM_Processor", "KVM_Memory", "KVM_NetworkPort", "KVM_LogicalDisk", "KVM_DisplayController", "KVM_PointingDevice", + "KVM_Controller", "LXC_Processor", "LXC_Memory", "LXC_NetworkPort", "LXC_LogicalDisk", "LXC_DisplayController", "LXC_PointingDevice", + "LXC_Controller", NULL
No Xen/LXC
};
@@ -291,18 +294,21 @@ static char* device_or_pool[] = { "Xen_LogicalDisk", "Xen_DisplayController", "Xen_PointingDevice", + "Xen_Controller", "KVM_Processor", "KVM_Memory", "KVM_NetworkPort", "KVM_LogicalDisk", "KVM_DisplayController", "KVM_PointingDevice", + "KVM_Controller", "LXC_Processor", "LXC_Memory", "LXC_NetworkPort", "LXC_LogicalDisk", "LXC_DisplayController", "LXC_PointingDevice", + "LXC_Controller", "Xen_ProcessorPool", "Xen_MemoryPool", "Xen_NetworkPool",
No Xen/LXC
diff --git a/src/Virt_ElementSettingData.c b/src/Virt_ElementSettingData.c index c088e49..38d7821 100644 --- a/src/Virt_ElementSettingData.c +++ b/src/Virt_ElementSettingData.c @@ -130,6 +130,7 @@ static char* resource_allocation_setting_data[] = { "Xen_GraphicsResourceAllocationSettingData", "Xen_ConsoleResourceAllocationSettingData", "Xen_InputResourceAllocationSettingData", + "Xen_ControllerResourceAllocationSettingData", "KVM_DiskResourceAllocationSettingData", "KVM_MemResourceAllocationSettingData", "KVM_NetResourceAllocationSettingData", @@ -137,6 +138,7 @@ static char* resource_allocation_setting_data[] = { "KVM_GraphicsResourceAllocationSettingData", "KVM_ConsoleResourceAllocationSettingData", "KVM_InputResourceAllocationSettingData", + "KVM_ControllerResourceAllocationSettingData", "LXC_DiskResourceAllocationSettingData", "LXC_MemResourceAllocationSettingData", "LXC_NetResourceAllocationSettingData", @@ -144,6 +146,7 @@ static char* resource_allocation_setting_data[] = { "LXC_GraphicsResourceAllocationSettingData", "LXC_ConsoleResourceAllocationSettingData", "LXC_InputResourceAllocationSettingData", + "LXC_ControllerResourceAllocationSettingData", NULL };
No Xen/LXC
diff --git a/src/Virt_ServiceAffectsElement.c b/src/Virt_ServiceAffectsElement.c index 9810e02..ff63ab2 100644 --- a/src/Virt_ServiceAffectsElement.c +++ b/src/Virt_ServiceAffectsElement.c @@ -102,7 +102,8 @@ static CMPIStatus validate_cs_or_dev_ref(const CMPIContext *context, if (STREQC(classname, "ComputerSystem")) { s = get_domain_by_ref(_BROKER, ref, &inst); } else if ((STREQC(classname, "PointingDevice")) || - (STREQC(classname, "DisplayController"))) { + (STREQC(classname, "DisplayController")) || + (STREQC(classname, "Controller"))) { s = get_device_by_ref(_BROKER, ref, &inst); }
@@ -146,6 +147,9 @@ static char* affected_ele[] = { "Xen_DisplayController", "KVM_DisplayController", "LXC_DisplayController", + "Xen_Controller", + "KVM_Controller", + "LXC_Controller",
No Xen/LXC
NULL };
diff --git a/src/Virt_SettingsDefineState.c b/src/Virt_SettingsDefineState.c index c8cda97..9024fda 100644 --- a/src/Virt_SettingsDefineState.c +++ b/src/Virt_SettingsDefineState.c @@ -329,6 +329,7 @@ static char* logical_device[] = { "Xen_DisplayController", "Xen_ConsoleDisplayController", "Xen_PointingDevice", + "Xen_Controller", "KVM_Processor", "KVM_Memory", "KVM_NetworkPort", @@ -336,6 +337,7 @@ static char* logical_device[] = { "KVM_DisplayController", "KVM_ConsoleDisplayController", "KVM_PointingDevice", + "KVM_Controller", "LXC_Processor", "LXC_Memory", "LXC_NetworkPort", @@ -343,6 +345,7 @@ static char* logical_device[] = { "LXC_DisplayController", "LXC_ConsoleDisplayController", "LXC_PointingDevice", + "LXC_Controller", NULL
No Xen/LXC
};
@@ -354,6 +357,7 @@ static char* resource_allocation_setting_data[] = { "Xen_GraphicsResourceAllocationSettingData", "Xen_InputResourceAllocationSettingData", "Xen_ConsoleResourceAllocationSettingData", + "Xen_ControllerResourceAllocationSettingData", "KVM_DiskResourceAllocationSettingData", "KVM_MemResourceAllocationSettingData", "KVM_NetResourceAllocationSettingData", @@ -361,6 +365,7 @@ static char* resource_allocation_setting_data[] = { "KVM_GraphicsResourceAllocationSettingData", "KVM_InputResourceAllocationSettingData", "KVM_ConsoleResourceAllocationSettingData", + "KVM_ControllerResourceAllocationSettingData", "LXC_DiskResourceAllocationSettingData", "LXC_MemResourceAllocationSettingData", "LXC_NetResourceAllocationSettingData", @@ -368,6 +373,7 @@ static char* resource_allocation_setting_data[] = { "LXC_GraphicsResourceAllocationSettingData", "LXC_InputResourceAllocationSettingData", "LXC_ConsoleResourceAllocationSettingData", + "LXC_ControllerResourceAllocationSettingData", NULL
No Xen/LXC
};
diff --git a/src/Virt_SystemDevice.c b/src/Virt_SystemDevice.c index d2e526d..92dfe19 100644 --- a/src/Virt_SystemDevice.c +++ b/src/Virt_SystemDevice.c @@ -137,6 +137,7 @@ static char* part_component[] = { "Xen_DisplayController", "Xen_ConsoleDisplayController", "Xen_PointingDevice", + "Xen_Controller", "KVM_Processor", "KVM_Memory", "KVM_NetworkPort", @@ -144,6 +145,7 @@ static char* part_component[] = { "KVM_DisplayController", "KVM_ConsoleDisplayController", "KVM_PointingDevice", + "KVM_Controller", "LXC_Processor", "LXC_Memory", "LXC_NetworkPort", @@ -151,6 +153,7 @@ static char* part_component[] = { "LXC_DisplayController", "LXC_ConsoleDisplayController", "LXC_PointingDevice", + "LXC_Controller",
No Xen/LXC
NULL };
diff --git a/src/Virt_VSSDComponent.c b/src/Virt_VSSDComponent.c index 35bffde..1fd1221 100644 --- a/src/Virt_VSSDComponent.c +++ b/src/Virt_VSSDComponent.c @@ -134,6 +134,7 @@ static char* part_component[] = { "Xen_GraphicsResourceAllocationSettingData", "Xen_ConsoleResourceAllocationSettingData", "Xen_InputResourceAllocationSettingData", + "Xen_ControllerResourceAllocationSettingData", "KVM_DiskResourceAllocationSettingData", "KVM_MemResourceAllocationSettingData", "KVM_NetResourceAllocationSettingData", @@ -141,6 +142,7 @@ static char* part_component[] = { "KVM_GraphicsResourceAllocationSettingData", "KVM_InputResourceAllocationSettingData", "KVM_ConsoleResourceAllocationSettingData", + "KVM_ControllerResourceAllocationSettingData", "LXC_DiskResourceAllocationSettingData", "LXC_MemResourceAllocationSettingData", "LXC_NetResourceAllocationSettingData", @@ -148,6 +150,7 @@ static char* part_component[] = { "LXC_GraphicsResourceAllocationSettingData", "LXC_InputResourceAllocationSettingData", "LXC_ConsoleResourceAllocationSettingData", + "LXC_ControllerResourceAllocationSettingData",
No Xen/LXC
NULL };

On 03/25/2014 03:20 AM, Xu Wang wrote:
These patches are based on V1. An unexpectable accident makes me only one hand could work now so sorry everything from me takes so long time.
Sorry to hear that - I have co-worker who did the same thing this past July. Took him a while to be productive again. Not sure if you followed along with the recent posts - I did try to take what you've coded (in V1) and get things to work. There's patches from me regarding Virtual Controller Device on the list. Unfortunately it seems I didn't get the exactly right, but I'm assuming that I can further massage them in order to make a ControllerRASD as well as the Controller Logical Device (I think we're going to need one anyway if I read Boris' response correctly). Also the cimtest failures below most assuredly have to do with not having a KVM_Controller RASD in the list... I think if you start with 'XenKvmLib/rasd.py' and start adding a ControllerRASD - you'll eventually work your way through the tests. HOWEVER, I am messing with cimtest right now. Upstream libvirt added a keyboard device which (unfortunately) resides in the /devices/input list. That makes it parseable and placed into the PointingDevice RASD resulting in two InputRASD's being present. Now one can argue a keyboard is not a PointingDevice - I get it, but what I found is the cimtest tests have an inherent assumption that there's the Class Name can be used as a key for a dictionary in python. That fails if there's two InputRASD devices. I have a pile of fixes for that where I've changed the dictionary to a list of tuples with the Class Name as the first element and whatever the dictionary was referencing as the second element. I have cimtest passing with top of trunk. I have to test it on an older libvirt to see what happens. I also think that a keyboard shouldn't be a PointingDevice, but I'm trying to "wait" to add that until we close on the Controller code. So the short of it is - cimtest is going to be broken for a bit I think. Now that I have my cimtest environment "working" I'll start looking at this set of changes over the next day or so. John
Updates from V1: 1. Added 2 break logic in switch. 2. Changed CIM_RES_TYPE_CONTROLLER into 32771. 3. Added XEN/KVM/LXC_Controller classes for cimtest.
Most of cimtest testcases have passed except the following: -------------------------------------------------------------------- HostSystem - 02_hostsystem_to_rasd.py: FAIL ERROR - Failed to get associators information for KVM_SettingsDefineState ERROR - Exception: u'KVM_Controller' -------------------------------------------------------------------- -------------------------------------------------------------------- RASD - 03_rasd_errs.py: FAIL ERROR - Expected 6 RASDs, got 7 -------------------------------------------------------------------- -------------------------------------------------------------------- ResourceAllocationFromPool - 01_forward.py: FAIL ERROR - 7 RASD insts != 6 pool insts -------------------------------------------------------------------- ResourceAllocationFromPool - 02_reverse.py: FAIL ERROR - 7 RASD insts != 6 pool insts -------------------------------------------------------------------- -------------------------------------------------------------------- SettingsDefine - 01_forward.py: FAIL ERROR - 6 device insts != 7 RASD insts -------------------------------------------------------------------- SettingsDefine - 02_reverse.py: FAIL ERROR - u'KVM_Controller' -------------------------------------------------------------------- -------------------------------------------------------------------- SystemDevice - 01_forward.py: FAIL 01_forward.py:29: DeprecationWarning: the sets module is deprecated from sets import Set ERROR - Device Class mismatch ERROR - Exception Expected Device class list: ['KVM_DisplayController', 'KVM_LogicalDisk', 'KVM_Memory', 'KVM_NetworkPort', 'KVM_PointingDevice', 'KVM_Processor'] Got: [u'KVM_Controller', u'KVM_DisplayController', u'KVM_LogicalDisk', u'KVM_Memory', u'KVM_NetworkPort', u'KVM_PointingDevice', u'KVM_Processor'] -------------------------------------------------------------------- -------------------------------------------------------------------- VirtualSystemSettingDataComponent - 02_reverse.py: FAIL ERROR - Unexpected RASD instance type ERROR - Mistmatching association value -------------------------------------------------------------------- I think they are caused by the parameter set of cimtest (such as KVM_Controller or ControllerResourceAllocationSettingData should be added into some arrays. But if you find they are caused by my coding errors, please let me know, thanks). I'll fix these issues of cimtest later.
Dear John and Boris, could you help me testing it on RHEL6.5? I just have an upgraded version and introduced some packages from CentOS source (I am worried about they may influence the testing result). I'll rebuild my developing environment later using pure RHEL 6.5 version.
Xu Wang (5): libxutil: Controller Support RASD: Schema and Provider Support for Controller RASDs VSMS: Support for domains with controller devices Device: CIM_LogicalDevice for controllers Virt_Device: Add a device class for controllers
Makefile.am | 2 + libvirt-cim.spec.in | 2 + libxkutil/device_parsing.c | 70 ++++++++++++++++++++- libxkutil/device_parsing.h | 9 +++ libxkutil/xmlgen.c | 30 +++++++++ schema/Controller.mof | 16 +++++ schema/Controller.registration | 5 ++ schema/ResourceAllocationSettingData.mof | 27 ++++++++ schema/ResourceAllocationSettingData.registration | 3 + src/Virt_Device.c | 36 ++++++++++- src/Virt_ElementAllocatedFromPool.c | 6 ++ src/Virt_ElementSettingData.c | 3 + src/Virt_RASD.c | 24 +++++++ src/Virt_ServiceAffectsElement.c | 6 ++- src/Virt_SettingsDefineState.c | 6 ++ src/Virt_SystemDevice.c | 3 + src/Virt_VSSDComponent.c | 3 + src/Virt_VirtualSystemManagementService.c | 44 +++++++++++++ src/svpc_types.h | 4 +- 19 files changed, 295 insertions(+), 4 deletions(-) create mode 100644 schema/Controller.mof create mode 100644 schema/Controller.registration
participants (2)
-
John Ferlan
-
Xu Wang