From cvincent at linux.vnet.ibm.com Tue Jun 15 16:24:40 2010 From: cvincent at linux.vnet.ibm.com (Chip Vincent) Date: Tue, 15 Jun 2010 12:24:40 -0400 Subject: [Libvirt-cim] [PATCH] Workaround for Pegasus ObjectPath issue In-Reply-To: <49781459fdcfb5cd91eb.1274997606@elm3b151.beaverton.ibm.com> References: <49781459fdcfb5cd91eb.1274997606@elm3b151.beaverton.ibm.com> Message-ID: <4C17A948.8010801@linux.vnet.ibm.com> +1 Sharad Mishra wrote: > # HG changeset patch > # User Sharad Mishra > # Date 1274997567 25200 > # Node ID 49781459fdcfb5cd91eb7c1e99701d663d5b53eb > # Parent 8b1793add36c7e72933c2f8f04c400fa9d3b8910 > Workaround for Pegasus ObjectPath issue. > > Pegasus loses its object path after a call to CMGetObjectPath. > This patch adds the object path back to indication. > > Signed-off-by: Sharad Mishra > > diff -r 8b1793add36c -r 49781459fdcf src/Virt_ResourceAllocationSettingDataIndication.c > --- a/src/Virt_ResourceAllocationSettingDataIndication.c Thu May 27 14:09:56 2010 -0700 > +++ b/src/Virt_ResourceAllocationSettingDataIndication.c Thu May 27 14:59:27 2010 -0700 > @@ -113,6 +113,10 @@ > args->classname = strdup(CLASSNAME(ref)); > args->_ctx = _ctx; > > + /* This is a workaround for Pegasus, it loses its objectpath by > + CMGetObjectPath. So set it back. */ > + ind->ft->setObjectPath((CMPIInstance *)ind, ref); > + > s = stdi_deliver(broker, ctx, args, (CMPIInstance *)ind); > if (s.rc == CMPI_RC_OK) { > CU_DEBUG("Indication delivered"); > diff -r 8b1793add36c -r 49781459fdcf src/Virt_VSMigrationService.c > --- a/src/Virt_VSMigrationService.c Thu May 27 14:09:56 2010 -0700 > +++ b/src/Virt_VSMigrationService.c Thu May 27 14:59:27 2010 -0700 > @@ -757,6 +757,11 @@ > ind_name = ind_type_to_name(ind_type); > > ref = CMGetObjectPath(inst, &s); > + > + /* This is a workaround for Pegasus, it loses its objectpath by > + CMGetObjectPath. So set it back. */ > + inst->ft->setObjectPath((CMPIInstance *)inst, ref); > + > if ((ref == NULL) || (s.rc != CMPI_RC_OK)) { > CU_DEBUG("Failed to get job reference"); > } else { > > _______________________________________________ > Libvirt-cim mailing list > Libvirt-cim at redhat.com > https://www.redhat.com/mailman/listinfo/libvirt-cim > -- Chip Vincent Open Virtualization, Linux Technology Center IBM Systems & Technology Group phone: 919-254-4482, T/L 444-4482 email: cvincent at us.ibm.com From snmishra at us.ibm.com Tue Jun 15 21:26:24 2010 From: snmishra at us.ibm.com (Sharad Mishra) Date: Tue, 15 Jun 2010 14:26:24 -0700 Subject: [Libvirt-cim] [PATCH] (#2) Generating Deleted indication after Modified indication Message-ID: # HG changeset patch # User Sharad Mishra # Date 1276637134 25200 # Node ID b2b8177338722a1f961430c8ccfe7820a5368ff7 # Parent e4583b1db56fd083c67d12a388a012ab860a5604 (#2) Generating Deleted indication after Modified indication. Changes: Virt_VSMigrationService changed, so patch was redone. This patch moves migration job deleted indication after migration job modified (job completed) indication. Signed-off-by: Sharad Mishra diff -r e4583b1db56f -r b2b817733872 src/Virt_VSMigrationService.c --- a/src/Virt_VSMigrationService.c Thu May 27 14:59:27 2010 -0700 +++ b/src/Virt_VSMigrationService.c Tue Jun 15 14:25:34 2010 -0700 @@ -1240,7 +1240,6 @@ } out: clear_infstore_migration_flag(dom); - raise_deleted_ind(job); free(uri); free(xml); @@ -1271,6 +1270,7 @@ CIM_JOBSTATE_COMPLETE, "Completed"); + raise_deleted_ind(job); virConnectClose(job->conn); free(job->domain); free(job->ref_cn); From cvincent at linux.vnet.ibm.com Wed Jun 16 18:37:50 2010 From: cvincent at linux.vnet.ibm.com (Chip Vincent) Date: Wed, 16 Jun 2010 14:37:50 -0400 Subject: [Libvirt-cim] [PATCH] (#2) Generating Deleted indication after Modified indication In-Reply-To: References: Message-ID: <4C1919FE.7080102@linux.vnet.ibm.com> +1 Sharad Mishra wrote: > # HG changeset patch > # User Sharad Mishra > # Date 1276637134 25200 > # Node ID b2b8177338722a1f961430c8ccfe7820a5368ff7 > # Parent e4583b1db56fd083c67d12a388a012ab860a5604 > (#2) Generating Deleted indication after Modified indication. > > Changes: Virt_VSMigrationService changed, so patch was redone. > > This patch moves migration job deleted indication after migration job > modified (job completed) indication. > > Signed-off-by: Sharad Mishra > > diff -r e4583b1db56f -r b2b817733872 src/Virt_VSMigrationService.c > --- a/src/Virt_VSMigrationService.c Thu May 27 14:59:27 2010 -0700 > +++ b/src/Virt_VSMigrationService.c Tue Jun 15 14:25:34 2010 -0700 > @@ -1240,7 +1240,6 @@ > } > out: > clear_infstore_migration_flag(dom); > - raise_deleted_ind(job); > > free(uri); > free(xml); > @@ -1271,6 +1270,7 @@ > CIM_JOBSTATE_COMPLETE, > "Completed"); > > + raise_deleted_ind(job); > virConnectClose(job->conn); > free(job->domain); > free(job->ref_cn); > > _______________________________________________ > Libvirt-cim mailing list > Libvirt-cim at redhat.com > https://www.redhat.com/mailman/listinfo/libvirt-cim > -- Chip Vincent Open Virtualization, Linux Technology Center IBM Systems & Technology Group phone: 919-254-4482, T/L 444-4482 email: cvincent at us.ibm.com From snmishra at us.ibm.com Thu Jun 17 21:43:52 2010 From: snmishra at us.ibm.com (Sharad Mishra) Date: Thu, 17 Jun 2010 14:43:52 -0700 Subject: [Libvirt-cim] [PATCH] Add support for VSI/DCN Message-ID: # HG changeset patch # User Sharad Mishra # Date 1276810951 25200 # Node ID a31f3f023acdd0edd73636a86a93c08803dd7158 # Parent b2b8177338722a1f961430c8ccfe7820a5368ff7 Add support for VSI/DCN. Signed-off-by: Sharad Mishra diff -r b2b817733872 -r a31f3f023acd libxkutil/device_parsing.c --- a/libxkutil/device_parsing.c Tue Jun 15 14:25:34 2010 -0700 +++ b/libxkutil/device_parsing.c Thu Jun 17 14:42:31 2010 -0700 @@ -58,6 +58,17 @@ free(dev->bus_type); } +static void cleanup_vsi_device(struct vsi_device *dev) +{ + free(dev->vsi_type); + free(dev->manager_id); + free(dev->type_id); + free(dev->type_id_version); + free(dev->instance_id); + free(dev->filter_ref); + free(dev->profile_id); +} + static void cleanup_net_device(struct net_device *dev) { free(dev->type); @@ -66,6 +77,7 @@ free(dev->model); free(dev->device); free(dev->net_mode); + cleanup_vsi_device(&dev->vsi); } static void cleanup_emu_device(struct emu_device *dev) @@ -288,6 +300,7 @@ { struct virt_device *vdev = NULL; struct net_device *ndev = NULL; + struct vsi_device *vsi_dev = NULL; xmlNode *child = NULL; vdev = calloc(1, sizeof(*vdev)); @@ -295,6 +308,7 @@ goto err; ndev = &(vdev->dev.net); + vsi_dev = &(ndev->vsi); ndev->type = get_attr_value(inode, "type"); if (ndev->type == NULL) @@ -325,12 +339,28 @@ ndev->model = get_attr_value(child, "type"); if (ndev->model == NULL) goto err; + } else if (XSTREQ(child->name, "virtualport")) { + vsi_dev->vsi_type = get_attr_value(child, "type"); + if (vsi_dev->vsi_type == NULL) + goto err; + } else if (XSTREQ(child->name, "parameters")) { + vsi_dev->manager_id = get_attr_value(child, "managerid"); + if (vsi_dev->manager_id == NULL) + goto err; + + vsi_dev->type_id = get_attr_value(child, "typeid"); + if (vsi_dev->type_id == NULL) + goto err; + + vsi_dev->type_id_version = get_attr_value(child, "typeidversion"); + if (vsi_dev->type_id_version == NULL) + goto err; + + vsi_dev->instance_id = get_attr_value(child, "instanceid"); + vsi_dev->profile_id = get_attr_value(child, "profileid"); } } - if (ndev->mac == NULL) - goto err; - if (ndev->source == NULL) CU_DEBUG("No network source defined, leaving blank\n"); @@ -602,6 +632,7 @@ int len = 0; int count = 0; + CU_DEBUG("In parse_deviceso - type is %d", type); xmlDoc *xmldoc; xmlXPathContext *xpathCtx; xmlXPathObject *xpathObj; @@ -672,6 +703,13 @@ DUP_FIELD(dev, _dev, dev.net.model); DUP_FIELD(dev, _dev, dev.net.device); DUP_FIELD(dev, _dev, dev.net.net_mode); + DUP_FIELD(dev, _dev, dev.net.vsi.vsi_type); + DUP_FIELD(dev, _dev, dev.net.vsi.manager_id); + DUP_FIELD(dev, _dev, dev.net.vsi.type_id); + DUP_FIELD(dev, _dev, dev.net.vsi.type_id_version); + DUP_FIELD(dev, _dev, dev.net.vsi.instance_id); + DUP_FIELD(dev, _dev, dev.net.vsi.filter_ref); + DUP_FIELD(dev, _dev, dev.net.vsi.profile_id); } else if (dev->type == CIM_RES_TYPE_DISK) { DUP_FIELD(dev, _dev, dev.disk.type); DUP_FIELD(dev, _dev, dev.disk.device); @@ -980,6 +1018,7 @@ { int ret; + CU_DEBUG("In get_dominfo_from_xml"); *dominfo = malloc(sizeof(**dominfo)); if (*dominfo == NULL) return 0; @@ -1019,8 +1058,8 @@ { char *xml; int ret; + xml = virDomainGetXMLDesc(dom, 0); - xml = virDomainGetXMLDesc(dom, 0); if (xml == NULL) return 0; diff -r b2b817733872 -r a31f3f023acd libxkutil/device_parsing.h --- a/libxkutil/device_parsing.h Tue Jun 15 14:25:34 2010 -0700 +++ b/libxkutil/device_parsing.h Thu Jun 17 14:42:31 2010 -0700 @@ -33,6 +33,16 @@ #include "../src/svpc_types.h" +struct vsi_device { + char *vsi_type; + char *manager_id; + char *type_id; + char *type_id_version; + char *instance_id; + char *filter_ref; + char *profile_id; +}; + struct disk_device { char *type; char *device; @@ -52,6 +62,7 @@ char *model; char *device; char *net_mode; + struct vsi_device vsi; }; struct mem_device { diff -r b2b817733872 -r a31f3f023acd libxkutil/xmlgen.c --- a/libxkutil/xmlgen.c Tue Jun 15 14:25:34 2010 -0700 +++ b/libxkutil/xmlgen.c Thu Jun 17 14:42:31 2010 -0700 @@ -159,6 +159,40 @@ return msg; } +static const char *set_net_vsi(xmlNodePtr nic, struct vsi_device *dev) +{ + xmlNodePtr tmp; + + tmp = xmlNewChild(nic, NULL, BAD_CAST "virtualport", NULL); + if (tmp == NULL) + return XML_ERROR; + xmlNewProp(tmp, BAD_CAST "type", BAD_CAST dev->vsi_type); + + tmp = xmlNewChild(tmp, NULL, BAD_CAST "parameters", NULL); + if (tmp == NULL) + return XML_ERROR; + if (STREQ(dev->vsi_type, "802.1Qbh")) { + if (dev->profile_id != NULL) + xmlNewProp(tmp, BAD_CAST "profileid", + BAD_CAST dev->profile_id); + } else { + if (dev->manager_id != NULL) + xmlNewProp(tmp, BAD_CAST "managerid", + BAD_CAST dev->manager_id); + if (dev->type_id != NULL) + xmlNewProp(tmp, BAD_CAST "typeid", + BAD_CAST dev->type_id); + if (dev->type_id_version != NULL) + xmlNewProp(tmp, BAD_CAST "typeidversion", + BAD_CAST dev->type_id_version); + if (dev->instance_id != NULL) + xmlNewProp(tmp, BAD_CAST "instanceid", + BAD_CAST dev->instance_id); + } + + return NULL; +} + static const char *set_net_source(xmlNodePtr nic, struct net_device *dev, const char *src_type) @@ -247,8 +281,13 @@ msg = bridge_net_to_xml(nic, net); else if (STREQ(dev->dev.net.type, "user")) continue; - else if (STREQ(dev->dev.net.type, "direct")) + else if (STREQ(dev->dev.net.type, "direct")) { msg = set_net_source(nic, net, "direct"); + if (net->vsi.vsi_type != NULL) { + struct vsi_device *vsi = &dev->dev.net.vsi; + msg = set_net_vsi(nic, vsi); + } + } else msg = "Unknown interface type"; } diff -r b2b817733872 -r a31f3f023acd schema/ResourceAllocationSettingData.mof --- a/schema/ResourceAllocationSettingData.mof Tue Jun 15 14:25:34 2010 -0700 +++ b/schema/ResourceAllocationSettingData.mof Thu Jun 17 14:42:31 2010 -0700 @@ -68,6 +68,29 @@ [Description ("Network mode, could be 'vepa', 'pepa' etc.")] string NetworkMode; + + [Description ("VSI type")] + string VSIType; + + [Description ("VSI manager id")] + string VSIManagerID; + + [Description ("VSI type")] + string VSITypeID; + + [Description ("expected/desired version of VTID")] + string VSITypeIDVersion; + + [Description ("A globally unique ID for the connection instance." + " The ID shall be done consistent with IETF RFC 4122.")] + string VSIInstanceID; + + [Description ("Profile ID")] + string ProfileID; + + [Description ("Filter REF")] + string FilterRef; + }; [Description ("KVM virtual network configuration"), @@ -90,6 +113,28 @@ [Description ("Network mode, could be 'vepa', 'pepa' etc.")] string NetworkMode; + + [Description ("VSI type")] + string VSIType; + + [Description ("VSI manager id")] + string VSIManagerID; + + [Description ("VSI type")] + string VSITypeID; + + [Description ("expected/desired version of VTID")] + string VSITypeIDVersion; + + [Description ("A globally unique ID for the connection instance." + " The ID shall be done consistent with IETF RFC 4122.")] + string VSIInstanceID; + + [Description ("Profile ID")] + string ProfileID; + + [Description ("Filter REF")] + string FilterRef; }; [Description ("LXC virtual network configuration"), diff -r b2b817733872 -r a31f3f023acd src/Virt_RASD.c --- a/src/Virt_RASD.c Tue Jun 15 14:25:34 2010 -0700 +++ b/src/Virt_RASD.c Thu Jun 17 14:42:31 2010 -0700 @@ -278,6 +278,57 @@ return s; } +static CMPIStatus set_net_vsi_rasd_params(const CMPIBroker *broker, + const CMPIObjectPath *ref, + const struct vsi_device vsi, + CMPIInstance *inst) +{ + CMPIStatus s = {CMPI_RC_OK, NULL}; + + CMSetProperty(inst, + "VSIType", + (CMPIValue *)vsi.vsi_type, + CMPI_chars); + + if (vsi.manager_id != NULL) + CMSetProperty(inst, + "VSIManagerID", + (CMPIValue *)vsi.manager_id, + CMPI_chars); + + if (vsi.type_id != NULL) + CMSetProperty(inst, + "VSITypeID", + (CMPIValue *)vsi.type_id, + CMPI_chars); + + if (vsi.type_id_version != NULL) + CMSetProperty(inst, + "VSITypeIDVersion", + (CMPIValue *)vsi.type_id_version, + CMPI_chars); + + if (vsi.instance_id != NULL) + CMSetProperty(inst, + "VSIInstanceID", + (CMPIValue *)vsi.instance_id, + CMPI_chars); + + if (vsi.filter_ref != NULL) + CMSetProperty(inst, + "FilterRef", + (CMPIValue *)vsi.filter_ref, + CMPI_chars); + + if (vsi.profile_id != NULL) + CMSetProperty(inst, + "ProfileID", + (CMPIValue *)vsi.profile_id, + CMPI_chars); + + return s; +} + static CMPIStatus set_net_rasd_params(const CMPIBroker *broker, const CMPIObjectPath *ref, const struct virt_device *dev, @@ -482,6 +533,13 @@ s = set_disk_rasd_params(broker, ref, dev, inst); } else if (dev->type == CIM_RES_TYPE_NET) { s = set_net_rasd_params(broker, ref, dev, inst); + if ((s.rc == CMPI_RC_OK) && + (dev->dev.net.vsi.vsi_type != NULL)) + s = set_net_vsi_rasd_params(broker, + ref, + dev->dev.net.vsi, + inst); + } else if (dev->type == CIM_RES_TYPE_MEM) { const char *units = "KiloBytes"; diff -r b2b817733872 -r a31f3f023acd src/Virt_SettingsDefineCapabilities.c --- a/src/Virt_SettingsDefineCapabilities.c Tue Jun 15 14:25:34 2010 -0700 +++ b/src/Virt_SettingsDefineCapabilities.c Thu Jun 17 14:42:31 2010 -0700 @@ -550,6 +550,12 @@ const char *src_dev, const char *net_mode, const char *model, + const char *vsi, + const char *manager, + const char *typeid, + const char *version, + const char *instance, + const char *profile, struct inst_list *list) { CMPIInstance *inst; @@ -583,6 +589,31 @@ CMSetProperty(inst, "ResourceSubType", (CMPIValue *)model, CMPI_chars); + if (vsi != NULL) + s = CMSetProperty(inst, "VSIType", + (CMPIValue *)vsi, CMPI_chars); + + + if (manager != NULL) + CMSetProperty(inst, "VSIManagerID", + (CMPIValue *)manager, CMPI_chars); + + if (typeid != NULL) + CMSetProperty(inst, "VSITypeID", + (CMPIValue *)typeid, CMPI_chars); + + if (version != NULL) + CMSetProperty(inst, "VSITypeIDVersion", + (CMPIValue *)version, CMPI_chars); + + if (instance != NULL) + CMSetProperty(inst, "VSIInstanceID", + (CMPIValue *)instance, CMPI_chars); + + if (profile != NULL) + CMSetProperty(inst, "ProfileID", + (CMPIValue *)profile, CMPI_chars); + inst_list_add(list, inst); out: @@ -600,8 +631,6 @@ int i,j; const char *type[] = {"network", "bridge", "user"}; const char *device[] = {"vtap1", NULL}; - const char *src_dev[] = {NULL, NULL}; - const char *net_mode[] = {NULL, NULL}; const char *model[] = {"e1000", NULL}; const char *name[] = {NULL, "br0", NULL}; @@ -641,17 +670,40 @@ name[i], num_nics, device[j], - src_dev[j], - net_mode[j], + NULL, + NULL, model[j], + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, list); if (s.rc != CMPI_RC_OK) goto out; } } - s = set_net_props(template_type, ref, id, "direct", NULL, num_nics, - NULL, "eth1", "vepa", NULL, list); + s = set_net_props(template_type, ref, id, "direct", NULL, + num_nics, NULL, "eth1", "vepa", NULL, + NULL, NULL, NULL, NULL, NULL, NULL, list); + /* profile id*/ + s = set_net_props(template_type, ref, id, "direct", NULL, + num_nics, NULL, "eth1", "vepa", NULL, + "802.1Qbh", NULL, NULL, NULL, + NULL, "my_profile", list); + /* no profile id but with instance id*/ + s = set_net_props(template_type, ref, id, "direct", NULL, + num_nics, NULL, "eth1", "vepa", NULL, + "802.1Qbg", "managerid", "typeid", + "typeidversion", "instanceid", NULL, + list); + /* no profile id and no instance id*/ + s = set_net_props(template_type, ref, id, "direct", NULL, + num_nics, NULL, "eth1", "vepa", NULL, + "802.1Qbg", "managerid", "typeid", + "typeidversion", "NULL", "NULL", list); out: return s; diff -r b2b817733872 -r a31f3f023acd src/Virt_VirtualSystemManagementService.c --- a/src/Virt_VirtualSystemManagementService.c Tue Jun 15 14:25:34 2010 -0700 +++ b/src/Virt_VirtualSystemManagementService.c Thu Jun 17 14:42:31 2010 -0700 @@ -760,6 +760,50 @@ return "Source Device is empty"; else return "No Source Device specified"; + + free(dev->dev.net.vsi.vsi_type); + if (cu_get_str_prop(inst, "VSIType", &val) != CMPI_RC_OK) + dev->dev.net.vsi.vsi_type = NULL; + else + dev->dev.net.vsi.vsi_type = strdup(val); + + free(dev->dev.net.vsi.manager_id); + if (cu_get_str_prop(inst, "VSIManagerID", &val) != CMPI_RC_OK) + dev->dev.net.vsi.manager_id = NULL; + else + dev->dev.net.vsi.manager_id = strdup(val); + + free(dev->dev.net.vsi.type_id); + if (cu_get_str_prop(inst, "VSITypeID", &val) != CMPI_RC_OK) + dev->dev.net.vsi.type_id = NULL; + else + dev->dev.net.vsi.type_id = strdup(val); + + free(dev->dev.net.vsi.type_id_version); + if (cu_get_str_prop(inst, "VSITypeIDVersion", &val) != + CMPI_RC_OK) + dev->dev.net.vsi.type_id_version = NULL; + else + dev->dev.net.vsi.type_id_version = strdup(val); + + free(dev->dev.net.vsi.instance_id); + if (cu_get_str_prop(inst, "VSIInstanceID", &val) != CMPI_RC_OK) + dev->dev.net.vsi.instance_id = NULL; + else + dev->dev.net.vsi.instance_id = strdup(val); + + free(dev->dev.net.vsi.filter_ref); + if (cu_get_str_prop(inst, "FilterRef", &val) != CMPI_RC_OK) + dev->dev.net.vsi.filter_ref = NULL; + else + dev->dev.net.vsi.filter_ref = strdup(val); + + free(dev->dev.net.vsi.profile_id); + if (cu_get_str_prop(inst, "ProfileID", &val) != CMPI_RC_OK) + dev->dev.net.vsi.profile_id = NULL; + else + dev->dev.net.vsi.profile_id = strdup(val); + } else return "Invalid Network Type specified";