os-cmpi-xen

changeset 25:16d625984bc4

Lots of work on MemoryPool and its associations. Also fixed bugs in various
associations that were discovered while working on the MemoryPool associations.

Signed-off-by: Jim Fehlig <jfehlig@novell.com>
author jfehlig@jfehlig3.provo.novell.com
date Thu Sep 28 17:07:14 2006 -0600 (2006-09-28)
parents 5ea0266dce26
children a4962bb9446a
files .hgignore Makefile.am autoconfiscate.sh schema/Xen_MemoryAllocatedFromPool.mof schema/Xen_MemoryAllocatedFromPool.registration schema/Xen_MemoryPool.mof schema/Xen_MemoryPoolComponent.mof schema/Xen_MemoryPoolComponent.registration schema/Xen_MemorySettingAllocationFromPool.mof schema/Xen_MemorySettingAllocationFromPool.registration schema/Xen_ProcessorAllocatedFromPool.mof schema/Xen_ProcessorPoolComponent.mof src/Makefile.am src/Xen_ComputerSystem.c src/Xen_HostedMemoryPool.c src/Xen_MemoryAllocatedFromPool.c src/Xen_MemoryPool.c src/Xen_MemoryPoolComponent.c src/Xen_MemoryPool_Resource.c src/Xen_MemorySettingAllocationFromPool.c src/Xen_Memory_Resource.c src/Xen_ProcessorAllocatedFromPool.c src/Xen_ProcessorPool.c src/Xen_ProcessorPoolComponent.c src/Xen_ProcessorPool_Resource.c src/Xen_ProcessorSettingAllocationFromPool.c src/Xen_VirtualSystemManagementService.c src/provider_common.h src/xm.c
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/.hgignore	Thu Sep 28 17:07:14 2006 -0600
     1.3 @@ -0,0 +1,20 @@
     1.4 +# use glob syntax.
     1.5 +syntax: glob
     1.6 +
     1.7 +Makefile
     1.8 +Makefile.in
     1.9 +config.*
    1.10 +configure
    1.11 +libtool
    1.12 +aclocal.m4
    1.13 +stamp-h1
    1.14 +autom4te*
    1.15 +*.spec
    1.16 +
    1.17 +*.la*
    1.18 +*.lo
    1.19 +*.*o
    1.20 +*.so*
    1.21 +*.a*
    1.22 +*.pyc
    1.23 +*~
     2.1 --- a/Makefile.am	Tue Sep 26 15:08:04 2006 -0600
     2.2 +++ b/Makefile.am	Thu Sep 28 17:07:14 2006 -0600
     2.3 @@ -17,6 +17,7 @@
     2.4  # =============================================================================
     2.5  # Author:       Dr. Gareth S. Bestor <bestor@us.ibm.com>
     2.6  # Contributors: Tokunbo Adeshiyan <tokunbo@us.ibm.com>
     2.7 +#               Jim Fehlig <jfehlig@novell.com>
     2.8  # Description:
     2.9  #    Automake input file for the CMPI Xen CIM provider.
    2.10  # =============================================================================
    2.11 @@ -101,6 +102,7 @@ XEN_MOFS = \
    2.12  	schema/Xen_ResourcePool.mof \
    2.13  	schema/Xen_MemoryPool.mof \
    2.14  	schema/Xen_HostedMemoryPool.mof \
    2.15 +	schema/Xen_MemoryPoolComponent.mof \
    2.16  	schema/Xen_ProcessorPool.mof \
    2.17  	schema/Xen_HostedProcessorPool.mof \
    2.18  	schema/Xen_ProcessorPoolComponent.mof \
    2.19 @@ -109,6 +111,8 @@ XEN_MOFS = \
    2.20  	schema/Xen_MemoryCapabilitiesSettingData.mof \
    2.21  	schema/Xen_ProcessorAllocatedFromPool.mof \
    2.22  	schema/Xen_ProcessorSettingAllocationFromPool.mof \
    2.23 +	schema/Xen_MemoryAllocatedFromPool.mof \
    2.24 +	schema/Xen_MemorySettingAllocationFromPool.mof \
    2.25  	schema/Xen_RegisteredSVProfile.mof \
    2.26  	schema/Xen_ElementConformsToSVProfile.mof \
    2.27  	schema/Xen_RegisteredVSProfile.mof \
    2.28 @@ -149,6 +153,7 @@ XEN_REGS = \
    2.29  	schema/Xen_DiskElementSettingData.registration \
    2.30  	schema/Xen_MemoryPool.registration \
    2.31  	schema/Xen_HostedMemoryPool.registration \
    2.32 +	schema/Xen_MemoryPoolComponent.registration \
    2.33  	schema/Xen_ProcessorPool.registration \
    2.34  	schema/Xen_HostedProcessorPool.registration \
    2.35  	schema/Xen_ProcessorPoolComponent.registration \
    2.36 @@ -157,6 +162,8 @@ XEN_REGS = \
    2.37  	schema/Xen_MemoryCapabilitiesSettingData.registration \
    2.38  	schema/Xen_ProcessorAllocatedFromPool.registration \
    2.39  	schema/Xen_ProcessorSettingAllocationFromPool.registration \
    2.40 +	schema/Xen_MemoryAllocatedFromPool.registration \
    2.41 +	schema/Xen_MemorySettingAllocationFromPool.registration \
    2.42  	schema/Xen_RegisteredSVProfile.registration \
    2.43  	schema/Xen_ElementConformsToSVProfile.registration \
    2.44  	schema/Xen_RegisteredVSProfile.registration \
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/schema/Xen_MemoryAllocatedFromPool.mof	Thu Sep 28 17:07:14 2006 -0600
     4.3 @@ -0,0 +1,24 @@
     4.4 +// Copyright (c) 2006 Novell, Inc. All rights reserved.
     4.5 +
     4.6 +// *******************************************************************
     4.7 +// Associations
     4.8 +// *******************************************************************
     4.9 +
    4.10 +// ==================================================================
    4.11 +// Xen_MemoryAllocatedFromPool
    4.12 +// ==================================================================
    4.13 +   [Association,
    4.14 +    Provider ("cmpi:Xen_MemoryAllocatedFromPool"),
    4.15 +    Description (
    4.16 +	"A class derived from CIM_DeviceAllocatedFromPool that "
    4.17 +	"associates an instance of Xen_Memory representing the "
    4.18 +	"Xen domain memory with the Xen_MemoryPool from which it "
    4.19 +	"was allocated.")]
    4.20 +class Xen_MemoryAllocatedFromPool : CIM_DeviceAllocatedFromPool {
    4.21 +
    4.22 +      [Override ("Antecedent"), Description ("The memory resource pool.")]
    4.23 +    Xen_MemoryPool REF Antecedent;
    4.24 +
    4.25 +      [Override ("Dependent"), Description ("The allocated memory.")]
    4.26 +    Xen_Memory REF Dependent;
    4.27 +};      
     5.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.2 +++ b/schema/Xen_MemoryAllocatedFromPool.registration	Thu Sep 28 17:07:14 2006 -0600
     5.3 @@ -0,0 +1,2 @@
     5.4 +# Classname Namespace ProviderName ProviderModule ProviderTypes ...
     5.5 +Xen_MemoryAllocatedFromPool root/cimv2 Xen_MemoryAllocatedFromPool Xen_MemoryAllocatedFromPool association
     6.1 --- a/schema/Xen_MemoryPool.mof	Tue Sep 26 15:08:04 2006 -0600
     6.2 +++ b/schema/Xen_MemoryPool.mof	Thu Sep 28 17:07:14 2006 -0600
     6.3 @@ -3,12 +3,13 @@
     6.4  // ==================================================================
     6.5  // Xen_MemoryPool
     6.6  // ==================================================================
     6.7 -[Description (
     6.8 -	"A class derived from Xen_ResourcePool to represent "
     6.9 +[Provider ("cmpi:Xen_MemoryPool"),
    6.10 + Description (
    6.11 +	"A class derived from CIM_ResourcePool to represent "
    6.12  	"the 'pool' of memory resources that exist on the Xen host "
    6.13  	"computer system that are available for allocation to "
    6.14  	"specific Xen domains.")]
    6.15 -class Xen_MemoryPool : Xen_ResourcePool
    6.16 +class Xen_MemoryPool : CIM_ResourcePool
    6.17  {
    6.18  };
    6.19  
     7.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.2 +++ b/schema/Xen_MemoryPoolComponent.mof	Thu Sep 28 17:07:14 2006 -0600
     7.3 @@ -0,0 +1,24 @@
     7.4 +// Copyright (c) 2006 Novell, Inc. All rights reserved.
     7.5 +
     7.6 +// *******************************************************************
     7.7 +// Associations
     7.8 +// *******************************************************************
     7.9 +
    7.10 +// ==================================================================
    7.11 +// Xen_MemoryPoolComponent
    7.12 +// ==================================================================
    7.13 +[Association,
    7.14 + Provider ("cmpi:Xen_MemoryPoolComponent"),
    7.15 + Description (
    7.16 +	"A class derived from CIM_ConcreteComponent to represent "
    7.17 +	"the collection of host CIM_Memory(s) assigned to the "
    7.18 +	"memory pool.")]
    7.19 +class Xen_MemoryPoolComponent : CIM_ConcreteComponent
    7.20 +{
    7.21 +   [Override("PartComponent")]
    7.22 +   CIM_Memory REF PartComponent;
    7.23 +
    7.24 +   [Override("GroupComponent")]
    7.25 +   Xen_MemoryPool REF GroupComponent;
    7.26 +};
    7.27 +
     8.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     8.2 +++ b/schema/Xen_MemoryPoolComponent.registration	Thu Sep 28 17:07:14 2006 -0600
     8.3 @@ -0,0 +1,2 @@
     8.4 +# Classname Namespace ProviderName ProviderModule ProviderTypes ...
     8.5 +Xen_MemoryPoolComponent root/cimv2 Xen_MemoryPoolComponent Xen_MemoryPoolComponent association
     9.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     9.2 +++ b/schema/Xen_MemorySettingAllocationFromPool.mof	Thu Sep 28 17:07:14 2006 -0600
     9.3 @@ -0,0 +1,24 @@
     9.4 +// Copyright (c) 2006 Novell, Inc. All rights reserved.
     9.5 +
     9.6 +// *******************************************************************
     9.7 +// Associations
     9.8 +// *******************************************************************
     9.9 +
    9.10 +// ==================================================================
    9.11 +// Xen_MemorySettingAllocatedFromPool
    9.12 +// ==================================================================
    9.13 +   [Association,
    9.14 +    Provider ("cmpi:Xen_MemorySettingAllocationFromPool"),
    9.15 +    Description (
    9.16 +	"A class derived from CIM_ResourceAllocationFromPool that "
    9.17 +	"associates an instance of Xen_MemorySettingData representing "
    9.18 +	"a memory allocation with the Xen_MemoryPool from which "
    9.19 +	"it is allocated.")]
    9.20 +class Xen_MemorySettingAllocationFromPool : CIM_ResourceAllocationFromPool {
    9.21 +
    9.22 +      [Override ("Antecedent"), Description ("The memory pool.")]
    9.23 +    Xen_MemoryPool REF Antecedent;
    9.24 +
    9.25 +      [Override ("Dependent"), Description ("The memory setting data.")]
    9.26 +    Xen_MemorySettingData REF Dependent;
    9.27 +};      
    10.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    10.2 +++ b/schema/Xen_MemorySettingAllocationFromPool.registration	Thu Sep 28 17:07:14 2006 -0600
    10.3 @@ -0,0 +1,2 @@
    10.4 +# Classname Namespace ProviderName ProviderModule ProviderTypes ...
    10.5 +Xen_MemorySettingAllocationFromPool root/cimv2 Xen_MemorySettingAllocationFromPool Xen_MemorySettingAllocationFromPool association
    11.1 --- a/schema/Xen_ProcessorAllocatedFromPool.mof	Tue Sep 26 15:08:04 2006 -0600
    11.2 +++ b/schema/Xen_ProcessorAllocatedFromPool.mof	Thu Sep 28 17:07:14 2006 -0600
    11.3 @@ -2,7 +2,7 @@
    11.4      Provider ("cmpi:Xen_ProcessorAllocatedFromPool"),
    11.5      Description (
    11.6  	"A class derived from CIM_DeviceAllocatedFromPool that "
    11.7 -	"associates an instance of Xen_Processor representing the "
    11.8 +	"associates an instance of Xen_Processor representing "
    11.9  	"a Xen domain virtual processor with the Xen_ProcessorPool "
   11.10  	"from which it was allocated.")]
   11.11  class Xen_ProcessorAllocatedFromPool : CIM_DeviceAllocatedFromPool {
    12.1 --- a/schema/Xen_ProcessorPoolComponent.mof	Tue Sep 26 15:08:04 2006 -0600
    12.2 +++ b/schema/Xen_ProcessorPoolComponent.mof	Thu Sep 28 17:07:14 2006 -0600
    12.3 @@ -5,7 +5,7 @@
    12.4  // *******************************************************************
    12.5  
    12.6  // ==================================================================
    12.7 -// Xen_HostedProcessorPool
    12.8 +// Xen_ProcessorPoolComponent
    12.9  // ==================================================================
   12.10  [Association,
   12.11   Provider ("cmpi:Xen_ProcessorPoolComponent"),
    13.1 --- a/src/Makefile.am	Tue Sep 26 15:08:04 2006 -0600
    13.2 +++ b/src/Makefile.am	Thu Sep 28 17:07:14 2006 -0600
    13.3 @@ -17,6 +17,7 @@
    13.4  # =============================================================================
    13.5  # Author:       Dr. Gareth S. Bestor <bestor@us.ibm.com>
    13.6  # Contributors: Tokunbo Adeshiyan <tokunbo@us.ibm.com>
    13.7 +#               Jim Fehlig <jfehlig@novell.com>
    13.8  # Description:
    13.9  #    Automake input file for the CMPI Xen CIM provider.
   13.10  # =============================================================================
   13.11 @@ -109,6 +110,7 @@ provider_LTLIBRARIES = \
   13.12  	libXen_DiskElementSettingData.la \
   13.13  	libXen_MemoryPool.la \
   13.14  	libXen_HostedMemoryPool.la \
   13.15 +	libXen_MemoryPoolComponent.la \
   13.16  	libXen_ProcessorPool.la \
   13.17  	libXen_HostedProcessorPool.la \
   13.18  	libXen_ProcessorPoolComponent.la \
   13.19 @@ -117,6 +119,8 @@ provider_LTLIBRARIES = \
   13.20  	libXen_MemoryCapabilitiesSettingData.la \
   13.21  	libXen_ProcessorAllocatedFromPool.la \
   13.22  	libXen_ProcessorSettingAllocationFromPool.la \
   13.23 +	libXen_MemoryAllocatedFromPool.la \
   13.24 +	libXen_MemorySettingAllocationFromPool.la \
   13.25  	libXen_ElementConformsToSVProfile.la \
   13.26  	libXen_ElementConformsToVSProfile.la \
   13.27  	libXen_RegisteredProfiles.la
   13.28 @@ -234,6 +238,9 @@ libXen_MemoryPool_la_CFLAGS = -I../
   13.29  libXen_HostedMemoryPool_la_SOURCES = Xen_HostedMemoryPool.c
   13.30  libXen_HostedMemoryPool_la_LIBADD =
   13.31  
   13.32 +libXen_MemoryPoolComponent_la_SOURCES = Xen_MemoryPoolComponent.c
   13.33 +libXen_MemoryPoolComponent_la_LIBADD = libXen_utils.la
   13.34 +
   13.35  libXen_ProcessorPool_la_SOURCES = Xen_ProcessorPool.c Xen_ProcessorPool_Resource.c
   13.36  libXen_ProcessorPool_la_LIBADD = libxm.la libXen_utils.la -lxenstore -luuid
   13.37  libXen_ProcessorPool_la_CFLAGS = -I../
   13.38 @@ -261,6 +268,12 @@ libXen_ProcessorAllocatedFromPool_la_LIB
   13.39  libXen_ProcessorSettingAllocationFromPool_la_SOURCES = Xen_ProcessorSettingAllocationFromPool.c
   13.40  libXen_ProcessorSettingAllocationFromPool_la_LIBADD = libXen_utils.la
   13.41  
   13.42 +libXen_MemoryAllocatedFromPool_la_SOURCES = Xen_MemoryAllocatedFromPool.c
   13.43 +libXen_MemoryAllocatedFromPool_la_LIBADD = libXen_utils.la
   13.44 +
   13.45 +libXen_MemorySettingAllocationFromPool_la_SOURCES = Xen_MemorySettingAllocationFromPool.c
   13.46 +libXen_MemorySettingAllocationFromPool_la_LIBADD = libXen_utils.la
   13.47 +
   13.48  libXen_ElementConformsToSVProfile_la_SOURCES = Xen_ElementConformsToSVProfile.c
   13.49  libXen_ElementConformsToSVProfile_la_LIBADD = libXen_utils.la
   13.50  
    14.1 --- a/src/Xen_ComputerSystem.c	Tue Sep 26 15:08:04 2006 -0600
    14.2 +++ b/src/Xen_ComputerSystem.c	Thu Sep 28 17:07:14 2006 -0600
    14.3 @@ -16,6 +16,7 @@
    14.4  // ============================================================================
    14.5  // Authors:       Dr. Gareth S. Bestor, <bestor@us.ibm.com>
    14.6  //                Tokunbo Adeshiyan, <tokunbo@us.ibm.com>
    14.7 +//                Jim Fehlig, <jfehlig@novell.com>
    14.8  // Contributors:
    14.9  // Description:
   14.10  // ============================================================================
   14.11 @@ -105,7 +106,7 @@ static CMPIStatus EnumInstanceNames(
   14.12     _SBLIM_TRACE(2, ("--- namespace=\"%s\"", namespace));
   14.13  
   14.14     if (strcmp(namespace, HOST_INSTRUMENTATION_NS) == 0) {
   14.15 -      _SBLIM_TRACE(1,("--- \"%s\" is not a valid namespace for System Virtualization Profile", namespace));
   14.16 +      _SBLIM_TRACE(1,("--- \"%s\" is not a valid namespace for %s", namespace, _CLASSNAME));
   14.17        goto exit;
   14.18     }
   14.19  
   14.20 @@ -192,7 +193,7 @@ static CMPIStatus EnumInstances(
   14.21     _SBLIM_TRACE(2, ("--- namespace=\"%s\"", namespace));
   14.22  
   14.23     if (strcmp(namespace, HOST_INSTRUMENTATION_NS) == 0) {
   14.24 -      _SBLIM_TRACE(2,("--- \"%s\" is not a valid namespace for System Virtualization Profile", namespace));
   14.25 +      _SBLIM_TRACE(1,("--- \"%s\" is not a valid namespace for %s", namespace, _CLASSNAME));
   14.26        goto exit;
   14.27     }
   14.28  
   14.29 @@ -279,7 +280,7 @@ static CMPIStatus GetInstance(
   14.30     _SBLIM_TRACE(2, ("--- namespace=\"%s\"", namespace));
   14.31  
   14.32     if (strcmp(namespace, HOST_INSTRUMENTATION_NS) == 0) {
   14.33 -      _SBLIM_TRACE(2,("--- \"%s\" is not a valid namespace for System Virtualization Profile", namespace));
   14.34 +      _SBLIM_TRACE(1,("--- \"%s\" is not a valid namespace for %s", namespace, _CLASSNAME));
   14.35        goto exit;
   14.36     }
   14.37  
   14.38 @@ -371,7 +372,7 @@ static CMPIStatus SetInstance(
   14.39     _SBLIM_TRACE(2, ("--- namespace=\"%s\"", namespace));
   14.40  
   14.41     if (strcmp(namespace, HOST_INSTRUMENTATION_NS) == 0) {
   14.42 -      _SBLIM_TRACE(2,("--- \"%s\" is not a valid namespace for System Virtualization Profile", namespace));
   14.43 +      _SBLIM_TRACE(1,("--- \"%s\" is not a valid namespace for %s", namespace, _CLASSNAME));
   14.44        goto exit;
   14.45     }
   14.46   
   14.47 @@ -448,7 +449,7 @@ static CMPIStatus CreateInstance(
   14.48     _SBLIM_TRACE(2, ("--- namespace=\"%s\"", namespace));
   14.49  
   14.50     if (strcmp(namespace, HOST_INSTRUMENTATION_NS) == 0) {
   14.51 -      _SBLIM_TRACE(2,("--- \"%s\" is not a valid namespace for System Virtualization Profile", namespace));
   14.52 +      _SBLIM_TRACE(1,("--- \"%s\" is not a valid namespace for %s", namespace, _CLASSNAME));
   14.53        goto exit;
   14.54     }
   14.55  
   14.56 @@ -530,7 +531,7 @@ static CMPIStatus DeleteInstance(
   14.57     _SBLIM_TRACE(2, ("--- namespace=\"%s\"", namespace));
   14.58  
   14.59     if (strcmp(namespace, HOST_INSTRUMENTATION_NS) == 0) {
   14.60 -      _SBLIM_TRACE(2,("--- \"%s\" is not a valid namespace for System Virtualization Profile", namespace));
   14.61 +      _SBLIM_TRACE(1,("--- \"%s\" is not a valid namespace for %s", namespace, _CLASSNAME));
   14.62        goto exit;
   14.63     }
   14.64  
   14.65 @@ -607,8 +608,8 @@ static CMPIStatus ExecQuery(
   14.66     _SBLIM_TRACE(2, ("--- namespace=\"%s\"", namespace));
   14.67  
   14.68     if (strcmp(namespace, HOST_INSTRUMENTATION_NS) == 0) {
   14.69 -      _SBLIM_TRACE(1,("--- \"%s\" is not a valid namespace for System Virtualization Profile", namespace));
   14.70 -      CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_INVALID_NAMESPACE, "Invalid namespace specified for System Virtualization Profile");
   14.71 +      _SBLIM_TRACE(1,("--- \"%s\" is not a valid namespace for %s", namespace, _CLASSNAME));
   14.72 +      CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_INVALID_NAMESPACE, "Invalid namespace specified for Xen_ComputerSystem");
   14.73        goto exit;
   14.74     }
   14.75  
   14.76 @@ -704,6 +705,12 @@ static CMPIStatus InvokeMethod(
   14.77     _SBLIM_TRACE(2, ("--- methodname=\"%s\"", methodname));
   14.78     _SBLIM_TRACE(2, ("--- namespace=\"%s\"", namespace));
   14.79  
   14.80 +   if (strcmp(namespace, HOST_INSTRUMENTATION_NS) == 0) {
   14.81 +      _SBLIM_TRACE(1,("--- \"%s\" is not a valid namespace for %s", namespace, _CLASSNAME));
   14.82 +      CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_INVALID_NAMESPACE, "Invalid namespace specified for Xen_ComputerSystem");
   14.83 +      goto exit;
   14.84 +   }
   14.85 +
   14.86     /* Only support RequestStateChange() for now. */
   14.87     if (strcmp(methodname, "RequestStateChange")) {
   14.88        _SBLIM_TRACE(1,("--- Method \"%s\" is not supported", methodname));
    15.1 --- a/src/Xen_HostedMemoryPool.c	Tue Sep 26 15:08:04 2006 -0600
    15.2 +++ b/src/Xen_HostedMemoryPool.c	Thu Sep 28 17:07:14 2006 -0600
    15.3 @@ -15,6 +15,7 @@
    15.4  //    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
    15.5  // ============================================================================
    15.6  // Authors:       Dr. Gareth S. Bestor, <bestor@us.ibm.com>
    15.7 +//                Jim Fehlig, <jfehlig@novell.com>
    15.8  // Contributors:
    15.9  // Description:
   15.10  // ============================================================================
   15.11 @@ -52,11 +53,15 @@ static CMPIBroker *_BROKER;
   15.12  /* Name of the left and right hand side classes of this association. */
   15.13  static char * _ASSOCCLASS = "Xen_HostedMemoryPool";
   15.14  static char * _LHSCLASSNAME = "Xen_MemoryPool";
   15.15 -static char * _RHSCLASSNAME = "Linux_ComputerSystem";
   15.16 +static char * _RHSCLASSNAME = "CIM_ComputerSystem";
   15.17  static char * _LHSPROPERTYNAME = "PartComponent"; 
   15.18  static char * _RHSPROPERTYNAME = "GroupComponent";
   15.19  static char * _LHSKEYNAME = "SystemName";
   15.20  static char * _RHSKEYNAME = "Name";
   15.21 +static char * _LHSNAMESPACE = "root/cimv2";
   15.22 +static char * _RHSNAMESPACE = "smash";
   15.23 +
   15.24 +static char * _XEN_DOMU_CLASS = "Xen_ComputerSystem";
   15.25  
   15.26  // ----------------------------------------------------------------------------
   15.27  // AssociationCleanup()
   15.28 @@ -96,9 +101,7 @@ static CMPIStatus AssociatorNames(
   15.29     char *namespace = CMGetCharPtr(CMGetNameSpace(reference, NULL)); /* Target namespace. */
   15.30     char *sourceclass = CMGetCharPtr(CMGetClassName(reference, &status)); /* Class of the source reference object */
   15.31     char *targetclass; 				/* Class of the target object(s). */
   15.32 -
   15.33 -   char *sourcekeyname;
   15.34 -   char *targetkeyname;
   15.35 +   char *targetnamespace;
   15.36  
   15.37     _SBLIM_ENTER("AssociatorNames");
   15.38     _SBLIM_TRACE(2, ("--- self=\"%s\"", self->ft->miName));
   15.39 @@ -111,6 +114,12 @@ static CMPIStatus AssociatorNames(
   15.40     _SBLIM_TRACE(2, ("--- namespace=\"%s\"", namespace));
   15.41     _SBLIM_TRACE(2, ("--- sourceclass=\"%s\"", sourceclass));
   15.42  
   15.43 +   /* Ensure the source class is not a virtual computer system */
   15.44 +   if (strcmp(sourceclass, _XEN_DOMU_CLASS) == 0) {
   15.45 +      _SBLIM_TRACE(2, ("--- Ignoring source class %s.", _XEN_DOMU_CLASS));
   15.46 +      goto exit;
   15.47 +   }
   15.48 +
   15.49     /* Check that the requested association class, if any, is supported. */
   15.50     if (assocClass != NULL) {
   15.51        CMPIObjectPath * assoc = CMNewObjectPath(_BROKER, namespace, _ASSOCCLASS, NULL);
   15.52 @@ -126,27 +135,22 @@ static CMPIStatus AssociatorNames(
   15.53        goto exit;
   15.54     }
   15.55  
   15.56 -   /* Determine the target class from the source class. */
   15.57 -   if (strcmp(sourceclass, _LHSCLASSNAME) == 0) {
   15.58 -      sourcekeyname = _LHSKEYNAME;
   15.59 +   /* Determine the target class and namespace from the source class. */
   15.60 +   if (CMClassPathIsA(_BROKER, reference, _LHSCLASSNAME, NULL)) {
   15.61        targetclass = _RHSCLASSNAME;
   15.62 -      targetkeyname = _RHSKEYNAME;
   15.63 -   } else if (strcmp(sourceclass, _RHSCLASSNAME) == 0) {
   15.64 -      sourcekeyname = _RHSKEYNAME;
   15.65 +      targetnamespace = _RHSNAMESPACE;
   15.66 +   } else if (CMClassPathIsA(_BROKER, reference, _RHSCLASSNAME, NULL)) {
   15.67        targetclass = _LHSCLASSNAME;
   15.68 -      targetkeyname = _LHSKEYNAME;
   15.69 +      targetnamespace = _LHSNAMESPACE;
   15.70     } else {
   15.71        _SBLIM_TRACE(2, ("--- Unrecognized source class. Ignoring request."));
   15.72        goto exit;
   15.73 -   }
   15.74 +   } 
   15.75     _SBLIM_TRACE(2, ("--- targetclass=\"%s\"", targetclass));
   15.76 -
   15.77 -   CMPIData namedata = CMGetKey(reference, sourcekeyname, NULL);
   15.78 -   char * sourcename = CMGetCharPtr(namedata.value.string);
   15.79 -   _SBLIM_TRACE(2, ("--- sourcename=\"%s\"", sourcename));
   15.80 +   _SBLIM_TRACE(2, ("--- targetnamespace=\"%s\"", targetnamespace));
   15.81  
   15.82     /* Create an object path for the result class. */
   15.83 -   CMPIObjectPath * objectpath = CMNewObjectPath(_BROKER, namespace, targetclass, &status);
   15.84 +   CMPIObjectPath * objectpath = CMNewObjectPath(_BROKER, targetnamespace, targetclass, &status);
   15.85     if ((status.rc != CMPI_RC_OK) || CMIsNullObject(objectpath)) {
   15.86        _SBLIM_TRACE(1,("--- CMNewObjectPath() failed - %s", CMGetCharPtr(status.msg)));
   15.87        CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERROR, "Cannot create new CMPIObjectPath");
   15.88 @@ -165,14 +169,17 @@ static CMPIStatus AssociatorNames(
   15.89     while (CMHasNext(objectpaths, NULL)) {
   15.90        CMPIData data = CMGetNext(objectpaths, NULL);
   15.91        char *class = CMGetCharPtr(CMGetClassName(data.value.ref, NULL));
   15.92 -      if ((strcmp(class,targetclass) == 0) && ((resultClass == NULL) || (strcmp(class,resultClass) == 0))) {
   15.93 -         /* Only return entries whose name matches the reference. */
   15.94 -         namedata = CMGetKey(data.value.ref, targetkeyname, &status);
   15.95 -         char * resultname = CMGetCharPtr(namedata.value.string);
   15.96 -         if (strcmp(sourcename, resultname) == 0) CMReturnObjectPath(results, data.value.ref);
   15.97 +
   15.98 +      _SBLIM_TRACE(2, ("--- got objectpath=\"%s\"", CMGetCharPtr(CDToString(_BROKER, data.value.ref, NULL))));
   15.99 +
  15.100 +      /* Ignore possible instances of source class. */
  15.101 +      if (strcmp(class,sourceclass) &&
  15.102 +          (resultClass == NULL || CMClassPathIsA(_BROKER, data.value.ref, resultClass, NULL))) {
  15.103 +
  15.104 +         CMReturnObjectPath(results, data.value.ref);
  15.105        }
  15.106     }
  15.107 -
  15.108 +   
  15.109     CMReturnDone(results);
  15.110  
  15.111  exit:
  15.112 @@ -198,9 +205,7 @@ static CMPIStatus Associators(
  15.113     char *namespace = CMGetCharPtr(CMGetNameSpace(reference, NULL)); /* Target namespace. */
  15.114     char *sourceclass = CMGetCharPtr(CMGetClassName(reference, &status)); /* Class of the source reference object */
  15.115     char *targetclass;                           /* Class of the target object(s). */
  15.116 -
  15.117 -   char *sourcekeyname;
  15.118 -   char *targetkeyname;
  15.119 +   char *targetnamespace;
  15.120  
  15.121     _SBLIM_ENTER("Associators");
  15.122     _SBLIM_TRACE(2, ("--- self=\"%s\"", self->ft->miName));
  15.123 @@ -213,6 +218,12 @@ static CMPIStatus Associators(
  15.124     _SBLIM_TRACE(2, ("--- namespace=\"%s\"", namespace));
  15.125     _SBLIM_TRACE(2, ("--- sourceclass=\"%s\"", sourceclass));
  15.126  
  15.127 +   /* Ensure the source class is not a virtual computer system */
  15.128 +   if (strcmp(sourceclass, _XEN_DOMU_CLASS) == 0) {
  15.129 +      _SBLIM_TRACE(2, ("--- Ignoring source class %s.", _XEN_DOMU_CLASS));
  15.130 +      goto exit;
  15.131 +   }
  15.132 +
  15.133     /* Check that the requested association class, if any, is supported. */
  15.134     if (assocClass != NULL) {
  15.135        CMPIObjectPath * assoc = CMNewObjectPath(_BROKER, namespace, _ASSOCCLASS, NULL);
  15.136 @@ -230,26 +241,21 @@ static CMPIStatus Associators(
  15.137     CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_NOT_SUPPORTED, NULL);
  15.138  
  15.139     /* Determine the target class from the source class. */
  15.140 -   if (strcmp(sourceclass, _LHSCLASSNAME) == 0) {
  15.141 -      sourcekeyname = _LHSKEYNAME;
  15.142 +   if (CMClassPathIsA(_BROKER, reference, _LHSCLASSNAME, NULL)) {
  15.143        targetclass = _RHSCLASSNAME;
  15.144 -      targetkeyname = _RHSKEYNAME;
  15.145 -   } else if (strcmp(sourceclass, _RHSCLASSNAME) == 0) {
  15.146 -      sourcekeyname = _RHSKEYNAME;
  15.147 +      targetnamespace = _RHSNAMESPACE;
  15.148 +   } else if (CMClassPathIsA(_BROKER, reference, _RHSCLASSNAME, NULL)) {
  15.149        targetclass = _LHSCLASSNAME;
  15.150 -      targetkeyname = _LHSKEYNAME;
  15.151 +      targetnamespace = _LHSNAMESPACE;
  15.152     } else {
  15.153        _SBLIM_TRACE(2, ("--- Unrecognized source class. Ignoring request."));
  15.154        goto exit;
  15.155 -   }
  15.156 +   } 
  15.157     _SBLIM_TRACE(2, ("--- targetclass=\"%s\"", targetclass));
  15.158 -
  15.159 -   CMPIData namedata = CMGetKey(reference, sourcekeyname, NULL);
  15.160 -   char * sourcename = CMGetCharPtr(namedata.value.string);
  15.161 -   _SBLIM_TRACE(2, ("--- sourcename=\"%s\"", sourcename));
  15.162 +   _SBLIM_TRACE(2, ("--- targetnamespace=\"%s\"", targetnamespace));
  15.163  
  15.164     /* Create an object path for the result class. */
  15.165 -   CMPIObjectPath * objectpath = CMNewObjectPath(_BROKER, namespace, targetclass, &status);
  15.166 +   CMPIObjectPath * objectpath = CMNewObjectPath(_BROKER, targetnamespace, targetclass, &status);
  15.167     if ((status.rc != CMPI_RC_OK) || CMIsNullObject(objectpath)) {
  15.168        _SBLIM_TRACE(1,("--- CMNewObjectPath() failed - %s", CMGetCharPtr(status.msg)));
  15.169        CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERROR, "Cannot create new CMPIObjectPath");
  15.170 @@ -264,17 +270,20 @@ static CMPIStatus Associators(
  15.171        goto exit;
  15.172     }
  15.173  
  15.174 +
  15.175     /* Return all instances that exactly match the target class and resultClass, if specified. */
  15.176     while (CMHasNext(instances, NULL)) {
  15.177        CMPIData data = CMGetNext(instances, NULL);
  15.178 -      char *class = CMGetCharPtr(CMGetClassName(CMGetObjectPath(data.value.inst,NULL), NULL));
  15.179 -      if ((strcmp(class,targetclass) == 0) && ((resultClass == NULL) || (strcmp(class,resultClass) == 0))) {
  15.180 -         /* Only return entries whose name matches the reference. */
  15.181 -         namedata = CMGetProperty(data.value.inst, targetkeyname, NULL);
  15.182 -         char * resultname = CMGetCharPtr(namedata.value.string);
  15.183 -// BUG - returning data causes crash !?!
  15.184 -_SBLIM_TRACE(2, ("--- data.value.inst=\"%s\"", CMGetCharPtr(CDToString(_BROKER, data.value.inst, NULL))));
  15.185 -//         if (strcmp(sourcename, resultname) == 0) CMReturnInstance(results, data.value.inst);
  15.186 +      CMPIObjectPath *op = CMGetObjectPath(data.value.inst,NULL);
  15.187 +      char *class = CMGetCharPtr(CMGetClassName(op, NULL));
  15.188 +
  15.189 +      //CMSetNameSpace(op, targetnamespace);
  15.190 +      _SBLIM_TRACE(2, ("--- got objectpath=\"%s\"", CMGetCharPtr(CDToString(_BROKER, op, NULL))));
  15.191 +
  15.192 +      /* Ignore possible instances of source class. */
  15.193 +      if (strcmp(class,sourceclass) &&
  15.194 +          (resultClass == NULL || CMClassPathIsA(_BROKER, op, resultClass, NULL))) {
  15.195 +         CMReturnInstance(results, data.value.inst);
  15.196        }
  15.197     }
  15.198  
  15.199 @@ -300,9 +309,7 @@ static CMPIStatus ReferenceNames(
  15.200     char *namespace = CMGetCharPtr(CMGetNameSpace(reference, NULL)); /* Target namespace. */
  15.201     char *sourceclass = CMGetCharPtr(CMGetClassName(reference, &status)); /* Class of the source reference object */
  15.202     char *targetclass;                           /* Class of the target object(s). */
  15.203 -
  15.204 -   char *sourcekeyname;
  15.205 -   char *targetkeyname;
  15.206 +   char *targetnamespace;
  15.207  
  15.208     _SBLIM_ENTER("ReferenceNames");
  15.209     _SBLIM_TRACE(2, ("--- self=\"%s\"", self->ft->miName));
  15.210 @@ -313,6 +320,12 @@ static CMPIStatus ReferenceNames(
  15.211     _SBLIM_TRACE(2, ("--- namespace=\"%s\"", namespace));
  15.212     _SBLIM_TRACE(2, ("--- sourceclass=\"%s\"", sourceclass));
  15.213  
  15.214 +   /* Ensure the source class is not a virtual computer system */
  15.215 +   if (strcmp(sourceclass, _XEN_DOMU_CLASS) == 0) {
  15.216 +      _SBLIM_TRACE(2, ("--- Ignoring source class %s.", _XEN_DOMU_CLASS));
  15.217 +      goto exit;
  15.218 +   }
  15.219 +
  15.220     /* Check that the requested association class, if any, is supported. */
  15.221     if (assocClass != NULL) {
  15.222        CMPIObjectPath * assoc = CMNewObjectPath(_BROKER, namespace, _ASSOCCLASS, NULL);
  15.223 @@ -329,26 +342,23 @@ static CMPIStatus ReferenceNames(
  15.224     }
  15.225  
  15.226     /* Determine the target class from the source class. */
  15.227 -   if (strcmp(sourceclass, _LHSCLASSNAME) == 0) {
  15.228 -      sourcekeyname = _LHSKEYNAME;
  15.229 +   if (CMClassPathIsA(_BROKER, reference, _LHSCLASSNAME, NULL)) {
  15.230        targetclass = _RHSCLASSNAME;
  15.231 -      targetkeyname = _RHSKEYNAME;
  15.232 -   } else if (strcmp(sourceclass, _RHSCLASSNAME) == 0) {
  15.233 -      sourcekeyname = _RHSKEYNAME;
  15.234 +      targetnamespace = _RHSNAMESPACE;
  15.235 +      /* Refences of LHS class should always be in LHS namespace. */
  15.236 +      CMSetNameSpace(reference, _LHSNAMESPACE);
  15.237 +   } else if (CMClassPathIsA(_BROKER, reference, _RHSCLASSNAME, NULL)) {
  15.238        targetclass = _LHSCLASSNAME;
  15.239 -      targetkeyname = _LHSKEYNAME;
  15.240 +      targetnamespace = _LHSNAMESPACE;
  15.241     } else {
  15.242        _SBLIM_TRACE(2, ("--- Unrecognized source class. Ignoring request."));
  15.243        goto exit;
  15.244 -   }
  15.245 +   } 
  15.246     _SBLIM_TRACE(2, ("--- targetclass=\"%s\"", targetclass));
  15.247 -
  15.248 -   CMPIData namedata = CMGetKey(reference, sourcekeyname, NULL);
  15.249 -   char * sourcename = CMGetCharPtr(namedata.value.string);
  15.250 -   _SBLIM_TRACE(2, ("--- sourcename=\"%s\"", sourcename));
  15.251 +   _SBLIM_TRACE(2, ("--- targetnamespace=\"%s\"", targetnamespace));
  15.252  
  15.253     /* Create an object path for the result class. */
  15.254 -   CMPIObjectPath * objectpath = CMNewObjectPath(_BROKER, namespace, targetclass, &status);
  15.255 +   CMPIObjectPath * objectpath = CMNewObjectPath(_BROKER, targetnamespace, targetclass, &status);
  15.256     if ((status.rc != CMPI_RC_OK) || CMIsNullObject(objectpath)) {
  15.257        _SBLIM_TRACE(1,("--- CMNewObjectPath() failed - %s", CMGetCharPtr(status.msg)));
  15.258        CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERROR, "Cannot create new CMPIObjectPath");
  15.259 @@ -366,11 +376,13 @@ static CMPIStatus ReferenceNames(
  15.260     /* Return all object paths that exactly match the target class and resultClass, if specified. */
  15.261     while (CMHasNext(objectpaths, NULL)) {
  15.262        CMPIData data = CMGetNext(objectpaths, NULL);
  15.263 -      char *class = CMGetCharPtr(CMGetClassName(data.value.ref, NULL));
  15.264 -      if (strcmp(class,targetclass) == 0) {
  15.265  
  15.266 -         /* Create an object path for the association. */
  15.267 -         CMPIObjectPath * refobjectpath = CMNewObjectPath(_BROKER, namespace, _ASSOCCLASS, &status);
  15.268 +      if((CMClassPathIsA(_BROKER, data.value.ref, targetclass, NULL)) &&
  15.269 +         (!CMClassPathIsA(_BROKER, data.value.ref, sourceclass, NULL))) {
  15.270 +         /* Create an object path for the association. Note that the association
  15.271 +          * objects should exist in 'virt namespace' not the host namespace.
  15.272 +          */
  15.273 +         CMPIObjectPath * refobjectpath = CMNewObjectPath(_BROKER, _LHSNAMESPACE, _ASSOCCLASS, &status);
  15.274           if ((status.rc != CMPI_RC_OK) || CMIsNullObject(refobjectpath)) {
  15.275              _SBLIM_TRACE(1,("--- CMNewObjectPath() failed - %s", CMGetCharPtr(status.msg)));
  15.276              CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERROR, "Cannot create new CMPIObjectPath");
  15.277 @@ -386,14 +398,12 @@ static CMPIStatus ReferenceNames(
  15.278              CMAddKey(refobjectpath, _LHSPROPERTYNAME, &reference, CMPI_ref);
  15.279           }
  15.280  
  15.281 -         /* Only return entries whose name matches the reference. */
  15.282 -         namedata = CMGetKey(data.value.ref, targetkeyname, &status);
  15.283 -         char * resultname = CMGetCharPtr(namedata.value.string);
  15.284 -         if (strcmp(sourcename, resultname) == 0) CMReturnObjectPath(results, refobjectpath);
  15.285 +         CMReturnObjectPath(results, refobjectpath);
  15.286        }
  15.287     }
  15.288  
  15.289 -exit:
  15.290 +
  15.291 + exit:
  15.292     _SBLIM_RETURNSTATUS(status);
  15.293  }
  15.294  
  15.295 @@ -414,9 +424,7 @@ static CMPIStatus References(
  15.296     char *namespace = CMGetCharPtr(CMGetNameSpace(reference, NULL)); /* Target namespace. */
  15.297     char *sourceclass = CMGetCharPtr(CMGetClassName(reference, &status)); /* Class of the source reference object */
  15.298     char *targetclass;                           /* Class of the target object(s). */
  15.299 -
  15.300 -   char *sourcekeyname;
  15.301 -   char *targetkeyname;
  15.302 +   char *targetnamespace;
  15.303  
  15.304     _SBLIM_ENTER("References");
  15.305     _SBLIM_TRACE(2, ("--- self=\"%s\"", self->ft->miName));
  15.306 @@ -427,6 +435,12 @@ static CMPIStatus References(
  15.307     _SBLIM_TRACE(2, ("--- namespace=\"%s\"", namespace));
  15.308     _SBLIM_TRACE(2, ("--- sourceclass=\"%s\"", sourceclass));
  15.309  
  15.310 +   /* Ensure the source class is not a virtual computer system */
  15.311 +   if (strcmp(sourceclass, _XEN_DOMU_CLASS) == 0) {
  15.312 +      _SBLIM_TRACE(2, ("--- Ignoring source class %s.", _XEN_DOMU_CLASS));
  15.313 +      goto exit;
  15.314 +   }
  15.315 +
  15.316     /* Check that the requested association class, if any, is supported. */
  15.317     if (assocClass != NULL) {
  15.318        CMPIObjectPath * assoc = CMNewObjectPath(_BROKER, namespace, _ASSOCCLASS, NULL);
  15.319 @@ -443,26 +457,23 @@ static CMPIStatus References(
  15.320     }
  15.321  
  15.322     /* Determine the target class from the source class. */
  15.323 -   if (strcmp(sourceclass, _LHSCLASSNAME) == 0) {
  15.324 -      sourcekeyname = _LHSKEYNAME;
  15.325 +   if (CMClassPathIsA(_BROKER, reference, _LHSCLASSNAME, NULL)) {
  15.326        targetclass = _RHSCLASSNAME;
  15.327 -      targetkeyname = _RHSKEYNAME;
  15.328 -   } else if (strcmp(sourceclass, _RHSCLASSNAME) == 0) {
  15.329 -      sourcekeyname = _RHSKEYNAME;
  15.330 +      targetnamespace = _RHSNAMESPACE;
  15.331 +      /* Refences of LHS class should always be in LHS namespace. */
  15.332 +      CMSetNameSpace(reference, _LHSNAMESPACE);
  15.333 +   } else if (CMClassPathIsA(_BROKER, reference, _RHSCLASSNAME, NULL)) {
  15.334        targetclass = _LHSCLASSNAME;
  15.335 -      targetkeyname = _LHSKEYNAME;
  15.336 +      targetnamespace = _LHSNAMESPACE;
  15.337     } else {
  15.338        _SBLIM_TRACE(2, ("--- Unrecognized source class. Ignoring request."));
  15.339        goto exit;
  15.340 -   }
  15.341 +   } 
  15.342     _SBLIM_TRACE(2, ("--- targetclass=\"%s\"", targetclass));
  15.343 -
  15.344 -   CMPIData namedata = CMGetKey(reference, sourcekeyname, NULL);
  15.345 -   char * sourcename = CMGetCharPtr(namedata.value.string);
  15.346 -   _SBLIM_TRACE(2, ("--- sourcename=\"%s\"", sourcename));
  15.347 +   _SBLIM_TRACE(2, ("--- targetnamespace=\"%s\"", targetnamespace));
  15.348  
  15.349     /* Create an object path for the result class. */
  15.350 -   CMPIObjectPath * objectpath = CMNewObjectPath(_BROKER, namespace, targetclass, &status);
  15.351 +   CMPIObjectPath * objectpath = CMNewObjectPath(_BROKER, targetnamespace, targetclass, &status);
  15.352     if ((status.rc != CMPI_RC_OK) || CMIsNullObject(objectpath)) {
  15.353        _SBLIM_TRACE(1,("--- CMNewObjectPath() failed - %s", CMGetCharPtr(status.msg)));
  15.354        CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERROR, "Cannot create new CMPIObjectPath");
  15.355 @@ -480,11 +491,13 @@ static CMPIStatus References(
  15.356     /* Return all object paths that exactly match the target class and resultClass, if specified. */
  15.357     while (CMHasNext(objectpaths, NULL)) {
  15.358        CMPIData data = CMGetNext(objectpaths, NULL);
  15.359 -      char *class = CMGetCharPtr(CMGetClassName(data.value.ref, NULL));
  15.360 -      if (strcmp(class,targetclass) == 0) {
  15.361  
  15.362 -         /* Create an instance for the association. */
  15.363 -         CMPIInstance * refinstance = _CMNewInstance(_BROKER, namespace, _ASSOCCLASS, &status);
  15.364 +      if((CMClassPathIsA(_BROKER, data.value.ref, targetclass, NULL)) &&
  15.365 +         (!CMClassPathIsA(_BROKER, data.value.ref, sourceclass, NULL))) {
  15.366 +         /* Create an instance for the association. Note that the association
  15.367 +          * objects should exist in 'virt namespace' not the host namespace.
  15.368 +          */
  15.369 +         CMPIInstance * refinstance = _CMNewInstance(_BROKER, _LHSNAMESPACE, _ASSOCCLASS, &status);
  15.370           if ((status.rc != CMPI_RC_OK) || CMIsNullObject(refinstance)) {
  15.371              _SBLIM_TRACE(1,("--- CMNewInstance() failed - %s", CMGetCharPtr(status.msg)));
  15.372              CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERROR, "Cannot create new CMPIInstance");
  15.373 @@ -499,13 +512,11 @@ static CMPIStatus References(
  15.374              CMSetProperty(refinstance, _RHSPROPERTYNAME, &data.value.ref, CMPI_ref);
  15.375              CMSetProperty(refinstance, _LHSPROPERTYNAME, &reference, CMPI_ref);
  15.376           }
  15.377 -
  15.378 -         /* Only return entries whose name matches the reference. */
  15.379 -         namedata = CMGetKey(data.value.ref, targetkeyname, &status);
  15.380 -         char * resultname = CMGetCharPtr(namedata.value.string);
  15.381 -         if (strcmp(sourcename, resultname) == 0) CMReturnInstance(results, refinstance);
  15.382 +         
  15.383 +         CMReturnInstance(results, refinstance);
  15.384        }
  15.385     }
  15.386 +
  15.387  exit:
  15.388     _SBLIM_RETURNSTATUS(status);
  15.389  }
    16.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    16.2 +++ b/src/Xen_MemoryAllocatedFromPool.c	Thu Sep 28 17:07:14 2006 -0600
    16.3 @@ -0,0 +1,483 @@
    16.4 +// Copyright (C) 2006 Novell, Inc.
    16.5 +//
    16.6 +//    This library is free software; you can redistribute it and/or
    16.7 +//    modify it under the terms of the GNU Lesser General Public
    16.8 +//    License as published by the Free Software Foundation; either
    16.9 +//    version 2.1 of the License, or (at your option) any later version.
   16.10 +//
   16.11 +//    This library is distributed in the hope that it will be useful,
   16.12 +//    but WITHOUT ANY WARRANTY; without even the implied warranty of
   16.13 +//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   16.14 +//    Lesser General Public License for more details.
   16.15 +//
   16.16 +//    You should have received a copy of the GNU Lesser General Public
   16.17 +//    License along with this library; if not, write to the Free Software
   16.18 +//    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
   16.19 +// ============================================================================
   16.20 +// Authors:       Jim Fehlig, <jfehlig@novell.com>
   16.21 +// Contributors:
   16.22 +// Description:
   16.23 +// ============================================================================
   16.24 +
   16.25 +#include <string.h>
   16.26 +
   16.27 +/* Include the required CMPI data types, function headers, and macros */
   16.28 +#include "cmpidt.h"
   16.29 +#include "cmpift.h"
   16.30 +#include "cmpimacs.h"
   16.31 +
   16.32 +
   16.33 +// ----------------------------------------------------------------------------
   16.34 +// COMMON GLOBAL VARIABLES
   16.35 +// ----------------------------------------------------------------------------
   16.36 +
   16.37 +/* Handle to the CIM broker. Initialized when the provider lib is loaded. */
   16.38 +static CMPIBroker *_BROKER;
   16.39 +
   16.40 +/* Include utility functions */
   16.41 +#include "cmpiutil.h"
   16.42 +
   16.43 +/* Include _SBLIM_TRACE() logging support */
   16.44 +#include "cmpitrace.h"
   16.45 +
   16.46 +
   16.47 +// ============================================================================
   16.48 +// CMPI ASSOCIATION PROVIDER FUNCTION TABLE
   16.49 +// ============================================================================
   16.50 +
   16.51 +// ----------------------------------------------------------------------------
   16.52 +// Info for the class supported by the association provider
   16.53 +// ----------------------------------------------------------------------------
   16.54 +                                                                                                                                 
   16.55 +/* Name of the left and right hand side classes of this association. */
   16.56 +static char * _ASSOCCLASS = "Xen_MemoryAllocatedFromPool";
   16.57 +static char * _LHSCLASSNAME = "Xen_MemoryPool";
   16.58 +static char * _RHSCLASSNAME = "Xen_Memory";
   16.59 +static char * _LHSPROPERTYNAME = "Antecedent"; 
   16.60 +static char * _RHSPROPERTYNAME = "Dependent";
   16.61 +
   16.62 +
   16.63 +// ----------------------------------------------------------------------------
   16.64 +// AssociationCleanup()
   16.65 +// Perform any necessary cleanup immediately before this provider is unloaded.
   16.66 +// ----------------------------------------------------------------------------
   16.67 +static CMPIStatus AssociationCleanup(
   16.68 +		CMPIAssociationMI * self,	/* [in] Handle to this provider (i.e. 'self'). */
   16.69 +		CMPIContext * context)		/* [in] Additional context info, if any. */
   16.70 +{
   16.71 +   CMPIStatus status = { CMPI_RC_OK, NULL };	/* Return status of CIM operations. */
   16.72 +
   16.73 +   _SBLIM_ENTER("AssociationCleanup");
   16.74 +   _SBLIM_TRACE(2, ("--- self=\"%s\"", self->ft->miName));
   16.75 +   _SBLIM_TRACE(2, ("--- context=\"%s\"", CMGetCharPtr(CDToString(_BROKER, context, NULL))));
   16.76 +
   16.77 +   /* Nothing needs to be done for cleanup. */
   16.78 +
   16.79 +exit:
   16.80 +   _SBLIM_RETURNSTATUS(status);
   16.81 +}
   16.82 +
   16.83 +
   16.84 +// ----------------------------------------------------------------------------
   16.85 +// AssociatorNames()
   16.86 +// ----------------------------------------------------------------------------
   16.87 +static CMPIStatus AssociatorNames(
   16.88 +		CMPIAssociationMI * self,	/* [in] Handle to this provider (i.e. 'self'). */
   16.89 +		CMPIContext * context,		/* [in] Additional context info, if any. */
   16.90 +		CMPIResult * results,		/* [out] Results of this operation. */
   16.91 +		CMPIObjectPath * reference,	/* [in] Contains source namespace, classname and object path. */
   16.92 +		const char * assocClass,
   16.93 +		const char * resultClass,
   16.94 +		const char * role,
   16.95 +		const char * resultRole)
   16.96 +{
   16.97 +   CMPIStatus status = { CMPI_RC_OK, NULL };    /* Return status of CIM operations. */
   16.98 +   char *namespace = CMGetCharPtr(CMGetNameSpace(reference, NULL)); /* Target namespace. */
   16.99 +   char *sourceclass = CMGetCharPtr(CMGetClassName(reference, &status)); /* Class of the source reference object */
  16.100 +   char *targetclass; 				/* Class of the target object(s). */
  16.101 +
  16.102 +   _SBLIM_ENTER("AssociatorNames");
  16.103 +   _SBLIM_TRACE(2, ("--- self=\"%s\"", self->ft->miName));
  16.104 +   _SBLIM_TRACE(2, ("--- context=\"%s\"", CMGetCharPtr(CDToString(_BROKER, context, NULL))));
  16.105 +   _SBLIM_TRACE(2, ("--- reference=\"%s\"", CMGetCharPtr(CDToString(_BROKER, reference, NULL))));
  16.106 +   _SBLIM_TRACE(2, ("--- assocClass=\"%s\"", assocClass));
  16.107 +   _SBLIM_TRACE(2, ("--- resultClass=\"%s\"", resultClass));
  16.108 +   _SBLIM_TRACE(2, ("--- role=\"%s\"", role));
  16.109 +   _SBLIM_TRACE(2, ("--- resultRole=\"%s\"", resultRole));
  16.110 +   _SBLIM_TRACE(2, ("--- namespace=\"%s\"", namespace));
  16.111 +   _SBLIM_TRACE(2, ("--- sourceclass=\"%s\"", sourceclass));
  16.112 +
  16.113 +   /* Check that the requested association class, if any, is supported. */
  16.114 +   if (assocClass != NULL) {
  16.115 +      CMPIObjectPath * assoc = CMNewObjectPath(_BROKER, namespace, _ASSOCCLASS, NULL);
  16.116 +      if (!CMClassPathIsA(_BROKER, assoc, assocClass, NULL)) {
  16.117 +         _SBLIM_TRACE(2, ("--- Unrecognized association class. Ignoring request."));
  16.118 +         goto exit;
  16.119 +      }
  16.120 +   }
  16.121 +
  16.122 +   /* Check that the reference matches the required role, if any. */
  16.123 +   if ((role != NULL) && strcmp(role, sourceclass) != 0) {
  16.124 +      _SBLIM_TRACE(2, ("--- Reference does not match required role. Ignoring request."));
  16.125 +      goto exit;
  16.126 +   }
  16.127 +
  16.128 +   /* Determine the target class from the source class. */
  16.129 +   if (strcmp(sourceclass, _LHSCLASSNAME) == 0) {
  16.130 +      targetclass = _RHSCLASSNAME;
  16.131 +   } else if (strcmp(sourceclass, _RHSCLASSNAME) == 0) {
  16.132 +      targetclass = _LHSCLASSNAME;
  16.133 +   } else {
  16.134 +      _SBLIM_TRACE(2, ("--- Unrecognized source class. Ignoring request."));
  16.135 +      goto exit;
  16.136 +   }
  16.137 +   _SBLIM_TRACE(2, ("--- targetclass=\"%s\"", targetclass));
  16.138 +
  16.139 +   /* Create an object path for the result class. */
  16.140 +   CMPIObjectPath * objectpath = CMNewObjectPath(_BROKER, namespace, targetclass, &status);
  16.141 +   if ((status.rc != CMPI_RC_OK) || CMIsNullObject(objectpath)) {
  16.142 +      _SBLIM_TRACE(1,("--- CMNewObjectPath() failed - %s", CMGetCharPtr(status.msg)));
  16.143 +      CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERROR, "Cannot create new CMPIObjectPath");
  16.144 +      goto exit;
  16.145 +   }
  16.146 +
  16.147 +   /* Get the list of all target class object paths from the CIMOM. */
  16.148 +   CMPIEnumeration * objectpaths = CBEnumInstanceNames(_BROKER, context, objectpath, &status);
  16.149 +   if ((status.rc != CMPI_RC_OK) || CMIsNullObject(objectpaths)) {
  16.150 +      _SBLIM_TRACE(1,("--- CBEnumInstanceNames() failed - %s", CMGetCharPtr(status.msg)));
  16.151 +      CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERROR, "Cannot enumerate target class");
  16.152 +      goto exit;
  16.153 +   }
  16.154 +
  16.155 +   /* Return all object paths that exactly match the target class and resultClass, if specified. */
  16.156 +   while (CMHasNext(objectpaths, NULL)) {
  16.157 +      CMPIData data = CMGetNext(objectpaths, NULL);
  16.158 +      _SBLIM_TRACE(2, ("--- got objectpath=\"%s\"", CMGetCharPtr(CDToString(_BROKER, data.value.ref, NULL))));
  16.159 +
  16.160 +      if (CMClassPathIsA(_BROKER, data.value.ref, targetclass, NULL) &&
  16.161 +          (resultClass == NULL || CMClassPathIsA(_BROKER, data.value.ref, resultClass, NULL))) {
  16.162 +         CMReturnObjectPath(results, data.value.ref);
  16.163 +      }
  16.164 +   }
  16.165 +
  16.166 +   CMReturnDone(results);
  16.167 +
  16.168 +exit:
  16.169 +   _SBLIM_RETURNSTATUS(status);
  16.170 +}
  16.171 +
  16.172 +
  16.173 +// ----------------------------------------------------------------------------
  16.174 +// Associators()
  16.175 +// ----------------------------------------------------------------------------
  16.176 +static CMPIStatus Associators(
  16.177 +		CMPIAssociationMI * self,	/* [in] Handle to this provider (i.e. 'self'). */
  16.178 +		CMPIContext * context,		/* [in] Additional context info, if any. */
  16.179 +		CMPIResult * results,		/* [out] Results of this operation. */
  16.180 +		CMPIObjectPath * reference,	/* [in] Contains the source namespace, classname and object path. */
  16.181 +		const char *assocClass,
  16.182 +		const char *resultClass,
  16.183 +		const char *role,
  16.184 +		const char *resultRole,
  16.185 +		char ** properties)		/* [in] List of desired properties (NULL=all). */
  16.186 +{
  16.187 +   CMPIStatus status = { CMPI_RC_OK, NULL };    /* Return status of CIM operations. */
  16.188 +   char *namespace = CMGetCharPtr(CMGetNameSpace(reference, NULL)); /* Target namespace. */
  16.189 +   char *sourceclass = CMGetCharPtr(CMGetClassName(reference, &status)); /* Class of the source reference object */
  16.190 +   char *targetclass;                           /* Class of the target object(s). */
  16.191 +
  16.192 +   _SBLIM_ENTER("Associators");
  16.193 +   _SBLIM_TRACE(2, ("--- self=\"%s\"", self->ft->miName));
  16.194 +   _SBLIM_TRACE(2, ("--- context=\"%s\"", CMGetCharPtr(CDToString(_BROKER, context, NULL))));
  16.195 +   _SBLIM_TRACE(2, ("--- reference=\"%s\"", CMGetCharPtr(CDToString(_BROKER, reference, NULL))));
  16.196 +   _SBLIM_TRACE(2, ("--- assocClass=\"%s\"", assocClass));
  16.197 +   _SBLIM_TRACE(2, ("--- resultClass=\"%s\"", resultClass));
  16.198 +   _SBLIM_TRACE(2, ("--- role=\"%s\"", role));
  16.199 +   _SBLIM_TRACE(2, ("--- resultRole=\"%s\"", resultRole));
  16.200 +   _SBLIM_TRACE(2, ("--- namespace=\"%s\"", namespace));
  16.201 +   _SBLIM_TRACE(2, ("--- sourceclass=\"%s\"", sourceclass));
  16.202 +
  16.203 +   /* Check that the requested association class, if any, is supported. */
  16.204 +   if (assocClass != NULL) {
  16.205 +      CMPIObjectPath * assoc = CMNewObjectPath(_BROKER, namespace, _ASSOCCLASS, NULL);
  16.206 +      if (!CMClassPathIsA(_BROKER, assoc, assocClass, NULL)) {
  16.207 +         _SBLIM_TRACE(2, ("--- Unrecognized association class. Ignoring request."));
  16.208 +         goto exit;
  16.209 +      }
  16.210 +   }
  16.211 +
  16.212 +   /* Check that the reference matches the required role, if any. */
  16.213 +   if ((role != NULL) && strcmp(role, sourceclass) != 0) {
  16.214 +      _SBLIM_TRACE(2, ("--- Reference does not match required role. Ignoring request."));
  16.215 +      goto exit;
  16.216 +   }
  16.217 +   CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_NOT_SUPPORTED, NULL);
  16.218 +
  16.219 +   /* Determine the target class from the source class. */
  16.220 +   if (strcmp(sourceclass, _LHSCLASSNAME) == 0) {
  16.221 +      targetclass = _RHSCLASSNAME;
  16.222 +   } else if (strcmp(sourceclass, _RHSCLASSNAME) == 0) {
  16.223 +      targetclass = _LHSCLASSNAME;
  16.224 +   } else {
  16.225 +      _SBLIM_TRACE(2, ("--- Unrecognized source class. Ignoring request."));
  16.226 +      goto exit;
  16.227 +   }
  16.228 +   _SBLIM_TRACE(2, ("--- targetclass=\"%s\"", targetclass));
  16.229 +
  16.230 +   /* Create an object path for the result class. */
  16.231 +   CMPIObjectPath * objectpath = CMNewObjectPath(_BROKER, namespace, targetclass, &status);
  16.232 +   if ((status.rc != CMPI_RC_OK) || CMIsNullObject(objectpath)) {
  16.233 +      _SBLIM_TRACE(1,("--- CMNewObjectPath() failed - %s", CMGetCharPtr(status.msg)));
  16.234 +      CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERROR, "Cannot create new CMPIObjectPath");
  16.235 +      goto exit;
  16.236 +   }
  16.237 +
  16.238 +   /* Get the list of all target class instances from the CIMOM. */
  16.239 +   CMPIEnumeration * instances = CBEnumInstances(_BROKER, context, objectpath, NULL, &status);
  16.240 +   if ((status.rc != CMPI_RC_OK) || CMIsNullObject(instances)) {
  16.241 +      _SBLIM_TRACE(1,("--- CBEnumInstances() failed - %s", CMGetCharPtr(status.msg)));
  16.242 +      CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERROR, "Cannot enumerate target class");
  16.243 +      goto exit;
  16.244 +   }
  16.245 +
  16.246 +   /* Return all instances that exactly match the target class and resultClass, if specified. */
  16.247 +   while (CMHasNext(instances, NULL)) {
  16.248 +      CMPIData data = CMGetNext(instances, NULL);
  16.249 +      CMPIObjectPath *op = CMGetObjectPath(data.value.inst,NULL);
  16.250 +      CMSetNameSpace(op, namespace);
  16.251 +      _SBLIM_TRACE(2, ("--- got objectpath=\"%s\"", CMGetCharPtr(CDToString(_BROKER, op, NULL))));
  16.252 +
  16.253 +      if (CMClassPathIsA(_BROKER, op, targetclass, NULL) &&
  16.254 +          (resultClass == NULL || CMClassPathIsA(_BROKER, op, resultClass, NULL))) {
  16.255 +         CMReturnInstance(results, data.value.inst);
  16.256 +      }
  16.257 +   }
  16.258 +   
  16.259 +   CMReturnDone(results);
  16.260 +
  16.261 +exit:
  16.262 +   _SBLIM_RETURNSTATUS(status);
  16.263 +}
  16.264 +
  16.265 +
  16.266 +// ----------------------------------------------------------------------------
  16.267 +// ReferenceNames()
  16.268 +// ----------------------------------------------------------------------------
  16.269 +static CMPIStatus ReferenceNames(
  16.270 +		CMPIAssociationMI * self,	/* [in] Handle to this provider (i.e. 'self'). */
  16.271 +		CMPIContext * context,		/* [in] Additional context info, if any. */
  16.272 +		CMPIResult * results,		/* [out] Results of this operation. */
  16.273 +		CMPIObjectPath * reference,	/* [in] Contains the source namespace, classname and object path. */
  16.274 +		const char *assocClass, 
  16.275 +		const char *role)
  16.276 +{
  16.277 +   CMPIStatus status = { CMPI_RC_OK, NULL };    /* Return status of CIM operations. */
  16.278 +   char *namespace = CMGetCharPtr(CMGetNameSpace(reference, NULL)); /* Target namespace. */
  16.279 +   char *sourceclass = CMGetCharPtr(CMGetClassName(reference, &status)); /* Class of the source reference object */
  16.280 +   char *targetclass;                           /* Class of the target object(s). */
  16.281 +
  16.282 +   _SBLIM_ENTER("ReferenceNames");
  16.283 +   _SBLIM_TRACE(2, ("--- self=\"%s\"", self->ft->miName));
  16.284 +   _SBLIM_TRACE(2, ("--- context=\"%s\"", CMGetCharPtr(CDToString(_BROKER, context, NULL))));
  16.285 +   _SBLIM_TRACE(2, ("--- reference=\"%s\"", CMGetCharPtr(CDToString(_BROKER, reference, NULL))));
  16.286 +   _SBLIM_TRACE(2, ("--- assocClass=\"%s\"", assocClass));
  16.287 +   _SBLIM_TRACE(2, ("--- role=\"%s\"", role));
  16.288 +   _SBLIM_TRACE(2, ("--- namespace=\"%s\"", namespace));
  16.289 +   _SBLIM_TRACE(2, ("--- sourceclass=\"%s\"", sourceclass));
  16.290 +
  16.291 +   /* Check that the requested association class, if any, is supported. */
  16.292 +   if (assocClass != NULL) {
  16.293 +      CMPIObjectPath * assoc = CMNewObjectPath(_BROKER, namespace, _ASSOCCLASS, NULL);
  16.294 +      if (!CMClassPathIsA(_BROKER, assoc, assocClass, NULL)) {
  16.295 +         _SBLIM_TRACE(2, ("--- Unrecognized association class. Ignoring request."));
  16.296 +         goto exit;
  16.297 +      }
  16.298 +   }
  16.299 +
  16.300 +   /* Check that the reference matches the required role, if any. */
  16.301 +   if ((role != NULL) && strcmp(role, sourceclass) != 0) {
  16.302 +      _SBLIM_TRACE(2, ("--- Reference does not match required role. Ignoring request."));
  16.303 +      goto exit;
  16.304 +   }
  16.305 +
  16.306 +   /* Determine the target class from the source class. */
  16.307 +   if (strcmp(sourceclass, _LHSCLASSNAME) == 0) {
  16.308 +      targetclass = _RHSCLASSNAME;
  16.309 +   } else if (strcmp(sourceclass, _RHSCLASSNAME) == 0) {
  16.310 +      targetclass = _LHSCLASSNAME;
  16.311 +   } else {
  16.312 +      _SBLIM_TRACE(2, ("--- Unrecognized source class. Ignoring request."));
  16.313 +      goto exit;
  16.314 +   }
  16.315 +   _SBLIM_TRACE(2, ("--- targetclass=\"%s\"", targetclass));
  16.316 +
  16.317 +   /* Create an object path for the result class. */
  16.318 +   CMPIObjectPath * objectpath = CMNewObjectPath(_BROKER, namespace, targetclass, &status);
  16.319 +   if ((status.rc != CMPI_RC_OK) || CMIsNullObject(objectpath)) {
  16.320 +      _SBLIM_TRACE(1,("--- CMNewObjectPath() failed - %s", CMGetCharPtr(status.msg)));
  16.321 +      CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERROR, "Cannot create new CMPIObjectPath");
  16.322 +      goto exit;
  16.323 +   }
  16.324 +
  16.325 +   /* Get the list of all target class object paths from the CIMOM. */
  16.326 +   CMPIEnumeration * objectpaths = CBEnumInstanceNames(_BROKER, context, objectpath, &status);
  16.327 +   if ((status.rc != CMPI_RC_OK) || CMIsNullObject(objectpaths)) {
  16.328 +      _SBLIM_TRACE(1,("--- CBEnumInstanceNames() failed - %s", CMGetCharPtr(status.msg)));
  16.329 +      CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERROR, "Cannot enumerate target class");
  16.330 +      goto exit;
  16.331 +   }
  16.332 +
  16.333 +   /* Return all object paths that exactly match the target class and resultClass, if specified. */
  16.334 +   while (CMHasNext(objectpaths, NULL)) {
  16.335 +      CMPIData data = CMGetNext(objectpaths, NULL);
  16.336 +
  16.337 +      if (CMClassPathIsA(_BROKER, data.value.ref, targetclass, NULL)) {
  16.338 +         /* Create an object path for the association. */
  16.339 +         CMPIObjectPath * refobjectpath = CMNewObjectPath(_BROKER, namespace, _ASSOCCLASS, &status);
  16.340 +         if ((status.rc != CMPI_RC_OK) || CMIsNullObject(refobjectpath)) {
  16.341 +            _SBLIM_TRACE(1,("--- CMNewObjectPath() failed - %s", CMGetCharPtr(status.msg)));
  16.342 +            CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERROR, "Cannot create new CMPIObjectPath");
  16.343 +            goto exit;
  16.344 +         }
  16.345 +
  16.346 +         /* Assign the references in the association appropriately. */
  16.347 +         if (strcmp(sourceclass, _RHSCLASSNAME) == 0) {
  16.348 +            CMAddKey(refobjectpath, _RHSPROPERTYNAME, &reference, CMPI_ref);
  16.349 +            CMAddKey(refobjectpath, _LHSPROPERTYNAME, &data.value.ref, CMPI_ref);
  16.350 +         } else {
  16.351 +            CMAddKey(refobjectpath, _RHSPROPERTYNAME, &data.value.ref, CMPI_ref);
  16.352 +            CMAddKey(refobjectpath, _LHSPROPERTYNAME, &reference, CMPI_ref);
  16.353 +         }
  16.354 +
  16.355 +         CMReturnObjectPath(results, refobjectpath);
  16.356 +      }
  16.357 +   }
  16.358 +
  16.359 +exit:
  16.360 +   _SBLIM_RETURNSTATUS(status);
  16.361 +}
  16.362 +
  16.363 +
  16.364 +// ----------------------------------------------------------------------------
  16.365 +// References()
  16.366 +// ----------------------------------------------------------------------------
  16.367 +static CMPIStatus References(
  16.368 +		CMPIAssociationMI * self,	/* [in] Handle to this provider (i.e. 'self'). */
  16.369 +		CMPIContext * context,		/* [in] Additional context info, if any. */
  16.370 +		CMPIResult * results,		/* [out] Results of this operation. */
  16.371 +		CMPIObjectPath * reference,	/* [in] Contains the namespace, classname and desired object path. */
  16.372 +		const char *assocClass,
  16.373 +		const char *role,
  16.374 +		char **properties)		/* [in] List of desired properties (NULL=all). */
  16.375 +{
  16.376 +   CMPIStatus status = { CMPI_RC_OK, NULL };    /* Return status of CIM operations. */
  16.377 +   char *namespace = CMGetCharPtr(CMGetNameSpace(reference, NULL)); /* Target namespace. */
  16.378 +   char *sourceclass = CMGetCharPtr(CMGetClassName(reference, &status)); /* Class of the source reference object */
  16.379 +   char *targetclass;                           /* Class of the target object(s). */
  16.380 +
  16.381 +   _SBLIM_ENTER("References");
  16.382 +   _SBLIM_TRACE(2, ("--- self=\"%s\"", self->ft->miName));
  16.383 +   _SBLIM_TRACE(2, ("--- context=\"%s\"", CMGetCharPtr(CDToString(_BROKER, context, NULL))));
  16.384 +   _SBLIM_TRACE(2, ("--- reference=\"%s\"", CMGetCharPtr(CDToString(_BROKER, reference, NULL))));
  16.385 +   _SBLIM_TRACE(2, ("--- assocClass=\"%s\"", assocClass));
  16.386 +   _SBLIM_TRACE(2, ("--- role=\"%s\"", role));
  16.387 +   _SBLIM_TRACE(2, ("--- namespace=\"%s\"", namespace));
  16.388 +   _SBLIM_TRACE(2, ("--- sourceclass=\"%s\"", sourceclass));
  16.389 +
  16.390 +   /* Check that the requested association class, if any, is supported. */
  16.391 +   if (assocClass != NULL) {
  16.392 +      CMPIObjectPath * assoc = CMNewObjectPath(_BROKER, namespace, _ASSOCCLASS, NULL);
  16.393 +      if (!CMClassPathIsA(_BROKER, assoc, assocClass, NULL)) {
  16.394 +         _SBLIM_TRACE(2, ("--- Unrecognized association class. Ignoring request."));
  16.395 +         goto exit;
  16.396 +      }
  16.397 +   }
  16.398 +
  16.399 +   /* Check that the reference matches the required role, if any. */
  16.400 +   if ((role != NULL) && strcmp(role, sourceclass) != 0) {
  16.401 +      _SBLIM_TRACE(2, ("--- Reference does not match required role. Ignoring request."));
  16.402 +      goto exit;
  16.403 +   }
  16.404 +
  16.405 +   /* Determine the target class from the source class. */
  16.406 +   if (strcmp(sourceclass, _LHSCLASSNAME) == 0) {
  16.407 +      targetclass = _RHSCLASSNAME;
  16.408 +   } else if (strcmp(sourceclass, _RHSCLASSNAME) == 0) {
  16.409 +      targetclass = _LHSCLASSNAME;
  16.410 +   } else {
  16.411 +      _SBLIM_TRACE(2, ("--- Unrecognized source class. Ignoring request."));
  16.412 +      goto exit;
  16.413 +   }
  16.414 +   _SBLIM_TRACE(2, ("--- targetclass=\"%s\"", targetclass));
  16.415 +
  16.416 +   /* Create an object path for the result class. */
  16.417 +   CMPIObjectPath * objectpath = CMNewObjectPath(_BROKER, namespace, targetclass, &status);
  16.418 +   if ((status.rc != CMPI_RC_OK) || CMIsNullObject(objectpath)) {
  16.419 +      _SBLIM_TRACE(1,("--- CMNewObjectPath() failed - %s", CMGetCharPtr(status.msg)));
  16.420 +      CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERROR, "Cannot create new CMPIObjectPath");
  16.421 +      goto exit;
  16.422 +   }
  16.423 +
  16.424 +   /* Get the list of all target class object paths from the CIMOM. */
  16.425 +   CMPIEnumeration * objectpaths = CBEnumInstanceNames(_BROKER, context, objectpath, &status);
  16.426 +   if ((status.rc != CMPI_RC_OK) || CMIsNullObject(objectpaths)) {
  16.427 +      _SBLIM_TRACE(1,("--- CBEnumInstanceNames() failed - %s", CMGetCharPtr(status.msg)));
  16.428 +      CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERROR, "Cannot enumerate target class");
  16.429 +      goto exit;
  16.430 +   }
  16.431 +
  16.432 +   /* Return all object paths that exactly match the target class and resultClass, if specified. */
  16.433 +   while (CMHasNext(objectpaths, NULL)) {
  16.434 +      CMPIData data = CMGetNext(objectpaths, NULL);
  16.435 +      char *class = CMGetCharPtr(CMGetClassName(data.value.ref, NULL));
  16.436 +
  16.437 +      if (CMClassPathIsA(_BROKER, data.value.ref, targetclass, NULL)) {
  16.438 +         /* Create an instance for the association. */
  16.439 +         CMPIInstance * refinstance = _CMNewInstance(_BROKER, namespace, _ASSOCCLASS, &status);
  16.440 +         if ((status.rc != CMPI_RC_OK) || CMIsNullObject(refinstance)) {
  16.441 +            _SBLIM_TRACE(1,("--- CMNewInstance() failed - %s", CMGetCharPtr(status.msg)));
  16.442 +            CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERROR, "Cannot create new CMPIInstance");
  16.443 +            goto exit;
  16.444 +         }
  16.445 +
  16.446 +         /* Assign the references in the association appropriately. */
  16.447 +         if (strcmp(sourceclass, _RHSCLASSNAME) == 0) {
  16.448 +            CMSetProperty(refinstance, _RHSPROPERTYNAME, &reference, CMPI_ref);
  16.449 +            CMSetProperty(refinstance, _LHSPROPERTYNAME, &data.value.ref, CMPI_ref);
  16.450 +         } else {
  16.451 +            CMSetProperty(refinstance, _RHSPROPERTYNAME, &data.value.ref, CMPI_ref);
  16.452 +            CMSetProperty(refinstance, _LHSPROPERTYNAME, &reference, CMPI_ref);
  16.453 +         }
  16.454 +
  16.455 +         CMReturnInstance(results, refinstance);
  16.456 +      }
  16.457 +   }
  16.458 +exit:
  16.459 +   _SBLIM_RETURNSTATUS(status);
  16.460 +}
  16.461 +
  16.462 +
  16.463 +// ----------------------------------------------------------------------------
  16.464 +// AssociationInitialize()
  16.465 +// Perform any necessary initialization immediately after this provider is
  16.466 +// first loaded.
  16.467 +// ----------------------------------------------------------------------------
  16.468 +static void AssociationInitialize(
  16.469 +		CMPIAssociationMI * self,	/* [in] Handle to this provider (i.e. 'self'). */
  16.470 +		CMPIContext * context)		/* [in] Additional context info, if any. */
  16.471 +{
  16.472 +   _SBLIM_ENTER("AssociationInitialize");
  16.473 +   _SBLIM_TRACE(2, ("--- self=\"%s\"", self->ft->miName));
  16.474 +   //   _SBLIM_TRACE(2, ("--- context=\"%s\"", CMGetCharPtr(CDToString(_BROKER, context, NULL))));
  16.475 +
  16.476 +   /* Nothing needs to be done to initialize this provider */
  16.477 +
  16.478 +exit:
  16.479 +   _SBLIM_RETURN();
  16.480 +}
  16.481 +
  16.482 +
  16.483 +// ============================================================================
  16.484 +// CMPI ASSOCIATION PROVIDER FUNCTION TABLE SETUP
  16.485 +// ============================================================================
  16.486 +CMAssociationMIStub( , Xen_MemoryAllocatedFromPool, _BROKER, AssociationInitialize(&mi, ctx));
    17.1 --- a/src/Xen_MemoryPool.c	Tue Sep 26 15:08:04 2006 -0600
    17.2 +++ b/src/Xen_MemoryPool.c	Thu Sep 28 17:07:14 2006 -0600
    17.3 @@ -15,6 +15,7 @@
    17.4  //    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
    17.5  // ============================================================================
    17.6  // Authors:       Dr. Gareth S. Bestor, <bestor@us.ibm.com>
    17.7 +//                Jim Fehlig, <jfehlig@novell.com>
    17.8  // Contributors:
    17.9  // Description:
   17.10  // ============================================================================
   17.11 @@ -24,6 +25,7 @@
   17.12  #include "cmpift.h"
   17.13  #include "cmpimacs.h"
   17.14  
   17.15 +#include "provider_common.h"
   17.16  
   17.17  // ----------------------------------------------------------------------------
   17.18  // COMMON GLOBAL VARIABLES
   17.19 @@ -89,7 +91,7 @@ static CMPIStatus EnumInstanceNames(
   17.20  		CMPIObjectPath * reference) 	/* [in] Contains target namespace and classname. */
   17.21  {
   17.22     CMPIStatus status = {CMPI_RC_OK, NULL};	/* Return status of CIM operations. */
   17.23 -   _RESOURCES * resources;			/* Handle to the list of system resources. */
   17.24 +   _RESOURCES * resources = NULL;			/* Handle to the list of system resources. */
   17.25     _RESOURCE * resource;			/* Handle to each system resource. */
   17.26     char * namespace = CMGetCharPtr(CMGetNameSpace(reference, NULL)); /* Target namespace. */
   17.27     int found = 0;				/* Found any instances? */
   17.28 @@ -100,6 +102,11 @@ static CMPIStatus EnumInstanceNames(
   17.29     _SBLIM_TRACE(2, ("--- reference=\"%s\"", CMGetCharPtr(CDToString(_BROKER, reference, NULL))));
   17.30     _SBLIM_TRACE(2, ("--- namespace=\"%s\"", namespace));
   17.31  
   17.32 +   if (strcmp(namespace, HOST_INSTRUMENTATION_NS) == 0) {
   17.33 +      _SBLIM_TRACE(1,("--- \"%s\" is not a valid namespace for %s", namespace, _CLASSNAME));
   17.34 +      goto exit;
   17.35 +   }
   17.36 +
   17.37     /* Get a handle to the list of system resources. */
   17.38     if (!Xen_MemoryPool_getResources(&resources)) {
   17.39        _SBLIM_TRACE(1,("--- _getResources() failed"));
   17.40 @@ -170,7 +177,7 @@ static CMPIStatus EnumInstances(
   17.41  		const char ** properties)	/* [in] List of desired properties (NULL=all). */
   17.42  {
   17.43     CMPIStatus status = {CMPI_RC_OK, NULL};	/* Return status of CIM operations. */
   17.44 -   _RESOURCES * resources;			/* Handle to the list of system resources. */
   17.45 +   _RESOURCES * resources = NULL;			/* Handle to the list of system resources. */
   17.46     _RESOURCE * resource;			/* Handle to each system resource. */
   17.47     char * namespace = CMGetCharPtr(CMGetNameSpace(reference, NULL)); /* Target namespace. */
   17.48     int found = 0;				/* Found any resource instances? */
   17.49 @@ -181,6 +188,11 @@ static CMPIStatus EnumInstances(
   17.50     _SBLIM_TRACE(2, ("--- reference=\"%s\"", CMGetCharPtr(CDToString(_BROKER, reference, NULL))));
   17.51     _SBLIM_TRACE(2, ("--- namespace=\"%s\"", namespace));
   17.52  
   17.53 +   if (strcmp(namespace, HOST_INSTRUMENTATION_NS) == 0) {
   17.54 +      _SBLIM_TRACE(1,("--- \"%s\" is not a valid namespace for %s", namespace, _CLASSNAME));
   17.55 +      goto exit;
   17.56 +   }
   17.57 +
   17.58     /* Get a handle to the list of system resources. */
   17.59     if (!Xen_MemoryPool_getResources(&resources)) {
   17.60        _SBLIM_TRACE(1,("--- _getResources() failed"));
   17.61 @@ -251,7 +263,7 @@ static CMPIStatus GetInstance(
   17.62  		const char ** properties)		/* [in] List of desired properties (NULL=all). */
   17.63  {
   17.64     CMPIStatus status = {CMPI_RC_OK, NULL};	/* Return status of CIM operations. */
   17.65 -   _RESOURCES * resources;			/* Handle to the list of system resources. */
   17.66 +   _RESOURCES * resources = NULL;			/* Handle to the list of system resources. */
   17.67     _RESOURCE * resource;			/* Handle to the system resource. */
   17.68     char * namespace = CMGetCharPtr(CMGetNameSpace(reference, NULL)); /* Target namespace. */
   17.69     int found = 0;				/* Found the target instance? */
   17.70 @@ -262,6 +274,11 @@ static CMPIStatus GetInstance(
   17.71     _SBLIM_TRACE(2, ("--- reference=\"%s\"", CMGetCharPtr(CDToString(_BROKER, reference, NULL))));
   17.72     _SBLIM_TRACE(2, ("--- namespace=\"%s\"", namespace));
   17.73  
   17.74 +   if (strcmp(namespace, HOST_INSTRUMENTATION_NS) == 0) {
   17.75 +      _SBLIM_TRACE(1,("--- \"%s\" is not a valid namespace for %s", namespace, _CLASSNAME));
   17.76 +      goto exit;
   17.77 +   }
   17.78 +
   17.79     /* Get a handle to the list of system resources. */
   17.80     if (!Xen_MemoryPool_getResources(&resources)) {
   17.81        _SBLIM_TRACE(1,("--- _getResources() failed"));
   17.82 @@ -336,7 +353,7 @@ static CMPIStatus SetInstance(
   17.83  		CMPIInstance * newinstance)	/* [in] Contains the new instance data. */
   17.84  {
   17.85     CMPIStatus status = {CMPI_RC_OK, NULL};	/* Return status of CIM operations. */
   17.86 -   _RESOURCES * resources;			/* Handle to the list of system resources. */
   17.87 +   _RESOURCES * resources = NULL;			/* Handle to the list of system resources. */
   17.88     _RESOURCE * resource;	       		/* Handle to the system resource. */
   17.89     char * namespace = CMGetCharPtr(CMGetNameSpace(reference, NULL)); /* Target namespace. */
   17.90     int found = 0;				/* Found the target instance? */
   17.91 @@ -348,6 +365,11 @@ static CMPIStatus SetInstance(
   17.92     _SBLIM_TRACE(2, ("--- newinstance=\"%s\"", CMGetCharPtr(CDToString(_BROKER, newinstance, NULL))));
   17.93     _SBLIM_TRACE(2, ("--- namespace=\"%s\"", namespace));
   17.94  
   17.95 +   if (strcmp(namespace, HOST_INSTRUMENTATION_NS) == 0) {
   17.96 +      _SBLIM_TRACE(1,("--- \"%s\" is not a valid namespace for %s", namespace, _CLASSNAME));
   17.97 +      goto exit;
   17.98 +   }
   17.99 +
  17.100     /* Get a handle to the list of system resources. */
  17.101     if (!Xen_MemoryPool_getResources(&resources)) {
  17.102        _SBLIM_TRACE(1,("--- _getResources() failed"));
  17.103 @@ -408,7 +430,7 @@ static CMPIStatus CreateInstance(
  17.104  		CMPIInstance * newinstance)	/* [in] Contains the new instance data. */
  17.105  {
  17.106     CMPIStatus status = {CMPI_RC_OK, NULL};	/* Return status of CIM operations. */
  17.107 -   _RESOURCES * resources;			/* Handle to the list of system resources. */
  17.108 +   _RESOURCES * resources = NULL;			/* Handle to the list of system resources. */
  17.109     _RESOURCE * resource;			/* Handle to the system resource. */
  17.110     char * namespace = CMGetCharPtr(CMGetNameSpace(reference, NULL)); /* Target namespace. */
  17.111     int found = 0;				/* Found the target instance? */
  17.112 @@ -420,6 +442,11 @@ static CMPIStatus CreateInstance(
  17.113     _SBLIM_TRACE(2, ("--- newinstance=\"%s\"", CMGetCharPtr(CDToString(_BROKER, newinstance, NULL))));
  17.114     _SBLIM_TRACE(2, ("--- namespace=\"%s\"", namespace));
  17.115  
  17.116 +   if (strcmp(namespace, HOST_INSTRUMENTATION_NS) == 0) {
  17.117 +      _SBLIM_TRACE(1,("--- \"%s\" is not a valid namespace for %s", namespace, _CLASSNAME));
  17.118 +      goto exit;
  17.119 +   }
  17.120 +
  17.121     /* WORKAROUND FOR PEGASUS BUG?! reference does not contain object path, only namespace & classname. */
  17.122     reference = CMGetObjectPath(newinstance, NULL);
  17.123  
  17.124 @@ -486,7 +513,7 @@ static CMPIStatus DeleteInstance(
  17.125  		CMPIObjectPath * reference)	/* [in] Contains the target namespace, classname and object path. */
  17.126  {
  17.127     CMPIStatus status = {CMPI_RC_OK, NULL};	/* Return status of CIM operations. */
  17.128 -   _RESOURCES * resources;			/* Handle to the list of system resources. */
  17.129 +   _RESOURCES * resources = NULL;			/* Handle to the list of system resources. */
  17.130     _RESOURCE * resource;		/* Handle to the system resource. */
  17.131     char * namespace = CMGetCharPtr(CMGetNameSpace(reference, NULL)); /* Target namespace. */
  17.132     int found = 0;				/* Found the target instance? */
  17.133 @@ -497,6 +524,11 @@ static CMPIStatus DeleteInstance(
  17.134     _SBLIM_TRACE(2, ("--- reference=\"%s\"", CMGetCharPtr(CDToString(_BROKER, reference, NULL))));
  17.135     _SBLIM_TRACE(2, ("--- namespace=\"%s\"", namespace));
  17.136  
  17.137 +   if (strcmp(namespace, HOST_INSTRUMENTATION_NS) == 0) {
  17.138 +      _SBLIM_TRACE(1,("--- \"%s\" is not a valid namespace for %s", namespace, _CLASSNAME));
  17.139 +      goto exit;
  17.140 +   }
  17.141 +
  17.142     /* Get a handle to the list of system resources. */
  17.143     if (!Xen_MemoryPool_getResources(&resources)) {
  17.144        _SBLIM_TRACE(1,("--- _getResources() failed"));
  17.145 @@ -569,6 +601,11 @@ static CMPIStatus ExecQuery(
  17.146     _SBLIM_TRACE(2, ("--- query=\"%s\"", query));
  17.147     _SBLIM_TRACE(2, ("--- namespace=\"%s\"", namespace));
  17.148  
  17.149 +   if (strcmp(namespace, HOST_INSTRUMENTATION_NS) == 0) {
  17.150 +      _SBLIM_TRACE(1,("--- \"%s\" is not a valid namespace for %s", namespace, _CLASSNAME));
  17.151 +      goto exit;
  17.152 +   }
  17.153 +
  17.154     /* EXECQUERY() IS NOT YET SUPPORTED FOR THIS CLASS */
  17.155     CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_NOT_SUPPORTED, NULL);
  17.156  
    18.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    18.2 +++ b/src/Xen_MemoryPoolComponent.c	Thu Sep 28 17:07:14 2006 -0600
    18.3 @@ -0,0 +1,564 @@
    18.4 +// Copyright (C) 2006 Novell, Inc
    18.5 +//
    18.6 +//    This library is free software; you can redistribute it and/or
    18.7 +//    modify it under the terms of the GNU Lesser General Public
    18.8 +//    License as published by the Free Software Foundation; either
    18.9 +//    version 2.1 of the License, or (at your option) any later version.
   18.10 +//
   18.11 +//    This library is distributed in the hope that it will be useful,
   18.12 +//    but WITHOUT ANY WARRANTY; without even the implied warranty of
   18.13 +//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   18.14 +//    Lesser General Public License for more details.
   18.15 +//
   18.16 +//    You should have received a copy of the GNU Lesser General Public
   18.17 +//    License along with this library; if not, write to the Free Software
   18.18 +//    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
   18.19 +// ============================================================================
   18.20 +// Authors:       Jim Fehlig, <jfehlig@novell.com>
   18.21 +// Contributors:
   18.22 +// Description:
   18.23 +// ============================================================================
   18.24 +
   18.25 +#include <string.h>
   18.26 +
   18.27 +/* Include the required CMPI data types, function headers, and macros */
   18.28 +#include "cmpidt.h"
   18.29 +#include "cmpift.h"
   18.30 +#include "cmpimacs.h"
   18.31 +
   18.32 +
   18.33 +// ----------------------------------------------------------------------------
   18.34 +// COMMON GLOBAL VARIABLES
   18.35 +// ----------------------------------------------------------------------------
   18.36 +
   18.37 +/* Handle to the CIM broker. Initialized when the provider lib is loaded. */
   18.38 +static CMPIBroker *_BROKER;
   18.39 +
   18.40 +/* Include utility functions */
   18.41 +#include "cmpiutil.h"
   18.42 +
   18.43 +/* Include _SBLIM_TRACE() logging support */
   18.44 +#include "cmpitrace.h"
   18.45 +
   18.46 +
   18.47 +// ============================================================================
   18.48 +// CMPI ASSOCIATION PROVIDER FUNCTION TABLE
   18.49 +// ============================================================================
   18.50 +
   18.51 +// ----------------------------------------------------------------------------
   18.52 +// Info for the class supported by the association provider
   18.53 +// ----------------------------------------------------------------------------
   18.54 +                                                                                                                                 
   18.55 +/* Name of the left and right hand side classes of this association. */
   18.56 +static char * _ASSOCCLASS = "Xen_MemoryPoolComponent";
   18.57 +static char * _LHSCLASSNAME = "Xen_MemoryPool";
   18.58 +static char * _RHSCLASSNAME = "CIM_Memory";
   18.59 +static char * _LHSPROPERTYNAME = "GroupComponent"; 
   18.60 +static char * _RHSPROPERTYNAME = "PartComponent";
   18.61 +static char * _LHSNAMESPACE = "root/cimv2";
   18.62 +static char * _RHSNAMESPACE = "smash";
   18.63 +
   18.64 +static char * _XEN_DOMU_MEMORY_CLASS = "Xen_Memory";
   18.65 +
   18.66 +/*
   18.67 + * TODO:
   18.68 + * When enumerating classes of CIM_Memory it is possible to get OMC_Memory
   18.69 + * and OMC_CacheMemory.  How do we filter without explicitly stating "I
   18.70 + * don't want OMC_CacheMemory"?  I suggest moving to a config file.  But
   18.71 + * should it be at build, install or runtime?
   18.72 + */
   18.73 +
   18.74 +static char * _OMC_CACHE_MEMORY_CLASS = "OMC_CacheMemory";
   18.75 +
   18.76 +
   18.77 +// ----------------------------------------------------------------------------
   18.78 +// AssociationCleanup()
   18.79 +// Perform any necessary cleanup immediately before this provider is unloaded.
   18.80 +// ----------------------------------------------------------------------------
   18.81 +static CMPIStatus AssociationCleanup(
   18.82 +		CMPIAssociationMI * self,	/* [in] Handle to this provider (i.e. 'self'). */
   18.83 +		CMPIContext * context)		/* [in] Additional context info, if any. */
   18.84 +{
   18.85 +   CMPIStatus status = { CMPI_RC_OK, NULL };	/* Return status of CIM operations. */
   18.86 +
   18.87 +   _SBLIM_ENTER("AssociationCleanup");
   18.88 +   _SBLIM_TRACE(2, ("--- self=\"%s\"", self->ft->miName));
   18.89 +   _SBLIM_TRACE(2, ("--- context=\"%s\"", CMGetCharPtr(CDToString(_BROKER, context, NULL))));
   18.90 +
   18.91 +   /* Nothing needs to be done for cleanup. */
   18.92 +
   18.93 +exit:
   18.94 +   _SBLIM_RETURNSTATUS(status);
   18.95 +}
   18.96 +
   18.97 +
   18.98 +// ----------------------------------------------------------------------------
   18.99 +// AssociatorNames()
  18.100 +// ----------------------------------------------------------------------------
  18.101 +static CMPIStatus AssociatorNames(
  18.102 +		CMPIAssociationMI * self,	/* [in] Handle to this provider (i.e. 'self'). */
  18.103 +		CMPIContext * context,		/* [in] Additional context info, if any. */
  18.104 +		CMPIResult * results,		/* [out] Results of this operation. */
  18.105 +		CMPIObjectPath * reference,	/* [in] Contains source namespace, classname and object path. */
  18.106 +		const char * assocClass,
  18.107 +		const char * resultClass,
  18.108 +		const char * role,
  18.109 +		const char * resultRole)
  18.110 +{
  18.111 +   CMPIStatus status = { CMPI_RC_OK, NULL };    /* Return status of CIM operations. */
  18.112 +   char *namespace = CMGetCharPtr(CMGetNameSpace(reference, NULL)); /* Target namespace. */
  18.113 +   char *sourceclass = CMGetCharPtr(CMGetClassName(reference, &status)); /* Class of the source reference object */
  18.114 +   char *targetclass; 				/* Class of the target object(s). */
  18.115 +   char *targetnamespace;
  18.116 +
  18.117 +   _SBLIM_ENTER("AssociatorNames");
  18.118 +   _SBLIM_TRACE(2, ("--- self=\"%s\"", self->ft->miName));
  18.119 +   _SBLIM_TRACE(2, ("--- context=\"%s\"", CMGetCharPtr(CDToString(_BROKER, context, NULL))));
  18.120 +   _SBLIM_TRACE(2, ("--- reference=\"%s\"", CMGetCharPtr(CDToString(_BROKER, reference, NULL))));
  18.121 +   _SBLIM_TRACE(2, ("--- assocClass=\"%s\"", assocClass));
  18.122 +   _SBLIM_TRACE(2, ("--- resultClass=\"%s\"", resultClass));
  18.123 +   _SBLIM_TRACE(2, ("--- role=\"%s\"", role));
  18.124 +   _SBLIM_TRACE(2, ("--- resultRole=\"%s\"", resultRole));
  18.125 +   _SBLIM_TRACE(2, ("--- namespace=\"%s\"", namespace));
  18.126 +   _SBLIM_TRACE(2, ("--- sourceclass=\"%s\"", sourceclass));
  18.127 +
  18.128 +   /* Ensure the source class is not a virtual processor */
  18.129 +   if (strcmp(sourceclass, _XEN_DOMU_MEMORY_CLASS) == 0) {
  18.130 +      _SBLIM_TRACE(2, ("--- Ignoring source class %s.", _XEN_DOMU_MEMORY_CLASS));
  18.131 +      goto exit;
  18.132 +   }
  18.133 +
  18.134 +   /* Check that the requested association class, if any, is supported. */
  18.135 +   if (assocClass != NULL) {
  18.136 +      CMPIObjectPath * assoc = CMNewObjectPath(_BROKER, namespace, _ASSOCCLASS, NULL);
  18.137 +      if (!CMClassPathIsA(_BROKER, assoc, assocClass, NULL)) {
  18.138 +         _SBLIM_TRACE(2, ("--- Unrecognized association class. Ignoring request."));
  18.139 +         goto exit;
  18.140 +      }
  18.141 +   }
  18.142 +
  18.143 +   /* Check that the reference matches the required role, if any. */
  18.144 +   if ((role != NULL) && strcmp(role, sourceclass) != 0) {
  18.145 +      _SBLIM_TRACE(2, ("--- Reference does not match required role. Ignoring request."));
  18.146 +      goto exit;
  18.147 +   }
  18.148 +
  18.149 +   /* Determine the target class from the source class. */
  18.150 +   if (CMClassPathIsA(_BROKER, reference, _LHSCLASSNAME, NULL)) {
  18.151 +      targetclass = _RHSCLASSNAME;
  18.152 +      targetnamespace = _RHSNAMESPACE;
  18.153 +   } else if (CMClassPathIsA(_BROKER, reference, _RHSCLASSNAME, NULL)) {
  18.154 +      targetclass = _LHSCLASSNAME;
  18.155 +      targetnamespace = _LHSNAMESPACE;
  18.156 +   } else {
  18.157 +      _SBLIM_TRACE(2, ("--- Unrecognized source class. Ignoring request."));
  18.158 +      goto exit;
  18.159 +   } 
  18.160 +   _SBLIM_TRACE(2, ("--- targetclass=\"%s\"", targetclass));
  18.161 +   _SBLIM_TRACE(2, ("--- targetnamespace=\"%s\"", targetnamespace));
  18.162 +
  18.163 +   /* Create an object path for the result class. */
  18.164 +   CMPIObjectPath * objectpath = CMNewObjectPath(_BROKER, targetnamespace, targetclass, &status);
  18.165 +   if ((status.rc != CMPI_RC_OK) || CMIsNullObject(objectpath)) {
  18.166 +      _SBLIM_TRACE(1,("--- CMNewObjectPath() failed - %s", CMGetCharPtr(status.msg)));
  18.167 +      CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERROR, "Cannot create new CMPIObjectPath");
  18.168 +      goto exit;
  18.169 +   }
  18.170 +
  18.171 +   /* Get the list of all target class object paths from the CIMOM. */
  18.172 +   CMPIEnumeration * objectpaths = CBEnumInstanceNames(_BROKER, context, objectpath, &status);
  18.173 +   if ((status.rc != CMPI_RC_OK) || CMIsNullObject(objectpaths)) {
  18.174 +      _SBLIM_TRACE(1,("--- CBEnumInstanceNames() failed - %s", CMGetCharPtr(status.msg)));
  18.175 +      CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERROR, "Cannot enumerate target class");
  18.176 +      goto exit;
  18.177 +   }
  18.178 +
  18.179 +   /* Return all object paths that exactly match the target class and resultClass, if specified. */
  18.180 +   while (CMHasNext(objectpaths, NULL)) {
  18.181 +      CMPIData data = CMGetNext(objectpaths, NULL);
  18.182 +      char *class = CMGetCharPtr(CMGetClassName(data.value.ref, NULL));
  18.183 +
  18.184 +      _SBLIM_TRACE(2, ("--- got objectpath=\"%s\"", CMGetCharPtr(CDToString(_BROKER, data.value.ref, NULL))));
  18.185 +
  18.186 +      /* Ignore possible instances of source class. */
  18.187 +      /*
  18.188 +       * TODO: _OMC_CACHE_MEMORY_CLASS
  18.189 +       */
  18.190 +      if (strcmp(class, _OMC_CACHE_MEMORY_CLASS) &&
  18.191 +          strcmp(class,sourceclass) &&
  18.192 +          (resultClass == NULL || CMClassPathIsA(_BROKER, data.value.ref, resultClass, NULL))) {
  18.193 +
  18.194 +         CMReturnObjectPath(results, data.value.ref);
  18.195 +      }
  18.196 +   }
  18.197 +
  18.198 +   CMReturnDone(results);
  18.199 +
  18.200 +exit:
  18.201 +   _SBLIM_RETURNSTATUS(status);
  18.202 +}
  18.203 +
  18.204 +
  18.205 +// ----------------------------------------------------------------------------
  18.206 +// Associators()
  18.207 +// ----------------------------------------------------------------------------
  18.208 +static CMPIStatus Associators(
  18.209 +		CMPIAssociationMI * self,	/* [in] Handle to this provider (i.e. 'self'). */
  18.210 +		CMPIContext * context,		/* [in] Additional context info, if any. */
  18.211 +		CMPIResult * results,		/* [out] Results of this operation. */
  18.212 +		CMPIObjectPath * reference,	/* [in] Contains the source namespace, classname and object path. */
  18.213 +		const char *assocClass,
  18.214 +		const char *resultClass,
  18.215 +		const char *role,
  18.216 +		const char *resultRole,
  18.217 +		char ** properties)		/* [in] List of desired properties (NULL=all). */
  18.218 +{
  18.219 +   CMPIStatus status = { CMPI_RC_OK, NULL };    /* Return status of CIM operations. */
  18.220 +   char *namespace = CMGetCharPtr(CMGetNameSpace(reference, NULL)); /* Target namespace. */
  18.221 +   char *sourceclass = CMGetCharPtr(CMGetClassName(reference, &status)); /* Class of the source reference object */
  18.222 +   char *targetclass;                           /* Class of the target object(s). */
  18.223 +   char *targetnamespace;
  18.224 +
  18.225 +   _SBLIM_ENTER("Associators");
  18.226 +   _SBLIM_TRACE(2, ("--- self=\"%s\"", self->ft->miName));
  18.227 +   _SBLIM_TRACE(2, ("--- context=\"%s\"", CMGetCharPtr(CDToString(_BROKER, context, NULL))));
  18.228 +   _SBLIM_TRACE(2, ("--- reference=\"%s\"", CMGetCharPtr(CDToString(_BROKER, reference, NULL))));
  18.229 +   _SBLIM_TRACE(2, ("--- assocClass=\"%s\"", assocClass));
  18.230 +   _SBLIM_TRACE(2, ("--- resultClass=\"%s\"", resultClass));
  18.231 +   _SBLIM_TRACE(2, ("--- role=\"%s\"", role));
  18.232 +   _SBLIM_TRACE(2, ("--- resultRole=\"%s\"", resultRole));
  18.233 +   _SBLIM_TRACE(2, ("--- namespace=\"%s\"", namespace));
  18.234 +   _SBLIM_TRACE(2, ("--- sourceclass=\"%s\"", sourceclass));
  18.235 +
  18.236 +   /* Ensure the source class is not a virtual processor */
  18.237 +   if (strcmp(sourceclass, _XEN_DOMU_MEMORY_CLASS) == 0) {
  18.238 +      _SBLIM_TRACE(2, ("--- Ignoring source class %s.", _XEN_DOMU_MEMORY_CLASS));
  18.239 +      goto exit;
  18.240 +   }
  18.241 +
  18.242 +   /* Check that the requested association class, if any, is supported. */
  18.243 +   if (assocClass != NULL) {
  18.244 +      CMPIObjectPath * assoc = CMNewObjectPath(_BROKER, namespace, _ASSOCCLASS, NULL);
  18.245 +      if (!CMClassPathIsA(_BROKER, assoc, assocClass, NULL)) {
  18.246 +         _SBLIM_TRACE(2, ("--- Unrecognized association class. Ignoring request."));
  18.247 +         goto exit;
  18.248 +      }
  18.249 +   }
  18.250 +
  18.251 +   /* Check that the reference matches the required role, if any. */
  18.252 +   if ((role != NULL) && strcmp(role, sourceclass) != 0) {
  18.253 +      _SBLIM_TRACE(2, ("--- Reference does not match required role. Ignoring request."));
  18.254 +      goto exit;
  18.255 +   }
  18.256 +   CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_NOT_SUPPORTED, NULL);
  18.257 +
  18.258 +   /* Determine the target class from the source class. */
  18.259 +   if (CMClassPathIsA(_BROKER, reference, _LHSCLASSNAME, NULL)) {
  18.260 +      targetclass = _RHSCLASSNAME;
  18.261 +      targetnamespace = _RHSNAMESPACE;
  18.262 +   } else if (CMClassPathIsA(_BROKER, reference, _RHSCLASSNAME, NULL)) {
  18.263 +      targetclass = _LHSCLASSNAME;
  18.264 +      targetnamespace = _LHSNAMESPACE;
  18.265 +   } else {
  18.266 +      _SBLIM_TRACE(2, ("--- Unrecognized source class. Ignoring request."));
  18.267 +      goto exit;
  18.268 +   } 
  18.269 +   _SBLIM_TRACE(2, ("--- targetclass=\"%s\"", targetclass));
  18.270 +   _SBLIM_TRACE(2, ("--- targetnamespace=\"%s\"", targetnamespace));
  18.271 +
  18.272 +   /* Create an object path for the result class. */
  18.273 +   CMPIObjectPath * objectpath = CMNewObjectPath(_BROKER, targetnamespace, targetclass, &status);
  18.274 +   if ((status.rc != CMPI_RC_OK) || CMIsNullObject(objectpath)) {
  18.275 +      _SBLIM_TRACE(1,("--- CMNewObjectPath() failed - %s", CMGetCharPtr(status.msg)));
  18.276 +      CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERROR, "Cannot create new CMPIObjectPath");
  18.277 +      goto exit;
  18.278 +   }
  18.279 +
  18.280 +   /* Get the list of all target class instances from the CIMOM. */
  18.281 +   CMPIEnumeration * instances = CBEnumInstances(_BROKER, context, objectpath, NULL, &status);
  18.282 +   if ((status.rc != CMPI_RC_OK) || CMIsNullObject(instances)) {
  18.283 +      _SBLIM_TRACE(1,("--- CBEnumInstances() failed - %s", CMGetCharPtr(status.msg)));
  18.284 +      CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERROR, "Cannot enumerate target class");
  18.285 +      goto exit;
  18.286 +   }
  18.287 +
  18.288 +   /* Return all instances that exactly match the target class and resultClass, if specified. */
  18.289 +   while (CMHasNext(instances, NULL)) {
  18.290 +      CMPIData data = CMGetNext(instances, NULL);
  18.291 +      CMPIObjectPath *op = CMGetObjectPath(data.value.inst,NULL);
  18.292 +      char *class = CMGetCharPtr(CMGetClassName(op, NULL));
  18.293 +
  18.294 +      CMSetNameSpace(op, targetnamespace);
  18.295 +      _SBLIM_TRACE(2, ("--- got objectpath=\"%s\"", CMGetCharPtr(CDToString(_BROKER, op, NULL))));
  18.296 +      _SBLIM_TRACE(2, ("--- got class=\"%s\"", class));
  18.297 +
  18.298 +      /* Ignore possible instances of source class. */
  18.299 +      if (strcmp(class, _OMC_CACHE_MEMORY_CLASS) &&
  18.300 +          strcmp(class,sourceclass) &&
  18.301 +          (resultClass == NULL || CMClassPathIsA(_BROKER, op, resultClass, NULL))) {
  18.302 +         _SBLIM_TRACE(2, ("--- returning instance"));
  18.303 +         CMReturnInstance(results, data.value.inst);
  18.304 +      }
  18.305 +   }
  18.306 +   
  18.307 +   CMReturnDone(results);
  18.308 +
  18.309 +exit:
  18.310 +   _SBLIM_RETURNSTATUS(status);
  18.311 +}
  18.312 +
  18.313 +
  18.314 +// ----------------------------------------------------------------------------
  18.315 +// ReferenceNames()
  18.316 +// ----------------------------------------------------------------------------
  18.317 +static CMPIStatus ReferenceNames(
  18.318 +		CMPIAssociationMI * self,	/* [in] Handle to this provider (i.e. 'self'). */
  18.319 +		CMPIContext * context,		/* [in] Additional context info, if any. */
  18.320 +		CMPIResult * results,		/* [out] Results of this operation. */
  18.321 +		CMPIObjectPath * reference,	/* [in] Contains the source namespace, classname and object path. */
  18.322 +		const char *assocClass, 
  18.323 +		const char *role)
  18.324 +{
  18.325 +   CMPIStatus status = { CMPI_RC_OK, NULL };    /* Return status of CIM operations. */
  18.326 +   char *namespace = CMGetCharPtr(CMGetNameSpace(reference, NULL)); /* Target namespace. */
  18.327 +   char *sourceclass = CMGetCharPtr(CMGetClassName(reference, &status)); /* Class of the source reference object */
  18.328 +   char *targetclass;                           /* Class of the target object(s). */
  18.329 +   char *targetnamespace;
  18.330 +
  18.331 +   _SBLIM_ENTER("ReferenceNames");
  18.332 +   _SBLIM_TRACE(2, ("--- self=\"%s\"", self->ft->miName));
  18.333 +   _SBLIM_TRACE(2, ("--- context=\"%s\"", CMGetCharPtr(CDToString(_BROKER, context, NULL))));
  18.334 +   _SBLIM_TRACE(2, ("--- reference=\"%s\"", CMGetCharPtr(CDToString(_BROKER, reference, NULL))));
  18.335 +   _SBLIM_TRACE(2, ("--- assocClass=\"%s\"", assocClass));
  18.336 +   _SBLIM_TRACE(2, ("--- role=\"%s\"", role));
  18.337 +   _SBLIM_TRACE(2, ("--- namespace=\"%s\"", namespace));
  18.338 +   _SBLIM_TRACE(2, ("--- sourceclass=\"%s\"", sourceclass));
  18.339 +
  18.340 +   /* Ensure the source class is not a virtual processor */
  18.341 +   if (strcmp(sourceclass, _XEN_DOMU_MEMORY_CLASS) == 0) {
  18.342 +      _SBLIM_TRACE(2, ("--- Ignoring source class %s.", _XEN_DOMU_MEMORY_CLASS));
  18.343 +      goto exit;
  18.344 +   }
  18.345 +
  18.346 +   /* Check that the requested association class, if any, is supported. */
  18.347 +   if (assocClass != NULL) {
  18.348 +      CMPIObjectPath * assoc = CMNewObjectPath(_BROKER, namespace, _ASSOCCLASS, NULL);
  18.349 +      if (!CMClassPathIsA(_BROKER, assoc, assocClass, NULL)) {
  18.350 +         _SBLIM_TRACE(2, ("--- Unrecognized association class. Ignoring request."));
  18.351 +         goto exit;
  18.352 +      }
  18.353 +   }
  18.354 +
  18.355 +   /* Check that the reference matches the required role, if any. */
  18.356 +   if ((role != NULL) && strcmp(role, sourceclass) != 0) {
  18.357 +      _SBLIM_TRACE(2, ("--- Reference does not match required role. Ignoring request."));
  18.358 +      goto exit;
  18.359 +   }
  18.360 +
  18.361 +   /* Determine the target class from the source class. */
  18.362 +   if (CMClassPathIsA(_BROKER, reference, _LHSCLASSNAME, NULL)) {
  18.363 +      targetclass = _RHSCLASSNAME;
  18.364 +      targetnamespace = _RHSNAMESPACE;
  18.365 +      /* Refences of LHS class should always be in LHS namespace. */
  18.366 +      CMSetNameSpace(reference, _LHSNAMESPACE);
  18.367 +   } else if (CMClassPathIsA(_BROKER, reference, _RHSCLASSNAME, NULL)) {
  18.368 +      targetclass = _LHSCLASSNAME;
  18.369 +      targetnamespace = _LHSNAMESPACE;
  18.370 +   } else {
  18.371 +      _SBLIM_TRACE(2, ("--- Unrecognized source class. Ignoring request."));
  18.372 +      goto exit;
  18.373 +   } 
  18.374 +   _SBLIM_TRACE(2, ("--- targetclass=\"%s\"", targetclass));
  18.375 +   _SBLIM_TRACE(2, ("--- targetnamespace=\"%s\"", targetnamespace));
  18.376 +
  18.377 +   /* Create an object path for the result class. */
  18.378 +   CMPIObjectPath * objectpath = CMNewObjectPath(_BROKER, targetnamespace, targetclass, &status);
  18.379 +   if ((status.rc != CMPI_RC_OK) || CMIsNullObject(objectpath)) {
  18.380 +      _SBLIM_TRACE(1,("--- CMNewObjectPath() failed - %s", CMGetCharPtr(status.msg)));
  18.381 +      CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERROR, "Cannot create new CMPIObjectPath");
  18.382 +      goto exit;
  18.383 +   }
  18.384 +
  18.385 +   /* Get the list of all target class object paths from the CIMOM. */
  18.386 +   CMPIEnumeration * objectpaths = CBEnumInstanceNames(_BROKER, context, objectpath, &status);
  18.387 +   if ((status.rc != CMPI_RC_OK) || CMIsNullObject(objectpaths)) {
  18.388 +      _SBLIM_TRACE(1,("--- CBEnumInstanceNames() failed - %s", CMGetCharPtr(status.msg)));
  18.389 +      CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERROR, "Cannot enumerate target class");
  18.390 +      goto exit;
  18.391 +   }
  18.392 +
  18.393 +   /* Return all object paths that exactly match the target class and resultClass, if specified. */
  18.394 +   while (CMHasNext(objectpaths, NULL)) {
  18.395 +      CMPIData data = CMGetNext(objectpaths, NULL);
  18.396 +      char *class = CMGetCharPtr(CMGetClassName(data.value.ref, NULL));
  18.397 +
  18.398 +      /* Ignore possible instances of source class. */
  18.399 +      if (strcmp(class, _OMC_CACHE_MEMORY_CLASS) &&
  18.400 +          strcmp(class,sourceclass)) {
  18.401 +         /* Create an object path for the association. Note that the association
  18.402 +          * objects should exist in 'virt namespace' not the host namespace.
  18.403 +          */
  18.404 +         CMPIObjectPath * refobjectpath = CMNewObjectPath(_BROKER, _LHSNAMESPACE, _ASSOCCLASS, &status);
  18.405 +         if ((status.rc != CMPI_RC_OK) || CMIsNullObject(refobjectpath)) {
  18.406 +            _SBLIM_TRACE(1,("--- CMNewObjectPath() failed - %s", CMGetCharPtr(status.msg)));
  18.407 +            CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERROR, "Cannot create new CMPIObjectPath");
  18.408 +            goto exit;
  18.409 +         }
  18.410 +
  18.411 +         /* Assign the references in the association appropriately. */
  18.412 +         if (strcmp(sourceclass, _RHSCLASSNAME) == 0) {
  18.413 +            CMAddKey(refobjectpath, _RHSPROPERTYNAME, &reference, CMPI_ref);
  18.414 +            CMAddKey(refobjectpath, _LHSPROPERTYNAME, &data.value.ref, CMPI_ref);
  18.415 +         } else {
  18.416 +            CMAddKey(refobjectpath, _RHSPROPERTYNAME, &data.value.ref, CMPI_ref);
  18.417 +            CMAddKey(refobjectpath, _LHSPROPERTYNAME, &reference, CMPI_ref);
  18.418 +         }
  18.419 +
  18.420 +         CMReturnObjectPath(results, refobjectpath);
  18.421 +      }
  18.422 +   }
  18.423 +
  18.424 +exit:
  18.425 +   _SBLIM_RETURNSTATUS(status);
  18.426 +}
  18.427 +
  18.428 +
  18.429 +// ----------------------------------------------------------------------------
  18.430 +// References()
  18.431 +// ----------------------------------------------------------------------------
  18.432 +static CMPIStatus References(
  18.433 +		CMPIAssociationMI * self,	/* [in] Handle to this provider (i.e. 'self'). */
  18.434 +		CMPIContext * context,		/* [in] Additional context info, if any. */
  18.435 +		CMPIResult * results,		/* [out] Results of this operation. */
  18.436 +		CMPIObjectPath * reference,	/* [in] Contains the namespace, classname and desired object path. */
  18.437 +		const char *assocClass,
  18.438 +		const char *role,
  18.439 +		char **properties)		/* [in] List of desired properties (NULL=all). */
  18.440 +{
  18.441 +   CMPIStatus status = { CMPI_RC_OK, NULL };    /* Return status of CIM operations. */
  18.442 +   char *namespace = CMGetCharPtr(CMGetNameSpace(reference, NULL)); /* Target namespace. */
  18.443 +   char *sourceclass = CMGetCharPtr(CMGetClassName(reference, &status)); /* Class of the source reference object */
  18.444 +   char *targetclass;                           /* Class of the target object(s). */
  18.445 +   char *targetnamespace;
  18.446 +
  18.447 +   _SBLIM_ENTER("References");
  18.448 +   _SBLIM_TRACE(2, ("--- self=\"%s\"", self->ft->miName));
  18.449 +   _SBLIM_TRACE(2, ("--- context=\"%s\"", CMGetCharPtr(CDToString(_BROKER, context, NULL))));
  18.450 +   _SBLIM_TRACE(2, ("--- reference=\"%s\"", CMGetCharPtr(CDToString(_BROKER, reference, NULL))));
  18.451 +   _SBLIM_TRACE(2, ("--- assocClass=\"%s\"", assocClass));
  18.452 +   _SBLIM_TRACE(2, ("--- role=\"%s\"", role));
  18.453 +   _SBLIM_TRACE(2, ("--- namespace=\"%s\"", namespace));
  18.454 +   _SBLIM_TRACE(2, ("--- sourceclass=\"%s\"", sourceclass));
  18.455 +
  18.456 +   /* Ensure the source class is not a virtual processor */
  18.457 +   if (strcmp(sourceclass, _XEN_DOMU_MEMORY_CLASS) == 0) {
  18.458 +      _SBLIM_TRACE(2, ("--- Ignoring source class %s.", _XEN_DOMU_MEMORY_CLASS));
  18.459 +      goto exit;
  18.460 +   }
  18.461 +
  18.462 +   /* Check that the requested association class, if any, is supported. */
  18.463 +   if (assocClass != NULL) {
  18.464 +      CMPIObjectPath * assoc = CMNewObjectPath(_BROKER, namespace, _ASSOCCLASS, NULL);
  18.465 +      if (!CMClassPathIsA(_BROKER, assoc, assocClass, NULL)) {
  18.466 +         _SBLIM_TRACE(2, ("--- Unrecognized association class. Ignoring request."));
  18.467 +         goto exit;
  18.468 +      }
  18.469 +   }
  18.470 +
  18.471 +   /* Check that the reference matches the required role, if any. */
  18.472 +   if ((role != NULL) && strcmp(role, sourceclass) != 0) {
  18.473 +      _SBLIM_TRACE(2, ("--- Reference does not match required role. Ignoring request."));
  18.474 +      goto exit;
  18.475 +   }
  18.476 +
  18.477 +   /* Determine the target class from the source class. */
  18.478 +   if (CMClassPathIsA(_BROKER, reference, _LHSCLASSNAME, NULL)) {
  18.479 +      targetclass = _RHSCLASSNAME;
  18.480 +      targetnamespace = _RHSNAMESPACE;
  18.481 +      /* Refences of LHS class should always be in LHS namespace. */
  18.482 +      CMSetNameSpace(reference, _LHSNAMESPACE);
  18.483 +   } else if (CMClassPathIsA(_BROKER, reference, _RHSCLASSNAME, NULL)) {
  18.484 +      targetclass = _LHSCLASSNAME;
  18.485 +      targetnamespace = _LHSNAMESPACE;
  18.486 +   } else {
  18.487 +      _SBLIM_TRACE(2, ("--- Unrecognized source class. Ignoring request."));
  18.488 +      goto exit;
  18.489 +   } 
  18.490 +   _SBLIM_TRACE(2, ("--- targetclass=\"%s\"", targetclass));
  18.491 +   _SBLIM_TRACE(2, ("--- targetnamespace=\"%s\"", targetnamespace));
  18.492 +
  18.493 +   /* Create an object path for the result class. */
  18.494 +   CMPIObjectPath * objectpath = CMNewObjectPath(_BROKER, targetnamespace, targetclass, &status);
  18.495 +   if ((status.rc != CMPI_RC_OK) || CMIsNullObject(objectpath)) {
  18.496 +      _SBLIM_TRACE(1,("--- CMNewObjectPath() failed - %s", CMGetCharPtr(status.msg)));
  18.497 +      CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERROR, "Cannot create new CMPIObjectPath");
  18.498 +      goto exit;
  18.499 +   }
  18.500 +
  18.501 +   /* Get the list of all target class object paths from the CIMOM. */
  18.502 +   CMPIEnumeration * objectpaths = CBEnumInstanceNames(_BROKER, context, objectpath, &status);
  18.503 +   if ((status.rc != CMPI_RC_OK) || CMIsNullObject(objectpaths)) {
  18.504 +      _SBLIM_TRACE(1,("--- CBEnumInstanceNames() failed - %s", CMGetCharPtr(status.msg)));
  18.505 +      CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERROR, "Cannot enumerate target class");
  18.506 +      goto exit;
  18.507 +   }
  18.508 +
  18.509 +   /* Return all object paths that exactly match the target class and resultClass, if specified. */
  18.510 +   while (CMHasNext(objectpaths, NULL)) {
  18.511 +      CMPIData data = CMGetNext(objectpaths, NULL);
  18.512 +      char *class = CMGetCharPtr(CMGetClassName(data.value.ref, NULL));
  18.513 +
  18.514 +      /* Ignore possible instances of source class. */
  18.515 +      if (strcmp(class, _OMC_CACHE_MEMORY_CLASS) &&
  18.516 +          strcmp(class,sourceclass)) {
  18.517 +         /* Create an instance for the association. Note that the association
  18.518 +          * objects should exist in 'virt namespace' not the host namespace.
  18.519 +          */
  18.520 +         CMPIInstance * refinstance = _CMNewInstance(_BROKER, _LHSNAMESPACE, _ASSOCCLASS, &status);
  18.521 +         if ((status.rc != CMPI_RC_OK) || CMIsNullObject(refinstance)) {
  18.522 +            _SBLIM_TRACE(1,("--- CMNewInstance() failed - %s", CMGetCharPtr(status.msg)));
  18.523 +            CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERROR, "Cannot create new CMPIInstance");
  18.524 +            goto exit;
  18.525 +         }
  18.526 +
  18.527 +         /* Assign the references in the association appropriately. */
  18.528 +         if (strcmp(sourceclass, _RHSCLASSNAME) == 0) {
  18.529 +            CMSetProperty(refinstance, _RHSPROPERTYNAME, &reference, CMPI_ref);
  18.530 +            CMSetProperty(refinstance, _LHSPROPERTYNAME, &data.value.ref, CMPI_ref);
  18.531 +         } else {
  18.532 +            CMSetProperty(refinstance, _RHSPROPERTYNAME, &data.value.ref, CMPI_ref);
  18.533 +            CMSetProperty(refinstance, _LHSPROPERTYNAME, &reference, CMPI_ref);
  18.534 +         }
  18.535 +         
  18.536 +         CMReturnInstance(results, refinstance);
  18.537 +      }
  18.538 +   }
  18.539 +exit:
  18.540 +   _SBLIM_RETURNSTATUS(status);
  18.541 +}
  18.542 +
  18.543 +
  18.544 +// ----------------------------------------------------------------------------
  18.545 +// AssociationInitialize()
  18.546 +// Perform any necessary initialization immediately after this provider is
  18.547 +// first loaded.
  18.548 +// ----------------------------------------------------------------------------
  18.549 +static void AssociationInitialize(
  18.550 +		CMPIAssociationMI * self,	/* [in] Handle to this provider (i.e. 'self'). */
  18.551 +		CMPIContext * context)		/* [in] Additional context info, if any. */
  18.552 +{
  18.553 +   _SBLIM_ENTER("AssociationInitialize");
  18.554 +   _SBLIM_TRACE(2, ("--- self=\"%s\"", self->ft->miName));
  18.555 +   //   _SBLIM_TRACE(2, ("--- context=\"%s\"", CMGetCharPtr(CDToString(_BROKER, context, NULL))));
  18.556 +
  18.557 +   /* Nothing needs to be done to initialize this provider */
  18.558 +
  18.559 +exit:
  18.560 +   _SBLIM_RETURN();
  18.561 +}
  18.562 +
  18.563 +
  18.564 +// ============================================================================
  18.565 +// CMPI ASSOCIATION PROVIDER FUNCTION TABLE SETUP
  18.566 +// ============================================================================
  18.567 +CMAssociationMIStub( , Xen_MemoryPoolComponent, _BROKER, AssociationInitialize(&mi, ctx));
    19.1 --- a/src/Xen_MemoryPool_Resource.c	Tue Sep 26 15:08:04 2006 -0600
    19.2 +++ b/src/Xen_MemoryPool_Resource.c	Thu Sep 28 17:07:14 2006 -0600
    19.3 @@ -15,11 +15,13 @@
    19.4  //    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
    19.5  // ============================================================================
    19.6  // Authors:       Dr. Gareth S. Bestor, <bestor@us.ibm.com>
    19.7 +//                Jim Fehlig, <jfehlig@novell.com>
    19.8  // Contributors:
    19.9  // Description:
   19.10  // ============================================================================
   19.11  
   19.12  #include <string.h>
   19.13 +#include <stdlib.h>
   19.14  #include <unistd.h>
   19.15  
   19.16  #include "Xen_MemoryPool_Resource.h"
   19.17 @@ -34,6 +36,49 @@
   19.18  
   19.19  // ----------------------------------------------------------------------------
   19.20  
   19.21 +static int populate_resource(_RESOURCE *resource)
   19.22 +{
   19.23 +   /* Get the total host memory from 'xm info' fields. */
   19.24 +   /*
   19.25 +    * TODO:
   19.26 +    * What if we can't determine the total memory or free
   19.27 +    * memory on host?
   19.28 +    */
   19.29 +   FILE * cmd;
   19.30 +   unsigned long long totalmemory = 0;
   19.31 +   if ((cmd = popen("xm info | gawk '/^total_memory/ {print $3}'","r"))) {
   19.32 +      fscanf(cmd, "%llu", &totalmemory);
   19.33 +      pclose(cmd);
   19.34 +   }
   19.35 +   resource->capacity = totalmemory << 20; /* MB -> Bytes */
   19.36 +
   19.37 +   /* Get the unallocated available memory for DomU's.
   19.38 +    * Use the max_free_memory field if it exists, otherwise use
   19.39 +    * free_memory.
   19.40 +    */
   19.41 +   unsigned long long freememory = 0;
   19.42 +   if ((cmd = popen("xm info | gawk '/^max_free_memory/ {print $3}'","r"))) {
   19.43 +      if (fscanf(cmd, "%llu", &freememory) != 1) {
   19.44 +         pclose(cmd);
   19.45 +         if ((cmd = popen("xm info | gawk '/^free_memory/ {print $3}'","r")))
   19.46 +            fscanf(cmd, "%llu", &freememory);
   19.47 +      }
   19.48 +   }
   19.49 +   pclose(cmd);
   19.50 +   
   19.51 +   /*
   19.52 +    * TODO:
   19.53 +    * What if freememory > totalmemory?  For now we'll say all memory
   19.54 +    * is reserved and avoid propogating some strange situation.
   19.55 +    */
   19.56 +   if (freememory > totalmemory)
   19.57 +      resource->reserved = resource->capacity;
   19.58 +   else
   19.59 +      resource->reserved = (totalmemory - freememory) << 20; /* MB -> Bytes */
   19.60 +   
   19.61 +   return 1;
   19.62 +}
   19.63 +
   19.64  /* Get a handle to the list of all system resources for this class. */
   19.65  int Xen_MemoryPool_getResources( _RESOURCES ** resources )
   19.66  {
   19.67 @@ -71,19 +116,10 @@ int Xen_MemoryPool_getNextResource( _RES
   19.68     *resource = (_RESOURCE *)malloc(sizeof(_RESOURCE));
   19.69     if (*resource == NULL) return 0;
   19.70  
   19.71 -   /* Get the total host memory from 'xm info' fields. */
   19.72 -   FILE * cmd = popen("xm info | gawk '/^memory/ {print $3}'","r");
   19.73 -   unsigned long long totalmemory;
   19.74 -   fscanf(cmd, "%llu", &totalmemory);
   19.75 -   pclose(cmd);
   19.76 -   (*resource)->capacity = totalmemory << 20; /* MB -> Bytes */
   19.77 -
   19.78 -   /* Get the unallocated available memory for DomU's. */
   19.79 -   cmd = popen("xm info | gawk '/^free_memory/ {print $3}'","r");
   19.80 -   unsigned long long freememory;
   19.81 -   fscanf(cmd, "%llu", &freememory);
   19.82 -   pclose(cmd);
   19.83 -   (*resource)->reserved = (totalmemory - freememory) << 20; /* MB -> Bytes */
   19.84 +   if (!populate_resource(*resource)) {
   19.85 +      free(*resource);
   19.86 +      return 0;
   19.87 +   }
   19.88   
   19.89     /* Single resource so no more resources in the list. */
   19.90     resources->finished = 1;
   19.91 @@ -116,19 +152,10 @@ int Xen_MemoryPool_getResourceForObjectP
   19.92     *resource = (_RESOURCE *)malloc(sizeof(_RESOURCE));
   19.93     if (*resource == NULL) return 0;
   19.94  
   19.95 -   /* Get the total host memory from 'xm info' fields. */
   19.96 -   FILE * cmd = popen("xm info | gawk '/^memory/ {print $3}'","r");
   19.97 -   unsigned long long totalmemory;
   19.98 -   fscanf(cmd, "%llu", &totalmemory);
   19.99 -   pclose(cmd);
  19.100 -   (*resource)->capacity = totalmemory << 20; /* MB -> Bytes */
  19.101 -
  19.102 -   /* Get the unallocated available memory for DomU's. */
  19.103 -   cmd = popen("xm info | gawk '/^free_memory/ {print $3}'","r");
  19.104 -   unsigned long long freememory;
  19.105 -   fscanf(cmd, "%llu", &freememory);
  19.106 -   pclose(cmd);
  19.107 -   (*resource)->reserved = (totalmemory - freememory) << 20; /* MB -> Bytes */
  19.108 +   if (!populate_resource(*resource)) {
  19.109 +      free(*resource);
  19.110 +      return 0;
  19.111 +   }
  19.112  
  19.113     return 1;
  19.114  }
  19.115 @@ -138,6 +165,11 @@ int Xen_MemoryPool_getResourceForObjectP
  19.116  /* Free/deallocate/cleanup the resource after use. */
  19.117  int Xen_MemoryPool_freeResource( _RESOURCE * resource )
  19.118  {
  19.119 +   if (resource != NULL) {
  19.120 +      free(resource);
  19.121 +      resource = NULL;
  19.122 +   }
  19.123 +
  19.124     return 1;
  19.125  }
  19.126  
  19.127 @@ -158,11 +190,11 @@ int Xen_MemoryPool_setInstanceFromResour
  19.128  #endif
  19.129  
  19.130     /* Set the CMPIInstance properties from the resource data. */
  19.131 -   CMSetProperty(instance, "SystemCreationClassName",(CMPIValue *)"Linux_ComputerSystem", CMPI_chars);
  19.132 -   CMSetProperty(instance, "SystemName",(CMPIValue *)systemname, CMPI_chars);
  19.133 +   CMSetProperty(instance, "InstanceID",(CMPIValue *)"XenMemoryPool", CMPI_chars);
  19.134     CMSetProperty(instance, "PoolID",(CMPIValue *)"XenMemoryPool", CMPI_chars);
  19.135  
  19.136 -   CMSetProperty(instance, "ResourceType",(CMPIValue *)"Memory", CMPI_chars);
  19.137 +   int type = 4; /* 4 == Memory */
  19.138 +   CMSetProperty(instance, "ResourceType",(CMPIValue *)&type, CMPI_uint16);
  19.139     CMSetProperty(instance, "AllocationUnits",(CMPIValue *)"Bytes", CMPI_chars);
  19.140  
  19.141     CMSetProperty(instance, "Capacity",(CMPIValue *)&(resource->capacity), CMPI_uint64);
    20.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    20.2 +++ b/src/Xen_MemorySettingAllocationFromPool.c	Thu Sep 28 17:07:14 2006 -0600
    20.3 @@ -0,0 +1,481 @@
    20.4 +// Copyright (C) 2006 Novell, Inc.
    20.5 +//
    20.6 +//    This library is free software; you can redistribute it and/or
    20.7 +//    modify it under the terms of the GNU Lesser General Public
    20.8 +//    License as published by the Free Software Foundation; either
    20.9 +//    version 2.1 of the License, or (at your option) any later version.
   20.10 +//
   20.11 +//    This library is distributed in the hope that it will be useful,
   20.12 +//    but WITHOUT ANY WARRANTY; without even the implied warranty of
   20.13 +//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   20.14 +//    Lesser General Public License for more details.
   20.15 +//
   20.16 +//    You should have received a copy of the GNU Lesser General Public
   20.17 +//    License along with this library; if not, write to the Free Software
   20.18 +//    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
   20.19 +// ============================================================================
   20.20 +// Authors:       Jim Fehlig, <jfehlig@novell.com>
   20.21 +// Contributors:
   20.22 +// Description:
   20.23 +// ============================================================================
   20.24 +
   20.25 +#include <string.h>
   20.26 +
   20.27 +/* Include the required CMPI data types, function headers, and macros */
   20.28 +#include "cmpidt.h"
   20.29 +#include "cmpift.h"
   20.30 +#include "cmpimacs.h"
   20.31 +
   20.32 +
   20.33 +// ----------------------------------------------------------------------------
   20.34 +// COMMON GLOBAL VARIABLES
   20.35 +// ----------------------------------------------------------------------------
   20.36 +
   20.37 +/* Handle to the CIM broker. Initialized when the provider lib is loaded. */
   20.38 +static CMPIBroker *_BROKER;
   20.39 +
   20.40 +/* Include utility functions */
   20.41 +#include "cmpiutil.h"
   20.42 +
   20.43 +/* Include _SBLIM_TRACE() logging support */
   20.44 +#include "cmpitrace.h"
   20.45 +
   20.46 +
   20.47 +// ============================================================================
   20.48 +// CMPI ASSOCIATION PROVIDER FUNCTION TABLE
   20.49 +// ============================================================================
   20.50 +
   20.51 +// ----------------------------------------------------------------------------
   20.52 +// Info for the class supported by the association provider
   20.53 +// ----------------------------------------------------------------------------
   20.54 +                                                                                                                                 
   20.55 +/* Name of the left and right hand side classes of this association. */
   20.56 +static char * _ASSOCCLASS = "Xen_MemorySettingAllocationFromPool";
   20.57 +static char * _LHSCLASSNAME = "Xen_MemoryPool";
   20.58 +static char * _RHSCLASSNAME = "Xen_MemorySettingData";
   20.59 +static char * _LHSPROPERTYNAME = "Antecedent"; 
   20.60 +static char * _RHSPROPERTYNAME = "Dependent";
   20.61 +
   20.62 +
   20.63 +// ----------------------------------------------------------------------------
   20.64 +// AssociationCleanup()
   20.65 +// Perform any necessary cleanup immediately before this provider is unloaded.
   20.66 +// ----------------------------------------------------------------------------
   20.67 +static CMPIStatus AssociationCleanup(
   20.68 +		CMPIAssociationMI * self,	/* [in] Handle to this provider (i.e. 'self'). */
   20.69 +		CMPIContext * context)		/* [in] Additional context info, if any. */
   20.70 +{
   20.71 +   CMPIStatus status = { CMPI_RC_OK, NULL };	/* Return status of CIM operations. */
   20.72 +
   20.73 +   _SBLIM_ENTER("AssociationCleanup");
   20.74 +   _SBLIM_TRACE(2, ("--- self=\"%s\"", self->ft->miName));
   20.75 +   _SBLIM_TRACE(2, ("--- context=\"%s\"", CMGetCharPtr(CDToString(_BROKER, context, NULL))));
   20.76 +
   20.77 +   /* Nothing needs to be done for cleanup. */
   20.78 +
   20.79 +exit:
   20.80 +   _SBLIM_RETURNSTATUS(status);
   20.81 +}
   20.82 +
   20.83 +
   20.84 +// ----------------------------------------------------------------------------
   20.85 +// AssociatorNames()
   20.86 +// ----------------------------------------------------------------------------
   20.87 +static CMPIStatus AssociatorNames(
   20.88 +		CMPIAssociationMI * self,	/* [in] Handle to this provider (i.e. 'self'). */
   20.89 +		CMPIContext * context,		/* [in] Additional context info, if any. */
   20.90 +		CMPIResult * results,		/* [out] Results of this operation. */
   20.91 +		CMPIObjectPath * reference,	/* [in] Contains source namespace, classname and object path. */
   20.92 +		const char * assocClass,
   20.93 +		const char * resultClass,
   20.94 +		const char * role,
   20.95 +		const char * resultRole)
   20.96 +{
   20.97 +   CMPIStatus status = { CMPI_RC_OK, NULL };    /* Return status of CIM operations. */
   20.98 +   char *namespace = CMGetCharPtr(CMGetNameSpace(reference, NULL)); /* Target namespace. */
   20.99 +   char *sourceclass = CMGetCharPtr(CMGetClassName(reference, &status)); /* Class of the source reference object */
  20.100 +   char *targetclass; 				/* Class of the target object(s). */
  20.101 +
  20.102 +   _SBLIM_ENTER("AssociatorNames");
  20.103 +   _SBLIM_TRACE(2, ("--- self=\"%s\"", self->ft->miName));
  20.104 +   _SBLIM_TRACE(2, ("--- context=\"%s\"", CMGetCharPtr(CDToString(_BROKER, context, NULL))));
  20.105 +   _SBLIM_TRACE(2, ("--- reference=\"%s\"", CMGetCharPtr(CDToString(_BROKER, reference, NULL))));
  20.106 +   _SBLIM_TRACE(2, ("--- assocClass=\"%s\"", assocClass));
  20.107 +   _SBLIM_TRACE(2, ("--- resultClass=\"%s\"", resultClass));
  20.108 +   _SBLIM_TRACE(2, ("--- role=\"%s\"", role));
  20.109 +   _SBLIM_TRACE(2, ("--- resultRole=\"%s\"", resultRole));
  20.110 +   _SBLIM_TRACE(2, ("--- namespace=\"%s\"", namespace));
  20.111 +   _SBLIM_TRACE(2, ("--- sourceclass=\"%s\"", sourceclass));
  20.112 +
  20.113 +   /* Check that the requested association class, if any, is supported. */
  20.114 +   if (assocClass != NULL) {
  20.115 +      CMPIObjectPath * assoc = CMNewObjectPath(_BROKER, namespace, _ASSOCCLASS, NULL);
  20.116 +      if (!CMClassPathIsA(_BROKER, assoc, assocClass, NULL)) {
  20.117 +         _SBLIM_TRACE(2, ("--- Unrecognized association class. Ignoring request."));
  20.118 +         goto exit;
  20.119 +      }
  20.120 +   }
  20.121 +
  20.122 +   /* Check that the reference matches the required role, if any. */
  20.123 +   if ((role != NULL) && strcmp(role, sourceclass) != 0) {
  20.124 +      _SBLIM_TRACE(2, ("--- Reference does not match required role. Ignoring request."));
  20.125 +      goto exit;
  20.126 +   }
  20.127 +
  20.128 +   /* Determine the target class from the source class. */
  20.129 +   if (strcmp(sourceclass, _LHSCLASSNAME) == 0) {
  20.130 +      targetclass = _RHSCLASSNAME;
  20.131 +   } else if (strcmp(sourceclass, _RHSCLASSNAME) == 0) {
  20.132 +      targetclass = _LHSCLASSNAME;
  20.133 +   } else {
  20.134 +      _SBLIM_TRACE(2, ("--- Unrecognized source class. Ignoring request."));
  20.135 +      goto exit;
  20.136 +   }
  20.137 +   _SBLIM_TRACE(2, ("--- targetclass=\"%s\"", targetclass));
  20.138 +
  20.139 +   /* Create an object path for the result class. */
  20.140 +   CMPIObjectPath * objectpath = CMNewObjectPath(_BROKER, namespace, targetclass, &status);
  20.141 +   if ((status.rc != CMPI_RC_OK) || CMIsNullObject(objectpath)) {
  20.142 +      _SBLIM_TRACE(1,("--- CMNewObjectPath() failed - %s", CMGetCharPtr(status.msg)));
  20.143 +      CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERROR, "Cannot create new CMPIObjectPath");
  20.144 +      goto exit;
  20.145 +   }
  20.146 +
  20.147 +   /* Get the list of all target class object paths from the CIMOM. */
  20.148 +   CMPIEnumeration * objectpaths = CBEnumInstanceNames(_BROKER, context, objectpath, &status);
  20.149 +   if ((status.rc != CMPI_RC_OK) || CMIsNullObject(objectpaths)) {
  20.150 +      _SBLIM_TRACE(1,("--- CBEnumInstanceNames() failed - %s", CMGetCharPtr(status.msg)));
  20.151 +      CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERROR, "Cannot enumerate target class");
  20.152 +      goto exit;
  20.153 +   }
  20.154 +
  20.155 +   /* Return all object paths that exactly match the target class and resultClass, if specified. */
  20.156 +   while (CMHasNext(objectpaths, NULL)) {
  20.157 +      CMPIData data = CMGetNext(objectpaths, NULL);
  20.158 +      char *class = CMGetCharPtr(CMGetClassName(data.value.ref, NULL));
  20.159 +      if ((strcmp(class, targetclass) == 0) &&
  20.160 +          (resultClass == NULL || CMClassPathIsA(_BROKER, data.value.ref, resultClass, NULL))) {
  20.161 +         CMReturnObjectPath(results, data.value.ref);
  20.162 +      }
  20.163 +   }
  20.164 +
  20.165 +   CMReturnDone(results);
  20.166 +
  20.167 +exit:
  20.168 +   _SBLIM_RETURNSTATUS(status);
  20.169 +}
  20.170 +
  20.171 +
  20.172 +// ----------------------------------------------------------------------------
  20.173 +// Associators()
  20.174 +// ----------------------------------------------------------------------------
  20.175 +static CMPIStatus Associators(
  20.176 +		CMPIAssociationMI * self,	/* [in] Handle to this provider (i.e. 'self'). */
  20.177 +		CMPIContext * context,		/* [in] Additional context info, if any. */
  20.178 +		CMPIResult * results,		/* [out] Results of this operation. */
  20.179 +		CMPIObjectPath * reference,	/* [in] Contains the source namespace, classname and object path. */
  20.180 +		const char *assocClass,
  20.181 +		const char *resultClass,
  20.182 +		const char *role,
  20.183 +		const char *resultRole,
  20.184 +		char ** properties)		/* [in] List of desired properties (NULL=all). */
  20.185 +{
  20.186 +   CMPIStatus status = { CMPI_RC_OK, NULL };    /* Return status of CIM operations. */
  20.187 +   char *namespace = CMGetCharPtr(CMGetNameSpace(reference, NULL)); /* Target namespace. */
  20.188 +   char *sourceclass = CMGetCharPtr(CMGetClassName(reference, &status)); /* Class of the source reference object */
  20.189 +   char *targetclass;                           /* Class of the target object(s). */
  20.190 +
  20.191 +   _SBLIM_ENTER("Associators");
  20.192 +   _SBLIM_TRACE(2, ("--- self=\"%s\"", self->ft->miName));
  20.193 +   _SBLIM_TRACE(2, ("--- context=\"%s\"", CMGetCharPtr(CDToString(_BROKER, context, NULL))));
  20.194 +   _SBLIM_TRACE(2, ("--- reference=\"%s\"", CMGetCharPtr(CDToString(_BROKER, reference, NULL))));
  20.195 +   _SBLIM_TRACE(2, ("--- assocClass=\"%s\"", assocClass));
  20.196 +   _SBLIM_TRACE(2, ("--- resultClass=\"%s\"", resultClass));
  20.197 +   _SBLIM_TRACE(2, ("--- role=\"%s\"", role));
  20.198 +   _SBLIM_TRACE(2, ("--- resultRole=\"%s\"", resultRole));
  20.199 +   _SBLIM_TRACE(2, ("--- namespace=\"%s\"", namespace));
  20.200 +   _SBLIM_TRACE(2, ("--- sourceclass=\"%s\"", sourceclass));
  20.201 +
  20.202 +   /* Check that the requested association class, if any, is supported. */
  20.203 +   if (assocClass != NULL) {
  20.204 +      CMPIObjectPath * assoc = CMNewObjectPath(_BROKER, namespace, _ASSOCCLASS, NULL);
  20.205 +      if (!CMClassPathIsA(_BROKER, assoc, assocClass, NULL)) {
  20.206 +         _SBLIM_TRACE(2, ("--- Unrecognized association class. Ignoring request."));
  20.207 +         goto exit;
  20.208 +      }
  20.209 +   }
  20.210 +
  20.211 +   /* Check that the reference matches the required role, if any. */
  20.212 +   if ((role != NULL) && strcmp(role, sourceclass) != 0) {
  20.213 +      _SBLIM_TRACE(2, ("--- Reference does not match required role. Ignoring request."));
  20.214 +      goto exit;
  20.215 +   }
  20.216 +   CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_NOT_SUPPORTED, NULL);
  20.217 +
  20.218 +   /* Determine the target class from the source class. */
  20.219 +   if (strcmp(sourceclass, _LHSCLASSNAME) == 0) {
  20.220 +      targetclass = _RHSCLASSNAME;
  20.221 +   } else if (strcmp(sourceclass, _RHSCLASSNAME) == 0) {
  20.222 +      targetclass = _LHSCLASSNAME;
  20.223 +   } else {
  20.224 +      _SBLIM_TRACE(2, ("--- Unrecognized source class. Ignoring request."));
  20.225 +      goto exit;
  20.226 +   }
  20.227 +   _SBLIM_TRACE(2, ("--- targetclass=\"%s\"", targetclass));
  20.228 +
  20.229 +   /* Create an object path for the result class. */
  20.230 +   CMPIObjectPath * objectpath = CMNewObjectPath(_BROKER, namespace, targetclass, &status);
  20.231 +   if ((status.rc != CMPI_RC_OK) || CMIsNullObject(objectpath)) {
  20.232 +      _SBLIM_TRACE(1,("--- CMNewObjectPath() failed - %s", CMGetCharPtr(status.msg)));
  20.233 +      CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERROR, "Cannot create new CMPIObjectPath");
  20.234 +      goto exit;
  20.235 +   }
  20.236 +
  20.237 +   /* Get the list of all target class instances from the CIMOM. */
  20.238 +   CMPIEnumeration * instances = CBEnumInstances(_BROKER, context, objectpath, NULL, &status);
  20.239 +   if ((status.rc != CMPI_RC_OK) || CMIsNullObject(instances)) {
  20.240 +      _SBLIM_TRACE(1,("--- CBEnumInstances() failed - %s", CMGetCharPtr(status.msg)));
  20.241 +      CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERROR, "Cannot enumerate target class");
  20.242 +      goto exit;
  20.243 +   }
  20.244 +
  20.245 +   /* Return all instances that exactly match the target class and resultClass, if specified. */
  20.246 +   while (CMHasNext(instances, NULL)) {
  20.247 +      CMPIData data = CMGetNext(instances, NULL);
  20.248 +      CMPIObjectPath *op = CMGetObjectPath(data.value.inst,NULL);
  20.249 +      CMSetNameSpace(op, namespace);
  20.250 +      char *class = CMGetCharPtr(CMGetClassName(op, NULL));
  20.251 +      if ((strcmp(class, targetclass) == 0) &&
  20.252 +          (resultClass == NULL || CMClassPathIsA(_BROKER, op, resultClass, NULL))) {
  20.253 +         CMReturnInstance(results, data.value.inst);
  20.254 +      }
  20.255 +   }
  20.256 +   
  20.257 +   CMReturnDone(results);
  20.258 +
  20.259 +exit:
  20.260 +   _SBLIM_RETURNSTATUS(status);
  20.261 +}
  20.262 +
  20.263 +
  20.264 +// ----------------------------------------------------------------------------
  20.265 +// ReferenceNames()
  20.266 +// ----------------------------------------------------------------------------
  20.267 +static CMPIStatus ReferenceNames(
  20.268 +		CMPIAssociationMI * self,	/* [in] Handle to this provider (i.e. 'self'). */
  20.269 +		CMPIContext * context,		/* [in] Additional context info, if any. */
  20.270 +		CMPIResult * results,		/* [out] Results of this operation. */
  20.271 +		CMPIObjectPath * reference,	/* [in] Contains the source namespace, classname and object path. */
  20.272 +		const char *assocClass, 
  20.273 +		const char *role)
  20.274 +{
  20.275 +   CMPIStatus status = { CMPI_RC_OK, NULL };    /* Return status of CIM operations. */
  20.276 +   char *namespace = CMGetCharPtr(CMGetNameSpace(reference, NULL)); /* Target namespace. */
  20.277 +   char *sourceclass = CMGetCharPtr(CMGetClassName(reference, &status)); /* Class of the source reference object */
  20.278 +   char *targetclass;                           /* Class of the target object(s). */
  20.279 +
  20.280 +   _SBLIM_ENTER("ReferenceNames");
  20.281 +   _SBLIM_TRACE(2, ("--- self=\"%s\"", self->ft->miName));
  20.282 +   _SBLIM_TRACE(2, ("--- context=\"%s\"", CMGetCharPtr(CDToString(_BROKER, context, NULL))));
  20.283 +   _SBLIM_TRACE(2, ("--- reference=\"%s\"", CMGetCharPtr(CDToString(_BROKER, reference, NULL))));
  20.284 +   _SBLIM_TRACE(2, ("--- assocClass=\"%s\"", assocClass));
  20.285 +   _SBLIM_TRACE(2, ("--- role=\"%s\"", role));
  20.286 +   _SBLIM_TRACE(2, ("--- namespace=\"%s\"", namespace));
  20.287 +   _SBLIM_TRACE(2, ("--- sourceclass=\"%s\"", sourceclass));
  20.288 +
  20.289 +   /* Check that the requested association class, if any, is supported. */
  20.290 +   if (assocClass != NULL) {
  20.291 +      CMPIObjectPath * assoc = CMNewObjectPath(_BROKER, namespace, _ASSOCCLASS, NULL);
  20.292 +      if (!CMClassPathIsA(_BROKER, assoc, assocClass, NULL)) {
  20.293 +         _SBLIM_TRACE(2, ("--- Unrecognized association class. Ignoring request."));
  20.294 +         goto exit;
  20.295 +      }
  20.296 +   }
  20.297 +
  20.298 +   /* Check that the reference matches the required role, if any. */
  20.299 +   if ((role != NULL) && strcmp(role, sourceclass) != 0) {
  20.300 +      _SBLIM_TRACE(2, ("--- Reference does not match required role. Ignoring request."));
  20.301 +      goto exit;
  20.302 +   }
  20.303 +
  20.304 +   /* Determine the target class from the source class. */
  20.305 +   if (strcmp(sourceclass, _LHSCLASSNAME) == 0) {
  20.306 +      targetclass = _RHSCLASSNAME;
  20.307 +   } else if (strcmp(sourceclass, _RHSCLASSNAME) == 0) {
  20.308 +      targetclass = _LHSCLASSNAME;
  20.309 +   } else {
  20.310 +      _SBLIM_TRACE(2, ("--- Unrecognized source class. Ignoring request."));
  20.311 +      goto exit;
  20.312 +   }
  20.313 +   _SBLIM_TRACE(2, ("--- targetclass=\"%s\"", targetclass));
  20.314 +
  20.315 +   /* Create an object path for the result class. */
  20.316 +   CMPIObjectPath * objectpath = CMNewObjectPath(_BROKER, namespace, targetclass, &status);
  20.317 +   if ((status.rc != CMPI_RC_OK) || CMIsNullObject(objectpath)) {
  20.318 +      _SBLIM_TRACE(1,("--- CMNewObjectPath() failed - %s", CMGetCharPtr(status.msg)));
  20.319 +      CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERROR, "Cannot create new CMPIObjectPath");
  20.320 +      goto exit;
  20.321 +   }
  20.322 +
  20.323 +   /* Get the list of all target class object paths from the CIMOM. */
  20.324 +   CMPIEnumeration * objectpaths = CBEnumInstanceNames(_BROKER, context, objectpath, &status);
  20.325 +   if ((status.rc != CMPI_RC_OK) || CMIsNullObject(objectpaths)) {
  20.326 +      _SBLIM_TRACE(1,("--- CBEnumInstanceNames() failed - %s", CMGetCharPtr(status.msg)));
  20.327 +      CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERROR, "Cannot enumerate target class");
  20.328 +      goto exit;
  20.329 +   }
  20.330 +
  20.331 +   /* Return all object paths that exactly match the target class and resultClass, if specified. */
  20.332 +   while (CMHasNext(objectpaths, NULL)) {
  20.333 +      CMPIData data = CMGetNext(objectpaths, NULL);
  20.334 +      char *class = CMGetCharPtr(CMGetClassName(data.value.ref, NULL));
  20.335 +      if (strcmp(class, targetclass) == 0) {
  20.336 +         /* Create an object path for the association. */
  20.337 +         CMPIObjectPath * refobjectpath = CMNewObjectPath(_BROKER, namespace, _ASSOCCLASS, &status);
  20.338 +         if ((status.rc != CMPI_RC_OK) || CMIsNullObject(refobjectpath)) {
  20.339 +            _SBLIM_TRACE(1,("--- CMNewObjectPath() failed - %s", CMGetCharPtr(status.msg)));
  20.340 +            CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERROR, "Cannot create new CMPIObjectPath");
  20.341 +            goto exit;
  20.342 +         }
  20.343 +
  20.344 +         /* Assign the references in the association appropriately. */
  20.345 +         if (strcmp(sourceclass, _RHSCLASSNAME) == 0) {
  20.346 +            CMAddKey(refobjectpath, _RHSPROPERTYNAME, &reference, CMPI_ref);
  20.347 +            CMAddKey(refobjectpath, _LHSPROPERTYNAME, &data.value.ref, CMPI_ref);
  20.348 +         } else {
  20.349 +            CMAddKey(refobjectpath, _RHSPROPERTYNAME, &data.value.ref, CMPI_ref);
  20.350 +            CMAddKey(refobjectpath, _LHSPROPERTYNAME, &reference, CMPI_ref);
  20.351 +         }
  20.352 +
  20.353 +         CMReturnObjectPath(results, refobjectpath);
  20.354 +      }
  20.355 +   }
  20.356 +
  20.357 +exit:
  20.358 +   _SBLIM_RETURNSTATUS(status);
  20.359 +}
  20.360 +
  20.361 +
  20.362 +// ----------------------------------------------------------------------------
  20.363 +// References()
  20.364 +// ----------------------------------------------------------------------------
  20.365 +static CMPIStatus References(
  20.366 +		CMPIAssociationMI * self,	/* [in] Handle to this provider (i.e. 'self'). */
  20.367 +		CMPIContext * context,		/* [in] Additional context info, if any. */
  20.368 +		CMPIResult * results,		/* [out] Results of this operation. */
  20.369 +		CMPIObjectPath * reference,	/* [in] Contains the namespace, classname and desired object path. */
  20.370 +		const char *assocClass,
  20.371 +		const char *role,
  20.372 +		char **properties)		/* [in] List of desired properties (NULL=all). */
  20.373 +{
  20.374 +   CMPIStatus status = { CMPI_RC_OK, NULL };    /* Return status of CIM operations. */
  20.375 +   char *namespace = CMGetCharPtr(CMGetNameSpace(reference, NULL)); /* Target namespace. */
  20.376 +   char *sourceclass = CMGetCharPtr(CMGetClassName(reference, &status)); /* Class of the source reference object */
  20.377 +   char *targetclass;                           /* Class of the target object(s). */
  20.378 +
  20.379 +   _SBLIM_ENTER("References");
  20.380 +   _SBLIM_TRACE(2, ("--- self=\"%s\"", self->ft->miName));
  20.381 +   _SBLIM_TRACE(2, ("--- context=\"%s\"", CMGetCharPtr(CDToString(_BROKER, context, NULL))));
  20.382 +   _SBLIM_TRACE(2, ("--- reference=\"%s\"", CMGetCharPtr(CDToString(_BROKER, reference, NULL))));
  20.383 +   _SBLIM_TRACE(2, ("--- assocClass=\"%s\"", assocClass));
  20.384 +   _SBLIM_TRACE(2, ("--- role=\"%s\"", role));
  20.385 +   _SBLIM_TRACE(2, ("--- namespace=\"%s\"", namespace));
  20.386 +   _SBLIM_TRACE(2, ("--- sourceclass=\"%s\"", sourceclass));
  20.387 +
  20.388 +   /* Check that the requested association class, if any, is supported. */
  20.389 +   if (assocClass != NULL) {
  20.390 +      CMPIObjectPath * assoc = CMNewObjectPath(_BROKER, namespace, _ASSOCCLASS, NULL);
  20.391 +      if (!CMClassPathIsA(_BROKER, assoc, assocClass, NULL)) {
  20.392 +         _SBLIM_TRACE(2, ("--- Unrecognized association class. Ignoring request."));
  20.393 +         goto exit;
  20.394 +      }
  20.395 +   }
  20.396 +
  20.397 +   /* Check that the reference matches the required role, if any. */
  20.398 +   if ((role != NULL) && strcmp(role, sourceclass) != 0) {
  20.399 +      _SBLIM_TRACE(2, ("--- Reference does not match required role. Ignoring request."));
  20.400 +      goto exit;
  20.401 +   }
  20.402 +
  20.403 +   /* Determine the target class from the source class. */
  20.404 +   if (strcmp(sourceclass, _LHSCLASSNAME) == 0) {
  20.405 +      targetclass = _RHSCLASSNAME;
  20.406 +   } else if (strcmp(sourceclass, _RHSCLASSNAME) == 0) {
  20.407 +      targetclass = _LHSCLASSNAME;
  20.408 +   } else {
  20.409 +      _SBLIM_TRACE(2, ("--- Unrecognized source class. Ignoring request."));
  20.410 +      goto exit;
  20.411 +   }
  20.412 +   _SBLIM_TRACE(2, ("--- targetclass=\"%s\"", targetclass));
  20.413 +
  20.414 +   /* Create an object path for the result class. */
  20.415 +   CMPIObjectPath * objectpath = CMNewObjectPath(_BROKER, namespace, targetclass, &status);
  20.416 +   if ((status.rc != CMPI_RC_OK) || CMIsNullObject(objectpath)) {
  20.417 +      _SBLIM_TRACE(1,("--- CMNewObjectPath() failed - %s", CMGetCharPtr(status.msg)));
  20.418 +      CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERROR, "Cannot create new CMPIObjectPath");
  20.419 +      goto exit;
  20.420 +   }
  20.421 +
  20.422 +   /* Get the list of all target class object paths from the CIMOM. */
  20.423 +   CMPIEnumeration * objectpaths = CBEnumInstanceNames(_BROKER, context, objectpath, &status);
  20.424 +   if ((status.rc != CMPI_RC_OK) || CMIsNullObject(objectpaths)) {
  20.425 +      _SBLIM_TRACE(1,("--- CBEnumInstanceNames() failed - %s", CMGetCharPtr(status.msg)));
  20.426 +      CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERROR, "Cannot enumerate target class");
  20.427 +      goto exit;
  20.428 +   }
  20.429 +
  20.430 +   /* Return all object paths that exactly match the target class and resultClass, if specified. */
  20.431 +   while (CMHasNext(objectpaths, NULL)) {
  20.432 +      CMPIData data = CMGetNext(objectpaths, NULL);
  20.433 +      char *class = CMGetCharPtr(CMGetClassName(data.value.ref, NULL));
  20.434 +
  20.435 +      if (strcmp(class, targetclass) == 0) {
  20.436 +         /* Create an instance for the association. */
  20.437 +         CMPIInstance * refinstance = _CMNewInstance(_BROKER, namespace, _ASSOCCLASS, &status);
  20.438 +         if ((status.rc != CMPI_RC_OK) || CMIsNullObject(refinstance)) {
  20.439 +            _SBLIM_TRACE(1,("--- CMNewInstance() failed - %s", CMGetCharPtr(status.msg)));
  20.440 +            CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERROR, "Cannot create new CMPIInstance");
  20.441 +            goto exit;
  20.442 +         }
  20.443 +
  20.444 +         /* Assign the references in the association appropriately. */
  20.445 +         if (strcmp(sourceclass, _RHSCLASSNAME) == 0) {
  20.446 +            CMSetProperty(refinstance, _RHSPROPERTYNAME, &reference, CMPI_ref);
  20.447 +            CMSetProperty(refinstance, _LHSPROPERTYNAME, &data.value.ref, CMPI_ref);
  20.448 +         } else {
  20.449 +            CMSetProperty(refinstance, _RHSPROPERTYNAME, &data.value.ref, CMPI_ref);
  20.450 +            CMSetProperty(refinstance, _LHSPROPERTYNAME, &reference, CMPI_ref);
  20.451 +         }
  20.452 +
  20.453 +         CMReturnInstance(results, refinstance);
  20.454 +      }
  20.455 +   }
  20.456 +exit:
  20.457 +   _SBLIM_RETURNSTATUS(status);
  20.458 +}
  20.459 +
  20.460 +
  20.461 +// ----------------------------------------------------------------------------
  20.462 +// AssociationInitialize()
  20.463 +// Perform any necessary initialization immediately after this provider is
  20.464 +// first loaded.
  20.465 +// ----------------------------------------------------------------------------
  20.466 +static void AssociationInitialize(
  20.467 +		CMPIAssociationMI * self,	/* [in] Handle to this provider (i.e. 'self'). */
  20.468 +		CMPIContext * context)		/* [in] Additional context info, if any. */
  20.469 +{
  20.470 +   _SBLIM_ENTER("AssociationInitialize");
  20.471 +   _SBLIM_TRACE(2, ("--- self=\"%s\"", self->ft->miName));
  20.472 +   //   _SBLIM_TRACE(2, ("--- context=\"%s\"", CMGetCharPtr(CDToString(_BROKER, context, NULL))));
  20.473 +
  20.474 +   /* Nothing needs to be done to initialize this provider */
  20.475 +
  20.476 +exit:
  20.477 +   _SBLIM_RETURN();
  20.478 +}
  20.479 +
  20.480 +
  20.481 +// ============================================================================
  20.482 +// CMPI ASSOCIATION PROVIDER FUNCTION TABLE SETUP
  20.483 +// ============================================================================
  20.484 +CMAssociationMIStub( , Xen_MemorySettingAllocationFromPool, _BROKER, AssociationInitialize(&mi, ctx));
    21.1 --- a/src/Xen_Memory_Resource.c	Tue Sep 26 15:08:04 2006 -0600
    21.2 +++ b/src/Xen_Memory_Resource.c	Thu Sep 28 17:07:14 2006 -0600
    21.3 @@ -157,8 +157,8 @@ int Xen_Memory_setInstanceFromResource( 
    21.4     CMSetProperty(instance, "Purpose",(CMPIValue *)"Main Memory", CMPI_chars);
    21.5     CMSetProperty(instance, "Name",(CMPIValue *)"Memory0", CMPI_chars);
    21.6  
    21.7 -   /* BlockSize = 1MB */
    21.8 -   long blocksize = 1048576;
    21.9 +   /* BlockSize should be set to 1 as per Core/CIM_StorageExtent.mof. */
   21.10 +   long blocksize = 1;
   21.11     CMSetProperty(instance, "BlockSize", (CMPIValue *)&blocksize, CMPI_uint64);
   21.12  
   21.13     if (resource->info != NULL) {
    22.1 --- a/src/Xen_ProcessorAllocatedFromPool.c	Tue Sep 26 15:08:04 2006 -0600
    22.2 +++ b/src/Xen_ProcessorAllocatedFromPool.c	Thu Sep 28 17:07:14 2006 -0600
    22.3 @@ -1,4 +1,4 @@
    22.4 -// Copyright (C) 2006 ??
    22.5 +// Copyright (C) 2006 Novell, Inc.
    22.6  //
    22.7  //    This library is free software; you can redistribute it and/or
    22.8  //    modify it under the terms of the GNU Lesser General Public
    22.9 @@ -14,7 +14,7 @@
   22.10  //    License along with this library; if not, write to the Free Software
   22.11  //    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
   22.12  // ============================================================================
   22.13 -// Authors:       Jim Fehlig <jfehlig@novell.com>
   22.14 +// Authors:       Jim Fehlig, <jfehlig@novell.com>
   22.15  // Contributors:
   22.16  // Description:
   22.17  // ============================================================================
    23.1 --- a/src/Xen_ProcessorPool.c	Tue Sep 26 15:08:04 2006 -0600
    23.2 +++ b/src/Xen_ProcessorPool.c	Thu Sep 28 17:07:14 2006 -0600
    23.3 @@ -15,6 +15,7 @@
    23.4  //    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
    23.5  // ============================================================================
    23.6  // Authors:       Dr. Gareth S. Bestor, <bestor@us.ibm.com>
    23.7 +//                Jim Fehlig, <jfehlig@novell.com>
    23.8  // Contributors:
    23.9  // Description:
   23.10  // ============================================================================
   23.11 @@ -24,6 +25,7 @@
   23.12  #include "cmpift.h"
   23.13  #include "cmpimacs.h"
   23.14  
   23.15 +#include "provider_common.h"
   23.16  
   23.17  // ----------------------------------------------------------------------------
   23.18  // COMMON GLOBAL VARIABLES
   23.19 @@ -89,7 +91,7 @@ static CMPIStatus EnumInstanceNames(
   23.20  		CMPIObjectPath * reference) 	/* [in] Contains target namespace and classname. */
   23.21  {
   23.22     CMPIStatus status = {CMPI_RC_OK, NULL};	/* Return status of CIM operations. */
   23.23 -   _RESOURCES * resources;			/* Handle to the list of system resources. */
   23.24 +   _RESOURCES * resources = NULL;			/* Handle to the list of system resources. */
   23.25     _RESOURCE * resource;			/* Handle to each system resource. */
   23.26     char * namespace = CMGetCharPtr(CMGetNameSpace(reference, NULL)); /* Target namespace. */
   23.27     int found = 0;				/* Found any instances? */
   23.28 @@ -100,6 +102,11 @@ static CMPIStatus EnumInstanceNames(
   23.29     _SBLIM_TRACE(2, ("--- reference=\"%s\"", CMGetCharPtr(CDToString(_BROKER, reference, NULL))));
   23.30     _SBLIM_TRACE(2, ("--- namespace=\"%s\"", namespace));
   23.31  
   23.32 +   if (strcmp(namespace, HOST_INSTRUMENTATION_NS) == 0) {
   23.33 +      _SBLIM_TRACE(1,("--- \"%s\" is not a valid namespace for %s", namespace, _CLASSNAME));
   23.34 +      goto exit;
   23.35 +   }
   23.36 +
   23.37     /* Get a handle to the list of system resources. */
   23.38     if (!Xen_ProcessorPool_getResources(&resources)) {
   23.39        _SBLIM_TRACE(1,("--- _getResources() failed"));
   23.40 @@ -170,7 +177,7 @@ static CMPIStatus EnumInstances(
   23.41  		const char ** properties)	/* [in] List of desired properties (NULL=all). */
   23.42  {
   23.43     CMPIStatus status = {CMPI_RC_OK, NULL};	/* Return status of CIM operations. */
   23.44 -   _RESOURCES * resources;			/* Handle to the list of system resources. */
   23.45 +   _RESOURCES * resources = NULL;			/* Handle to the list of system resources. */
   23.46     _RESOURCE * resource;			/* Handle to each system resource. */
   23.47     char * namespace = CMGetCharPtr(CMGetNameSpace(reference, NULL)); /* Target namespace. */
   23.48     int found = 0;				/* Found any resource instances? */
   23.49 @@ -181,6 +188,11 @@ static CMPIStatus EnumInstances(
   23.50     _SBLIM_TRACE(2, ("--- reference=\"%s\"", CMGetCharPtr(CDToString(_BROKER, reference, NULL))));
   23.51     _SBLIM_TRACE(2, ("--- namespace=\"%s\"", namespace));
   23.52  
   23.53 +   if (strcmp(namespace, HOST_INSTRUMENTATION_NS) == 0) {
   23.54 +      _SBLIM_TRACE(1,("--- \"%s\" is not a valid namespace for %s", namespace, _CLASSNAME));
   23.55 +      goto exit;
   23.56 +   }
   23.57 +
   23.58     /* Get a handle to the list of system resources. */
   23.59     if (!Xen_ProcessorPool_getResources(&resources)) {
   23.60        _SBLIM_TRACE(1,("--- _getResources() failed"));
   23.61 @@ -251,7 +263,7 @@ static CMPIStatus GetInstance(
   23.62  		const char ** properties)		/* [in] List of desired properties (NULL=all). */
   23.63  {
   23.64     CMPIStatus status = {CMPI_RC_OK, NULL};	/* Return status of CIM operations. */
   23.65 -   _RESOURCES * resources;			/* Handle to the list of system resources. */
   23.66 +   _RESOURCES * resources = NULL;			/* Handle to the list of system resources. */
   23.67     _RESOURCE * resource;			/* Handle to the system resource. */
   23.68     char * namespace = CMGetCharPtr(CMGetNameSpace(reference, NULL)); /* Target namespace. */
   23.69     int found = 0;				/* Found the target instance? */
   23.70 @@ -262,6 +274,11 @@ static CMPIStatus GetInstance(
   23.71     _SBLIM_TRACE(2, ("--- reference=\"%s\"", CMGetCharPtr(CDToString(_BROKER, reference, NULL))));
   23.72     _SBLIM_TRACE(2, ("--- namespace=\"%s\"", namespace));
   23.73  
   23.74 +   if (strcmp(namespace, HOST_INSTRUMENTATION_NS) == 0) {
   23.75 +      _SBLIM_TRACE(1,("--- \"%s\" is not a valid namespace for %s", namespace, _CLASSNAME));
   23.76 +      goto exit;
   23.77 +   }
   23.78 +
   23.79     /* Get a handle to the list of system resources. */
   23.80     if (!Xen_ProcessorPool_getResources(&resources)) {
   23.81        _SBLIM_TRACE(1,("--- _getResources() failed"));
   23.82 @@ -336,7 +353,7 @@ static CMPIStatus SetInstance(
   23.83  		CMPIInstance * newinstance)	/* [in] Contains the new instance data. */
   23.84  {
   23.85     CMPIStatus status = {CMPI_RC_OK, NULL};	/* Return status of CIM operations. */
   23.86 -   _RESOURCES * resources;			/* Handle to the list of system resources. */
   23.87 +   _RESOURCES * resources = NULL;			/* Handle to the list of system resources. */
   23.88     _RESOURCE * resource;	       		/* Handle to the system resource. */
   23.89     char * namespace = CMGetCharPtr(CMGetNameSpace(reference, NULL)); /* Target namespace. */
   23.90     int found = 0;				/* Found the target instance? */
   23.91 @@ -348,6 +365,11 @@ static CMPIStatus SetInstance(
   23.92     _SBLIM_TRACE(2, ("--- newinstance=\"%s\"", CMGetCharPtr(CDToString(_BROKER, newinstance, NULL))));
   23.93     _SBLIM_TRACE(2, ("--- namespace=\"%s\"", namespace));
   23.94  
   23.95 +   if (strcmp(namespace, HOST_INSTRUMENTATION_NS) == 0) {
   23.96 +      _SBLIM_TRACE(1,("--- \"%s\" is not a valid namespace for %s", namespace, _CLASSNAME));
   23.97 +      goto exit;
   23.98 +   }
   23.99 +
  23.100     /* Get a handle to the list of system resources. */
  23.101     if (!Xen_ProcessorPool_getResources(&resources)) {
  23.102        _SBLIM_TRACE(1,("--- _getResources() failed"));
  23.103 @@ -408,7 +430,7 @@ static CMPIStatus CreateInstance(
  23.104  		CMPIInstance * newinstance)	/* [in] Contains the new instance data. */
  23.105  {
  23.106     CMPIStatus status = {CMPI_RC_OK, NULL};	/* Return status of CIM operations. */
  23.107 -   _RESOURCES * resources;			/* Handle to the list of system resources. */
  23.108 +   _RESOURCES * resources = NULL;			/* Handle to the list of system resources. */
  23.109     _RESOURCE * resource;			/* Handle to the system resource. */
  23.110     char * namespace = CMGetCharPtr(CMGetNameSpace(reference, NULL)); /* Target namespace. */
  23.111     int found = 0;				/* Found the target instance? */
  23.112 @@ -420,6 +442,11 @@ static CMPIStatus CreateInstance(
  23.113     _SBLIM_TRACE(2, ("--- newinstance=\"%s\"", CMGetCharPtr(CDToString(_BROKER, newinstance, NULL))));
  23.114     _SBLIM_TRACE(2, ("--- namespace=\"%s\"", namespace));
  23.115  
  23.116 +   if (strcmp(namespace, HOST_INSTRUMENTATION_NS) == 0) {
  23.117 +      _SBLIM_TRACE(1,("--- \"%s\" is not a valid namespace for %s", namespace, _CLASSNAME));
  23.118 +      goto exit;
  23.119 +   }
  23.120 +
  23.121     /* WORKAROUND FOR PEGASUS BUG?! reference does not contain object path, only namespace & classname. */
  23.122     reference = CMGetObjectPath(newinstance, NULL);
  23.123  
  23.124 @@ -486,7 +513,7 @@ static CMPIStatus DeleteInstance(
  23.125  		CMPIObjectPath * reference)	/* [in] Contains the target namespace, classname and object path. */
  23.126  {
  23.127     CMPIStatus status = {CMPI_RC_OK, NULL};	/* Return status of CIM operations. */
  23.128 -   _RESOURCES * resources;			/* Handle to the list of system resources. */
  23.129 +   _RESOURCES * resources = NULL;			/* Handle to the list of system resources. */
  23.130     _RESOURCE * resource;		/* Handle to the system resource. */
  23.131     char * namespace = CMGetCharPtr(CMGetNameSpace(reference, NULL)); /* Target namespace. */
  23.132     int found = 0;				/* Found the target instance? */
  23.133 @@ -497,6 +524,11 @@ static CMPIStatus DeleteInstance(
  23.134     _SBLIM_TRACE(2, ("--- reference=\"%s\"", CMGetCharPtr(CDToString(_BROKER, reference, NULL))));
  23.135     _SBLIM_TRACE(2, ("--- namespace=\"%s\"", namespace));
  23.136  
  23.137 +   if (strcmp(namespace, HOST_INSTRUMENTATION_NS) == 0) {
  23.138 +      _SBLIM_TRACE(1,("--- \"%s\" is not a valid namespace for %s", namespace, _CLASSNAME));
  23.139 +      goto exit;
  23.140 +   }
  23.141 +
  23.142     /* Get a handle to the list of system resources. */
  23.143     if (!Xen_ProcessorPool_getResources(&resources)) {
  23.144        _SBLIM_TRACE(1,("--- _getResources() failed"));
  23.145 @@ -569,6 +601,11 @@ static CMPIStatus ExecQuery(
  23.146     _SBLIM_TRACE(2, ("--- query=\"%s\"", query));
  23.147     _SBLIM_TRACE(2, ("--- namespace=\"%s\"", namespace));
  23.148  
  23.149 +   if (strcmp(namespace, HOST_INSTRUMENTATION_NS) == 0) {
  23.150 +      _SBLIM_TRACE(1,("--- \"%s\" is not a valid namespace for %s", namespace, _CLASSNAME));
  23.151 +      goto exit;
  23.152 +   }
  23.153 +
  23.154     /* EXECQUERY() IS NOT YET SUPPORTED FOR THIS CLASS */
  23.155     CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_NOT_SUPPORTED, NULL);
  23.156  
    24.1 --- a/src/Xen_ProcessorPoolComponent.c	Tue Sep 26 15:08:04 2006 -0600
    24.2 +++ b/src/Xen_ProcessorPoolComponent.c	Thu Sep 28 17:07:14 2006 -0600
    24.3 @@ -1,4 +1,4 @@
    24.4 -// Copyright (C) 2006 IBM Corporation
    24.5 +// Copyright (C) 2006 Novell, Inc.
    24.6  //
    24.7  //    This library is free software; you can redistribute it and/or
    24.8  //    modify it under the terms of the GNU Lesser General Public
    24.9 @@ -14,7 +14,7 @@
   24.10  //    License along with this library; if not, write to the Free Software
   24.11  //    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
   24.12  // ============================================================================
   24.13 -// Authors:       Dr. Gareth S. Bestor, <bestor@us.ibm.com>
   24.14 +// Authors:       Jim Fehlig, <jfehlig@novell.com>
   24.15  // Contributors:
   24.16  // Description:
   24.17  // ============================================================================
    25.1 --- a/src/Xen_ProcessorPool_Resource.c	Tue Sep 26 15:08:04 2006 -0600
    25.2 +++ b/src/Xen_ProcessorPool_Resource.c	Thu Sep 28 17:07:14 2006 -0600
    25.3 @@ -15,7 +15,8 @@
    25.4  //    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
    25.5  // ============================================================================
    25.6  // Authors:       Dr. Gareth S. Bestor, <bestor@us.ibm.com>
    25.7 -// Contributors:  Jim Fehlig <jfehlig@novell.com>
    25.8 +//                Jim Fehlig, <jfehlig@novell.com>
    25.9 +// Contributors:
   25.10  // Description:
   25.11  // ============================================================================
   25.12  
   25.13 @@ -40,7 +41,7 @@ static char * _RESOURCECLASSNAME = "CIM_
   25.14  
   25.15  // ----------------------------------------------------------------------------
   25.16  
   25.17 -static int populate_resource( _RESOURCE ** resource, CMPIBroker * broker, CMPIContext * context )
   25.18 +static int populate_resource( _RESOURCE * resource, CMPIBroker * broker, CMPIContext * context )
   25.19  {
   25.20     CMPIStatus status = { CMPI_RC_OK, NULL };    /* Return status of CIM operations. */
   25.21     /* Get the number of host processors from the SMASH host instrumentation. */
   25.22 @@ -60,12 +61,12 @@ static int populate_resource( _RESOURCE 
   25.23           count them (and move the iterator). */
   25.24        CMPIData data = CMGetNext(instances, NULL);
   25.25  
   25.26 -      (*resource)->capacity++;
   25.27 +      resource->capacity++;
   25.28     }
   25.29  
   25.30     /* Xen does not currently support dedicated processor allocation,
   25.31        therefore no processors can be exclusively 'reserved' by a DomU. */
   25.32 -   (*resource)->reserved = 0;
   25.33 +   resource->reserved = 0;
   25.34  
   25.35     return 1;
   25.36  }
   25.37 @@ -108,7 +109,7 @@ int Xen_ProcessorPool_getNextResource( _
   25.38     *resource = (_RESOURCE *)calloc(1, sizeof(_RESOURCE));
   25.39     if (*resource == NULL) return 0;
   25.40  
   25.41 -   if (populate_resource(resource, broker, context) == 0) {
   25.42 +   if (populate_resource(*resource, broker, context) == 0) {
   25.43        free(*resource);
   25.44        *resource = NULL;
   25.45        return 0;
   25.46 @@ -145,7 +146,7 @@ int Xen_ProcessorPool_getResourceForObje
   25.47     *resource = (_RESOURCE *)calloc(1, sizeof(_RESOURCE));
   25.48     if (*resource == NULL) return 0;
   25.49  
   25.50 -   if (populate_resource(resource, broker, context) == 0) {
   25.51 +   if (populate_resource(*resource, broker, context) == 0) {
   25.52        free(*resource);
   25.53        *resource == NULL;
   25.54        return 0;
    26.1 --- a/src/Xen_ProcessorSettingAllocationFromPool.c	Tue Sep 26 15:08:04 2006 -0600
    26.2 +++ b/src/Xen_ProcessorSettingAllocationFromPool.c	Thu Sep 28 17:07:14 2006 -0600
    26.3 @@ -1,4 +1,4 @@
    26.4 -// Copyright (C) 2006 ??
    26.5 +// Copyright (C) 2006 Novell, Inc.
    26.6  //
    26.7  //    This library is free software; you can redistribute it and/or
    26.8  //    modify it under the terms of the GNU Lesser General Public
    26.9 @@ -14,7 +14,7 @@
   26.10  //    License along with this library; if not, write to the Free Software
   26.11  //    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
   26.12  // ============================================================================
   26.13 -// Authors:       Jim Fehlig <jfehlig@novell.com>
   26.14 +// Authors:       Jim Fehlig, <jfehlig@novell.com>
   26.15  // Contributors:
   26.16  // Description:
   26.17  // ============================================================================
    27.1 --- a/src/Xen_VirtualSystemManagementService.c	Tue Sep 26 15:08:04 2006 -0600
    27.2 +++ b/src/Xen_VirtualSystemManagementService.c	Thu Sep 28 17:07:14 2006 -0600
    27.3 @@ -15,6 +15,7 @@
    27.4  //    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
    27.5  // ============================================================================
    27.6  // Authors:       Dr. Gareth S. Bestor, <bestor@us.ibm.com>
    27.7 +//                Jim Fehlig, <jfehlig@novell.com>
    27.8  // Contributors:
    27.9  // Description:
   27.10  // ============================================================================
   27.11 @@ -38,6 +39,8 @@
   27.12  #include "cmpift.h"
   27.13  #include "cmpimacs.h"
   27.14  
   27.15 +#include "provider_common.h"
   27.16 +
   27.17  
   27.18  // ----------------------------------------------------------------------------
   27.19  // COMMON GLOBAL VARIABLES
   27.20 @@ -108,7 +111,7 @@ static CMPIStatus EnumInstanceNames(
   27.21  		CMPIObjectPath * reference) 	/* [in] Contains target namespace and classname. */
   27.22  {
   27.23     CMPIStatus status = {CMPI_RC_OK, NULL};	/* Return status of CIM operations. */
   27.24 -   _RESOURCES * resources;			/* Handle to the list of system resources. */
   27.25 +   _RESOURCES * resources = NULL;			/* Handle to the list of system resources. */
   27.26     _RESOURCE * resource;			/* Handle to each system resource. */
   27.27     char * namespace = CMGetCharPtr(CMGetNameSpace(reference, NULL)); /* Target namespace. */
   27.28     int found = 0;				/* Found any instances? */
   27.29 @@ -119,6 +122,11 @@ static CMPIStatus EnumInstanceNames(
   27.30     _SBLIM_TRACE(2, ("--- reference=\"%s\"", CMGetCharPtr(CDToString(_BROKER, reference, NULL))));
   27.31     _SBLIM_TRACE(2, ("--- namespace=\"%s\"", namespace));
   27.32  
   27.33 +   if (strcmp(namespace, HOST_INSTRUMENTATION_NS) == 0) {
   27.34 +      _SBLIM_TRACE(1,("--- \"%s\" is not a valid namespace for %s", namespace, _CLASSNAME));
   27.35 +      goto exit;
   27.36 +   }
   27.37 +
   27.38     /* Get a handle to the list of system resources. */
   27.39     if (!Xen_VirtualSystemManagementService_getResources(&resources)) {
   27.40        _SBLIM_TRACE(1,("--- _getResources() failed"));
   27.41 @@ -189,7 +197,7 @@ static CMPIStatus EnumInstances(
   27.42  		const char ** properties)	/* [in] List of desired properties (NULL=all). */
   27.43  {
   27.44     CMPIStatus status = {CMPI_RC_OK, NULL};	/* Return status of CIM operations. */
   27.45 -   _RESOURCES * resources;			/* Handle to the list of system resources. */
   27.46 +   _RESOURCES * resources = NULL;			/* Handle to the list of system resources. */
   27.47     _RESOURCE * resource;			/* Handle to each system resource. */
   27.48     char * namespace = CMGetCharPtr(CMGetNameSpace(reference, NULL)); /* Target namespace. */
   27.49     int found = 0;				/* Found any resource instances? */
   27.50 @@ -200,6 +208,11 @@ static CMPIStatus EnumInstances(
   27.51     _SBLIM_TRACE(2, ("--- reference=\"%s\"", CMGetCharPtr(CDToString(_BROKER, reference, NULL))));
   27.52     _SBLIM_TRACE(2, ("--- namespace=\"%s\"", namespace));
   27.53  
   27.54 +   if (strcmp(namespace, HOST_INSTRUMENTATION_NS) == 0) {
   27.55 +      _SBLIM_TRACE(1,("--- \"%s\" is not a valid namespace for %s", namespace, _CLASSNAME));
   27.56 +      goto exit;
   27.57 +   }
   27.58 +
   27.59     /* Get a handle to the list of system resources. */
   27.60     if (!Xen_VirtualSystemManagementService_getResources(&resources)) {
   27.61        _SBLIM_TRACE(1,("--- _getResources() failed"));
   27.62 @@ -270,7 +283,7 @@ static CMPIStatus GetInstance(
   27.63  		const char ** properties)		/* [in] List of desired properties (NULL=all). */
   27.64  {
   27.65     CMPIStatus status = {CMPI_RC_OK, NULL};	/* Return status of CIM operations. */
   27.66 -   _RESOURCES * resources;			/* Handle to the list of system resources. */
   27.67 +   _RESOURCES * resources = NULL;			/* Handle to the list of system resources. */
   27.68     _RESOURCE * resource;			/* Handle to the system resource. */
   27.69     char * namespace = CMGetCharPtr(CMGetNameSpace(reference, NULL)); /* Target namespace. */
   27.70     int found = 0;				/* Found the target instance? */
   27.71 @@ -281,6 +294,11 @@ static CMPIStatus GetInstance(
   27.72     _SBLIM_TRACE(2, ("--- reference=\"%s\"", CMGetCharPtr(CDToString(_BROKER, reference, NULL))));
   27.73     _SBLIM_TRACE(2, ("--- namespace=\"%s\"", namespace));
   27.74  
   27.75 +   if (strcmp(namespace, HOST_INSTRUMENTATION_NS) == 0) {
   27.76 +      _SBLIM_TRACE(1,("--- \"%s\" is not a valid namespace for %s", namespace, _CLASSNAME));
   27.77 +      goto exit;
   27.78 +   }
   27.79 +
   27.80     /* Get a handle to the list of system resources. */
   27.81     if (!Xen_VirtualSystemManagementService_getResources(&resources)) {
   27.82        _SBLIM_TRACE(1,("--- _getResources() failed"));
   27.83 @@ -355,7 +373,7 @@ static CMPIStatus SetInstance(
   27.84  		CMPIInstance * newinstance)	/* [in] Contains the new instance data. */
   27.85  {
   27.86     CMPIStatus status = {CMPI_RC_OK, NULL};	/* Return status of CIM operations. */
   27.87 -   _RESOURCES * resources;			/* Handle to the list of system resources. */
   27.88 +   _RESOURCES * resources = NULL;			/* Handle to the list of system resources. */
   27.89     _RESOURCE * resource;	       		/* Handle to the system resource. */
   27.90     char * namespace = CMGetCharPtr(CMGetNameSpace(reference, NULL)); /* Target namespace. */
   27.91     int found = 0;				/* Found the target instance? */
   27.92 @@ -367,6 +385,11 @@ static CMPIStatus SetInstance(
   27.93     _SBLIM_TRACE(2, ("--- newinstance=\"%s\"", CMGetCharPtr(CDToString(_BROKER, newinstance, NULL))));
   27.94     _SBLIM_TRACE(2, ("--- namespace=\"%s\"", namespace));
   27.95  
   27.96 +   if (strcmp(namespace, HOST_INSTRUMENTATION_NS) == 0) {
   27.97 +      _SBLIM_TRACE(1,("--- \"%s\" is not a valid namespace for %s", namespace, _CLASSNAME));
   27.98 +      goto exit;
   27.99 +   }
  27.100 +
  27.101     /* Get a handle to the list of system resources. */
  27.102     if (!Xen_VirtualSystemManagementService_getResources(&resources)) {
  27.103        _SBLIM_TRACE(1,("--- _getResources() failed"));
  27.104 @@ -427,7 +450,7 @@ static CMPIStatus CreateInstance(
  27.105  		CMPIInstance * newinstance)	/* [in] Contains the new instance data. */
  27.106  {
  27.107     CMPIStatus status = {CMPI_RC_OK, NULL};	/* Return status of CIM operations. */
  27.108 -   _RESOURCES * resources;			/* Handle to the list of system resources. */
  27.109 +   _RESOURCES * resources = NULL;			/* Handle to the list of system resources. */
  27.110     _RESOURCE * resource;			/* Handle to the system resource. */
  27.111     char * namespace = CMGetCharPtr(CMGetNameSpace(reference, NULL)); /* Target namespace. */
  27.112     int found = 0;				/* Found the target instance? */
  27.113 @@ -439,6 +462,11 @@ static CMPIStatus CreateInstance(
  27.114     _SBLIM_TRACE(2, ("--- newinstance=\"%s\"", CMGetCharPtr(CDToString(_BROKER, newinstance, NULL))));
  27.115     _SBLIM_TRACE(2, ("--- namespace=\"%s\"", namespace));
  27.116  
  27.117 +   if (strcmp(namespace, HOST_INSTRUMENTATION_NS) == 0) {
  27.118 +      _SBLIM_TRACE(1,("--- \"%s\" is not a valid namespace for %s", namespace, _CLASSNAME));
  27.119 +      goto exit;
  27.120 +   }
  27.121 +
  27.122     /* WORKAROUND FOR PEGASUS BUG?! reference does not contain object path, only namespace & classname. */
  27.123     reference = CMGetObjectPath(newinstance, NULL);
  27.124  
  27.125 @@ -505,7 +533,7 @@ static CMPIStatus DeleteInstance(
  27.126  		CMPIObjectPath * reference)	/* [in] Contains the target namespace, classname and object path. */
  27.127  {
  27.128     CMPIStatus status = {CMPI_RC_OK, NULL};	/* Return status of CIM operations. */
  27.129 -   _RESOURCES * resources;			/* Handle to the list of system resources. */
  27.130 +   _RESOURCES * resources = NULL;			/* Handle to the list of system resources. */
  27.131     _RESOURCE * resource;		/* Handle to the system resource. */
  27.132     char * namespace = CMGetCharPtr(CMGetNameSpace(reference, NULL)); /* Target namespace. */
  27.133     int found = 0;				/* Found the target instance? */
  27.134 @@ -516,6 +544,11 @@ static CMPIStatus DeleteInstance(
  27.135     _SBLIM_TRACE(2, ("--- reference=\"%s\"", CMGetCharPtr(CDToString(_BROKER, reference, NULL))));
  27.136     _SBLIM_TRACE(2, ("--- namespace=\"%s\"", namespace));
  27.137  
  27.138 +   if (strcmp(namespace, HOST_INSTRUMENTATION_NS) == 0) {
  27.139 +      _SBLIM_TRACE(1,("--- \"%s\" is not a valid namespace for %s", namespace, _CLASSNAME));
  27.140 +      goto exit;
  27.141 +   }
  27.142 +
  27.143     /* Get a handle to the list of system resources. */
  27.144     if (!Xen_VirtualSystemManagementService_getResources(&resources)) {
  27.145        _SBLIM_TRACE(1,("--- _getResources() failed"));
  27.146 @@ -588,6 +621,11 @@ static CMPIStatus ExecQuery(
  27.147     _SBLIM_TRACE(2, ("--- query=\"%s\"", query));
  27.148     _SBLIM_TRACE(2, ("--- namespace=\"%s\"", namespace));
  27.149  
  27.150 +   if (strcmp(namespace, HOST_INSTRUMENTATION_NS) == 0) {
  27.151 +      _SBLIM_TRACE(1,("--- \"%s\" is not a valid namespace for %s", namespace, _CLASSNAME));
  27.152 +      goto exit;
  27.153 +   }
  27.154 +
  27.155     /* EXECQUERY() IS NOT YET SUPPORTED FOR THIS CLASS */
  27.156     CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_NOT_SUPPORTED, NULL);
  27.157  
    28.1 --- a/src/provider_common.h	Tue Sep 26 15:08:04 2006 -0600
    28.2 +++ b/src/provider_common.h	Thu Sep 28 17:07:14 2006 -0600
    28.3 @@ -1,4 +1,4 @@
    28.4 -// Copyright (C) 2006 ??
    28.5 +// Copyright (C) 2006 Novell, Inc.
    28.6  //
    28.7  //    This library is free software; you can redistribute it and/or
    28.8  //    modify it under the terms of the GNU Lesser General Public
    29.1 --- a/src/xm.c	Tue Sep 26 15:08:04 2006 -0600
    29.2 +++ b/src/xm.c	Thu Sep 28 17:07:14 2006 -0600
    29.3 @@ -1,5 +1,5 @@
    29.4  /*******************************************************************************
    29.5 - * Copyright (C) 2006 ???.
    29.6 + * Copyright (C) 2006 Novell, Inc.
    29.7   *
    29.8   * This library is free software; you can redistribute it and/or
    29.9   * modify it under the terms of the GNU Lesser General Public
   29.10 @@ -470,8 +470,8 @@ xml2config(virDomainPtr domainPtr, const
   29.11     dynInfo->id = virDomainGetID(domainPtr);
   29.12     // FIXME
   29.13     //dynInfo->ssidref = ?
   29.14 -   dynInfo->memory.current = dynamicInfo->memory;
   29.15 -   dynInfo->memory.maximum = dynamicInfo->maxMem;
   29.16 +   dynInfo->memory.current = dynamicInfo->memory * 1024;
   29.17 +   dynInfo->memory.maximum = dynamicInfo->maxMem * 1024;
   29.18     // FIXME
   29.19     //dynInfo->cpu = ?
   29.20     dynInfo->vcpus = dynamicInfo->nrVirtCpu;