os-cmpi-xen

view src/Xen_VSMSElementCapabilities.c @ 121:4868ace2726b

Add initial consistence checks in test suite for Xen_MemoryPool, Xen_ProcessorPool and Xen_VirtualSystemManagementService.

Signed-off-by: Luke Szymanski <Lukasz.Szymanski@Unisys.com>
author Jim Fehlig <jfehlig@novell.com>
date Fri Jun 08 10:22:05 2007 -0600 (2007-06-08)
parents ab8e99c757f5
children
line source
1 // Copyright (C) 2006 Novell, Inc.
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
16 // ============================================================================
17 // Authors: Jim Fehlig, <jfehlig@novell.com>
18 // Contributors:
19 // Description: Association provider for Xen_VSMSElementCapabilities.
20 // ============================================================================
22 #include <string.h>
24 /* Include the required CMPI data types, function headers, and macros */
25 #include "cmpidt.h"
26 #include "cmpift.h"
27 #include "cmpimacs.h"
30 // ----------------------------------------------------------------------------
31 // COMMON GLOBAL VARIABLES
32 // ----------------------------------------------------------------------------
34 /* Handle to the CIM broker. Initialized when the provider lib is loaded. */
35 static const CMPIBroker *_BROKER;
37 /* Include utility functions */
38 #include "cmpiutil.h"
40 /* Include _SBLIM_TRACE() logging support */
41 #include "cmpitrace.h"
44 // ============================================================================
45 // CMPI ASSOCIATION PROVIDER FUNCTION TABLE
46 // ============================================================================
48 // ----------------------------------------------------------------------------
49 // Info for the class supported by the association provider
50 // ----------------------------------------------------------------------------
52 /* Name of the left and right hand side classes of this association. */
53 static char * _ASSOCCLASS = "Xen_VSMSElementCapabilities";
54 static char * _LHSCLASSNAME = "Xen_VirtualSystemManagementService";
55 static char * _RHSCLASSNAME = "Xen_VirtualSystemManagementCapabilities";
56 static char * _LHSPROPERTYNAME = "ManagedElement";
57 static char * _RHSPROPERTYNAME = "Capabilities";
58 static char * _LHSNAMESPACE = "root/cimv2";
59 static char * _RHSNAMESPACE = "root/cimv2";
62 // ----------------------------------------------------------------------------
63 // AssociationCleanup()
64 // Perform any necessary cleanup immediately before this provider is unloaded.
65 // ----------------------------------------------------------------------------
66 static CMPIStatus AssociationCleanup(
67 CMPIAssociationMI * self, /* [in] Handle to this provider (i.e. 'self'). */
68 const CMPIContext * context, /* [in] Additional context info, if any. */
69 CMPIBoolean terminating) /* [in] True if MB is terminating */
70 {
71 CMPIStatus status = { CMPI_RC_OK, NULL }; /* Return status of CIM operations. */
73 _SBLIM_ENTER("AssociationCleanup");
74 _SBLIM_TRACE(2, ("--- self=\"%s\"", self->ft->miName));
75 _SBLIM_TRACE(2, ("--- context=\"%s\"", CMGetCharPtr(CDToString(_BROKER, context, NULL))));
77 /* Nothing needs to be done for cleanup. */
78 _SBLIM_RETURNSTATUS(status);
79 }
82 // ----------------------------------------------------------------------------
83 // AssociatorNames()
84 // ----------------------------------------------------------------------------
85 static CMPIStatus AssociatorNames(
86 CMPIAssociationMI * self, /* [in] Handle to this provider (i.e. 'self'). */
87 const CMPIContext * context, /* [in] Additional context info, if any. */
88 const CMPIResult * results, /* [out] Results of this operation. */
89 const CMPIObjectPath * reference, /* [in] Contains source namespace, classname and object path. */
90 const char * assocClass,
91 const char * resultClass,
92 const char * role,
93 const char * resultRole)
94 {
95 CMPIStatus status = { CMPI_RC_OK, NULL }; /* Return status of CIM operations. */
96 char *namespace = CMGetCharPtr(CMGetNameSpace(reference, NULL)); /* Target namespace. */
97 char *sourceclass = CMGetCharPtr(CMGetClassName(reference, &status)); /* Class of the source reference object */
98 char *targetclass; /* Class of the target object(s). */
101 _SBLIM_ENTER("AssociatorNames");
102 _SBLIM_TRACE(2, ("--- self=\"%s\"", self->ft->miName));
103 _SBLIM_TRACE(2, ("--- context=\"%s\"", CMGetCharPtr(CDToString(_BROKER, context, NULL))));
104 _SBLIM_TRACE(2, ("--- reference=\"%s\"", CMGetCharPtr(CDToString(_BROKER, reference, NULL))));
105 _SBLIM_TRACE(2, ("--- assocClass=\"%s\"", assocClass));
106 _SBLIM_TRACE(2, ("--- resultClass=\"%s\"", resultClass));
107 _SBLIM_TRACE(2, ("--- role=\"%s\"", role));
108 _SBLIM_TRACE(2, ("--- resultRole=\"%s\"", resultRole));
109 _SBLIM_TRACE(2, ("--- namespace=\"%s\"", namespace));
110 _SBLIM_TRACE(2, ("--- sourceclass=\"%s\"", sourceclass));
112 /* Check that the requested association class, if any, is supported. */
113 if (assocClass != NULL) {
114 CMPIObjectPath * assoc = CMNewObjectPath(_BROKER, namespace, _ASSOCCLASS, NULL);
115 if (!CMClassPathIsA(_BROKER, assoc, assocClass, NULL)) {
116 _SBLIM_TRACE(2, ("--- Unrecognized association class. Ignoring request."));
117 goto exit;
118 }
119 }
121 /* Check that the reference matches the required role, if any. */
122 if ((role != NULL) && strcmp(role, sourceclass) != 0) {
123 _SBLIM_TRACE(2, ("--- Reference does not match required role. Ignoring request."));
124 goto exit;
125 }
127 /* Determine the target class from the source class. */
128 if (strcmp(sourceclass, _LHSCLASSNAME) == 0) {
129 targetclass = _RHSCLASSNAME;
130 } else if (strcmp(sourceclass, _RHSCLASSNAME) == 0) {
131 targetclass = _LHSCLASSNAME;
132 } else {
133 _SBLIM_TRACE(2, ("--- Unrecognized source class. Ignoring request."));
134 goto exit;
135 }
136 _SBLIM_TRACE(2, ("--- targetclass=\"%s\"", targetclass));
138 /* Create an object path for the result class. */
139 CMPIObjectPath * objectpath = CMNewObjectPath(_BROKER, namespace, targetclass, &status);
140 if ((status.rc != CMPI_RC_OK) || CMIsNullObject(objectpath)) {
141 _SBLIM_TRACE(1,("--- CMNewObjectPath() failed - %s", CMGetCharPtr(status.msg)));
142 CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERROR, "Cannot create new CMPIObjectPath");
143 goto exit;
144 }
146 /* Get the list of all target class object paths from the CIMOM. */
147 CMPIEnumeration * objectpaths = CBEnumInstanceNames(_BROKER, context, objectpath, &status);
148 if ((status.rc != CMPI_RC_OK) || CMIsNullObject(objectpaths)) {
149 _SBLIM_TRACE(1,("--- CBEnumInstanceNames() failed - %s", CMGetCharPtr(status.msg)));
150 CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERROR, "Cannot enumerate target class");
151 goto exit;
152 }
154 /* Return all object paths that exactly match the target class and resultClass, if specified. */
155 while (CMHasNext(objectpaths, NULL)) {
156 CMPIData data = CMGetNext(objectpaths, NULL);
157 char *class = CMGetCharPtr(CMGetClassName(data.value.ref, NULL));
159 /* Ignore possible instances of source class. */
160 if (strcmp(class,sourceclass) &&
161 (resultClass == NULL || CMClassPathIsA(_BROKER, data.value.ref, resultClass, NULL))) {
163 CMReturnObjectPath(results, data.value.ref);
164 }
165 }
167 CMReturnDone(results);
169 exit:
170 _SBLIM_RETURNSTATUS(status);
171 }
174 // ----------------------------------------------------------------------------
175 // Associators()
176 // ----------------------------------------------------------------------------
177 static CMPIStatus Associators(
178 CMPIAssociationMI * self, /* [in] Handle to this provider (i.e. 'self'). */
179 const CMPIContext * context, /* [in] Additional context info, if any. */
180 const CMPIResult * results, /* [out] Results of this operation. */
181 const CMPIObjectPath * reference, /* [in] Contains the source namespace, classname and object path. */
182 const char *assocClass,
183 const char *resultClass,
184 const char *role,
185 const char *resultRole,
186 const char ** properties) /* [in] List of desired properties (NULL=all). */
187 {
188 CMPIStatus status = { CMPI_RC_OK, NULL }; /* Return status of CIM operations. */
189 char *namespace = CMGetCharPtr(CMGetNameSpace(reference, NULL)); /* Target namespace. */
190 char *sourceclass = CMGetCharPtr(CMGetClassName(reference, &status)); /* Class of the source reference object */
191 char *targetclass; /* Class of the target object(s). */
193 _SBLIM_ENTER("Associators");
194 _SBLIM_TRACE(2, ("--- self=\"%s\"", self->ft->miName));
195 _SBLIM_TRACE(2, ("--- context=\"%s\"", CMGetCharPtr(CDToString(_BROKER, context, NULL))));
196 _SBLIM_TRACE(2, ("--- reference=\"%s\"", CMGetCharPtr(CDToString(_BROKER, reference, NULL))));
197 _SBLIM_TRACE(2, ("--- assocClass=\"%s\"", assocClass));
198 _SBLIM_TRACE(2, ("--- resultClass=\"%s\"", resultClass));
199 _SBLIM_TRACE(2, ("--- role=\"%s\"", role));
200 _SBLIM_TRACE(2, ("--- resultRole=\"%s\"", resultRole));
201 _SBLIM_TRACE(2, ("--- namespace=\"%s\"", namespace));
202 _SBLIM_TRACE(2, ("--- sourceclass=\"%s\"", sourceclass));
204 /* Check that the requested association class, if any, is supported. */
205 if (assocClass != NULL) {
206 CMPIObjectPath * assoc = CMNewObjectPath(_BROKER, namespace, _ASSOCCLASS, NULL);
207 if (!CMClassPathIsA(_BROKER, assoc, assocClass, NULL)) {
208 _SBLIM_TRACE(2, ("--- Unrecognized association class. Ignoring request."));
209 goto exit;
210 }
211 }
213 /* Check that the reference matches the required role, if any. */
214 if ((role != NULL) && strcmp(role, sourceclass) != 0) {
215 _SBLIM_TRACE(2, ("--- Reference does not match required role. Ignoring request."));
216 goto exit;
217 }
219 /* Determine the target class from the source class. */
220 if (strcmp(sourceclass, _LHSCLASSNAME) == 0) {
221 targetclass = _RHSCLASSNAME;
222 } else if (strcmp(sourceclass, _RHSCLASSNAME) == 0) {
223 targetclass = _LHSCLASSNAME;
224 } else {
225 _SBLIM_TRACE(2, ("--- Unrecognized source class. Ignoring request."));
226 goto exit;
227 }
228 _SBLIM_TRACE(2, ("--- targetclass=\"%s\"", targetclass));
230 /* Create an object path for the result class. */
231 CMPIObjectPath * objectpath = CMNewObjectPath(_BROKER, namespace, targetclass, &status);
232 if ((status.rc != CMPI_RC_OK) || CMIsNullObject(objectpath)) {
233 _SBLIM_TRACE(1,("--- CMNewObjectPath() failed - %s", CMGetCharPtr(status.msg)));
234 CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERROR, "Cannot create new CMPIObjectPath");
235 goto exit;
236 }
238 /* Get the list of all target class instances from the CIMOM. */
239 CMPIEnumeration * instances = CBEnumInstances(_BROKER, context, objectpath, NULL, &status);
240 if ((status.rc != CMPI_RC_OK) || CMIsNullObject(instances)) {
241 _SBLIM_TRACE(1,("--- CBEnumInstances() failed - %s", CMGetCharPtr(status.msg)));
242 CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERROR, "Cannot enumerate target class");
243 goto exit;
244 }
246 /* Return all instances that exactly match the target class and resultClass, if specified. */
247 while (CMHasNext(instances, NULL)) {
248 CMPIData data = CMGetNext(instances, NULL);
249 CMPIObjectPath *op = CMGetObjectPath(data.value.inst,NULL);
250 char *class = CMGetCharPtr(CMGetClassName(CMGetObjectPath(data.value.inst,NULL), NULL));
252 /* Ignore possible instances of source class. */
253 if (strcmp(class,sourceclass) &&
254 (resultClass == NULL || CMClassPathIsA(_BROKER, op, resultClass, NULL))) {
255 CMReturnInstance(results, data.value.inst);
256 }
257 }
259 CMReturnDone(results);
261 exit:
262 _SBLIM_RETURNSTATUS(status);
263 }
266 // ----------------------------------------------------------------------------
267 // ReferenceNames()
268 // ----------------------------------------------------------------------------
269 static CMPIStatus ReferenceNames(
270 CMPIAssociationMI * self, /* [in] Handle to this provider (i.e. 'self'). */
271 const CMPIContext * context, /* [in] Additional context info, if any. */
272 const CMPIResult * results, /* [out] Results of this operation. */
273 const CMPIObjectPath * reference, /* [in] Contains the source namespace, classname and object path. */
274 const char *assocClass,
275 const char *role)
276 {
277 CMPIStatus status = { CMPI_RC_OK, NULL }; /* Return status of CIM operations. */
278 char *namespace = CMGetCharPtr(CMGetNameSpace(reference, NULL)); /* Target namespace. */
279 char *sourceclass = CMGetCharPtr(CMGetClassName(reference, &status)); /* Class of the source reference object */
280 char *targetclass; /* Class of the target object(s). */
282 _SBLIM_ENTER("ReferenceNames");
283 _SBLIM_TRACE(2, ("--- self=\"%s\"", self->ft->miName));
284 _SBLIM_TRACE(2, ("--- context=\"%s\"", CMGetCharPtr(CDToString(_BROKER, context, NULL))));
285 _SBLIM_TRACE(2, ("--- reference=\"%s\"", CMGetCharPtr(CDToString(_BROKER, reference, NULL))));
286 _SBLIM_TRACE(2, ("--- assocClass=\"%s\"", assocClass));
287 _SBLIM_TRACE(2, ("--- role=\"%s\"", role));
288 _SBLIM_TRACE(2, ("--- namespace=\"%s\"", namespace));
289 _SBLIM_TRACE(2, ("--- sourceclass=\"%s\"", sourceclass));
291 /* Check that the requested association class, if any, is supported. */
292 if (assocClass != NULL) {
293 CMPIObjectPath * assoc = CMNewObjectPath(_BROKER, namespace, _ASSOCCLASS, NULL);
294 if (!CMClassPathIsA(_BROKER, assoc, assocClass, NULL)) {
295 _SBLIM_TRACE(2, ("--- Unrecognized association class. Ignoring request."));
296 goto exit;
297 }
298 }
300 /* Check that the reference matches the required role, if any. */
301 if ((role != NULL) && strcmp(role, sourceclass) != 0) {
302 _SBLIM_TRACE(2, ("--- Reference does not match required role. Ignoring request."));
303 goto exit;
304 }
306 /* Determine the target class from the source class. */
307 if (strcmp(sourceclass, _LHSCLASSNAME) == 0) {
308 targetclass = _RHSCLASSNAME;
309 } else if (strcmp(sourceclass, _RHSCLASSNAME) == 0) {
310 targetclass = _LHSCLASSNAME;
311 } else {
312 _SBLIM_TRACE(2, ("--- Unrecognized source class. Ignoring request."));
313 goto exit;
314 }
315 _SBLIM_TRACE(2, ("--- targetclass=\"%s\"", targetclass));
317 /* Create an object path for the result class. */
318 CMPIObjectPath * objectpath = CMNewObjectPath(_BROKER, namespace, targetclass, &status);
319 if ((status.rc != CMPI_RC_OK) || CMIsNullObject(objectpath)) {
320 _SBLIM_TRACE(1,("--- CMNewObjectPath() failed - %s", CMGetCharPtr(status.msg)));
321 CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERROR, "Cannot create new CMPIObjectPath");
322 goto exit;
323 }
325 /* Get the list of all target class object paths from the CIMOM. */
326 CMPIEnumeration * objectpaths = CBEnumInstanceNames(_BROKER, context, objectpath, &status);
327 if ((status.rc != CMPI_RC_OK) || CMIsNullObject(objectpaths)) {
328 _SBLIM_TRACE(1,("--- CBEnumInstanceNames() failed - %s", CMGetCharPtr(status.msg)));
329 CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERROR, "Cannot enumerate target class");
330 goto exit;
331 }
333 /* Return all object paths that exactly match the target class and resultClass, if specified. */
334 while (CMHasNext(objectpaths, NULL)) {
335 CMPIData data = CMGetNext(objectpaths, NULL);
336 char *class = CMGetCharPtr(CMGetClassName(data.value.ref, NULL));
338 if((CMClassPathIsA(_BROKER, data.value.ref, targetclass, NULL)) &&
339 (!CMClassPathIsA(_BROKER, data.value.ref, sourceclass, NULL))) {
340 /* Create an object path for the association. Note that the association
341 * objects should exist in 'virt namespace' not the host namespace.
342 */
343 CMPIObjectPath * refobjectpath = CMNewObjectPath(_BROKER, _LHSNAMESPACE, _ASSOCCLASS, &status);
344 if ((status.rc != CMPI_RC_OK) || CMIsNullObject(refobjectpath)) {
345 _SBLIM_TRACE(1,("--- CMNewObjectPath() failed - %s", CMGetCharPtr(status.msg)));
346 CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERROR, "Cannot create new CMPIObjectPath");
347 goto exit;
348 }
350 /* Assign the references in the association appropriately. */
351 if (strcmp(sourceclass, _RHSCLASSNAME) == 0) {
352 CMAddKey(refobjectpath, _RHSPROPERTYNAME, &reference, CMPI_ref);
353 CMAddKey(refobjectpath, _LHSPROPERTYNAME, &data.value.ref, CMPI_ref);
354 } else {
355 CMAddKey(refobjectpath, _RHSPROPERTYNAME, &data.value.ref, CMPI_ref);
356 CMAddKey(refobjectpath, _LHSPROPERTYNAME, &reference, CMPI_ref);
357 }
359 CMReturnObjectPath(results, refobjectpath);
360 }
361 }
363 exit:
364 _SBLIM_RETURNSTATUS(status);
365 }
368 // ----------------------------------------------------------------------------
369 // References()
370 // ----------------------------------------------------------------------------
371 static CMPIStatus References(
372 CMPIAssociationMI * self, /* [in] Handle to this provider (i.e. 'self'). */
373 const CMPIContext * context, /* [in] Additional context info, if any. */
374 const CMPIResult * results, /* [out] Results of this operation. */
375 const CMPIObjectPath * reference, /* [in] Contains the namespace, classname and desired object path. */
376 const char *assocClass,
377 const char *role,
378 const char **properties) /* [in] List of desired properties (NULL=all). */
379 {
380 CMPIStatus status = { CMPI_RC_OK, NULL }; /* Return status of CIM operations. */
381 char *namespace = CMGetCharPtr(CMGetNameSpace(reference, NULL)); /* Target namespace. */
382 char *sourceclass = CMGetCharPtr(CMGetClassName(reference, &status)); /* Class of the source reference object */
383 char *targetclass; /* Class of the target object(s). */
385 _SBLIM_ENTER("References");
386 _SBLIM_TRACE(2, ("--- self=\"%s\"", self->ft->miName));
387 _SBLIM_TRACE(2, ("--- context=\"%s\"", CMGetCharPtr(CDToString(_BROKER, context, NULL))));
388 _SBLIM_TRACE(2, ("--- reference=\"%s\"", CMGetCharPtr(CDToString(_BROKER, reference, NULL))));
389 _SBLIM_TRACE(2, ("--- assocClass=\"%s\"", assocClass));
390 _SBLIM_TRACE(2, ("--- role=\"%s\"", role));
391 _SBLIM_TRACE(2, ("--- namespace=\"%s\"", namespace));
392 _SBLIM_TRACE(2, ("--- sourceclass=\"%s\"", sourceclass));
394 /* Check that the requested association class, if any, is supported. */
395 if (assocClass != NULL) {
396 CMPIObjectPath * assoc = CMNewObjectPath(_BROKER, namespace, _ASSOCCLASS, NULL);
397 if (!CMClassPathIsA(_BROKER, assoc, assocClass, NULL)) {
398 _SBLIM_TRACE(2, ("--- Unrecognized association class. Ignoring request."));
399 goto exit;
400 }
401 }
403 /* Check that the reference matches the required role, if any. */
404 if ((role != NULL) && strcmp(role, sourceclass) != 0) {
405 _SBLIM_TRACE(2, ("--- Reference does not match required role. Ignoring request."));
406 goto exit;
407 }
409 /* Determine the target class from the source class. */
410 if (strcmp(sourceclass, _LHSCLASSNAME) == 0) {
411 targetclass = _RHSCLASSNAME;
412 } else if (strcmp(sourceclass, _RHSCLASSNAME) == 0) {
413 targetclass = _LHSCLASSNAME;
414 } else {
415 _SBLIM_TRACE(2, ("--- Unrecognized source class. Ignoring request."));
416 goto exit;
417 }
418 _SBLIM_TRACE(2, ("--- targetclass=\"%s\"", targetclass));
420 /* Create an object path for the result class. */
421 CMPIObjectPath * objectpath = CMNewObjectPath(_BROKER, namespace, targetclass, &status);
422 if ((status.rc != CMPI_RC_OK) || CMIsNullObject(objectpath)) {
423 _SBLIM_TRACE(1,("--- CMNewObjectPath() failed - %s", CMGetCharPtr(status.msg)));
424 CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERROR, "Cannot create new CMPIObjectPath");
425 goto exit;
426 }
428 /* Get the list of all target class object paths from the CIMOM. */
429 CMPIEnumeration * objectpaths = CBEnumInstanceNames(_BROKER, context, objectpath, &status);
430 if ((status.rc != CMPI_RC_OK) || CMIsNullObject(objectpaths)) {
431 _SBLIM_TRACE(1,("--- CBEnumInstanceNames() failed - %s", CMGetCharPtr(status.msg)));
432 CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERROR, "Cannot enumerate target class");
433 goto exit;
434 }
436 /* Return all object paths that exactly match the target class and resultClass, if specified. */
437 while (CMHasNext(objectpaths, NULL)) {
438 CMPIData data = CMGetNext(objectpaths, NULL);
440 if((CMClassPathIsA(_BROKER, data.value.ref, targetclass, NULL)) &&
441 (!CMClassPathIsA(_BROKER, data.value.ref, sourceclass, NULL))) {
442 /* Create an instance for the association. Note that the association
443 * objects should exist in 'virt namespace' not the host namespace.
444 */
445 CMPIInstance * refinstance = _CMNewInstance(_BROKER, _LHSNAMESPACE, _ASSOCCLASS, &status);
446 if ((status.rc != CMPI_RC_OK) || CMIsNullObject(refinstance)) {
447 _SBLIM_TRACE(1,("--- CMNewInstance() failed - %s", CMGetCharPtr(status.msg)));
448 CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERROR, "Cannot create new CMPIInstance");
449 goto exit;
450 }
452 /* Assign the references in the association appropriately. */
453 if (strcmp(sourceclass, _RHSCLASSNAME) == 0) {
454 CMSetProperty(refinstance, _RHSPROPERTYNAME, &reference, CMPI_ref);
455 CMSetProperty(refinstance, _LHSPROPERTYNAME, &data.value.ref, CMPI_ref);
456 } else {
457 CMSetProperty(refinstance, _RHSPROPERTYNAME, &data.value.ref, CMPI_ref);
458 CMSetProperty(refinstance, _LHSPROPERTYNAME, &reference, CMPI_ref);
459 }
461 CMReturnInstance(results, refinstance);
462 }
463 }
464 exit:
465 _SBLIM_RETURNSTATUS(status);
466 }
469 // ----------------------------------------------------------------------------
470 // AssociationInitialize()
471 // Perform any necessary initialization immediately after this provider is
472 // first loaded.
473 // ----------------------------------------------------------------------------
474 static void AssociationInitialize(
475 CMPIAssociationMI * self, /* [in] Handle to this provider (i.e. 'self'). */
476 const CMPIContext * context) /* [in] Additional context info, if any. */
477 {
478 _SBLIM_ENTER("AssociationInitialize");
479 _SBLIM_TRACE(2, ("--- self=\"%s\"", self->ft->miName));
480 // _SBLIM_TRACE(2, ("--- context=\"%s\"", CMGetCharPtr(CDToString(_BROKER, context, NULL))));
482 /* Nothing needs to be done to initialize this provider */
483 _SBLIM_RETURN();
484 }
487 // ============================================================================
488 // CMPI ASSOCIATION PROVIDER FUNCTION TABLE SETUP
489 // ============================================================================
490 CMAssociationMIStub( , Xen_VSMSElementCapabilities, _BROKER, AssociationInitialize(&mi, ctx));