diff -r 7c8d92923475 schema/Xen_HostedDisk.mof --- a/schema/Xen_HostedDisk.mof Fri May 19 15:23:59 2006 -0600 +++ b/schema/Xen_HostedDisk.mof Wed May 31 02:39:40 2006 -0700 @@ -12,7 +12,7 @@ Description ( "A class derived from CIM_HostedDependency to represent " "the association of a Xen domain's disk devices with the " - "host's Linux_LogicalDisk.")] + "host's CIM_LogicalDisk.")] class Xen_HostedDisk : CIM_HostedDependency { [Override("Dependent")] diff -r 7c8d92923475 schema/Xen_HostedMemory.mof --- a/schema/Xen_HostedMemory.mof Fri May 19 15:23:59 2006 -0600 +++ b/schema/Xen_HostedMemory.mof Wed May 31 02:39:40 2006 -0700 @@ -12,7 +12,7 @@ Description ( "A class derived from CIM_HostedDependency to represent " "the association of a Xen domain's main memory with the " - "host's Linux_CacheMemory.")] + "host's CIM_CacheMemory.")] class Xen_HostedMemory : CIM_HostedDependency { [Override("Dependent")] diff -r 7c8d92923475 schema/Xen_HostedNetworkPort.mof --- a/schema/Xen_HostedNetworkPort.mof Fri May 19 15:23:59 2006 -0600 +++ b/schema/Xen_HostedNetworkPort.mof Wed May 31 02:39:40 2006 -0700 @@ -12,7 +12,7 @@ Description ( "A class derived from CIM_HostedDependency to represent " "the association of a Xen domain's virtual network intefaces " - "with the host's Linux_LogicalNetworkAdapter.")] + "with the host's CIM_LogicalNetworkAdapter.")] class Xen_HostedNetworkPort : CIM_HostedDependency { [Override("Dependent")] diff -r 7c8d92923475 schema/Xen_HostedProcessor.mof --- a/schema/Xen_HostedProcessor.mof Fri May 19 15:23:59 2006 -0600 +++ b/schema/Xen_HostedProcessor.mof Wed May 31 02:39:40 2006 -0700 @@ -12,13 +12,13 @@ Description ( "A class derived from CIM_HostedDependency to represent " "the association of a Xen domain's virtual processor with " - "the host Linux_Processor.")] + "the host CIM_Processor.")] class Xen_HostedProcessor : CIM_HostedDependency { [Override("Dependent")] Xen_Processor REF Dependent; [Override("Antecedent")] - Linux_Processor REF Antecedent; + CIM_Processor REF Antecedent; }; diff -r 7c8d92923475 src/Xen_HostedDisk.c --- a/src/Xen_HostedDisk.c Fri May 19 15:23:59 2006 -0600 +++ b/src/Xen_HostedDisk.c Wed May 31 02:39:40 2006 -0700 @@ -121,14 +121,16 @@ static CMPIStatus AssociatorNames( } /* Determine the target class from the source class. */ - if (strcmp(sourceclass, _LHSCLASSNAME) == 0) { + /* This used to be done with strcmp, we will now do it with CMClassPAthIsA*/ + + if (CMClassPathIsA(_BROKER, reference, _LHSCLASSNAME, NULL)) { targetclass = _RHSCLASSNAME; - } else if (strcmp(sourceclass, _RHSCLASSNAME) == 0) { + } else if (CMClassPathIsA(_BROKER, reference, _RHSCLASSNAME, NULL)) { targetclass = _LHSCLASSNAME; } else { _SBLIM_TRACE(2, ("--- Unrecognized source class. Ignoring request.")); goto exit; - } + } _SBLIM_TRACE(2, ("--- targetclass=\"%s\"", targetclass)); /* Create an object path for the result class. */ @@ -147,17 +149,20 @@ static CMPIStatus AssociatorNames( goto exit; } - /* Return all object paths that exactly match the target class and resultClass, if specified. */ + /* Return all object paths that do not match the sourceClass and resultClass, if specified. + If the target class is CIM_Disk, the CIMOM will return both Xen_Disk and the + Host Provider. We need to return only the Host Provider. + This will also work, if the source class is the Host Provider's class. In that case, the only value returned + will be the Xen_Disk. + */ while (CMHasNext(objectpaths, NULL)) { CMPIData data = CMGetNext(objectpaths, NULL); char *class = CMGetCharPtr(CMGetClassName(data.value.ref, NULL)); - if ((strcmp(class,targetclass) == 0) && ((resultClass == NULL) || (strcmp(class,resultClass) == 0))) { + if (!(strcmp(class,sourceclass) == 0) && ((resultClass == NULL) || (strcmp(class,resultClass) == 0))) { CMReturnObjectPath(results, data.value.ref); } } - CMReturnDone(results); - exit: _SBLIM_RETURNSTATUS(status); } @@ -210,14 +215,15 @@ static CMPIStatus Associators( CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_NOT_SUPPORTED, NULL); /* Determine the target class from the source class. */ - if (strcmp(sourceclass, _LHSCLASSNAME) == 0) { + /* This used to be done with strcmp, we will now do it with CMClassPAthIsA*/ + if (CMClassPathIsA(_BROKER, reference, _LHSCLASSNAME, NULL)) { targetclass = _RHSCLASSNAME; - } else if (strcmp(sourceclass, _RHSCLASSNAME) == 0) { + } else if (CMClassPathIsA(_BROKER, reference, _RHSCLASSNAME, NULL)) { targetclass = _LHSCLASSNAME; } else { _SBLIM_TRACE(2, ("--- Unrecognized source class. Ignoring request.")); goto exit; - } + } _SBLIM_TRACE(2, ("--- targetclass=\"%s\"", targetclass)); /* Create an object path for the result class. */ @@ -240,10 +246,10 @@ static CMPIStatus Associators( while (CMHasNext(instances, NULL)) { CMPIData data = CMGetNext(instances, NULL); char *class = CMGetCharPtr(CMGetClassName(CMGetObjectPath(data.value.inst,NULL), NULL)); - if ((strcmp(class,targetclass) == 0) && ((resultClass == NULL) || (strcmp(class,resultClass) == 0))) { + if (!(strcmp(class,targetclass) == 0) && ((resultClass == NULL) || (strcmp(class,resultClass) == 0))) { // BUG - returning data causes crash !?! _SBLIM_TRACE(2, ("--- data.value.inst=\"%s\"", CMGetCharPtr(CDToString(_BROKER, data.value.inst, NULL)))); -// CMReturnInstance(results, data.value.inst); + CMReturnInstance(results, data.value.inst); } } @@ -295,15 +301,16 @@ static CMPIStatus ReferenceNames( } /* Determine the target class from the source class. */ - if (strcmp(sourceclass, _LHSCLASSNAME) == 0) { + /* This used to be done with strcmp, we will now do it with CMClassPAthIsA*/ + if (CMClassPathIsA(_BROKER, reference, _LHSCLASSNAME, NULL)) { targetclass = _RHSCLASSNAME; - } else if (strcmp(sourceclass, _RHSCLASSNAME) == 0) { + } else if (CMClassPathIsA(_BROKER, reference, _RHSCLASSNAME, NULL)) { targetclass = _LHSCLASSNAME; } else { _SBLIM_TRACE(2, ("--- Unrecognized source class. Ignoring request.")); goto exit; - } - _SBLIM_TRACE(2, ("--- targetclass=\"%s\"", targetclass)); + } + _SBLIM_TRACE(2, ("--- targetclass=\"%s\"", targetclass)); /* Create an object path for the result class. */ CMPIObjectPath * objectpath = CMNewObjectPath(_BROKER, namespace, targetclass, &status); @@ -324,9 +331,10 @@ static CMPIStatus ReferenceNames( /* Return all object paths that exactly match the target class and resultClass, if specified. */ while (CMHasNext(objectpaths, NULL)) { CMPIData data = CMGetNext(objectpaths, NULL); - char *class = CMGetCharPtr(CMGetClassName(data.value.ref, NULL)); - if (strcmp(class,targetclass) == 0) { - + //char *class = CMGetCharPtr(CMGetClassName(data.value.ref, NULL)); + // This used to be strcmp, now replaced with CMClassPathIsA + //if (strcmp(class,targetclass) == 0) { + if(CMClassPathIsA(_BROKER, data.value.ref, targetclass, NULL)) { /* Create an object path for the association. */ CMPIObjectPath * refobjectpath = CMNewObjectPath(_BROKER, namespace, _ASSOCCLASS, &status); if ((status.rc != CMPI_RC_OK) || CMIsNullObject(refobjectpath)) { @@ -336,12 +344,15 @@ static CMPIStatus ReferenceNames( } /* Assign the references in the association appropriately. */ - if (strcmp(sourceclass, _RHSCLASSNAME) == 0) { - CMAddKey(refobjectpath, _RHSPROPERTYNAME, &reference, CMPI_ref); - CMAddKey(refobjectpath, _LHSPROPERTYNAME, &data.value.ref, CMPI_ref); - } else { + /* This used to be strcmp (sourceclass, _RHSCLASSNAME), but since the RHSCLASSNAME will always be CIM_COMPUTERSYSTEM, + we will be better off comparing it to the _LHSCLASSNAME + */ + if (strcmp(sourceclass, _LHSCLASSNAME) == 0) { CMAddKey(refobjectpath, _RHSPROPERTYNAME, &data.value.ref, CMPI_ref); CMAddKey(refobjectpath, _LHSPROPERTYNAME, &reference, CMPI_ref); + } else { + CMAddKey(refobjectpath, _RHSPROPERTYNAME, &reference, CMPI_ref); + CMAddKey(refobjectpath, _LHSPROPERTYNAME, &data.value.ref, CMPI_ref); } CMReturnObjectPath(results, refobjectpath); @@ -395,14 +406,15 @@ static CMPIStatus References( } /* Determine the target class from the source class. */ - if (strcmp(sourceclass, _LHSCLASSNAME) == 0) { + /* This used to be done with strcmp, we will now do it with CMClassPAthIsA*/ + if (CMClassPathIsA(_BROKER, reference, _LHSCLASSNAME, NULL)) { targetclass = _RHSCLASSNAME; - } else if (strcmp(sourceclass, _RHSCLASSNAME) == 0) { + } else if (CMClassPathIsA(_BROKER, reference, _RHSCLASSNAME, NULL)) { targetclass = _LHSCLASSNAME; } else { _SBLIM_TRACE(2, ("--- Unrecognized source class. Ignoring request.")); goto exit; - } + } _SBLIM_TRACE(2, ("--- targetclass=\"%s\"", targetclass)); /* Create an object path for the result class. */ @@ -424,9 +436,10 @@ static CMPIStatus References( /* Return all object paths that exactly match the target class and resultClass, if specified. */ while (CMHasNext(objectpaths, NULL)) { CMPIData data = CMGetNext(objectpaths, NULL); - char *class = CMGetCharPtr(CMGetClassName(data.value.ref, NULL)); - if (strcmp(class,targetclass) == 0) { - + //char *class = CMGetCharPtr(CMGetClassName(data.value.ref, NULL)); + // This used to be strcmp, now replaced with CMClassPathIsA + //if (strcmp(class,targetclass) == 0) { + if(CMClassPathIsA(_BROKER, data.value.ref, targetclass, NULL)) { /* Create an instance for the association. */ CMPIInstance * refinstance = _CMNewInstance(_BROKER, namespace, _ASSOCCLASS, &status); if ((status.rc != CMPI_RC_OK) || CMIsNullObject(refinstance)) { @@ -436,14 +449,16 @@ static CMPIStatus References( } /* Assign the references in the association appropriately. */ - if (strcmp(sourceclass, _RHSCLASSNAME) == 0) { - CMSetProperty(refinstance, _RHSPROPERTYNAME, &reference, CMPI_ref); - CMSetProperty(refinstance, _LHSPROPERTYNAME, &data.value.ref, CMPI_ref); - } else { - CMSetProperty(refinstance, _RHSPROPERTYNAME, &data.value.ref, CMPI_ref); + /* This used to be strcmp (sourceclass, _RHSCLASSNAME), but since the RHSCLASSNAME will always be CIM_COMPUTERSYSTEM, + we will be better off comparing it to the _LHSCLASSNAME + */ + if (strcmp(sourceclass, _LHSCLASSNAME) == 0) { + CMSetProperty(refinstance, _RHSPROPERTYNAME, &data.value.ref, CMPI_ref); CMSetProperty(refinstance, _LHSPROPERTYNAME, &reference, CMPI_ref); + } else { + CMSetProperty(refinstance, _RHSPROPERTYNAME, &reference, CMPI_ref); + CMSetProperty(refinstance, _LHSPROPERTYNAME, &data.value.ref, CMPI_ref); } - CMReturnInstance(results, refinstance); } } diff -r 7c8d92923475 src/Xen_HostedMemory.c --- a/src/Xen_HostedMemory.c Fri May 19 15:23:59 2006 -0600 +++ b/src/Xen_HostedMemory.c Wed May 31 02:39:40 2006 -0700 @@ -122,14 +122,16 @@ static CMPIStatus AssociatorNames( } /* Determine the target class from the source class. */ - if (strcmp(sourceclass, _LHSCLASSNAME) == 0) { + /* This used to be done with strcmp, we will now do it with CMClassPAthIsA*/ + + if (CMClassPathIsA(_BROKER, reference, _LHSCLASSNAME, NULL)) { targetclass = _RHSCLASSNAME; - } else if (strcmp(sourceclass, _RHSCLASSNAME) == 0) { + } else if (CMClassPathIsA(_BROKER, reference, _RHSCLASSNAME, NULL)) { targetclass = _LHSCLASSNAME; } else { _SBLIM_TRACE(2, ("--- Unrecognized source class. Ignoring request.")); goto exit; - } + } _SBLIM_TRACE(2, ("--- targetclass=\"%s\"", targetclass)); /* Create an object path for the result class. */ @@ -148,17 +150,20 @@ static CMPIStatus AssociatorNames( goto exit; } - /* Return all object paths that exactly match the target class and resultClass, if specified. */ + /* Return all object paths that do not match the sourceClass and resultClass, if specified. + If the target class is CIM_Memory, the CIMOM will return both Xen_Memory and the + Host Provider. We need to return only the Host Provider. + This will also work, if the source class is the Host Provider's class. In that case, the only value returned + will be the Xen_Memory. + */ while (CMHasNext(objectpaths, NULL)) { CMPIData data = CMGetNext(objectpaths, NULL); char *class = CMGetCharPtr(CMGetClassName(data.value.ref, NULL)); - if ((strcmp(class,targetclass) == 0) && ((resultClass == NULL) || (strcmp(class,resultClass) == 0))) { + if (!(strcmp(class,sourceclass) == 0) && ((resultClass == NULL) || (strcmp(class,resultClass) == 0))) { CMReturnObjectPath(results, data.value.ref); } } - CMReturnDone(results); - exit: _SBLIM_RETURNSTATUS(status); } @@ -211,14 +216,15 @@ static CMPIStatus Associators( CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_NOT_SUPPORTED, NULL); /* Determine the target class from the source class. */ - if (strcmp(sourceclass, _LHSCLASSNAME) == 0) { + /* This used to be done with strcmp, we will now do it with CMClassPAthIsA*/ + if (CMClassPathIsA(_BROKER, reference, _LHSCLASSNAME, NULL)) { targetclass = _RHSCLASSNAME; - } else if (strcmp(sourceclass, _RHSCLASSNAME) == 0) { + } else if (CMClassPathIsA(_BROKER, reference, _RHSCLASSNAME, NULL)) { targetclass = _LHSCLASSNAME; } else { _SBLIM_TRACE(2, ("--- Unrecognized source class. Ignoring request.")); goto exit; - } + } _SBLIM_TRACE(2, ("--- targetclass=\"%s\"", targetclass)); /* Create an object path for the result class. */ @@ -241,10 +247,10 @@ static CMPIStatus Associators( while (CMHasNext(instances, NULL)) { CMPIData data = CMGetNext(instances, NULL); char *class = CMGetCharPtr(CMGetClassName(CMGetObjectPath(data.value.inst,NULL), NULL)); - if ((strcmp(class,targetclass) == 0) && ((resultClass == NULL) || (strcmp(class,resultClass) == 0))) { + if (!(strcmp(class,targetclass) == 0) && ((resultClass == NULL) || (strcmp(class,resultClass) == 0))) { // BUG - returning data causes crash !?! _SBLIM_TRACE(2, ("--- data.value.inst=\"%s\"", CMGetCharPtr(CDToString(_BROKER, data.value.inst, NULL)))); -// CMReturnInstance(results, data.value.inst); + CMReturnInstance(results, data.value.inst); } } @@ -296,15 +302,16 @@ static CMPIStatus ReferenceNames( } /* Determine the target class from the source class. */ - if (strcmp(sourceclass, _LHSCLASSNAME) == 0) { + /* This used to be done with strcmp, we will now do it with CMClassPAthIsA*/ + if (CMClassPathIsA(_BROKER, reference, _LHSCLASSNAME, NULL)) { targetclass = _RHSCLASSNAME; - } else if (strcmp(sourceclass, _RHSCLASSNAME) == 0) { + } else if (CMClassPathIsA(_BROKER, reference, _RHSCLASSNAME, NULL)) { targetclass = _LHSCLASSNAME; } else { _SBLIM_TRACE(2, ("--- Unrecognized source class. Ignoring request.")); goto exit; - } - _SBLIM_TRACE(2, ("--- targetclass=\"%s\"", targetclass)); + } + _SBLIM_TRACE(2, ("--- targetclass=\"%s\"", targetclass)); /* Create an object path for the result class. */ CMPIObjectPath * objectpath = CMNewObjectPath(_BROKER, namespace, targetclass, &status); @@ -325,9 +332,10 @@ static CMPIStatus ReferenceNames( /* Return all object paths that exactly match the target class and resultClass, if specified. */ while (CMHasNext(objectpaths, NULL)) { CMPIData data = CMGetNext(objectpaths, NULL); - char *class = CMGetCharPtr(CMGetClassName(data.value.ref, NULL)); - if (strcmp(class,targetclass) == 0) { - + //char *class = CMGetCharPtr(CMGetClassName(data.value.ref, NULL)); + // This used to be strcmp, now replaced with CMClassPathIsA + //if (strcmp(class,targetclass) == 0) { + if(CMClassPathIsA(_BROKER, data.value.ref, targetclass, NULL)) { /* Create an object path for the association. */ CMPIObjectPath * refobjectpath = CMNewObjectPath(_BROKER, namespace, _ASSOCCLASS, &status); if ((status.rc != CMPI_RC_OK) || CMIsNullObject(refobjectpath)) { @@ -337,12 +345,15 @@ static CMPIStatus ReferenceNames( } /* Assign the references in the association appropriately. */ - if (strcmp(sourceclass, _RHSCLASSNAME) == 0) { - CMAddKey(refobjectpath, _RHSPROPERTYNAME, &reference, CMPI_ref); - CMAddKey(refobjectpath, _LHSPROPERTYNAME, &data.value.ref, CMPI_ref); - } else { + /* This used to be strcmp (sourceclass, _RHSCLASSNAME), but since the RHSCLASSNAME will always be CIM_COMPUTERSYSTEM, + we will be better off comparing it to the _LHSCLASSNAME + */ + if (strcmp(sourceclass, _LHSCLASSNAME) == 0) { CMAddKey(refobjectpath, _RHSPROPERTYNAME, &data.value.ref, CMPI_ref); CMAddKey(refobjectpath, _LHSPROPERTYNAME, &reference, CMPI_ref); + } else { + CMAddKey(refobjectpath, _RHSPROPERTYNAME, &reference, CMPI_ref); + CMAddKey(refobjectpath, _LHSPROPERTYNAME, &data.value.ref, CMPI_ref); } CMReturnObjectPath(results, refobjectpath); @@ -396,14 +407,15 @@ static CMPIStatus References( } /* Determine the target class from the source class. */ - if (strcmp(sourceclass, _LHSCLASSNAME) == 0) { + /* This used to be done with strcmp, we will now do it with CMClassPAthIsA*/ + if (CMClassPathIsA(_BROKER, reference, _LHSCLASSNAME, NULL)) { targetclass = _RHSCLASSNAME; - } else if (strcmp(sourceclass, _RHSCLASSNAME) == 0) { + } else if (CMClassPathIsA(_BROKER, reference, _RHSCLASSNAME, NULL)) { targetclass = _LHSCLASSNAME; } else { _SBLIM_TRACE(2, ("--- Unrecognized source class. Ignoring request.")); goto exit; - } + } _SBLIM_TRACE(2, ("--- targetclass=\"%s\"", targetclass)); /* Create an object path for the result class. */ @@ -425,9 +437,10 @@ static CMPIStatus References( /* Return all object paths that exactly match the target class and resultClass, if specified. */ while (CMHasNext(objectpaths, NULL)) { CMPIData data = CMGetNext(objectpaths, NULL); - char *class = CMGetCharPtr(CMGetClassName(data.value.ref, NULL)); - if (strcmp(class,targetclass) == 0) { - + //char *class = CMGetCharPtr(CMGetClassName(data.value.ref, NULL)); + // This used to be strcmp, now replaced with CMClassPathIsA + //if (strcmp(class,targetclass) == 0) { + if(CMClassPathIsA(_BROKER, data.value.ref, targetclass, NULL)) { /* Create an instance for the association. */ CMPIInstance * refinstance = _CMNewInstance(_BROKER, namespace, _ASSOCCLASS, &status); if ((status.rc != CMPI_RC_OK) || CMIsNullObject(refinstance)) { @@ -437,14 +450,16 @@ static CMPIStatus References( } /* Assign the references in the association appropriately. */ - if (strcmp(sourceclass, _RHSCLASSNAME) == 0) { - CMSetProperty(refinstance, _RHSPROPERTYNAME, &reference, CMPI_ref); - CMSetProperty(refinstance, _LHSPROPERTYNAME, &data.value.ref, CMPI_ref); - } else { - CMSetProperty(refinstance, _RHSPROPERTYNAME, &data.value.ref, CMPI_ref); + /* This used to be strcmp (sourceclass, _RHSCLASSNAME), but since the RHSCLASSNAME will always be CIM_COMPUTERSYSTEM, + we will be better off comparing it to the _LHSCLASSNAME + */ + if (strcmp(sourceclass, _LHSCLASSNAME) == 0) { + CMSetProperty(refinstance, _RHSPROPERTYNAME, &data.value.ref, CMPI_ref); CMSetProperty(refinstance, _LHSPROPERTYNAME, &reference, CMPI_ref); + } else { + CMSetProperty(refinstance, _RHSPROPERTYNAME, &reference, CMPI_ref); + CMSetProperty(refinstance, _LHSPROPERTYNAME, &data.value.ref, CMPI_ref); } - CMReturnInstance(results, refinstance); } } diff -r 7c8d92923475 src/Xen_HostedNetworkPort.c --- a/src/Xen_HostedNetworkPort.c Fri May 19 15:23:59 2006 -0600 +++ b/src/Xen_HostedNetworkPort.c Wed May 31 02:39:40 2006 -0700 @@ -121,14 +121,16 @@ static CMPIStatus AssociatorNames( } /* Determine the target class from the source class. */ - if (strcmp(sourceclass, _LHSCLASSNAME) == 0) { + /* This used to be done with strcmp, we will now do it with CMClassPAthIsA*/ + + if (CMClassPathIsA(_BROKER, reference, _LHSCLASSNAME, NULL)) { targetclass = _RHSCLASSNAME; - } else if (strcmp(sourceclass, _RHSCLASSNAME) == 0) { + } else if (CMClassPathIsA(_BROKER, reference, _RHSCLASSNAME, NULL)) { targetclass = _LHSCLASSNAME; } else { _SBLIM_TRACE(2, ("--- Unrecognized source class. Ignoring request.")); goto exit; - } + } _SBLIM_TRACE(2, ("--- targetclass=\"%s\"", targetclass)); /* Create an object path for the result class. */ @@ -147,17 +149,20 @@ static CMPIStatus AssociatorNames( goto exit; } - /* Return all object paths that exactly match the target class and resultClass, if specified. */ + /* Return all object paths that do not match the sourceClass and resultClass, if specified. + If the target class is CIM_NetworkPort, the CIMOM will return both Xen_NetworkPort and the + Host Provider. We need to return only the Host Provider. + This will also work, if the source class is the Host Provider's class. In that case, the only value returned + will be the Xen_NetworkPort. + */ while (CMHasNext(objectpaths, NULL)) { CMPIData data = CMGetNext(objectpaths, NULL); char *class = CMGetCharPtr(CMGetClassName(data.value.ref, NULL)); - if ((strcmp(class,targetclass) == 0) && ((resultClass == NULL) || (strcmp(class,resultClass) == 0))) { + if (!(strcmp(class,sourceclass) == 0) && ((resultClass == NULL) || (strcmp(class,resultClass) == 0))) { CMReturnObjectPath(results, data.value.ref); } } - CMReturnDone(results); - exit: _SBLIM_RETURNSTATUS(status); } @@ -210,14 +215,15 @@ static CMPIStatus Associators( CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_NOT_SUPPORTED, NULL); /* Determine the target class from the source class. */ - if (strcmp(sourceclass, _LHSCLASSNAME) == 0) { + /* This used to be done with strcmp, we will now do it with CMClassPAthIsA*/ + if (CMClassPathIsA(_BROKER, reference, _LHSCLASSNAME, NULL)) { targetclass = _RHSCLASSNAME; - } else if (strcmp(sourceclass, _RHSCLASSNAME) == 0) { + } else if (CMClassPathIsA(_BROKER, reference, _RHSCLASSNAME, NULL)) { targetclass = _LHSCLASSNAME; } else { _SBLIM_TRACE(2, ("--- Unrecognized source class. Ignoring request.")); goto exit; - } + } _SBLIM_TRACE(2, ("--- targetclass=\"%s\"", targetclass)); /* Create an object path for the result class. */ @@ -240,10 +246,10 @@ static CMPIStatus Associators( while (CMHasNext(instances, NULL)) { CMPIData data = CMGetNext(instances, NULL); char *class = CMGetCharPtr(CMGetClassName(CMGetObjectPath(data.value.inst,NULL), NULL)); - if ((strcmp(class,targetclass) == 0) && ((resultClass == NULL) || (strcmp(class,resultClass) == 0))) { + if (!(strcmp(class,targetclass) == 0) && ((resultClass == NULL) || (strcmp(class,resultClass) == 0))) { // BUG - returning data causes crash !?! _SBLIM_TRACE(2, ("--- data.value.inst=\"%s\"", CMGetCharPtr(CDToString(_BROKER, data.value.inst, NULL)))); -// CMReturnInstance(results, data.value.inst); + CMReturnInstance(results, data.value.inst); } } @@ -295,15 +301,16 @@ static CMPIStatus ReferenceNames( } /* Determine the target class from the source class. */ - if (strcmp(sourceclass, _LHSCLASSNAME) == 0) { + /* This used to be done with strcmp, we will now do it with CMClassPAthIsA*/ + if (CMClassPathIsA(_BROKER, reference, _LHSCLASSNAME, NULL)) { targetclass = _RHSCLASSNAME; - } else if (strcmp(sourceclass, _RHSCLASSNAME) == 0) { + } else if (CMClassPathIsA(_BROKER, reference, _RHSCLASSNAME, NULL)) { targetclass = _LHSCLASSNAME; } else { _SBLIM_TRACE(2, ("--- Unrecognized source class. Ignoring request.")); goto exit; - } - _SBLIM_TRACE(2, ("--- targetclass=\"%s\"", targetclass)); + } + _SBLIM_TRACE(2, ("--- targetclass=\"%s\"", targetclass)); /* Create an object path for the result class. */ CMPIObjectPath * objectpath = CMNewObjectPath(_BROKER, namespace, targetclass, &status); @@ -324,9 +331,10 @@ static CMPIStatus ReferenceNames( /* Return all object paths that exactly match the target class and resultClass, if specified. */ while (CMHasNext(objectpaths, NULL)) { CMPIData data = CMGetNext(objectpaths, NULL); - char *class = CMGetCharPtr(CMGetClassName(data.value.ref, NULL)); - if (strcmp(class,targetclass) == 0) { - + //char *class = CMGetCharPtr(CMGetClassName(data.value.ref, NULL)); + // This used to be strcmp, now replaced with CMClassPathIsA + //if (strcmp(class,targetclass) == 0) { + if(CMClassPathIsA(_BROKER, data.value.ref, targetclass, NULL)) { /* Create an object path for the association. */ CMPIObjectPath * refobjectpath = CMNewObjectPath(_BROKER, namespace, _ASSOCCLASS, &status); if ((status.rc != CMPI_RC_OK) || CMIsNullObject(refobjectpath)) { @@ -336,12 +344,15 @@ static CMPIStatus ReferenceNames( } /* Assign the references in the association appropriately. */ - if (strcmp(sourceclass, _RHSCLASSNAME) == 0) { - CMAddKey(refobjectpath, _RHSPROPERTYNAME, &reference, CMPI_ref); - CMAddKey(refobjectpath, _LHSPROPERTYNAME, &data.value.ref, CMPI_ref); - } else { + /* This used to be strcmp (sourceclass, _RHSCLASSNAME), but since the RHSCLASSNAME will always be CIM_COMPUTERSYSTEM, + we will be better off comparing it to the _LHSCLASSNAME + */ + if (strcmp(sourceclass, _LHSCLASSNAME) == 0) { CMAddKey(refobjectpath, _RHSPROPERTYNAME, &data.value.ref, CMPI_ref); CMAddKey(refobjectpath, _LHSPROPERTYNAME, &reference, CMPI_ref); + } else { + CMAddKey(refobjectpath, _RHSPROPERTYNAME, &reference, CMPI_ref); + CMAddKey(refobjectpath, _LHSPROPERTYNAME, &data.value.ref, CMPI_ref); } CMReturnObjectPath(results, refobjectpath); @@ -395,14 +406,15 @@ static CMPIStatus References( } /* Determine the target class from the source class. */ - if (strcmp(sourceclass, _LHSCLASSNAME) == 0) { + /* This used to be done with strcmp, we will now do it with CMClassPAthIsA*/ + if (CMClassPathIsA(_BROKER, reference, _LHSCLASSNAME, NULL)) { targetclass = _RHSCLASSNAME; - } else if (strcmp(sourceclass, _RHSCLASSNAME) == 0) { + } else if (CMClassPathIsA(_BROKER, reference, _RHSCLASSNAME, NULL)) { targetclass = _LHSCLASSNAME; } else { _SBLIM_TRACE(2, ("--- Unrecognized source class. Ignoring request.")); goto exit; - } + } _SBLIM_TRACE(2, ("--- targetclass=\"%s\"", targetclass)); /* Create an object path for the result class. */ @@ -424,9 +436,10 @@ static CMPIStatus References( /* Return all object paths that exactly match the target class and resultClass, if specified. */ while (CMHasNext(objectpaths, NULL)) { CMPIData data = CMGetNext(objectpaths, NULL); - char *class = CMGetCharPtr(CMGetClassName(data.value.ref, NULL)); - if (strcmp(class,targetclass) == 0) { - + //char *class = CMGetCharPtr(CMGetClassName(data.value.ref, NULL)); + // This used to be strcmp, now replaced with CMClassPathIsA + //if (strcmp(class,targetclass) == 0) { + if(CMClassPathIsA(_BROKER, data.value.ref, targetclass, NULL)) { /* Create an instance for the association. */ CMPIInstance * refinstance = _CMNewInstance(_BROKER, namespace, _ASSOCCLASS, &status); if ((status.rc != CMPI_RC_OK) || CMIsNullObject(refinstance)) { @@ -436,14 +449,16 @@ static CMPIStatus References( } /* Assign the references in the association appropriately. */ - if (strcmp(sourceclass, _RHSCLASSNAME) == 0) { - CMSetProperty(refinstance, _RHSPROPERTYNAME, &reference, CMPI_ref); - CMSetProperty(refinstance, _LHSPROPERTYNAME, &data.value.ref, CMPI_ref); - } else { - CMSetProperty(refinstance, _RHSPROPERTYNAME, &data.value.ref, CMPI_ref); + /* This used to be strcmp (sourceclass, _RHSCLASSNAME), but since the RHSCLASSNAME will always be CIM_COMPUTERSYSTEM, + we will be better off comparing it to the _LHSCLASSNAME + */ + if (strcmp(sourceclass, _LHSCLASSNAME) == 0) { + CMSetProperty(refinstance, _RHSPROPERTYNAME, &data.value.ref, CMPI_ref); CMSetProperty(refinstance, _LHSPROPERTYNAME, &reference, CMPI_ref); + } else { + CMSetProperty(refinstance, _RHSPROPERTYNAME, &reference, CMPI_ref); + CMSetProperty(refinstance, _LHSPROPERTYNAME, &data.value.ref, CMPI_ref); } - CMReturnInstance(results, refinstance); } } diff -r 7c8d92923475 src/Xen_HostedProcessor.c --- a/src/Xen_HostedProcessor.c Fri May 19 15:23:59 2006 -0600 +++ b/src/Xen_HostedProcessor.c Wed May 31 02:39:40 2006 -0700 @@ -121,14 +121,16 @@ static CMPIStatus AssociatorNames( } /* Determine the target class from the source class. */ - if (strcmp(sourceclass, _LHSCLASSNAME) == 0) { + /* This used to be done with strcmp, we will now do it with CMClassPAthIsA*/ + + if (CMClassPathIsA(_BROKER, reference, _LHSCLASSNAME, NULL)) { targetclass = _RHSCLASSNAME; - } else if (strcmp(sourceclass, _RHSCLASSNAME) == 0) { + } else if (CMClassPathIsA(_BROKER, reference, _RHSCLASSNAME, NULL)) { targetclass = _LHSCLASSNAME; } else { _SBLIM_TRACE(2, ("--- Unrecognized source class. Ignoring request.")); goto exit; - } + } _SBLIM_TRACE(2, ("--- targetclass=\"%s\"", targetclass)); /* Create an object path for the result class. */ @@ -147,17 +149,20 @@ static CMPIStatus AssociatorNames( goto exit; } - /* Return all object paths that exactly match the target class and resultClass, if specified. */ + /* Return all object paths that do not match the sourceClass and resultClass, if specified. + If the target class is CIM_Processor, the CIMOM will return both Xen_Processor and the + Host Provider. We need to return only the Host Provider. + This will also work, if the source class is the Host Provider's class. In that case, the only value returned + will be the Xen_Processor. + */ while (CMHasNext(objectpaths, NULL)) { CMPIData data = CMGetNext(objectpaths, NULL); char *class = CMGetCharPtr(CMGetClassName(data.value.ref, NULL)); - if ((strcmp(class,targetclass) == 0) && ((resultClass == NULL) || (strcmp(class,resultClass) == 0))) { + if (!(strcmp(class,sourceclass) == 0) && ((resultClass == NULL) || (strcmp(class,resultClass) == 0))) { CMReturnObjectPath(results, data.value.ref); } } - CMReturnDone(results); - exit: _SBLIM_RETURNSTATUS(status); } @@ -210,14 +215,15 @@ static CMPIStatus Associators( CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_NOT_SUPPORTED, NULL); /* Determine the target class from the source class. */ - if (strcmp(sourceclass, _LHSCLASSNAME) == 0) { + /* This used to be done with strcmp, we will now do it with CMClassPAthIsA*/ + if (CMClassPathIsA(_BROKER, reference, _LHSCLASSNAME, NULL)) { targetclass = _RHSCLASSNAME; - } else if (strcmp(sourceclass, _RHSCLASSNAME) == 0) { + } else if (CMClassPathIsA(_BROKER, reference, _RHSCLASSNAME, NULL)) { targetclass = _LHSCLASSNAME; } else { _SBLIM_TRACE(2, ("--- Unrecognized source class. Ignoring request.")); goto exit; - } + } _SBLIM_TRACE(2, ("--- targetclass=\"%s\"", targetclass)); /* Create an object path for the result class. */ @@ -240,10 +246,10 @@ static CMPIStatus Associators( while (CMHasNext(instances, NULL)) { CMPIData data = CMGetNext(instances, NULL); char *class = CMGetCharPtr(CMGetClassName(CMGetObjectPath(data.value.inst,NULL), NULL)); - if ((strcmp(class,targetclass) == 0) && ((resultClass == NULL) || (strcmp(class,resultClass) == 0))) { + if (!(strcmp(class,targetclass) == 0) && ((resultClass == NULL) || (strcmp(class,resultClass) == 0))) { // BUG - returning data causes crash !?! _SBLIM_TRACE(2, ("--- data.value.inst=\"%s\"", CMGetCharPtr(CDToString(_BROKER, data.value.inst, NULL)))); -// CMReturnInstance(results, data.value.inst); + CMReturnInstance(results, data.value.inst); } } @@ -295,15 +301,16 @@ static CMPIStatus ReferenceNames( } /* Determine the target class from the source class. */ - if (strcmp(sourceclass, _LHSCLASSNAME) == 0) { + /* This used to be done with strcmp, we will now do it with CMClassPAthIsA*/ + if (CMClassPathIsA(_BROKER, reference, _LHSCLASSNAME, NULL)) { targetclass = _RHSCLASSNAME; - } else if (strcmp(sourceclass, _RHSCLASSNAME) == 0) { + } else if (CMClassPathIsA(_BROKER, reference, _RHSCLASSNAME, NULL)) { targetclass = _LHSCLASSNAME; } else { _SBLIM_TRACE(2, ("--- Unrecognized source class. Ignoring request.")); goto exit; - } - _SBLIM_TRACE(2, ("--- targetclass=\"%s\"", targetclass)); + } + _SBLIM_TRACE(2, ("--- targetclass=\"%s\"", targetclass)); /* Create an object path for the result class. */ CMPIObjectPath * objectpath = CMNewObjectPath(_BROKER, namespace, targetclass, &status); @@ -324,9 +331,10 @@ static CMPIStatus ReferenceNames( /* Return all object paths that exactly match the target class and resultClass, if specified. */ while (CMHasNext(objectpaths, NULL)) { CMPIData data = CMGetNext(objectpaths, NULL); - char *class = CMGetCharPtr(CMGetClassName(data.value.ref, NULL)); - if (strcmp(class,targetclass) == 0) { - + //char *class = CMGetCharPtr(CMGetClassName(data.value.ref, NULL)); + // This used to be strcmp, now replaced with CMClassPathIsA + //if (strcmp(class,targetclass) == 0) { + if(CMClassPathIsA(_BROKER, data.value.ref, targetclass, NULL)) { /* Create an object path for the association. */ CMPIObjectPath * refobjectpath = CMNewObjectPath(_BROKER, namespace, _ASSOCCLASS, &status); if ((status.rc != CMPI_RC_OK) || CMIsNullObject(refobjectpath)) { @@ -336,12 +344,15 @@ static CMPIStatus ReferenceNames( } /* Assign the references in the association appropriately. */ - if (strcmp(sourceclass, _RHSCLASSNAME) == 0) { - CMAddKey(refobjectpath, _RHSPROPERTYNAME, &reference, CMPI_ref); - CMAddKey(refobjectpath, _LHSPROPERTYNAME, &data.value.ref, CMPI_ref); - } else { + /* This used to be strcmp (sourceclass, _RHSCLASSNAME), but since the RHSCLASSNAME will always be CIM_COMPUTERSYSTEM, + we will be better off comparing it to the _LHSCLASSNAME + */ + if (strcmp(sourceclass, _LHSCLASSNAME) == 0) { CMAddKey(refobjectpath, _RHSPROPERTYNAME, &data.value.ref, CMPI_ref); CMAddKey(refobjectpath, _LHSPROPERTYNAME, &reference, CMPI_ref); + } else { + CMAddKey(refobjectpath, _RHSPROPERTYNAME, &reference, CMPI_ref); + CMAddKey(refobjectpath, _LHSPROPERTYNAME, &data.value.ref, CMPI_ref); } CMReturnObjectPath(results, refobjectpath); @@ -395,14 +406,15 @@ static CMPIStatus References( } /* Determine the target class from the source class. */ - if (strcmp(sourceclass, _LHSCLASSNAME) == 0) { + /* This used to be done with strcmp, we will now do it with CMClassPAthIsA*/ + if (CMClassPathIsA(_BROKER, reference, _LHSCLASSNAME, NULL)) { targetclass = _RHSCLASSNAME; - } else if (strcmp(sourceclass, _RHSCLASSNAME) == 0) { + } else if (CMClassPathIsA(_BROKER, reference, _RHSCLASSNAME, NULL)) { targetclass = _LHSCLASSNAME; } else { _SBLIM_TRACE(2, ("--- Unrecognized source class. Ignoring request.")); goto exit; - } + } _SBLIM_TRACE(2, ("--- targetclass=\"%s\"", targetclass)); /* Create an object path for the result class. */ @@ -424,9 +436,10 @@ static CMPIStatus References( /* Return all object paths that exactly match the target class and resultClass, if specified. */ while (CMHasNext(objectpaths, NULL)) { CMPIData data = CMGetNext(objectpaths, NULL); - char *class = CMGetCharPtr(CMGetClassName(data.value.ref, NULL)); - if (strcmp(class,targetclass) == 0) { - + //char *class = CMGetCharPtr(CMGetClassName(data.value.ref, NULL)); + // This used to be strcmp, now replaced with CMClassPathIsA + //if (strcmp(class,targetclass) == 0) { + if(CMClassPathIsA(_BROKER, data.value.ref, targetclass, NULL)) { /* Create an instance for the association. */ CMPIInstance * refinstance = _CMNewInstance(_BROKER, namespace, _ASSOCCLASS, &status); if ((status.rc != CMPI_RC_OK) || CMIsNullObject(refinstance)) { @@ -436,14 +449,16 @@ static CMPIStatus References( } /* Assign the references in the association appropriately. */ - if (strcmp(sourceclass, _RHSCLASSNAME) == 0) { - CMSetProperty(refinstance, _RHSPROPERTYNAME, &reference, CMPI_ref); - CMSetProperty(refinstance, _LHSPROPERTYNAME, &data.value.ref, CMPI_ref); - } else { - CMSetProperty(refinstance, _RHSPROPERTYNAME, &data.value.ref, CMPI_ref); + /* This used to be strcmp (sourceclass, _RHSCLASSNAME), but since the RHSCLASSNAME will always be CIM_COMPUTERSYSTEM, + we will be better off comparing it to the _LHSCLASSNAME + */ + if (strcmp(sourceclass, _LHSCLASSNAME) == 0) { + CMSetProperty(refinstance, _RHSPROPERTYNAME, &data.value.ref, CMPI_ref); CMSetProperty(refinstance, _LHSPROPERTYNAME, &reference, CMPI_ref); + } else { + CMSetProperty(refinstance, _RHSPROPERTYNAME, &reference, CMPI_ref); + CMSetProperty(refinstance, _LHSPROPERTYNAME, &data.value.ref, CMPI_ref); } - CMReturnInstance(results, refinstance); } }