[REPOST MERGED PATCH 0/3] Repost controller series merged

Changes since last time - 1. Address review comments 2. I did not add CONTROLLER_INDEX_NOT_SET. Since that's a -1 value and the index is an unsigned value - it just didn't seem right. Furthermore, if libvirt doesn't find the 'index' value, it defaults to using 0 when parsing the XML - so I think following that model is better. I have yet to chase down all the libvirt paths to see what happens, but I think if someone adds a controller without defining an index and that index conflicts with something already there for that named/type of controller, then libvirt will reject the xml for the guest to start requiring the "user" to fix it. 3. I didn't yet do it, but I think the 'master' may need to be removed. The libvirt documented example is: <devices> <controller type='usb' index='0' model='ich9-ehci1'> <address type='pci' domain='0' bus='0' slot='4' function='7'/> </controller> <controller type='usb' index='0' model='ich9-uhci1'> <master startport='0'/> <address type='pci' domain='0' bus='0' slot='4' function='0' multifunction='on'/> </controller> ... </devices> This examples shows that the type is 'usb' and the 'index' is 0 for both which would violate our namespace rule. The 'model' is the same too. So unless we incorporate the address into the name, then there's a conflict. I'll have to think about this one some more and of course take advice! 4. Just realized I forgot to switch the mof values for queues, ports, and vectors back to string types... I'll do that, but didn't want to lose my current cover letter. Xu Wang (3): libxutil, xmlgen: Add Controller Support RASD: Schema and Provider Support for Controller RASDs VSMS: Support for domains with controller devices libxkutil/device_parsing.c | 105 +++++++++++++++++++++- libxkutil/device_parsing.h | 15 ++++ libxkutil/xmlgen.c | 52 +++++++++++ schema/ResourceAllocationSettingData.mof | 41 +++++++++ schema/ResourceAllocationSettingData.registration | 1 + src/Virt_ElementSettingData.c | 1 + src/Virt_RASD.c | 81 +++++++++++++++-- src/Virt_SettingsDefineState.c | 1 + src/Virt_VSSDComponent.c | 1 + src/Virt_VirtualSystemManagementService.c | 76 ++++++++++++++++ src/svpc_types.h | 4 +- 11 files changed, 368 insertions(+), 10 deletions(-) -- 1.8.5.3

From: Xu Wang <gesaint@linux.vnet.ibm.com> Add support to define and save a controller found in the XML. A controller will have an "OTHER" RASD ResourceType value and make use of the CIM ResourceSubType property as the XML "type" of controller Signed-off-by: Xu Wang <gesaint@linux.vnet.ibm.com> Signed-off-by: John Ferlan <jferlan@redhat.com> --- libxkutil/device_parsing.c | 105 ++++++++++++++++++++++++++++++++++++++++++++- libxkutil/device_parsing.h | 15 +++++++ libxkutil/xmlgen.c | 52 ++++++++++++++++++++++ src/svpc_types.h | 4 +- 4 files changed, 174 insertions(+), 2 deletions(-) diff --git a/libxkutil/device_parsing.c b/libxkutil/device_parsing.c index c9ae886..f35df39 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" @@ -306,6 +307,20 @@ 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); + free(dev->queues); + free(dev->ports); + free(dev->vectors); + cleanup_device_address(&dev->address); + cleanup_device_address(&dev->master); +} + void cleanup_virt_device(struct virt_device *dev) { if (dev == NULL) @@ -323,6 +338,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); @@ -1101,6 +1118,71 @@ static int parse_input_device(xmlNode *node, struct virt_device **vdevs) return 0; } +static int parse_controller_device(xmlNode *cnode, struct virt_device **vdevs) +{ + struct virt_device *vdev = NULL; + struct controller_device *cdev = NULL; + xmlNode *child = 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(cnode, "type"); + if (cdev->type == NULL) { + CU_DEBUG("No type"); + goto err; + } + + index = get_attr_value(cnode, "index"); + if (index != NULL) { + sscanf(index, "%" PRIu64, &cdev->index); + free(index); + } else { + CU_DEBUG("No index"); + goto err; + } + + cdev->model = get_attr_value(cnode, "model"); + cdev->ports = get_attr_value(cnode, "ports"); + cdev->vectors = get_attr_value(cnode, "vectors"); + + for (child = cnode->children; child != NULL; child = child->next) { + if (XSTREQ(child->name, "address")) { + parse_device_address(child, &cdev->address); + } else if (XSTREQ(child->name, "master")) { + /* Although technically not an address it is similar + * insomuch as it's a paired list of attributes that + * we're just going to save and write out later + */ + parse_device_address(child, &cdev->master); + } else if (XSTREQ(child->name, "driver")) { + cdev->queues = get_attr_value(child, "queues"); + } + } + vdev->type = CIM_RES_TYPE_CONTROLLER; + + ret = asprintf(&vdev->id, "controller:%s:%" PRIu64, + cdev->type, cdev->index); + if (ret == -1) { + CU_DEBUG("Failed to create controller id string"); + goto err; + } + + *vdevs = vdev; + + return 1; + err: + cleanup_controller_device(cdev); + free(vdev); + + return 0; +} + static bool resize_devlist(struct virt_device **list, int newsize) { struct virt_device *_list; @@ -1224,6 +1306,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; @@ -1343,7 +1430,19 @@ 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); + dev->dev.controller.index = _dev->dev.controller.index; + DUP_FIELD(dev, _dev, dev.controller.model); + DUP_FIELD(dev, _dev, dev.controller.ports); + DUP_FIELD(dev, _dev, dev.controller.vectors); + DUP_FIELD(dev, _dev, dev.controller.queues); + duplicate_device_address(&dev->dev.controller.master, + &_dev->dev.controller.master); + duplicate_device_address(&dev->dev.controller.address, + &_dev->dev.controller.address); } + return dev; } @@ -1723,6 +1822,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; @@ -1811,6 +1913,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 92427c1..8072f51 100644 --- a/libxkutil/device_parsing.h +++ b/libxkutil/device_parsing.h @@ -161,6 +161,17 @@ struct input_device { char *bus; }; +struct controller_device { + char *type; + uint64_t index; + char *model; + char *ports; + char *vectors; + char *queues; + struct device_address address; + struct device_address master; +}; + struct virt_device { uint16_t type; union { @@ -172,6 +183,7 @@ struct virt_device { struct graphics_device graphics; struct console_device console; struct input_device input; + struct controller_device controller; } dev; char *id; }; @@ -247,6 +259,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 931f0c9..6418974 100644 --- a/libxkutil/xmlgen.c +++ b/libxkutil/xmlgen.c @@ -794,6 +794,52 @@ 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 ctlr; + xmlNodePtr tmp; + char *index; + + struct virt_device *_dev = &dominfo->dev_controller[i]; + if (_dev->type == CIM_RES_TYPE_UNKNOWN) + continue; + + struct controller_device *dev = &_dev->dev.controller; + + ctlr = xmlNewChild(root, NULL, BAD_CAST "controller", NULL); + if (ctlr == NULL) + return XML_ERROR; + + /* Required */ + xmlNewProp(ctlr, BAD_CAST "type", BAD_CAST dev->type); + if (asprintf(&index, "%" PRIu64, dev->index) == -1) + return XML_ERROR; + xmlNewProp(ctlr, BAD_CAST "index", BAD_CAST index); + free(index); + + /* Optional */ + if (dev->model) + xmlNewProp(ctlr, BAD_CAST "model", BAD_CAST dev->model); + if (dev->ports) + xmlNewProp(ctlr, BAD_CAST "ports", BAD_CAST dev->ports); + if (dev->vectors) + xmlNewProp(ctlr, BAD_CAST "vectors", BAD_CAST dev->vectors); + if (dev->queues) { + tmp = xmlNewChild(ctlr, NULL, BAD_CAST "driver", NULL); + xmlNewProp(tmp, BAD_CAST "queueus", BAD_CAST dev->queues); + } + if (dev->master.ct > 0) + return device_address_xml(ctlr, &dev->master); + if (dev->address.ct > 0) + return device_address_xml(ctlr, &dev->address); + } + + return NULL; +} + static char *system_xml(xmlNodePtr root, struct domain *domain) { xmlNodePtr tmp; @@ -1125,6 +1171,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; @@ -1163,6 +1214,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.8.5.3

On 03/14/2014 08:56 AM, John Ferlan wrote:
From: Xu Wang <gesaint@linux.vnet.ibm.com>
Add support to define and save a controller found in the XML. A controller will have an "OTHER" RASD ResourceType value and make use of the CIM ResourceSubType property as the XML "type" of controller
Signed-off-by: Xu Wang <gesaint@linux.vnet.ibm.com> Signed-off-by: John Ferlan <jferlan@redhat.com> --- libxkutil/device_parsing.c | 105 ++++++++++++++++++++++++++++++++++++++++++++- libxkutil/device_parsing.h | 15 +++++++ libxkutil/xmlgen.c | 52 ++++++++++++++++++++++ src/svpc_types.h | 4 +- 4 files changed, 174 insertions(+), 2 deletions(-)
diff --git a/libxkutil/device_parsing.c b/libxkutil/device_parsing.c index c9ae886..f35df39 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" @@ -306,6 +307,20 @@ 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); + free(dev->queues); + free(dev->ports); + free(dev->vectors); + cleanup_device_address(&dev->address); + cleanup_device_address(&dev->master); +} + void cleanup_virt_device(struct virt_device *dev) { if (dev == NULL) @@ -323,6 +338,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);
@@ -1101,6 +1118,71 @@ static int parse_input_device(xmlNode *node, struct virt_device **vdevs) return 0; }
+static int parse_controller_device(xmlNode *cnode, struct virt_device **vdevs) +{ + struct virt_device *vdev = NULL; + struct controller_device *cdev = NULL; + xmlNode *child = 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(cnode, "type"); + if (cdev->type == NULL) { + CU_DEBUG("No type"); + goto err; + } + + index = get_attr_value(cnode, "index"); + if (index != NULL) { + sscanf(index, "%" PRIu64, &cdev->index); + free(index); + } else { + CU_DEBUG("No index"); + goto err; + } + + cdev->model = get_attr_value(cnode, "model"); + cdev->ports = get_attr_value(cnode, "ports"); + cdev->vectors = get_attr_value(cnode, "vectors"); + + for (child = cnode->children; child != NULL; child = child->next) { + if (XSTREQ(child->name, "address")) { + parse_device_address(child, &cdev->address); + } else if (XSTREQ(child->name, "master")) { + /* Although technically not an address it is similar + * insomuch as it's a paired list of attributes that + * we're just going to save and write out later + */ + parse_device_address(child, &cdev->master); + } else if (XSTREQ(child->name, "driver")) { + cdev->queues = get_attr_value(child, "queues"); + } + } + vdev->type = CIM_RES_TYPE_CONTROLLER; + + ret = asprintf(&vdev->id, "controller:%s:%" PRIu64, + cdev->type, cdev->index); + if (ret == -1) { + CU_DEBUG("Failed to create controller id string"); + goto err; + } + + *vdevs = vdev; + + return 1; + err: + cleanup_controller_device(cdev); + free(vdev); + + return 0; +} + static bool resize_devlist(struct virt_device **list, int newsize) { struct virt_device *_list; @@ -1224,6 +1306,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; +
I really would like some guidance in this area to in order to understand what other kinds of changes are going to be necessary considering this particular "break;" causes quite a few cimtest failures. It's as if there needs to be some other place that has to know about the controller device. Perhaps in CIM parlance - some Association that's missing. John
default: CU_DEBUG("Unrecognized device type. Returning."); goto err1; @@ -1343,7 +1430,19 @@ 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); + dev->dev.controller.index = _dev->dev.controller.index; + DUP_FIELD(dev, _dev, dev.controller.model); + DUP_FIELD(dev, _dev, dev.controller.ports); + DUP_FIELD(dev, _dev, dev.controller.vectors); + DUP_FIELD(dev, _dev, dev.controller.queues); + duplicate_device_address(&dev->dev.controller.master, + &_dev->dev.controller.master); + duplicate_device_address(&dev->dev.controller.address, + &_dev->dev.controller.address); } + return dev; }
@@ -1723,6 +1822,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;
@@ -1811,6 +1913,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 92427c1..8072f51 100644 --- a/libxkutil/device_parsing.h +++ b/libxkutil/device_parsing.h @@ -161,6 +161,17 @@ struct input_device { char *bus; };
+struct controller_device { + char *type; + uint64_t index; + char *model; + char *ports; + char *vectors; + char *queues; + struct device_address address; + struct device_address master; +}; + struct virt_device { uint16_t type; union { @@ -172,6 +183,7 @@ struct virt_device { struct graphics_device graphics; struct console_device console; struct input_device input; + struct controller_device controller; } dev; char *id; }; @@ -247,6 +259,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 931f0c9..6418974 100644 --- a/libxkutil/xmlgen.c +++ b/libxkutil/xmlgen.c @@ -794,6 +794,52 @@ 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 ctlr; + xmlNodePtr tmp; + char *index; + + struct virt_device *_dev = &dominfo->dev_controller[i]; + if (_dev->type == CIM_RES_TYPE_UNKNOWN) + continue; + + struct controller_device *dev = &_dev->dev.controller; + + ctlr = xmlNewChild(root, NULL, BAD_CAST "controller", NULL); + if (ctlr == NULL) + return XML_ERROR; + + /* Required */ + xmlNewProp(ctlr, BAD_CAST "type", BAD_CAST dev->type); + if (asprintf(&index, "%" PRIu64, dev->index) == -1) + return XML_ERROR; + xmlNewProp(ctlr, BAD_CAST "index", BAD_CAST index); + free(index); + + /* Optional */ + if (dev->model) + xmlNewProp(ctlr, BAD_CAST "model", BAD_CAST dev->model); + if (dev->ports) + xmlNewProp(ctlr, BAD_CAST "ports", BAD_CAST dev->ports); + if (dev->vectors) + xmlNewProp(ctlr, BAD_CAST "vectors", BAD_CAST dev->vectors); + if (dev->queues) { + tmp = xmlNewChild(ctlr, NULL, BAD_CAST "driver", NULL); + xmlNewProp(tmp, BAD_CAST "queueus", BAD_CAST dev->queues); + } + if (dev->master.ct > 0) + return device_address_xml(ctlr, &dev->master); + if (dev->address.ct > 0) + return device_address_xml(ctlr, &dev->address); + } + + return NULL; +} + static char *system_xml(xmlNodePtr root, struct domain *domain) { xmlNodePtr tmp; @@ -1125,6 +1171,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; @@ -1163,6 +1214,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

From: Xu Wang <gesaint@linux.vnet.ibm.com> Add the various controller fields and support for RASDs Signed-off-by: Xu Wang <gesaint@linux.vnet.ibm.com> Signed-off-by: John Ferlan <jferlan@redhat.com> --- schema/ResourceAllocationSettingData.mof | 41 ++++++++++++ schema/ResourceAllocationSettingData.registration | 1 + src/Virt_ElementSettingData.c | 1 + src/Virt_RASD.c | 81 ++++++++++++++++++++--- src/Virt_SettingsDefineState.c | 1 + src/Virt_VSSDComponent.c | 1 + 6 files changed, 118 insertions(+), 8 deletions(-) diff --git a/schema/ResourceAllocationSettingData.mof b/schema/ResourceAllocationSettingData.mof index bf1fbb6..30e62c4 100644 --- a/schema/ResourceAllocationSettingData.mof +++ b/schema/ResourceAllocationSettingData.mof @@ -322,6 +322,47 @@ class LXC_InputResourceAllocationSettingData : LXC_ResourceAllocationSettingData string BusType; }; +[Description ("KVM virtual controller device. It is identified by: " + "CIM_ResourceAllocationSettingData.ResourceType=1 ('Other'), " + "CIM_ResourceAllocationSettingData.OtherResourceType='controller'" + " and CIM_ResourceAllocationSettingData.ResourceSubType set to " + "one of 'ide', 'fdc', 'scsi', 'sata', 'ccid', 'virtio-serial', " + "or 'pci'."), + Provider("cmpi::Virt_RASD") +] +class KVM_ControllerResourceAllocationSettingData : KVM_ResourceAllocationSettingData +{ + [Description ("Order in which the bus controller is encountered. " + "The order is controller type scoped.")] + uint64 Index; + + [Description ("Optional string providing a specific model " + "information based on the controller type.")] + string Model; + + [Description ("The 'virtio-serial' controller uses the Ports and " + "Vectors to control how many devices can be connected " + "through the controller.")] + uint64 Ports; + uint64 Vectors; + + [Description ("Number of queues for the controller.")] + uint64 Queues; + + [Description ("Device master property names")] + string MasterProperties[]; + + [Description ("Device master property values")] + string MasterValues[]; + + [Description ("For controllers that are themselves devices on a " + "bus an optional element to specify the exact " + "relationship of the controller to its master bus. " + "Stored in the property and value arrays.")] + string AddressProperties[]; + string AddressValues[]; +}; + [Description ("Xen virtual network pool settings"), Provider("cmpi::Virt_RASD") ] diff --git a/schema/ResourceAllocationSettingData.registration b/schema/ResourceAllocationSettingData.registration index b969bfe..da0b7d9 100644 --- a/schema/ResourceAllocationSettingData.registration +++ b/schema/ResourceAllocationSettingData.registration @@ -14,6 +14,7 @@ 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 diff --git a/src/Virt_ElementSettingData.c b/src/Virt_ElementSettingData.c index c088e49..1fa81f2 100644 --- a/src/Virt_ElementSettingData.c +++ b/src/Virt_ElementSettingData.c @@ -137,6 +137,7 @@ static char* resource_allocation_setting_data[] = { "KVM_GraphicsResourceAllocationSettingData", "KVM_ConsoleResourceAllocationSettingData", "KVM_InputResourceAllocationSettingData", + "KVM_ControllerResourceAllocationSettingData", "LXC_DiskResourceAllocationSettingData", "LXC_MemResourceAllocationSettingData", "LXC_NetResourceAllocationSettingData", diff --git a/src/Virt_RASD.c b/src/Virt_RASD.c index df1e921..d3922cf 100644 --- a/src/Virt_RASD.c +++ b/src/Virt_RASD.c @@ -289,10 +289,12 @@ static bool get_vol_size(const CMPIBroker *broker, } #endif -static CMPIStatus set_rasd_device_address(const CMPIBroker *broker, +static CMPIStatus set_rasd_property_value(const CMPIBroker *broker, const CMPIObjectPath *ref, const struct device_address *addr, - CMPIInstance *inst) + CMPIInstance *inst, + const char *property_name, + const char *property_value) { int i; CMPIArray *arr_key; @@ -338,11 +340,11 @@ static CMPIStatus set_rasd_device_address(const CMPIBroker *broker, CMPI_string); } - CMSetProperty(inst, "AddressProperties", + CMSetProperty(inst, property_name, (CMPIValue *)&arr_key, CMPI_stringA); - CMSetProperty(inst, "AddressValues", + CMSetProperty(inst, property_value, (CMPIValue *)&arr_value, CMPI_stringA); @@ -489,10 +491,12 @@ static CMPIStatus set_disk_rasd_params(const CMPIBroker *broker, CMPI_boolean); if (dev->dev.disk.address.ct > 0) - set_rasd_device_address(broker, + set_rasd_property_value(broker, ref, &dev->dev.disk.address, - inst); + inst, + "AddressProperties", + "AddressValues"); virStoragePoolFree(pool); virStorageVolFree(vol); @@ -658,10 +662,12 @@ static CMPIStatus set_net_rasd_params(const CMPIBroker *broker, CMPI_chars); if (dev->dev.net.address.ct > 0) - set_rasd_device_address(broker, + set_rasd_property_value(broker, ref, &dev->dev.net.address, - inst); + inst, + "AddressProperties", + "AddressValues"); #if LIBVIR_VERSION_NUMBER < 9000 out: @@ -903,6 +909,55 @@ static CMPIStatus set_input_rasd_params(const struct virt_device *dev, return s; } +static CMPIStatus set_controller_rasd_params(const CMPIBroker *broker, + const CMPIObjectPath *ref, + const struct virt_device *dev, + CMPIInstance *inst) +{ + CMPIStatus s = {CMPI_RC_OK, NULL}; + + CMSetProperty(inst, "OtherResourceType", "controller", CMPI_chars); + CMSetProperty(inst, "ResourceSubType", + (CMPIValue *)dev->dev.controller.type, CMPI_chars); + CMSetProperty(inst, "Index", + (CMPIValue *)dev->dev.controller.index, CMPI_uint32); + + if (dev->dev.controller.model) + CMSetProperty(inst, "Model", + (CMPIValue *)dev->dev.controller.model, CMPI_chars); + + if (dev->dev.controller.ports) + CMSetProperty(inst, "Ports", + (CMPIValue *)dev->dev.controller.ports, CMPI_uint32); + + if (dev->dev.controller.vectors) + CMSetProperty(inst, "Vectors", + (CMPIValue *)dev->dev.controller.vectors, + CMPI_uint32); + + if (dev->dev.controller.queues) + CMSetProperty(inst, "Queues", + (CMPIValue *)dev->dev.controller.queues, CMPI_uint32); + + if (dev->dev.controller.master.ct > 0) + set_rasd_property_value(broker, + ref, + &dev->dev.controller.address, + inst, + "MasterProperties", + "MasterValues"); + + if (dev->dev.controller.address.ct > 0) + set_rasd_property_value(broker, + ref, + &dev->dev.controller.address, + inst, + "AddressProperties", + "AddressValues"); + + return s; +} + CMPIInstance *rasd_from_vdev(const CMPIBroker *broker, struct virt_device *dev, const char *host, @@ -937,6 +992,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_OTHER; + base = "ControllerResourceAllocationSettingData"; } else { return NULL; } @@ -992,6 +1050,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(broker, ref, dev, inst); } /* FIXME: Put the HostResource in place */ @@ -1126,6 +1186,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; @@ -1163,6 +1225,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; } diff --git a/src/Virt_SettingsDefineState.c b/src/Virt_SettingsDefineState.c index c8cda97..d5c6726 100644 --- a/src/Virt_SettingsDefineState.c +++ b/src/Virt_SettingsDefineState.c @@ -361,6 +361,7 @@ static char* resource_allocation_setting_data[] = { "KVM_GraphicsResourceAllocationSettingData", "KVM_InputResourceAllocationSettingData", "KVM_ConsoleResourceAllocationSettingData", + "KVM_ControllerResourceAllocationSettingData", "LXC_DiskResourceAllocationSettingData", "LXC_MemResourceAllocationSettingData", "LXC_NetResourceAllocationSettingData", diff --git a/src/Virt_VSSDComponent.c b/src/Virt_VSSDComponent.c index 35bffde..734271c 100644 --- a/src/Virt_VSSDComponent.c +++ b/src/Virt_VSSDComponent.c @@ -141,6 +141,7 @@ static char* part_component[] = { "KVM_GraphicsResourceAllocationSettingData", "KVM_InputResourceAllocationSettingData", "KVM_ConsoleResourceAllocationSettingData", + "KVM_ControllerResourceAllocationSettingData", "LXC_DiskResourceAllocationSettingData", "LXC_MemResourceAllocationSettingData", "LXC_NetResourceAllocationSettingData", -- 1.8.5.3

From: Xu Wang <gesaint@linux.vnet.ibm.com>
Add the various controller fields and support for RASDs
Signed-off-by: Xu Wang <gesaint@linux.vnet.ibm.com> Signed-off-by: John Ferlan <jferlan@redhat.com> --- schema/ResourceAllocationSettingData.mof | 41 ++++++++++++ schema/ResourceAllocationSettingData.registration | 1 + src/Virt_ElementSettingData.c | 1 + src/Virt_RASD.c | 81 ++++++++++++++++++++--- src/Virt_SettingsDefineState.c | 1 + src/Virt_VSSDComponent.c | 1 + 6 files changed, 118 insertions(+), 8 deletions(-)
diff --git a/schema/ResourceAllocationSettingData.mof b/schema/ResourceAllocationSettingData.mof index bf1fbb6..30e62c4 100644 --- a/schema/ResourceAllocationSettingData.mof +++ b/schema/ResourceAllocationSettingData.mof @@ -322,6 +322,47 @@ class LXC_InputResourceAllocationSettingData : LXC_ResourceAllocationSettingData string BusType; };
+[Description ("KVM virtual controller device. It is identified by: " + "CIM_ResourceAllocationSettingData.ResourceType=1 ('Other'), " + "CIM_ResourceAllocationSettingData.OtherResourceType='controller'" + " and CIM_ResourceAllocationSettingData.ResourceSubType set to " + "one of 'ide', 'fdc', 'scsi', 'sata', 'ccid', 'virtio-serial', " + "or 'pci'."), + Provider("cmpi::Virt_RASD") +] +class KVM_ControllerResourceAllocationSettingData : KVM_ResourceAllocationSettingData +{ + [Description ("Order in which the bus controller is encountered. " + "The order is controller type scoped.")] + uint64 Index; + + [Description ("Optional string providing a specific model " + "information based on the controller type.")] + string Model; + + [Description ("The 'virtio-serial' controller uses the Ports and " + "Vectors to control how many devices can be connected " + "through the controller.")] + uint64 Ports; + uint64 Vectors; + + [Description ("Number of queues for the controller.")] + uint64 Queues; + + [Description ("Device master property names")] + string MasterProperties[]; + + [Description ("Device master property values")] + string MasterValues[]; + + [Description ("For controllers that are themselves devices on a " + "bus an optional element to specify the exact " + "relationship of the controller to its master bus. " + "Stored in the property and value arrays.")] + string AddressProperties[]; + string AddressValues[]; +}; + [Description ("Xen virtual network pool settings"), Provider("cmpi::Virt_RASD") ] diff --git a/schema/ResourceAllocationSettingData.registration b/schema/ResourceAllocationSettingData.registration index b969bfe..da0b7d9 100644 --- a/schema/ResourceAllocationSettingData.registration +++ b/schema/ResourceAllocationSettingData.registration @@ -14,6 +14,7 @@ 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 diff --git a/src/Virt_ElementSettingData.c b/src/Virt_ElementSettingData.c index c088e49..1fa81f2 100644 --- a/src/Virt_ElementSettingData.c +++ b/src/Virt_ElementSettingData.c @@ -137,6 +137,7 @@ static char* resource_allocation_setting_data[] = { "KVM_GraphicsResourceAllocationSettingData", "KVM_ConsoleResourceAllocationSettingData", "KVM_InputResourceAllocationSettingData", + "KVM_ControllerResourceAllocationSettingData", "LXC_DiskResourceAllocationSettingData", "LXC_MemResourceAllocationSettingData", "LXC_NetResourceAllocationSettingData", diff --git a/src/Virt_RASD.c b/src/Virt_RASD.c index df1e921..d3922cf 100644 --- a/src/Virt_RASD.c +++ b/src/Virt_RASD.c @@ -289,10 +289,12 @@ static bool get_vol_size(const CMPIBroker *broker, } #endif
-static CMPIStatus set_rasd_device_address(const CMPIBroker *broker, +static CMPIStatus set_rasd_property_value(const CMPIBroker *broker, const CMPIObjectPath *ref, const struct device_address *addr, - CMPIInstance *inst) + CMPIInstance *inst, + const char *property_name, + const char *property_value) { int i; CMPIArray *arr_key; @@ -338,11 +340,11 @@ static CMPIStatus set_rasd_device_address(const CMPIBroker *broker, CMPI_string); }
- CMSetProperty(inst, "AddressProperties", + CMSetProperty(inst, property_name, (CMPIValue *)&arr_key, CMPI_stringA);
- CMSetProperty(inst, "AddressValues", + CMSetProperty(inst, property_value, (CMPIValue *)&arr_value, CMPI_stringA);
@@ -489,10 +491,12 @@ static CMPIStatus set_disk_rasd_params(const CMPIBroker *broker, CMPI_boolean);
if (dev->dev.disk.address.ct > 0) - set_rasd_device_address(broker, + set_rasd_property_value(broker, ref, &dev->dev.disk.address, - inst); + inst, + "AddressProperties", + "AddressValues");
virStoragePoolFree(pool); virStorageVolFree(vol); @@ -658,10 +662,12 @@ static CMPIStatus set_net_rasd_params(const CMPIBroker *broker, CMPI_chars);
if (dev->dev.net.address.ct > 0) - set_rasd_device_address(broker, + set_rasd_property_value(broker, ref, &dev->dev.net.address, - inst); + inst, + "AddressProperties", + "AddressValues");
#if LIBVIR_VERSION_NUMBER < 9000 out: @@ -903,6 +909,55 @@ static CMPIStatus set_input_rasd_params(const struct virt_device *dev, return s; }
+static CMPIStatus set_controller_rasd_params(const CMPIBroker *broker, + const CMPIObjectPath *ref, + const struct virt_device *dev, + CMPIInstance *inst) +{ + CMPIStatus s = {CMPI_RC_OK, NULL}; + + CMSetProperty(inst, "OtherResourceType", "controller", CMPI_chars); + CMSetProperty(inst, "ResourceSubType", + (CMPIValue *)dev->dev.controller.type, CMPI_chars); + CMSetProperty(inst, "Index", + (CMPIValue *)dev->dev.controller.index, CMPI_uint32); (CMPIValue *)dev->dev.controller.index, CMPI_uint64); + + if (dev->dev.controller.model) + CMSetProperty(inst, "Model", + (CMPIValue *)dev->dev.controller.model, CMPI_chars); + + if (dev->dev.controller.ports) + CMSetProperty(inst, "Ports", + (CMPIValue *)dev->dev.controller.ports, CMPI_uint32); I leave these undocumented since you are going to change according to
On 03/14/2014 01:56 PM, John Ferlan wrote: the cover letter back to chars.
+ + if (dev->dev.controller.vectors) + CMSetProperty(inst, "Vectors", + (CMPIValue *)dev->dev.controller.vectors, + CMPI_uint32); + + if (dev->dev.controller.queues) + CMSetProperty(inst, "Queues", + (CMPIValue *)dev->dev.controller.queues, CMPI_uint32); + + if (dev->dev.controller.master.ct > 0) + set_rasd_property_value(broker, + ref, + &dev->dev.controller.address, + inst, + "MasterProperties", + "MasterValues"); + + if (dev->dev.controller.address.ct > 0) + set_rasd_property_value(broker, + ref, + &dev->dev.controller.address, + inst, + "AddressProperties", + "AddressValues"); + + return s; +} + CMPIInstance *rasd_from_vdev(const CMPIBroker *broker, struct virt_device *dev, const char *host, @@ -937,6 +992,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_OTHER; + base = "ControllerResourceAllocationSettingData"; } else { return NULL; } @@ -992,6 +1050,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(broker, ref, dev, inst); }
/* FIXME: Put the HostResource in place */ @@ -1126,6 +1186,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;
@@ -1163,6 +1225,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; } diff --git a/src/Virt_SettingsDefineState.c b/src/Virt_SettingsDefineState.c index c8cda97..d5c6726 100644 --- a/src/Virt_SettingsDefineState.c +++ b/src/Virt_SettingsDefineState.c @@ -361,6 +361,7 @@ static char* resource_allocation_setting_data[] = { "KVM_GraphicsResourceAllocationSettingData", "KVM_InputResourceAllocationSettingData", "KVM_ConsoleResourceAllocationSettingData", + "KVM_ControllerResourceAllocationSettingData", "LXC_DiskResourceAllocationSettingData", "LXC_MemResourceAllocationSettingData", "LXC_NetResourceAllocationSettingData", diff --git a/src/Virt_VSSDComponent.c b/src/Virt_VSSDComponent.c index 35bffde..734271c 100644 --- a/src/Virt_VSSDComponent.c +++ b/src/Virt_VSSDComponent.c @@ -141,6 +141,7 @@ static char* part_component[] = { "KVM_GraphicsResourceAllocationSettingData", "KVM_InputResourceAllocationSettingData", "KVM_ConsoleResourceAllocationSettingData", + "KVM_ControllerResourceAllocationSettingData", "LXC_DiskResourceAllocationSettingData", "LXC_MemResourceAllocationSettingData", "LXC_NetResourceAllocationSettingData",
-- Mit freundlichen Grüßen/Kind regards Boris Fiuczynski IBM Deutschland Research & Development GmbH Vorsitzender des Aufsichtsrats: Martina Köderitz Geschäftsführung: Dirk Wittkopp Sitz der Gesellschaft: Böblingen Registergericht: Amtsgericht Stuttgart, HRB 243294

On 03/14/2014 10:23 AM, Boris Fiuczynski wrote:
On 03/14/2014 01:56 PM, John Ferlan wrote:
From: Xu Wang <gesaint@linux.vnet.ibm.com>
Add the various controller fields and support for RASDs
Signed-off-by: Xu Wang <gesaint@linux.vnet.ibm.com> Signed-off-by: John Ferlan <jferlan@redhat.com> --- schema/ResourceAllocationSettingData.mof | 41 ++++++++++++ schema/ResourceAllocationSettingData.registration | 1 + src/Virt_ElementSettingData.c | 1 + src/Virt_RASD.c | 81 ++++++++++++++++++++--- src/Virt_SettingsDefineState.c | 1 + src/Virt_VSSDComponent.c | 1 + 6 files changed, 118 insertions(+), 8 deletions(-)
diff --git a/schema/ResourceAllocationSettingData.mof b/schema/ResourceAllocationSettingData.mof index bf1fbb6..30e62c4 100644 --- a/schema/ResourceAllocationSettingData.mof +++ b/schema/ResourceAllocationSettingData.mof @@ -322,6 +322,47 @@ class LXC_InputResourceAllocationSettingData : LXC_ResourceAllocationSettingData string BusType; };
+[Description ("KVM virtual controller device. It is identified by: " + "CIM_ResourceAllocationSettingData.ResourceType=1 ('Other'), " + "CIM_ResourceAllocationSettingData.OtherResourceType='controller'" + " and CIM_ResourceAllocationSettingData.ResourceSubType set to " + "one of 'ide', 'fdc', 'scsi', 'sata', 'ccid', 'virtio-serial', " + "or 'pci'."), + Provider("cmpi::Virt_RASD") +] +class KVM_ControllerResourceAllocationSettingData : KVM_ResourceAllocationSettingData +{ + [Description ("Order in which the bus controller is encountered. " + "The order is controller type scoped.")] + uint64 Index; + + [Description ("Optional string providing a specific model " + "information based on the controller type.")] + string Model; + + [Description ("The 'virtio-serial' controller uses the Ports and " + "Vectors to control how many devices can be connected " + "through the controller.")] + uint64 Ports; + uint64 Vectors; + + [Description ("Number of queues for the controller.")] + uint64 Queues; + + [Description ("Device master property names")] + string MasterProperties[]; + + [Description ("Device master property values")] + string MasterValues[]; + + [Description ("For controllers that are themselves devices on a " + "bus an optional element to specify the exact " + "relationship of the controller to its master bus. " + "Stored in the property and value arrays.")] + string AddressProperties[]; + string AddressValues[]; +}; + [Description ("Xen virtual network pool settings"), Provider("cmpi::Virt_RASD") ] diff --git a/schema/ResourceAllocationSettingData.registration b/schema/ResourceAllocationSettingData.registration index b969bfe..da0b7d9 100644 --- a/schema/ResourceAllocationSettingData.registration +++ b/schema/ResourceAllocationSettingData.registration @@ -14,6 +14,7 @@ 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 diff --git a/src/Virt_ElementSettingData.c b/src/Virt_ElementSettingData.c index c088e49..1fa81f2 100644 --- a/src/Virt_ElementSettingData.c +++ b/src/Virt_ElementSettingData.c @@ -137,6 +137,7 @@ static char* resource_allocation_setting_data[] = { "KVM_GraphicsResourceAllocationSettingData", "KVM_ConsoleResourceAllocationSettingData", "KVM_InputResourceAllocationSettingData", + "KVM_ControllerResourceAllocationSettingData", "LXC_DiskResourceAllocationSettingData", "LXC_MemResourceAllocationSettingData", "LXC_NetResourceAllocationSettingData", diff --git a/src/Virt_RASD.c b/src/Virt_RASD.c index df1e921..d3922cf 100644 --- a/src/Virt_RASD.c +++ b/src/Virt_RASD.c @@ -289,10 +289,12 @@ static bool get_vol_size(const CMPIBroker *broker, } #endif
-static CMPIStatus set_rasd_device_address(const CMPIBroker *broker, +static CMPIStatus set_rasd_property_value(const CMPIBroker *broker, const CMPIObjectPath *ref, const struct device_address *addr, - CMPIInstance *inst) + CMPIInstance *inst, + const char *property_name, + const char *property_value) { int i; CMPIArray *arr_key; @@ -338,11 +340,11 @@ static CMPIStatus set_rasd_device_address(const CMPIBroker *broker, CMPI_string); }
- CMSetProperty(inst, "AddressProperties", + CMSetProperty(inst, property_name, (CMPIValue *)&arr_key, CMPI_stringA);
- CMSetProperty(inst, "AddressValues", + CMSetProperty(inst, property_value, (CMPIValue *)&arr_value, CMPI_stringA);
@@ -489,10 +491,12 @@ static CMPIStatus set_disk_rasd_params(const CMPIBroker *broker, CMPI_boolean);
if (dev->dev.disk.address.ct > 0) - set_rasd_device_address(broker, + set_rasd_property_value(broker, ref, &dev->dev.disk.address, - inst); + inst, + "AddressProperties", + "AddressValues");
virStoragePoolFree(pool); virStorageVolFree(vol); @@ -658,10 +662,12 @@ static CMPIStatus set_net_rasd_params(const CMPIBroker *broker, CMPI_chars);
if (dev->dev.net.address.ct > 0) - set_rasd_device_address(broker, + set_rasd_property_value(broker, ref, &dev->dev.net.address, - inst); + inst, + "AddressProperties", + "AddressValues");
#if LIBVIR_VERSION_NUMBER < 9000 out: @@ -903,6 +909,55 @@ static CMPIStatus set_input_rasd_params(const struct virt_device *dev, return s; }
+static CMPIStatus set_controller_rasd_params(const CMPIBroker *broker, + const CMPIObjectPath *ref, + const struct virt_device *dev, + CMPIInstance *inst) +{ + CMPIStatus s = {CMPI_RC_OK, NULL}; + + CMSetProperty(inst, "OtherResourceType", "controller", CMPI_chars); + CMSetProperty(inst, "ResourceSubType", + (CMPIValue *)dev->dev.controller.type, CMPI_chars); + CMSetProperty(inst, "Index", + (CMPIValue *)dev->dev.controller.index, CMPI_uint32); (CMPIValue *)dev->dev.controller.index, CMPI_uint64);
yep - saw that too when I went back to change the others back to chars John
+ + if (dev->dev.controller.model) + CMSetProperty(inst, "Model", + (CMPIValue *)dev->dev.controller.model, CMPI_chars); + + if (dev->dev.controller.ports) + CMSetProperty(inst, "Ports", + (CMPIValue *)dev->dev.controller.ports, CMPI_uint32); I leave these undocumented since you are going to change according to the cover letter back to chars. + + if (dev->dev.controller.vectors) + CMSetProperty(inst, "Vectors", + (CMPIValue *)dev->dev.controller.vectors, + CMPI_uint32); + + if (dev->dev.controller.queues) + CMSetProperty(inst, "Queues", + (CMPIValue *)dev->dev.controller.queues, CMPI_uint32); + + if (dev->dev.controller.master.ct > 0) + set_rasd_property_value(broker, + ref, + &dev->dev.controller.address, + inst, + "MasterProperties", + "MasterValues"); + + if (dev->dev.controller.address.ct > 0) + set_rasd_property_value(broker, + ref, + &dev->dev.controller.address, + inst, + "AddressProperties", + "AddressValues"); + + return s; +} + CMPIInstance *rasd_from_vdev(const CMPIBroker *broker, struct virt_device *dev, const char *host, @@ -937,6 +992,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_OTHER; + base = "ControllerResourceAllocationSettingData"; } else { return NULL; } @@ -992,6 +1050,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(broker, ref, dev, inst); }
/* FIXME: Put the HostResource in place */ @@ -1126,6 +1186,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;
@@ -1163,6 +1225,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; } diff --git a/src/Virt_SettingsDefineState.c b/src/Virt_SettingsDefineState.c index c8cda97..d5c6726 100644 --- a/src/Virt_SettingsDefineState.c +++ b/src/Virt_SettingsDefineState.c @@ -361,6 +361,7 @@ static char* resource_allocation_setting_data[] = { "KVM_GraphicsResourceAllocationSettingData", "KVM_InputResourceAllocationSettingData", "KVM_ConsoleResourceAllocationSettingData", + "KVM_ControllerResourceAllocationSettingData", "LXC_DiskResourceAllocationSettingData", "LXC_MemResourceAllocationSettingData", "LXC_NetResourceAllocationSettingData", diff --git a/src/Virt_VSSDComponent.c b/src/Virt_VSSDComponent.c index 35bffde..734271c 100644 --- a/src/Virt_VSSDComponent.c +++ b/src/Virt_VSSDComponent.c @@ -141,6 +141,7 @@ static char* part_component[] = { "KVM_GraphicsResourceAllocationSettingData", "KVM_InputResourceAllocationSettingData", "KVM_ConsoleResourceAllocationSettingData", + "KVM_ControllerResourceAllocationSettingData", "LXC_DiskResourceAllocationSettingData", "LXC_MemResourceAllocationSettingData", "LXC_NetResourceAllocationSettingData",

From: Xu Wang <gesaint@linux.vnet.ibm.com> Support being able to convert the Controller RASD into a virtual device Signed-off-by: Xu Wang <gesaint@linux.vnet.ibm.com> Signed-off-by: John Ferlan <jferlan@redhat.com> --- src/Virt_VirtualSystemManagementService.c | 76 +++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) diff --git a/src/Virt_VirtualSystemManagementService.c b/src/Virt_VirtualSystemManagementService.c index 3e7785e..26de59d 100644 --- a/src/Virt_VirtualSystemManagementService.c +++ b/src/Virt_VirtualSystemManagementService.c @@ -1838,6 +1838,53 @@ 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 = NULL; + const char *msg = NULL; + int ret; + + if (cu_get_str_prop(inst, "ResourceSubType", &val) != CMPI_RC_OK) { + msg = "ControllerRASD ResourceSubType field not valid"; + goto out; + } + dev->dev.controller.type = strdup(val); + + /* Required fields */ + if (cu_get_u64_prop(inst, "Index", + &dev->dev.controller.index) != CMPI_RC_OK) { + msg = "ControllerRASD Index field not valid"; + goto out; + } + + /* Formulate our instance id from controller, controller type, + * and index value. This should be unique enough. + */ + ret = asprintf(&dev->id, "controller:%s:" PRIu64, + dev->dev.controller.type, + dev->dev.controller.index); + if (ret == -1) { + msg = "Failed to create controller string"; + goto out; + } + + /* Optional fields */ + if (cu_get_str_prop(inst, "Model", &val) == CMPI_RC_OK) + dev->dev.controller.model = strdup(val); + if (cu_get_str_prop(inst, "Ports", &val) == CMPI_RC_OK) + dev->dev.controller.ports = strdup(val); + if (cu_get_str_prop(inst, "Vectors", &val) == CMPI_RC_OK) + dev->dev.controller.vectors = strdup(val); + if (cu_get_str_prop(inst, "Queues", &val) == CMPI_RC_OK) + dev->dev.controller.queues = strdup(val); + msg = rasd_to_device_address(inst, &dev->dev.controller.address); + + out: + + return msg; +} + static const char *_sysvirt_rasd_to_vdev(CMPIInstance *inst, struct virt_device *dev, uint16_t type, @@ -1858,6 +1905,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"; @@ -1878,6 +1927,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"; @@ -1987,6 +2038,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; @@ -2101,7 +2155,23 @@ static const char *classify_resources(CMPIArray *resources, &domain->dev_input[0], ns, p_error); + } else if (type == CIM_RES_TYPE_CONTROLLER) { + struct virt_device dev; + int dcount = count + domain->dev_controller_ct; + + memset(&dev, 0, sizeof(dev)); + msg = rasd_to_vdev(inst, + domain, + &dev, + ns, + p_error); + if (msg == NULL) + msg = add_device_nodup(&dev, + domain->dev_controller, + dcount, + &domain->dev_controller_ct); } + if (msg != NULL) return msg; @@ -2908,6 +2978,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; @@ -3029,6 +3102,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 { @@ -3111,6 +3185,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, ""); @@ -3188,6 +3263,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.8.5.3

On 03/14/2014 01:56 PM, John Ferlan wrote:
From: Xu Wang <gesaint@linux.vnet.ibm.com>
Support being able to convert the Controller RASD into a virtual device Signed-off-by: Xu Wang <gesaint@linux.vnet.ibm.com>
Signed-off-by: John Ferlan <jferlan@redhat.com> --- src/Virt_VirtualSystemManagementService.c | 76 +++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+)
diff --git a/src/Virt_VirtualSystemManagementService.c b/src/Virt_VirtualSystemManagementService.c index 3e7785e..26de59d 100644 --- a/src/Virt_VirtualSystemManagementService.c +++ b/src/Virt_VirtualSystemManagementService.c @@ -1838,6 +1838,53 @@ 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 = NULL; + const char *msg = NULL; + int ret; + + if (cu_get_str_prop(inst, "ResourceSubType", &val) != CMPI_RC_OK) { + msg = "ControllerRASD ResourceSubType field not valid"; + goto out; + } + dev->dev.controller.type = strdup(val); + + /* Required fields */ + if (cu_get_u64_prop(inst, "Index", + &dev->dev.controller.index) != CMPI_RC_OK) { + msg = "ControllerRASD Index field not valid"; + goto out; + } As I wrote elsewhere this is going to prevent the libvirt-cim user from using the libvirt auto assignment for the index.
+ + /* Formulate our instance id from controller, controller type, + * and index value. This should be unique enough. + */
...
@@ -3029,6 +3102,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) || What is the reason for adding the controller here?
(type == CIM_RES_TYPE_INPUT)) cu_statusf(_BROKER, &s, CMPI_RC_OK, ""); else { @@ -3111,6 +3185,7 @@ static CMPIStatus resource_add(struct domain *dominfo,
Why is the controller instance not added to a running domain? Instead of restricting it in the if statement below all I think should be done is this (before the if in the patch below.) if (type == CIM_RES_TYPE_CONTROLLER && dev != NULL && dev->id == NULL) { cu_statusf(_BROKER, &s, CMPI_RC_ERR_FAILED, "Add resource failed: Index property is required."); goto out; }
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, ""); @@ -3188,6 +3263,7 @@ static CMPIStatus resource_mod(struct domain *dominfo,
if ((type == CIM_RES_TYPE_GRAPHICS) || (type == CIM_RES_TYPE_INPUT) || + (type == CIM_RES_TYPE_CONTROLLER) ||
What is the reason for adding the controller here?
(type == CIM_RES_TYPE_CONSOLE)) cu_statusf(_BROKER, &s, CMPI_RC_OK, ""); else {
-- Mit freundlichen Grüßen/Kind regards Boris Fiuczynski IBM Deutschland Research & Development GmbH Vorsitzender des Aufsichtsrats: Martina Köderitz Geschäftsführung: Dirk Wittkopp Sitz der Gesellschaft: Böblingen Registergericht: Amtsgericht Stuttgart, HRB 243294

On 03/14/2014 10:40 AM, Boris Fiuczynski wrote:
On 03/14/2014 01:56 PM, John Ferlan wrote:
From: Xu Wang <gesaint@linux.vnet.ibm.com>
Support being able to convert the Controller RASD into a virtual device Signed-off-by: Xu Wang <gesaint@linux.vnet.ibm.com>
Signed-off-by: John Ferlan <jferlan@redhat.com> --- src/Virt_VirtualSystemManagementService.c | 76 +++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+)
diff --git a/src/Virt_VirtualSystemManagementService.c b/src/Virt_VirtualSystemManagementService.c index 3e7785e..26de59d 100644 --- a/src/Virt_VirtualSystemManagementService.c +++ b/src/Virt_VirtualSystemManagementService.c @@ -1838,6 +1838,53 @@ 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 = NULL; + const char *msg = NULL; + int ret; + + if (cu_get_str_prop(inst, "ResourceSubType", &val) != CMPI_RC_OK) { + msg = "ControllerRASD ResourceSubType field not valid"; + goto out; + } + dev->dev.controller.type = strdup(val); + + /* Required fields */ + if (cu_get_u64_prop(inst, "Index", + &dev->dev.controller.index) != CMPI_RC_OK) { + msg = "ControllerRASD Index field not valid"; + goto out; + } As I wrote elsewhere this is going to prevent the libvirt-cim user from using the libvirt auto assignment for the index.
OK - I'll rework this..
+ + /* Formulate our instance id from controller, controller type, + * and index value. This should be unique enough. + */
...
@@ -3029,6 +3102,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) || What is the reason for adding the controller here?
That's original code that I haven't touched, thought about, or I guess knew what to do with... I guess I just hadn't got this far yet. I'll work through the remaining comments... Xu if you have the time to provide some feedback it would be most welcome... John
(type == CIM_RES_TYPE_INPUT)) cu_statusf(_BROKER, &s, CMPI_RC_OK, ""); else { @@ -3111,6 +3185,7 @@ static CMPIStatus resource_add(struct domain *dominfo,
Why is the controller instance not added to a running domain? Instead of restricting it in the if statement below all I think should be done is this (before the if in the patch below.) if (type == CIM_RES_TYPE_CONTROLLER && dev != NULL && dev->id == NULL) { cu_statusf(_BROKER, &s, CMPI_RC_ERR_FAILED, "Add resource failed: Index property is required."); goto out; }
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, ""); @@ -3188,6 +3263,7 @@ static CMPIStatus resource_mod(struct domain *dominfo,
if ((type == CIM_RES_TYPE_GRAPHICS) || (type == CIM_RES_TYPE_INPUT) || + (type == CIM_RES_TYPE_CONTROLLER) ||
What is the reason for adding the controller here?
(type == CIM_RES_TYPE_CONSOLE)) cu_statusf(_BROKER, &s, CMPI_RC_OK, ""); else {

Changes since last time -
1. Address review comments 2. I did not add CONTROLLER_INDEX_NOT_SET. Since that's a -1 value and the index is an unsigned value - it just didn't seem right. Furthermore, if libvirt doesn't find the 'index' value, it defaults to using 0 when parsing the XML - so I think following that model is better. I have yet to chase down all the libvirt paths to see what happens, but I think if someone adds a controller without defining an index and that index conflicts with something already there for that named/type of controller, then libvirt will reject the xml for the guest to start requiring the "user" to fix it. If I remember correctly libvirt has a mechanism to look for the next free index available. Defaulting the index when not specified to 0 would
3. I didn't yet do it, but I think the 'master' may need to be removed. The libvirt documented example is:
<devices> <controller type='usb' index='0' model='ich9-ehci1'> <address type='pci' domain='0' bus='0' slot='4' function='7'/> </controller> <controller type='usb' index='0' model='ich9-uhci1'> <master startport='0'/> <address type='pci' domain='0' bus='0' slot='4' function='0' multifunction='on'/> </controller> ... </devices>
This examples shows that the type is 'usb' and the 'index' is 0 for both which would violate our namespace rule. The 'model' is the same too. So unless we incorporate the address into the name, then there's a conflict. Yes, that is a correct observation and I agree with you that removing
On 03/14/2014 01:56 PM, John Ferlan wrote: prevent libvirt-cim users from exploiting the mechanism. the master and restricting the support for master is a feasible way. If at some later point this special case really becomes a requirement than it would still be possible to extend the InstanceID for these cases, I guess.
I'll have to think about this one some more and of course take advice!
4. Just realized I forgot to switch the mof values for queues, ports, and vectors back to string types... I'll do that, but didn't want to lose my current cover letter.
Xu Wang (3): libxutil, xmlgen: Add Controller Support RASD: Schema and Provider Support for Controller RASDs VSMS: Support for domains with controller devices
libxkutil/device_parsing.c | 105 +++++++++++++++++++++- libxkutil/device_parsing.h | 15 ++++ libxkutil/xmlgen.c | 52 +++++++++++ schema/ResourceAllocationSettingData.mof | 41 +++++++++ schema/ResourceAllocationSettingData.registration | 1 + src/Virt_ElementSettingData.c | 1 + src/Virt_RASD.c | 81 +++++++++++++++-- src/Virt_SettingsDefineState.c | 1 + src/Virt_VSSDComponent.c | 1 + src/Virt_VirtualSystemManagementService.c | 76 ++++++++++++++++ src/svpc_types.h | 4 +- 11 files changed, 368 insertions(+), 10 deletions(-)
-- Mit freundlichen Grüßen/Kind regards Boris Fiuczynski IBM Deutschland Research & Development GmbH Vorsitzender des Aufsichtsrats: Martina Köderitz Geschäftsführung: Dirk Wittkopp Sitz der Gesellschaft: Böblingen Registergericht: Amtsgericht Stuttgart, HRB 243294

On 03/14/2014 10:20 AM, Boris Fiuczynski wrote:
Changes since last time -
1. Address review comments 2. I did not add CONTROLLER_INDEX_NOT_SET. Since that's a -1 value and the index is an unsigned value - it just didn't seem right. Furthermore, if libvirt doesn't find the 'index' value, it defaults to using 0 when parsing the XML - so I think following that model is better. I have yet to chase down all the libvirt paths to see what happens, but I think if someone adds a controller without defining an index and that index conflicts with something already there for that named/type of controller, then libvirt will reject the xml for the guest to start requiring the "user" to fix it. If I remember correctly libvirt has a mechanism to look for the next free index available. Defaulting the index when not specified to 0 would
On 03/14/2014 01:56 PM, John Ferlan wrote: prevent libvirt-cim users from exploiting the mechanism.
OK - I guess it's the -1 into the unsigned value that really caught my attention. Now that things are "merged" into one change it may be easier for my brain to comprehend where things are. I assume this would be the 'create' path where we'd have to allow that -1 value. The problem I have is how then is then the dev->id thing. I'm trying to get the "big picture" of how that will be generated then. I'll go back and look at the change in the context of your previous review. Once libvirt creates the guest, it will be assigned a number and thus the next read of the XML would have it.
3. I didn't yet do it, but I think the 'master' may need to be removed. The libvirt documented example is:
<devices> <controller type='usb' index='0' model='ich9-ehci1'> <address type='pci' domain='0' bus='0' slot='4' function='7'/> </controller> <controller type='usb' index='0' model='ich9-uhci1'> <master startport='0'/> <address type='pci' domain='0' bus='0' slot='4' function='0' multifunction='on'/> </controller> ... </devices>
This examples shows that the type is 'usb' and the 'index' is 0 for both which would violate our namespace rule. The 'model' is the same too. So unless we incorporate the address into the name, then there's a conflict. Yes, that is a correct observation and I agree with you that removing the master and restricting the support for master is a feasible way. If at some later point this special case really becomes a requirement than it would still be possible to extend the InstanceID for these cases, I guess.
I'll work on removing it then. Not all good intentions work out... John
I'll have to think about this one some more and of course take advice!
4. Just realized I forgot to switch the mof values for queues, ports, and vectors back to string types... I'll do that, but didn't want to lose my current cover letter.
Xu Wang (3): libxutil, xmlgen: Add Controller Support RASD: Schema and Provider Support for Controller RASDs VSMS: Support for domains with controller devices
libxkutil/device_parsing.c | 105 +++++++++++++++++++++- libxkutil/device_parsing.h | 15 ++++ libxkutil/xmlgen.c | 52 +++++++++++ schema/ResourceAllocationSettingData.mof | 41 +++++++++ schema/ResourceAllocationSettingData.registration | 1 + src/Virt_ElementSettingData.c | 1 + src/Virt_RASD.c | 81 +++++++++++++++-- src/Virt_SettingsDefineState.c | 1 + src/Virt_VSSDComponent.c | 1 + src/Virt_VirtualSystemManagementService.c | 76 ++++++++++++++++ src/svpc_types.h | 4 +- 11 files changed, 368 insertions(+), 10 deletions(-)

While thinking during idle moments this past weekend (a 2+ hour each way drive) I was thinking perhaps some of the issues I'm facing with cimtest and associating this ControllerRASD is that there's no logical device Controller like there is for Input, Graphics, Console, etc. devices. Additionally, there's a pools and rasds association which I just haven't quite got right. So, I started looking into CIM_Controller and thought well - isn't that more of what we're talking about for a libvirt controller device? Other than a 'ccid' and 'virtio-serial' types the other types in the libvirt list can be correlated to a CIM_Controller "ProtocolSupported" value: ide == IDE fdc == Flexbile Diskette scsi == [one of the] SCSI * types sata == Serial ATA ccid == ?Our own value? virtio-serial == Our own value usb = Universal Serial Bus So I'm headed off in that direction, but before going to far - I wanted to be sure I wasn't off in the weeds too far. Still trying to nail down some minor particulars such as where is the DeviceID value set (eg dev->id), but "so far" for the most part things seem to be better 'cimtest' wise than going with the RASD type. Given that this is the right direction - I'm not sure a ControllerRASD is necessary, is it? The one thing that does seem to be necessary is when a bus is provided for some device, we have to "find" or "ensure" that KVM/CIM_Controller device exists. How the association there will work I haven't yet figured out, but theoretically it seems to be the right path. John
participants (2)
-
Boris Fiuczynski
-
John Ferlan