os-cmpi-xen
changeset 51:ab8e99c757f5
Updated to version 0.7.7 of DMTF SVPC Virtual System Profile.
Signed-off-by: Jim Fehlig <jfehlig@novell.com>
Signed-off-by: Jim Fehlig <jfehlig@novell.com>
line diff
1.1 --- a/Makefile.am Tue Jan 09 11:38:00 2007 -0700 1.2 +++ b/Makefile.am Wed Jan 10 16:52:37 2007 -0700 1.3 @@ -91,13 +91,18 @@ XEN_MOFS = \ 1.4 schema/Xen_RunningOS.mof \ 1.5 schema/Xen_ComputerSystemSettingData.mof \ 1.6 schema/Xen_CSElementSettingData.mof \ 1.7 + schema/Xen_CSSettingsDefineState.mof \ 1.8 schema/Xen_ProcessorSettingData.mof \ 1.9 + schema/Xen_ProcessorSettingsDefineState.mof \ 1.10 schema/Xen_ProcessorElementSettingData.mof \ 1.11 schema/Xen_MemorySettingData.mof \ 1.12 + schema/Xen_MemorySettingsDefineState.mof \ 1.13 schema/Xen_MemoryElementSettingData.mof \ 1.14 schema/Xen_NetworkPortSettingData.mof \ 1.15 + schema/Xen_NPSettingsDefineState.mof \ 1.16 schema/Xen_NetworkPortElementSettingData.mof \ 1.17 schema/Xen_DiskSettingData.mof \ 1.18 + schema/Xen_DiskSettingsDefineState.mof \ 1.19 schema/Xen_DiskElementSettingData.mof \ 1.20 schema/Xen_ResourcePool.mof \ 1.21 schema/Xen_MemoryPool.mof \ 1.22 @@ -147,13 +152,18 @@ XEN_REGS = \ 1.23 schema/Xen_RunningOS.registration \ 1.24 schema/Xen_ComputerSystemSettingData.registration \ 1.25 schema/Xen_CSElementSettingData.registration \ 1.26 + schema/Xen_CSSettingsDefineState.registration \ 1.27 schema/Xen_ProcessorSettingData.registration \ 1.28 + schema/Xen_ProcessorSettingsDefineState.registration \ 1.29 schema/Xen_ProcessorElementSettingData.registration \ 1.30 schema/Xen_MemorySettingData.registration \ 1.31 + schema/Xen_MemorySettingsDefineState.registration \ 1.32 schema/Xen_MemoryElementSettingData.registration \ 1.33 schema/Xen_NetworkPortSettingData.registration \ 1.34 + schema/Xen_NPSettingsDefineState.registration \ 1.35 schema/Xen_NetworkPortElementSettingData.registration \ 1.36 schema/Xen_DiskSettingData.registration \ 1.37 + schema/Xen_DiskSettingsDefineState.registration \ 1.38 schema/Xen_DiskElementSettingData.registration \ 1.39 schema/Xen_MemoryPool.registration \ 1.40 schema/Xen_HostedMemoryPool.registration \ 1.41 @@ -198,7 +208,8 @@ SPVC_MOFS = \ 1.42 schema/dmtf/CIM_VirtualSystemManagementCapabilities.mof \ 1.43 schema/dmtf/CIM_ResourceAllocationFromPool.mof \ 1.44 schema/dmtf/CIM_ResourcePoolSettingData.mof \ 1.45 - schema/dmtf/CIM_PoolAllocatedFromPool.mof 1.46 + schema/dmtf/CIM_PoolAllocatedFromPool.mof \ 1.47 + schema/dmtf/CIM_SettingsDefineState.mof 1.48 1.49 # Until the SPVC schema is public, we keep associated registration 1.50 # files in the project. 1.51 @@ -219,7 +230,8 @@ SPVC_REGS = \ 1.52 schema/dmtf/CIM_VirtualSystemManagementCapabilities.registration \ 1.53 schema/dmtf/CIM_ResourceAllocationFromPool.registration \ 1.54 schema/dmtf/CIM_ResourcePoolSettingData.registration \ 1.55 - schema/dmtf/CIM_PoolAllocatedFromPool.registration 1.56 + schema/dmtf/CIM_PoolAllocatedFromPool.registration \ 1.57 + schema/dmtf/CIM_SettingsDefineState.registration 1.58 1.59 # Some classes must reside in multiple namespaces. We list these here. 1.60 INTEROP_MOFS = \
2.1 --- a/schema/Xen_CSElementSettingData.mof Tue Jan 09 11:38:00 2007 -0700 2.2 +++ b/schema/Xen_CSElementSettingData.mof Wed Jan 10 16:52:37 2007 -0700 2.3 @@ -11,14 +11,16 @@ 2.4 Provider ("cmpi:Xen_CSElementSettingData"), 2.5 Description ( 2.6 "A class derived from CIM_ElementSettingData to represent " 2.7 - "the association of a Xen_ComputerSystem instance with its " 2.8 - "global (i.e. non-device specific) configuration settings.")] 2.9 + "the association of a Xen_ComputerSystemSettingData instance " 2.10 + "describing the extended state of a Xen_ComputerSystem with " 2.11 + "a Xen_ComputerSystemSettingData instance describing its " 2.12 + "defined configuration.")] 2.13 class Xen_CSElementSettingData : CIM_ElementSettingData 2.14 { 2.15 [Override("Dependent")] 2.16 Xen_ComputerSystemSettingData REF SettingData; 2.17 2.18 [Override("ManagedElement")] 2.19 - Xen_ComputerSystem REF ManagedElement; 2.20 + Xen_ComputerSystemSettingData REF ManagedElement; 2.21 }; 2.22
3.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 3.2 +++ b/schema/Xen_CSSettingsDefineState.mof Wed Jan 10 16:52:37 2007 -0700 3.3 @@ -0,0 +1,20 @@ 3.4 +// Copyright (c) 2006 Novell, Inc. All rights reserved. 3.5 + 3.6 +// ================================================================== 3.7 +// Xen_CSSettingsDefineState 3.8 +// ================================================================== 3.9 +[Association, 3.10 + Provider ("cmpi:Xen_CSSettingsDefineState"), 3.11 + Description ( 3.12 + "A class derived from CIM_SettingsDefineState to represent " 3.13 + "the association of a Xen_ComputerSystem instance with its " 3.14 + "extended, virtualization-specific state.")] 3.15 +class Xen_CSSettingsDefineState : CIM_SettingsDefineState 3.16 +{ 3.17 + [Override("ManagedElement")] 3.18 + Xen_ComputerSystem REF ManagedElement; 3.19 + 3.20 + [Override("SettingData")] 3.21 + Xen_ComputerSystemSettingData REF SettingData; 3.22 +}; 3.23 +
4.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 4.2 +++ b/schema/Xen_CSSettingsDefineState.registration Wed Jan 10 16:52:37 2007 -0700 4.3 @@ -0,0 +1,2 @@ 4.4 +# Classname Namespace ProviderName ProviderModule ProviderTypes ... 4.5 +Xen_CSSettingsDefineState root/cimv2 Xen_CSSettingsDefineState Xen_CSSettingsDefineState association
5.1 --- a/schema/Xen_DiskElementSettingData.mof Tue Jan 09 11:38:00 2007 -0700 5.2 +++ b/schema/Xen_DiskElementSettingData.mof Wed Jan 10 16:52:37 2007 -0700 5.3 @@ -1,5 +1,3 @@ 5.4 -// Copyright (c) 2006 IBM. All rights reserved. 5.5 - 5.6 // ******************************************************************* 5.7 // Associations 5.8 // ******************************************************************* 5.9 @@ -11,14 +9,16 @@ 5.10 Provider ("cmpi:Xen_DiskElementSettingData"), 5.11 Description ( 5.12 "A class derived from CIM_ElementSettingData to represent " 5.13 - "the association of a Xen_Disk instance with its " 5.14 - "device specific configuration settings.")] 5.15 + "the association of a Xen_DiskSettingData instance " 5.16 + "describing the extended state of a Xen_Disk instance " 5.17 + "with a Xen_DiskSettingData instance describing its " 5.18 + "defined configuration.")] 5.19 class Xen_DiskElementSettingData : CIM_ElementSettingData 5.20 { 5.21 [Override("Dependent")] 5.22 Xen_DiskSettingData REF SettingData; 5.23 5.24 [Override("ManagedElement")] 5.25 - Xen_Disk REF ManagedElement; 5.26 + Xen_DiskSettingData REF ManagedElement; 5.27 }; 5.28
6.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 6.2 +++ b/schema/Xen_DiskSettingsDefineState.mof Wed Jan 10 16:52:37 2007 -0700 6.3 @@ -0,0 +1,22 @@ 6.4 +// ******************************************************************* 6.5 +// Associations 6.6 +// ******************************************************************* 6.7 + 6.8 +// ================================================================== 6.9 +// Xen_DiskSettingsDefineState 6.10 +// ================================================================== 6.11 +[Association, 6.12 + Provider ("cmpi:Xen_DiskSettingsDefineState"), 6.13 + Description ( 6.14 + "A class derived from CIM_SettingsDefineState to represent " 6.15 + "the association of a Xen_Disk instance with its extended " 6.16 + "device specific configuration settings.")] 6.17 +class Xen_DiskSettingsDefineState : CIM_SettingsDefineState 6.18 +{ 6.19 + [Override("ManagedElement")] 6.20 + Xen_Disk REF ManagedElement; 6.21 + 6.22 + [Override("SettingData")] 6.23 + Xen_DiskSettingData REF SettingData; 6.24 +}; 6.25 +
7.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 7.2 +++ b/schema/Xen_DiskSettingsDefineState.registration Wed Jan 10 16:52:37 2007 -0700 7.3 @@ -0,0 +1,2 @@ 7.4 +# Classname Namespace ProviderName ProviderModule ProviderTypes ... 7.5 +Xen_DiskSettingsDefineState root/cimv2 Xen_DiskSettingsDefineState Xen_DiskSettingsDefineState association
8.1 --- a/schema/Xen_MemoryElementSettingData.mof Tue Jan 09 11:38:00 2007 -0700 8.2 +++ b/schema/Xen_MemoryElementSettingData.mof Wed Jan 10 16:52:37 2007 -0700 8.3 @@ -1,5 +1,3 @@ 8.4 -// Copyright (c) 2006 IBM. All rights reserved. 8.5 - 8.6 // ******************************************************************* 8.7 // Associations 8.8 // ******************************************************************* 8.9 @@ -11,14 +9,16 @@ 8.10 Provider ("cmpi:Xen_MemoryElementSettingData"), 8.11 Description ( 8.12 "A class derived from CIM_ElementSettingData to represent " 8.13 - "the association of a Xen_Memory instance with its " 8.14 - "device specific configuration settings.")] 8.15 + "the association of a Xen_MemorySettingData instance " 8.16 + "describing the extended state of a Xen_Memory instance " 8.17 + "with a Xen_MemorySettingData instance describing its " 8.18 + "defined configuration.")] 8.19 class Xen_MemoryElementSettingData : CIM_ElementSettingData 8.20 { 8.21 [Override("Dependent")] 8.22 Xen_MemorySettingData REF SettingData; 8.23 8.24 [Override("ManagedElement")] 8.25 - Xen_Memory REF ManagedElement; 8.26 + Xen_MemorySettingData REF ManagedElement; 8.27 }; 8.28
9.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 9.2 +++ b/schema/Xen_MemorySettingsDefineState.mof Wed Jan 10 16:52:37 2007 -0700 9.3 @@ -0,0 +1,22 @@ 9.4 +// ******************************************************************* 9.5 +// Associations 9.6 +// ******************************************************************* 9.7 + 9.8 +// ================================================================== 9.9 +// Xen_MemorySettingsDefineState 9.10 +// ================================================================== 9.11 +[Association, 9.12 + Provider ("cmpi:Xen_MemorySettingsDefineState"), 9.13 + Description ( 9.14 + "A class derived from CIM_SettingsDefineState to represent " 9.15 + "the association of a Xen_Memory instance with its extended " 9.16 + "device specific configuration settings.")] 9.17 +class Xen_MemorySettingsDefineState : CIM_SettingsDefineState 9.18 +{ 9.19 + [Override("ManagedElement")] 9.20 + Xen_Memory REF ManagedElement; 9.21 + 9.22 + [Override("SettingData")] 9.23 + Xen_MemorySettingData REF SettingData; 9.24 +}; 9.25 +
10.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 10.2 +++ b/schema/Xen_MemorySettingsDefineState.registration Wed Jan 10 16:52:37 2007 -0700 10.3 @@ -0,0 +1,2 @@ 10.4 +# Classname Namespace ProviderName ProviderModule ProviderTypes ... 10.5 +Xen_MemorySettingsDefineState root/cimv2 Xen_MemorySettingsDefineState Xen_MemorySettingsDefineState association
11.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 11.2 +++ b/schema/Xen_NPSettingsDefineState.mof Wed Jan 10 16:52:37 2007 -0700 11.3 @@ -0,0 +1,22 @@ 11.4 +// ******************************************************************* 11.5 +// Associations 11.6 +// ******************************************************************* 11.7 + 11.8 +// ================================================================== 11.9 +// Xen_NPSettingsDefineState 11.10 +// ================================================================== 11.11 +[Association, 11.12 + Provider ("cmpi:Xen_NPSettingsDefineState"), 11.13 + Description ( 11.14 + "A class derived from CIM_SettingsDefineState to represent " 11.15 + "the association of a Xen_NetworkPort instance with its extended " 11.16 + "device specific configuration settings.")] 11.17 +class Xen_NPSettingsDefineState : CIM_SettingsDefineState 11.18 +{ 11.19 + [Override("ManagedElement")] 11.20 + Xen_NetworkPort REF ManagedElement; 11.21 + 11.22 + [Override("SettingData")] 11.23 + Xen_NetworkPortSettingData REF SettingData; 11.24 +}; 11.25 +
12.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 12.2 +++ b/schema/Xen_NPSettingsDefineState.registration Wed Jan 10 16:52:37 2007 -0700 12.3 @@ -0,0 +1,2 @@ 12.4 +# Classname Namespace ProviderName ProviderModule ProviderTypes ... 12.5 +Xen_NPSettingsDefineState root/cimv2 Xen_NPSettingsDefineState Xen_NPSettingsDefineState association
13.1 --- a/schema/Xen_NetworkPortElementSettingData.mof Tue Jan 09 11:38:00 2007 -0700 13.2 +++ b/schema/Xen_NetworkPortElementSettingData.mof Wed Jan 10 16:52:37 2007 -0700 13.3 @@ -1,5 +1,3 @@ 13.4 -// Copyright (c) 2006 IBM. All rights reserved. 13.5 - 13.6 // ******************************************************************* 13.7 // Associations 13.8 // ******************************************************************* 13.9 @@ -11,14 +9,16 @@ 13.10 Provider ("cmpi:Xen_NetworkPortElementSettingData"), 13.11 Description ( 13.12 "A class derived from CIM_ElementSettingData to represent " 13.13 - "the association of a Xen_NetworkPort instance with its " 13.14 - "device specific configuration settings.")] 13.15 + "the association of a Xen_NetworkPortSettingData instance " 13.16 + "describing the extended state of a Xen_NetworkPort " 13.17 + "instance with a Xen_NetworkPortSettingData instance " 13.18 + "describing its defined configuration.")] 13.19 class Xen_NetworkPortElementSettingData : CIM_ElementSettingData 13.20 { 13.21 [Override("Dependent")] 13.22 Xen_NetworkPortSettingData REF SettingData; 13.23 13.24 [Override("ManagedElement")] 13.25 - Xen_NetworkPort REF ManagedElement; 13.26 + Xen_NetworkPortSettingData REF ManagedElement; 13.27 }; 13.28
14.1 --- a/schema/Xen_ProcessorElementSettingData.mof Tue Jan 09 11:38:00 2007 -0700 14.2 +++ b/schema/Xen_ProcessorElementSettingData.mof Wed Jan 10 16:52:37 2007 -0700 14.3 @@ -1,5 +1,3 @@ 14.4 -// Copyright (c) 2006 IBM. All rights reserved. 14.5 - 14.6 // ******************************************************************* 14.7 // Associations 14.8 // ******************************************************************* 14.9 @@ -11,14 +9,16 @@ 14.10 Provider ("cmpi:Xen_ProcessorElementSettingData"), 14.11 Description ( 14.12 "A class derived from CIM_ElementSettingData to represent " 14.13 - "the association of a Xen_Processor instance with its " 14.14 - "device specific configuration settings.")] 14.15 + "the association of a Xen_ProcessorSettingData instance " 14.16 + "describing the extended state of a Xen_Processor instance " 14.17 + "with a Xen_ProcessorSettingData instance describing its " 14.18 + "defined configuration.")] 14.19 class Xen_ProcessorElementSettingData : CIM_ElementSettingData 14.20 { 14.21 [Override("Dependent")] 14.22 Xen_ProcessorSettingData REF SettingData; 14.23 14.24 [Override("ManagedElement")] 14.25 - Xen_Processor REF ManagedElement; 14.26 + Xen_ProcessorSettingData REF ManagedElement; 14.27 }; 14.28
15.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 15.2 +++ b/schema/Xen_ProcessorSettingsDefineState.mof Wed Jan 10 16:52:37 2007 -0700 15.3 @@ -0,0 +1,22 @@ 15.4 +// ******************************************************************* 15.5 +// Associations 15.6 +// ******************************************************************* 15.7 + 15.8 +// ================================================================== 15.9 +// Xen_ProcessorSettingsDefineState 15.10 +// ================================================================== 15.11 +[Association, 15.12 + Provider ("cmpi:Xen_ProcessorSettingsDefineState"), 15.13 + Description ( 15.14 + "A class derived from CIM_SettingsDefineState to represent " 15.15 + "the association of a Xen_Processor instance with its extended " 15.16 + "device specific configuration settings.")] 15.17 +class Xen_ProcessorSettingsDefineState : CIM_SettingsDefineState 15.18 +{ 15.19 + [Override("ManagedElement")] 15.20 + Xen_Processor REF ManagedElement; 15.21 + 15.22 + [Override("SettingData")] 15.23 + Xen_ProcessorSettingData REF SettingData; 15.24 +}; 15.25 +
16.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 16.2 +++ b/schema/Xen_ProcessorSettingsDefineState.registration Wed Jan 10 16:52:37 2007 -0700 16.3 @@ -0,0 +1,2 @@ 16.4 +# Classname Namespace ProviderName ProviderModule ProviderTypes ... 16.5 +Xen_ProcessorSettingsDefineState root/cimv2 Xen_ProcessorSettingsDefineState Xen_ProcessorSettingsDefineState association
17.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 17.2 +++ b/schema/dmtf/CIM_SettingsDefineState.mof Wed Jan 10 16:52:37 2007 -0700 17.3 @@ -0,0 +1,27 @@ 17.4 +// ================================================================== 17.5 +// CIM_SettingsDefineState 17.6 +// ================================================================== 17.7 + [Association, Experimental, Version ( "2.14.0" ), Description ( 17.8 + "SettingsDefineState is used to associate an instance of SettingData " 17.9 + "with an instance of ManagedElement. This association indicates that " 17.10 + "the SettingData instance provides additional information about the " 17.11 + "Current State of the associated ManagedElement.\n " 17.12 + "State is broadly defined to include the configuration, status, " 17.13 + "capabilities, settings and other information of a class or association " 17.14 + "instance. \n" 17.15 + "Use of the same instance of SettingData to represent more than one of " 17.16 + "Current State (SettingsDefineState) and Desired State (ElementSettingData) " 17.17 + "and Possible State (SettingsDefineCapabilities) for a ManagedElement " 17.18 + "is not recommended." ), 17.19 + UMLPackagePath ( "CIM::Core::Settings" )] 17.20 +class CIM_SettingsDefineState { 17.21 + 17.22 + [Key, Description ( 17.23 + "The managed element.")] 17.24 + CIM_ManagedElement REF ManagedElement; 17.25 + 17.26 + [Key, Description ( 17.27 + "The SettingData object that provides additional information about " 17.28 + "the current state and configuration of the ManagedElement.")] 17.29 + CIM_SettingData REF SettingData; 17.30 +}; 17.31 \ No newline at end of file
18.1 --- a/src/Makefile.am Tue Jan 09 11:38:00 2007 -0700 18.2 +++ b/src/Makefile.am Wed Jan 10 16:52:37 2007 -0700 18.3 @@ -83,8 +83,10 @@ provider_LTLIBRARIES = \ 18.4 libXen_Processor.la \ 18.5 libXen_HostedProcessor.la \ 18.6 libXen_ComputerSystemProcessor.la \ 18.7 + libXen_Disk.la \ 18.8 libXen_HostedDisk.la \ 18.9 libXen_ComputerSystemDisk.la \ 18.10 + libXen_NetworkPort.la \ 18.11 libXen_HostedNetworkPort.la \ 18.12 libXen_ComputerSystemNetworkPort.la \ 18.13 libXen_ComputerSystemIndication.la \ 18.14 @@ -93,12 +95,19 @@ provider_LTLIBRARIES = \ 18.15 libXen_OperatingSystem.la \ 18.16 libXen_RunningOS.la \ 18.17 libXen_ComputerSystemSettingData.la \ 18.18 + libXen_CSSettingsDefineState.la \ 18.19 libXen_CSElementSettingData.la \ 18.20 libXen_ProcessorSettingData.la \ 18.21 + libXen_ProcessorSettingsDefineState.la \ 18.22 libXen_ProcessorElementSettingData.la \ 18.23 libXen_MemorySettingData.la \ 18.24 + libXen_MemorySettingsDefineState.la \ 18.25 libXen_MemoryElementSettingData.la \ 18.26 + libXen_NetworkPortSettingData.la \ 18.27 + libXen_NPSettingsDefineState.la \ 18.28 libXen_NetworkPortElementSettingData.la \ 18.29 + libXen_DiskSettingData.la \ 18.30 + libXen_DiskSettingsDefineState.la \ 18.31 libXen_DiskElementSettingData.la \ 18.32 libXen_MemoryPool.la \ 18.33 libXen_HostedMemoryPool.la \ 18.34 @@ -119,11 +128,8 @@ provider_LTLIBRARIES = \ 18.35 libXen_ComputerSystemCapabilities.la \ 18.36 libXen_VirtualSystemManagementCapabilities.la \ 18.37 libXen_CSElementCapabilities.la \ 18.38 - libXen_VSMSElementCapabilities.la \ 18.39 - libXen_Disk.la \ 18.40 - libXen_DiskSettingData.la \ 18.41 - libXen_NetworkPort.la \ 18.42 - libXen_NetworkPortSettingData.la 18.43 + libXen_VSMSElementCapabilities.la 18.44 + 18.45 18.46 libXen_ProviderCommon_la_SOURCES = cmpitrace.c cmpiutil.c xen_utils.c 18.47 libXen_ProviderCommon_la_CFLAGS = $(LIBXEN_CFLAGS) $(libxml2_CFLAGS) 18.48 @@ -203,6 +209,9 @@ libXen_ComputerSystemSettingData_la_SOUR 18.49 libXen_ComputerSystemSettingData_la_LIBADD = libXen_ProviderCommon.la 18.50 libXen_ComputerSystemSettingData_la_CFLAGS = -I../ $(LIBXEN_CFLAGS) 18.51 18.52 +libXen_CSSettingsDefineState_la_SOURCES = Xen_CSSettingsDefineState.c 18.53 +libXen_CSSettingsDefineState_la_LIBADD = libXen_ProviderCommon.la 18.54 + 18.55 libXen_CSElementSettingData_la_SOURCES = Xen_CSElementSettingData.c 18.56 libXen_CSElementSettingData_la_LIBADD = libXen_ProviderCommon.la 18.57 18.58 @@ -210,6 +219,9 @@ libXen_ProcessorSettingData_la_SOURCES = 18.59 libXen_ProcessorSettingData_la_LIBADD = libXen_ProviderCommon.la 18.60 libXen_ProcessorSettingData_la_CFLAGS = -I../ $(LIBXEN_CFLAGS) 18.61 18.62 +libXen_ProcessorSettingsDefineState_la_SOURCES = Xen_ProcessorSettingsDefineState.c 18.63 +libXen_ProcessorSettingsDefineState_la_LIBADD = libXen_ProviderCommon.la 18.64 + 18.65 libXen_ProcessorElementSettingData_la_SOURCES = Xen_ProcessorElementSettingData.c 18.66 libXen_ProcessorElementSettingData_la_LIBADD = libXen_ProviderCommon.la 18.67 18.68 @@ -217,6 +229,9 @@ libXen_MemorySettingData_la_SOURCES = Xe 18.69 libXen_MemorySettingData_la_LIBADD = libXen_ProviderCommon.la 18.70 libXen_MemorySettingData_la_CFLAGS = -I../ $(LIBXEN_CFLAGS) 18.71 18.72 +libXen_MemorySettingsDefineState_la_SOURCES = Xen_MemorySettingsDefineState.c 18.73 +libXen_MemorySettingsDefineState_la_LIBADD = libXen_ProviderCommon.la 18.74 + 18.75 libXen_MemoryElementSettingData_la_SOURCES = Xen_MemoryElementSettingData.c 18.76 libXen_MemoryElementSettingData_la_LIBADD = libXen_ProviderCommon.la 18.77 18.78 @@ -224,6 +239,9 @@ libXen_NetworkPortSettingData_la_SOURCES 18.79 libXen_NetworkPortSettingData_la_LIBADD = libXen_ProviderCommon.la 18.80 libXen_NetworkPortSettingData_la_CFLAGS = -I../ $(LIBXEN_CFLAGS) 18.81 18.82 +libXen_NPSettingsDefineState_la_SOURCES = Xen_NPSettingsDefineState.c 18.83 +libXen_NPSettingsDefineState_la_LIBADD = libXen_ProviderCommon.la 18.84 + 18.85 libXen_NetworkPortElementSettingData_la_SOURCES = Xen_NetworkPortElementSettingData.c 18.86 libXen_NetworkPortElementSettingData_la_LIBADD = libXen_ProviderCommon.la 18.87 18.88 @@ -231,6 +249,9 @@ libXen_DiskSettingData_la_SOURCES = Xen_ 18.89 libXen_DiskSettingData_la_LIBADD = libXen_ProviderCommon.la 18.90 libXen_DiskSettingData_la_CFLAGS = -I../ $(LIBXEN_CFLAGS) 18.91 18.92 +libXen_DiskSettingsDefineState_la_SOURCES = Xen_DiskSettingsDefineState.c 18.93 +libXen_DiskSettingsDefineState_la_LIBADD = libXen_ProviderCommon.la 18.94 + 18.95 libXen_DiskElementSettingData_la_SOURCES = Xen_DiskElementSettingData.c 18.96 libXen_DiskElementSettingData_la_LIBADD = libXen_ProviderCommon.la 18.97
19.1 --- a/src/Xen_CSElementCapabilities.c Tue Jan 09 11:38:00 2007 -0700 19.2 +++ b/src/Xen_CSElementCapabilities.c Wed Jan 10 16:52:37 2007 -0700 19.3 @@ -228,7 +228,6 @@ static CMPIStatus Associators( 19.4 _SBLIM_TRACE(2, ("--- Reference does not match required role. Ignoring request.")); 19.5 goto exit; 19.6 } 19.7 - CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_NOT_SUPPORTED, NULL); 19.8 19.9 /* Determine the target class from the source class. */ 19.10 if (strcmp(sourceclass, _LHSCLASSNAME) == 0) {
20.1 --- a/src/Xen_CSElementSettingData.c Tue Jan 09 11:38:00 2007 -0700 20.2 +++ b/src/Xen_CSElementSettingData.c Wed Jan 10 16:52:37 2007 -0700 20.3 @@ -52,11 +52,11 @@ static const CMPIBroker *_BROKER; 20.4 /* Name of the left and right hand side classes of this association. */ 20.5 static char * _ASSOCCLASS = "Xen_CSElementSettingData"; 20.6 static char * _LHSCLASSNAME = "Xen_ComputerSystemSettingData"; 20.7 -static char * _RHSCLASSNAME = "Xen_ComputerSystem"; 20.8 +static char * _RHSCLASSNAME = "Xen_ComputerSystemSettingData"; 20.9 static char * _LHSPROPERTYNAME = "SettingData"; 20.10 static char * _RHSPROPERTYNAME = "ManagedElement"; 20.11 static char * _LHSKEYNAME = "InstanceID"; 20.12 -static char * _RHSKEYNAME = "Name"; 20.13 +static char * _RHSKEYNAME = "InstanceID"; 20.14 20.15 // ---------------------------------------------------------------------------- 20.16 // AssociationCleanup() 20.17 @@ -226,7 +226,6 @@ static CMPIStatus Associators( 20.18 _SBLIM_TRACE(2, ("--- Reference does not match required role. Ignoring request.")); 20.19 goto exit; 20.20 } 20.21 - CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_NOT_SUPPORTED, NULL); 20.22 20.23 /* Determine the target class from the source class. */ 20.24 if (strcmp(sourceclass, _LHSCLASSNAME) == 0) { 20.25 @@ -271,9 +270,9 @@ static CMPIStatus Associators( 20.26 /* Only return entries whose name matches the reference. */ 20.27 namedata = CMGetProperty(data.value.inst, targetkeyname, NULL); 20.28 char * resultname = CMGetCharPtr(namedata.value.string); 20.29 -// BUG - returning data causes crash !?! 20.30 -_SBLIM_TRACE(2, ("--- data.value.inst=\"%s\"", CMGetCharPtr(CDToString(_BROKER, data.value.inst, NULL)))); 20.31 -// if (strcmp(sourcename, resultname) == 0) CMReturnInstance(results, data.value.inst); 20.32 + // BUG - returning data causes crash !?! 20.33 + _SBLIM_TRACE(2, ("--- data.value.inst=\"%s\"", CMGetCharPtr(CDToString(_BROKER, data.value.inst, NULL)))); 20.34 + if (strcmp(sourcename, resultname) == 0) CMReturnInstance(results, data.value.inst); 20.35 } 20.36 } 20.37
21.1 --- a/src/Xen_CSSettingDataComponent.c Tue Jan 09 11:38:00 2007 -0700 21.2 +++ b/src/Xen_CSSettingDataComponent.c Wed Jan 10 16:52:37 2007 -0700 21.3 @@ -233,7 +233,6 @@ static CMPIStatus Associators( 21.4 _SBLIM_TRACE(2, ("--- Reference does not match required role. Ignoring request.")); 21.5 goto exit; 21.6 } 21.7 - CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_NOT_SUPPORTED, NULL); 21.8 21.9 /* Determine the target class from the source class. */ 21.10 // if (strcmp(sourceclass, _LHSCLASSNAME) == 0) { 21.11 @@ -283,9 +282,9 @@ static CMPIStatus Associators( 21.12 /* Only return entries whose name matches the reference. */ 21.13 namedata = CMGetProperty(data.value.inst, targetkeyname, NULL); 21.14 char * resultname = CMGetCharPtr(namedata.value.string); 21.15 -// BUG - returning data causes crash !?! 21.16 -_SBLIM_TRACE(2, ("--- data.value.inst=\"%s\"", CMGetCharPtr(CDToString(_BROKER, data.value.inst, NULL)))); 21.17 -// if (strcmp(sourcename, resultname) == 0) CMReturnInstance(results, data.value.inst); 21.18 + // BUG - returning data causes crash !?! 21.19 + _SBLIM_TRACE(2, ("--- data.value.inst=\"%s\"", CMGetCharPtr(CDToString(_BROKER, data.value.inst, NULL)))); 21.20 + if (strcmp(sourcename, resultname) == 0) CMReturnInstance(results, data.value.inst); 21.21 } 21.22 } 21.23
22.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 22.2 +++ b/src/Xen_CSSettingsDefineState.c Wed Jan 10 16:52:37 2007 -0700 22.3 @@ -0,0 +1,530 @@ 22.4 +// Copyright (C) 2006 Novell, Inc. 22.5 +// 22.6 +// This library is free software; you can redistribute it and/or 22.7 +// modify it under the terms of the GNU Lesser General Public 22.8 +// License as published by the Free Software Foundation; either 22.9 +// version 2.1 of the License, or (at your option) any later version. 22.10 +// 22.11 +// This library is distributed in the hope that it will be useful, 22.12 +// but WITHOUT ANY WARRANTY; without even the implied warranty of 22.13 +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 22.14 +// Lesser General Public License for more details. 22.15 +// 22.16 +// You should have received a copy of the GNU Lesser General Public 22.17 +// License along with this library; if not, write to the Free Software 22.18 +// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 22.19 +// ============================================================================ 22.20 +// Authors: Jim Fehlig, <jfehlig@novell.com> 22.21 +// Description: 22.22 +// ============================================================================ 22.23 + 22.24 +#include <string.h> 22.25 + 22.26 +/* Include the required CMPI data types, function headers, and macros */ 22.27 +#include "cmpidt.h" 22.28 +#include "cmpift.h" 22.29 +#include "cmpimacs.h" 22.30 + 22.31 + 22.32 +// ---------------------------------------------------------------------------- 22.33 +// COMMON GLOBAL VARIABLES 22.34 +// ---------------------------------------------------------------------------- 22.35 + 22.36 +/* Handle to the CIM broker. Initialized when the provider lib is loaded. */ 22.37 +static const CMPIBroker *_BROKER; 22.38 + 22.39 +/* Include utility functions */ 22.40 +#include "cmpiutil.h" 22.41 +#include "provider_common.h" 22.42 + 22.43 +/* Include _SBLIM_TRACE() logging support */ 22.44 +#include "cmpitrace.h" 22.45 + 22.46 + 22.47 +// ============================================================================ 22.48 +// CMPI ASSOCIATION PROVIDER FUNCTION TABLE 22.49 +// ============================================================================ 22.50 + 22.51 +// ---------------------------------------------------------------------------- 22.52 +// Info for the class supported by the association provider 22.53 +// ---------------------------------------------------------------------------- 22.54 + 22.55 +/* Name of the left and right hand side classes of this association. */ 22.56 +static char * _ASSOCCLASS = "Xen_CSSettingsDefineState"; 22.57 +static char * _LHSCLASSNAME = "Xen_ComputerSystemSettingData"; 22.58 +static char * _RHSCLASSNAME = "Xen_ComputerSystem"; 22.59 +static char * _LHSPROPERTYNAME = "SettingData"; 22.60 +static char * _RHSPROPERTYNAME = "ManagedElement"; 22.61 +static char * _LHSKEYNAME = "InstanceID"; 22.62 +static char * _RHSKEYNAME = "Name"; 22.63 + 22.64 +// ---------------------------------------------------------------------------- 22.65 +// AssociationCleanup() 22.66 +// Perform any necessary cleanup immediately before this provider is unloaded. 22.67 +// ---------------------------------------------------------------------------- 22.68 +static CMPIStatus AssociationCleanup( 22.69 + CMPIAssociationMI * self, /* [in] Handle to this provider (i.e. 'self'). */ 22.70 + const CMPIContext * context, /* [in] Additional context info, if any. */ 22.71 + CMPIBoolean terminating) /* [in] True if MB is terminating */ 22.72 +{ 22.73 + CMPIStatus status = { CMPI_RC_OK, NULL }; /* Return status of CIM operations. */ 22.74 + 22.75 + _SBLIM_ENTER("AssociationCleanup"); 22.76 + _SBLIM_TRACE(2, ("--- self=\"%s\"", self->ft->miName)); 22.77 + _SBLIM_TRACE(2, ("--- context=\"%s\"", CMGetCharPtr(CDToString(_BROKER, context, NULL)))); 22.78 + 22.79 + /* Nothing needs to be done for cleanup. */ 22.80 + _SBLIM_RETURNSTATUS(status); 22.81 +} 22.82 + 22.83 + 22.84 +// ---------------------------------------------------------------------------- 22.85 +// AssociatorNames() 22.86 +// ---------------------------------------------------------------------------- 22.87 +static CMPIStatus AssociatorNames( 22.88 + CMPIAssociationMI * self, /* [in] Handle to this provider (i.e. 'self'). */ 22.89 + const CMPIContext * context, /* [in] Additional context info, if any. */ 22.90 + const CMPIResult * results, /* [out] Results of this operation. */ 22.91 + const CMPIObjectPath * reference, /* [in] Contains source namespace, classname and object path. */ 22.92 + const char * assocClass, 22.93 + const char * resultClass, 22.94 + const char * role, 22.95 + const char * resultRole) 22.96 +{ 22.97 + CMPIStatus status = { CMPI_RC_OK, NULL }; /* Return status of CIM operations. */ 22.98 + char *namespace = CMGetCharPtr(CMGetNameSpace(reference, NULL)); /* Target namespace. */ 22.99 + char *sourceclass = CMGetCharPtr(CMGetClassName(reference, &status)); /* Class of the source reference object */ 22.100 + char *targetclass; /* Class of the target object(s). */ 22.101 + char *sourcekeyname; 22.102 + char *targetkeyname; 22.103 + 22.104 + _SBLIM_ENTER("AssociatorNames"); 22.105 + _SBLIM_TRACE(2, ("--- self=\"%s\"", self->ft->miName)); 22.106 + _SBLIM_TRACE(2, ("--- context=\"%s\"", CMGetCharPtr(CDToString(_BROKER, context, NULL)))); 22.107 + _SBLIM_TRACE(2, ("--- reference=\"%s\"", CMGetCharPtr(CDToString(_BROKER, reference, NULL)))); 22.108 + _SBLIM_TRACE(2, ("--- assocClass=\"%s\"", assocClass)); 22.109 + _SBLIM_TRACE(2, ("--- resultClass=\"%s\"", resultClass)); 22.110 + _SBLIM_TRACE(2, ("--- role=\"%s\"", role)); 22.111 + _SBLIM_TRACE(2, ("--- resultRole=\"%s\"", resultRole)); 22.112 + _SBLIM_TRACE(2, ("--- namespace=\"%s\"", namespace)); 22.113 + _SBLIM_TRACE(2, ("--- sourceclass=\"%s\"", sourceclass)); 22.114 + 22.115 + /* Check that the requested association class, if any, is supported. */ 22.116 + if (assocClass != NULL) { 22.117 + CMPIObjectPath * assoc = CMNewObjectPath(_BROKER, namespace, _ASSOCCLASS, NULL); 22.118 + if (!CMClassPathIsA(_BROKER, assoc, assocClass, NULL)) { 22.119 + _SBLIM_TRACE(2, ("--- Unrecognized association class. Ignoring request.")); 22.120 + goto exit; 22.121 + } 22.122 + } 22.123 + 22.124 + /* Check that the reference matches the required role, if any. */ 22.125 + if ((role != NULL) && strcmp(role, sourceclass) != 0) { 22.126 + _SBLIM_TRACE(2, ("--- Reference does not match required role. Ignoring request.")); 22.127 + goto exit; 22.128 + } 22.129 + 22.130 + /* Determine the target class from the source class. */ 22.131 + if (strcmp(sourceclass, _LHSCLASSNAME) == 0) { 22.132 + sourcekeyname = _LHSKEYNAME; 22.133 + targetclass = _RHSCLASSNAME; 22.134 + targetkeyname = _RHSKEYNAME; 22.135 + } else if (strcmp(sourceclass, _RHSCLASSNAME) == 0) { 22.136 + sourcekeyname = _RHSKEYNAME; 22.137 + targetclass = _LHSCLASSNAME; 22.138 + targetkeyname = _LHSKEYNAME; 22.139 + } else { 22.140 + _SBLIM_TRACE(2, ("--- Unrecognized source class. Ignoring request.")); 22.141 + goto exit; 22.142 + } 22.143 + _SBLIM_TRACE(2, ("--- targetclass=\"%s\"", targetclass)); 22.144 + 22.145 + CMPIData namedata = CMGetKey(reference, sourcekeyname, NULL); 22.146 + char * sourcename = CMGetCharPtr(namedata.value.string); 22.147 + _SBLIM_TRACE(2, ("--- sourcename=\"%s\"", sourcename)); 22.148 + 22.149 + /* Create an object path for the result class. */ 22.150 + CMPIObjectPath * objectpath = CMNewObjectPath(_BROKER, namespace, targetclass, &status); 22.151 + if ((status.rc != CMPI_RC_OK) || CMIsNullObject(objectpath)) { 22.152 + _SBLIM_TRACE(1,("--- CMNewObjectPath() failed - %s", CMGetCharPtr(status.msg))); 22.153 + CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERROR, "Cannot create new CMPIObjectPath"); 22.154 + goto exit; 22.155 + } 22.156 + 22.157 + /* Get the list of all target class object paths from the CIMOM. */ 22.158 + CMPIEnumeration * objectpaths = CBEnumInstanceNames(_BROKER, context, objectpath, &status); 22.159 + if ((status.rc != CMPI_RC_OK) || CMIsNullObject(objectpaths)) { 22.160 + _SBLIM_TRACE(1,("--- CBEnumInstanceNames() failed - %s", CMGetCharPtr(status.msg))); 22.161 + CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERROR, "Cannot enumerate target class"); 22.162 + goto exit; 22.163 + } 22.164 + 22.165 + /* Return all object paths that exactly match the target class and resultClass, if specified. */ 22.166 + while (CMHasNext(objectpaths, NULL)) { 22.167 + CMPIData data = CMGetNext(objectpaths, NULL); 22.168 + char *class = CMGetCharPtr(CMGetClassName(data.value.ref, NULL)); 22.169 + if ((strcmp(class,targetclass) == 0) && ((resultClass == NULL) || (strcmp(class,resultClass) == 0))) { 22.170 + /* Only return entries whose name matches the reference. */ 22.171 + namedata = CMGetKey(data.value.ref, targetkeyname, &status); 22.172 + char * resultname = CMGetCharPtr(namedata.value.string); 22.173 + if (strcmp(sourcename, resultname) == 0) CMReturnObjectPath(results, data.value.ref); 22.174 + } 22.175 + } 22.176 + 22.177 + CMReturnDone(results); 22.178 + 22.179 +exit: 22.180 + _SBLIM_RETURNSTATUS(status); 22.181 +} 22.182 + 22.183 + 22.184 +// ---------------------------------------------------------------------------- 22.185 +// Associators() 22.186 +// ---------------------------------------------------------------------------- 22.187 +static CMPIStatus Associators( 22.188 + CMPIAssociationMI * self, /* [in] Handle to this provider (i.e. 'self'). */ 22.189 + const CMPIContext * context, /* [in] Additional context info, if any. */ 22.190 + const CMPIResult * results, /* [out] Results of this operation. */ 22.191 + const CMPIObjectPath * reference, /* [in] Contains the source namespace, classname and object path. */ 22.192 + const char *assocClass, 22.193 + const char *resultClass, 22.194 + const char *role, 22.195 + const char *resultRole, 22.196 + const char ** properties) /* [in] List of desired properties (NULL=all). */ 22.197 +{ 22.198 + CMPIStatus status = { CMPI_RC_OK, NULL }; /* Return status of CIM operations. */ 22.199 + char *namespace = CMGetCharPtr(CMGetNameSpace(reference, NULL)); /* Target namespace. */ 22.200 + char *sourceclass = CMGetCharPtr(CMGetClassName(reference, &status)); /* Class of the source reference object */ 22.201 + char *targetclass; /* Class of the target object(s). */ 22.202 + char *sourcekeyname; 22.203 + char *targetkeyname; 22.204 + 22.205 + _SBLIM_ENTER("Associators"); 22.206 + _SBLIM_TRACE(2, ("--- self=\"%s\"", self->ft->miName)); 22.207 + _SBLIM_TRACE(2, ("--- context=\"%s\"", CMGetCharPtr(CDToString(_BROKER, context, NULL)))); 22.208 + _SBLIM_TRACE(2, ("--- reference=\"%s\"", CMGetCharPtr(CDToString(_BROKER, reference, NULL)))); 22.209 + _SBLIM_TRACE(2, ("--- assocClass=\"%s\"", assocClass)); 22.210 + _SBLIM_TRACE(2, ("--- resultClass=\"%s\"", resultClass)); 22.211 + _SBLIM_TRACE(2, ("--- role=\"%s\"", role)); 22.212 + _SBLIM_TRACE(2, ("--- resultRole=\"%s\"", resultRole)); 22.213 + _SBLIM_TRACE(2, ("--- namespace=\"%s\"", namespace)); 22.214 + _SBLIM_TRACE(2, ("--- sourceclass=\"%s\"", sourceclass)); 22.215 + 22.216 + /* Check that the requested association class, if any, is supported. */ 22.217 + if (assocClass != NULL) { 22.218 + CMPIObjectPath * assoc = CMNewObjectPath(_BROKER, namespace, _ASSOCCLASS, NULL); 22.219 + if (!CMClassPathIsA(_BROKER, assoc, assocClass, NULL)) { 22.220 + _SBLIM_TRACE(2, ("--- Unrecognized association class. Ignoring request.")); 22.221 + goto exit; 22.222 + } 22.223 + } 22.224 + 22.225 + /* Check that the reference matches the required role, if any. */ 22.226 + if ((role != NULL) && strcmp(role, sourceclass) != 0) { 22.227 + _SBLIM_TRACE(2, ("--- Reference does not match required role. Ignoring request.")); 22.228 + goto exit; 22.229 + } 22.230 + 22.231 + /* Determine the target class from the source class. */ 22.232 + if (strcmp(sourceclass, _LHSCLASSNAME) == 0) { 22.233 + sourcekeyname = _LHSKEYNAME; 22.234 + targetclass = _RHSCLASSNAME; 22.235 + targetkeyname = _RHSKEYNAME; 22.236 + } else if (strcmp(sourceclass, _RHSCLASSNAME) == 0) { 22.237 + sourcekeyname = _RHSKEYNAME; 22.238 + targetclass = _LHSCLASSNAME; 22.239 + targetkeyname = _LHSKEYNAME; 22.240 + } else { 22.241 + _SBLIM_TRACE(2, ("--- Unrecognized source class. Ignoring request.")); 22.242 + goto exit; 22.243 + } 22.244 + _SBLIM_TRACE(2, ("--- targetclass=\"%s\"", targetclass)); 22.245 + 22.246 + CMPIData namedata = CMGetKey(reference, sourcekeyname, NULL); 22.247 + char * sourcename = CMGetCharPtr(namedata.value.string); 22.248 + _SBLIM_TRACE(2, ("--- sourcename=\"%s\"", sourcename)); 22.249 + 22.250 + /* Create an object path for the result class. */ 22.251 + CMPIObjectPath * objectpath = CMNewObjectPath(_BROKER, namespace, targetclass, &status); 22.252 + if ((status.rc != CMPI_RC_OK) || CMIsNullObject(objectpath)) { 22.253 + _SBLIM_TRACE(1,("--- CMNewObjectPath() failed - %s", CMGetCharPtr(status.msg))); 22.254 + CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERROR, "Cannot create new CMPIObjectPath"); 22.255 + goto exit; 22.256 + } 22.257 + 22.258 + /* Get the list of all target class instances from the CIMOM. */ 22.259 + CMPIEnumeration * instances = CBEnumInstances(_BROKER, context, objectpath, NULL, &status); 22.260 + if ((status.rc != CMPI_RC_OK) || CMIsNullObject(instances)) { 22.261 + _SBLIM_TRACE(1,("--- CBEnumInstances() failed - %s", CMGetCharPtr(status.msg))); 22.262 + CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERROR, "Cannot enumerate target class"); 22.263 + goto exit; 22.264 + } 22.265 + 22.266 + /* Return all instances that exactly match the target class and resultClass, if specified. */ 22.267 + while (CMHasNext(instances, NULL)) { 22.268 + CMPIData data = CMGetNext(instances, NULL); 22.269 + char *class = CMGetCharPtr(CMGetClassName(CMGetObjectPath(data.value.inst,NULL), NULL)); 22.270 + if ((strcmp(class,targetclass) == 0) && ((resultClass == NULL) || (strcmp(class,resultClass) == 0))) { 22.271 + /* Only return entries whose name matches the reference. */ 22.272 + namedata = CMGetProperty(data.value.inst, targetkeyname, NULL); 22.273 + char * resultname = CMGetCharPtr(namedata.value.string); 22.274 + // BUG - returning data causes crash !?! 22.275 + _SBLIM_TRACE(2, ("--- data.value.inst=\"%s\"", CMGetCharPtr(CDToString(_BROKER, data.value.inst, NULL)))); 22.276 + if (strcmp(sourcename, resultname) == 0) CMReturnInstance(results, data.value.inst); 22.277 + } 22.278 + } 22.279 + 22.280 + CMReturnDone(results); 22.281 + 22.282 +exit: 22.283 + _SBLIM_RETURNSTATUS(status); 22.284 +} 22.285 + 22.286 + 22.287 +// ---------------------------------------------------------------------------- 22.288 +// ReferenceNames() 22.289 +// ---------------------------------------------------------------------------- 22.290 +static CMPIStatus ReferenceNames( 22.291 + CMPIAssociationMI * self, /* [in] Handle to this provider (i.e. 'self'). */ 22.292 + const CMPIContext * context, /* [in] Additional context info, if any. */ 22.293 + const CMPIResult * results, /* [out] Results of this operation. */ 22.294 + const CMPIObjectPath * reference, /* [in] Contains the source namespace, classname and object path. */ 22.295 + const char *assocClass, 22.296 + const char *role) 22.297 +{ 22.298 + CMPIStatus status = { CMPI_RC_OK, NULL }; /* Return status of CIM operations. */ 22.299 + char *namespace = CMGetCharPtr(CMGetNameSpace(reference, NULL)); /* Target namespace. */ 22.300 + char *sourceclass = CMGetCharPtr(CMGetClassName(reference, &status)); /* Class of the source reference object */ 22.301 + char *targetclass; /* Class of the target object(s). */ 22.302 + char *sourcekeyname; 22.303 + char *targetkeyname; 22.304 + 22.305 + _SBLIM_ENTER("ReferenceNames"); 22.306 + _SBLIM_TRACE(2, ("--- self=\"%s\"", self->ft->miName)); 22.307 + _SBLIM_TRACE(2, ("--- context=\"%s\"", CMGetCharPtr(CDToString(_BROKER, context, NULL)))); 22.308 + _SBLIM_TRACE(2, ("--- reference=\"%s\"", CMGetCharPtr(CDToString(_BROKER, reference, NULL)))); 22.309 + _SBLIM_TRACE(2, ("--- assocClass=\"%s\"", assocClass)); 22.310 + _SBLIM_TRACE(2, ("--- role=\"%s\"", role)); 22.311 + _SBLIM_TRACE(2, ("--- namespace=\"%s\"", namespace)); 22.312 + _SBLIM_TRACE(2, ("--- sourceclass=\"%s\"", sourceclass)); 22.313 + 22.314 + /* Check that the requested association class, if any, is supported. */ 22.315 + if (assocClass != NULL) { 22.316 + CMPIObjectPath * assoc = CMNewObjectPath(_BROKER, namespace, _ASSOCCLASS, NULL); 22.317 + if (!CMClassPathIsA(_BROKER, assoc, assocClass, NULL)) { 22.318 + _SBLIM_TRACE(2, ("--- Unrecognized association class. Ignoring request.")); 22.319 + goto exit; 22.320 + } 22.321 + } 22.322 + 22.323 + /* Check that the reference matches the required role, if any. */ 22.324 + if ((role != NULL) && strcmp(role, sourceclass) != 0) { 22.325 + _SBLIM_TRACE(2, ("--- Reference does not match required role. Ignoring request.")); 22.326 + goto exit; 22.327 + } 22.328 + 22.329 + /* Determine the target class from the source class. */ 22.330 + if (strcmp(sourceclass, _LHSCLASSNAME) == 0) { 22.331 + sourcekeyname = _LHSKEYNAME; 22.332 + targetclass = _RHSCLASSNAME; 22.333 + targetkeyname = _RHSKEYNAME; 22.334 + } else if (strcmp(sourceclass, _RHSCLASSNAME) == 0) { 22.335 + sourcekeyname = _RHSKEYNAME; 22.336 + targetclass = _LHSCLASSNAME; 22.337 + targetkeyname = _LHSKEYNAME; 22.338 + } else { 22.339 + _SBLIM_TRACE(2, ("--- Unrecognized source class. Ignoring request.")); 22.340 + goto exit; 22.341 + } 22.342 + _SBLIM_TRACE(2, ("--- targetclass=\"%s\"", targetclass)); 22.343 + 22.344 + CMPIData namedata = CMGetKey(reference, sourcekeyname, NULL); 22.345 + char * sourcename = CMGetCharPtr(namedata.value.string); 22.346 + _SBLIM_TRACE(2, ("--- sourcename=\"%s\"", sourcename)); 22.347 + 22.348 + /* Create an object path for the result class. */ 22.349 + CMPIObjectPath * objectpath = CMNewObjectPath(_BROKER, namespace, targetclass, &status); 22.350 + if ((status.rc != CMPI_RC_OK) || CMIsNullObject(objectpath)) { 22.351 + _SBLIM_TRACE(1,("--- CMNewObjectPath() failed - %s", CMGetCharPtr(status.msg))); 22.352 + CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERROR, "Cannot create new CMPIObjectPath"); 22.353 + goto exit; 22.354 + } 22.355 + 22.356 + /* Get the list of all target class object paths from the CIMOM. */ 22.357 + CMPIEnumeration * objectpaths = CBEnumInstanceNames(_BROKER, context, objectpath, &status); 22.358 + if ((status.rc != CMPI_RC_OK) || CMIsNullObject(objectpaths)) { 22.359 + _SBLIM_TRACE(1,("--- CBEnumInstanceNames() failed - %s", CMGetCharPtr(status.msg))); 22.360 + CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERROR, "Cannot enumerate target class"); 22.361 + goto exit; 22.362 + } 22.363 + 22.364 + /* Return all object paths that exactly match the target class and resultClass, if specified. */ 22.365 + while (CMHasNext(objectpaths, NULL)) { 22.366 + CMPIData data = CMGetNext(objectpaths, NULL); 22.367 + char *class = CMGetCharPtr(CMGetClassName(data.value.ref, NULL)); 22.368 + if (strcmp(class,targetclass) == 0) { 22.369 + 22.370 + /* Create an object path for the association. */ 22.371 + CMPIObjectPath * refobjectpath = CMNewObjectPath(_BROKER, namespace, _ASSOCCLASS, &status); 22.372 + if ((status.rc != CMPI_RC_OK) || CMIsNullObject(refobjectpath)) { 22.373 + _SBLIM_TRACE(1,("--- CMNewObjectPath() failed - %s", CMGetCharPtr(status.msg))); 22.374 + CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERROR, "Cannot create new CMPIObjectPath"); 22.375 + goto exit; 22.376 + } 22.377 + 22.378 + /* Assign the references in the association appropriately. */ 22.379 + if (strcmp(sourceclass, _RHSCLASSNAME) == 0) { 22.380 + CMAddKey(refobjectpath, _RHSPROPERTYNAME, &reference, CMPI_ref); 22.381 + CMAddKey(refobjectpath, _LHSPROPERTYNAME, &data.value.ref, CMPI_ref); 22.382 + } else { 22.383 + CMAddKey(refobjectpath, _RHSPROPERTYNAME, &data.value.ref, CMPI_ref); 22.384 + CMAddKey(refobjectpath, _LHSPROPERTYNAME, &reference, CMPI_ref); 22.385 + } 22.386 + 22.387 + /* Only return entries whose name matches the reference. */ 22.388 + namedata = CMGetKey(data.value.ref, targetkeyname, &status); 22.389 + char * resultname = CMGetCharPtr(namedata.value.string); 22.390 + if (strcmp(sourcename, resultname) == 0) CMReturnObjectPath(results, refobjectpath); 22.391 + } 22.392 + } 22.393 + 22.394 +exit: 22.395 + _SBLIM_RETURNSTATUS(status); 22.396 +} 22.397 + 22.398 + 22.399 +// ---------------------------------------------------------------------------- 22.400 +// References() 22.401 +// ---------------------------------------------------------------------------- 22.402 +static CMPIStatus References( 22.403 + CMPIAssociationMI * self, /* [in] Handle to this provider (i.e. 'self'). */ 22.404 + const CMPIContext * context, /* [in] Additional context info, if any. */ 22.405 + const CMPIResult * results, /* [out] Results of this operation. */ 22.406 + const CMPIObjectPath * reference, /* [in] Contains the namespace, classname and desired object path. */ 22.407 + const char *assocClass, 22.408 + const char *role, 22.409 + const char **properties) /* [in] List of desired properties (NULL=all). */ 22.410 +{ 22.411 + CMPIStatus status = { CMPI_RC_OK, NULL }; /* Return status of CIM operations. */ 22.412 + char *namespace = CMGetCharPtr(CMGetNameSpace(reference, NULL)); /* Target namespace. */ 22.413 + char *sourceclass = CMGetCharPtr(CMGetClassName(reference, &status)); /* Class of the source reference object */ 22.414 + char *targetclass; /* Class of the target object(s). */ 22.415 + char *sourcekeyname; 22.416 + char *targetkeyname; 22.417 + 22.418 + _SBLIM_ENTER("References"); 22.419 + _SBLIM_TRACE(2, ("--- self=\"%s\"", self->ft->miName)); 22.420 + _SBLIM_TRACE(2, ("--- context=\"%s\"", CMGetCharPtr(CDToString(_BROKER, context, NULL)))); 22.421 + _SBLIM_TRACE(2, ("--- reference=\"%s\"", CMGetCharPtr(CDToString(_BROKER, reference, NULL)))); 22.422 + _SBLIM_TRACE(2, ("--- assocClass=\"%s\"", assocClass)); 22.423 + _SBLIM_TRACE(2, ("--- role=\"%s\"", role)); 22.424 + _SBLIM_TRACE(2, ("--- namespace=\"%s\"", namespace)); 22.425 + _SBLIM_TRACE(2, ("--- sourceclass=\"%s\"", sourceclass)); 22.426 + 22.427 + /* Check that the requested association class, if any, is supported. */ 22.428 + if (assocClass != NULL) { 22.429 + CMPIObjectPath * assoc = CMNewObjectPath(_BROKER, namespace, _ASSOCCLASS, NULL); 22.430 + if (!CMClassPathIsA(_BROKER, assoc, assocClass, NULL)) { 22.431 + _SBLIM_TRACE(2, ("--- Unrecognized association class. Ignoring request.")); 22.432 + goto exit; 22.433 + } 22.434 + } 22.435 + 22.436 + /* Check that the reference matches the required role, if any. */ 22.437 + if ((role != NULL) && strcmp(role, sourceclass) != 0) { 22.438 + _SBLIM_TRACE(2, ("--- Reference does not match required role. Ignoring request.")); 22.439 + goto exit; 22.440 + } 22.441 + 22.442 + /* Determine the target class from the source class. */ 22.443 + if (strcmp(sourceclass, _LHSCLASSNAME) == 0) { 22.444 + sourcekeyname = _LHSKEYNAME; 22.445 + targetclass = _RHSCLASSNAME; 22.446 + targetkeyname = _RHSKEYNAME; 22.447 + } else if (strcmp(sourceclass, _RHSCLASSNAME) == 0) { 22.448 + sourcekeyname = _RHSKEYNAME; 22.449 + targetclass = _LHSCLASSNAME; 22.450 + targetkeyname = _LHSKEYNAME; 22.451 + } else { 22.452 + _SBLIM_TRACE(2, ("--- Unrecognized source class. Ignoring request.")); 22.453 + goto exit; 22.454 + } 22.455 + _SBLIM_TRACE(2, ("--- targetclass=\"%s\"", targetclass)); 22.456 + 22.457 + CMPIData namedata = CMGetKey(reference, sourcekeyname, NULL); 22.458 + char * sourcename = CMGetCharPtr(namedata.value.string); 22.459 + _SBLIM_TRACE(2, ("--- sourcename=\"%s\"", sourcename)); 22.460 + 22.461 + /* Create an object path for the result class. */ 22.462 + CMPIObjectPath * objectpath = CMNewObjectPath(_BROKER, namespace, targetclass, &status); 22.463 + if ((status.rc != CMPI_RC_OK) || CMIsNullObject(objectpath)) { 22.464 + _SBLIM_TRACE(1,("--- CMNewObjectPath() failed - %s", CMGetCharPtr(status.msg))); 22.465 + CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERROR, "Cannot create new CMPIObjectPath"); 22.466 + goto exit; 22.467 + } 22.468 + 22.469 + /* Get the list of all target class object paths from the CIMOM. */ 22.470 + CMPIEnumeration * objectpaths = CBEnumInstanceNames(_BROKER, context, objectpath, &status); 22.471 + if ((status.rc != CMPI_RC_OK) || CMIsNullObject(objectpaths)) { 22.472 + _SBLIM_TRACE(1,("--- CBEnumInstanceNames() failed - %s", CMGetCharPtr(status.msg))); 22.473 + CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERROR, "Cannot enumerate target class"); 22.474 + goto exit; 22.475 + } 22.476 + 22.477 + /* Return all object paths that exactly match the target class and resultClass, if specified. */ 22.478 + while (CMHasNext(objectpaths, NULL)) { 22.479 + CMPIData data = CMGetNext(objectpaths, NULL); 22.480 + char *class = CMGetCharPtr(CMGetClassName(data.value.ref, NULL)); 22.481 + if (strcmp(class,targetclass) == 0) { 22.482 + 22.483 + /* Create an instance for the association. */ 22.484 + CMPIInstance * refinstance = _CMNewInstance(_BROKER, namespace, _ASSOCCLASS, &status); 22.485 + if ((status.rc != CMPI_RC_OK) || CMIsNullObject(refinstance)) { 22.486 + _SBLIM_TRACE(1,("--- CMNewInstance() failed - %s", CMGetCharPtr(status.msg))); 22.487 + CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERROR, "Cannot create new CMPIInstance"); 22.488 + goto exit; 22.489 + } 22.490 + 22.491 + /* Assign the references in the association appropriately. */ 22.492 + if (strcmp(sourceclass, _RHSCLASSNAME) == 0) { 22.493 + CMSetProperty(refinstance, _RHSPROPERTYNAME, &reference, CMPI_ref); 22.494 + CMSetProperty(refinstance, _LHSPROPERTYNAME, &data.value.ref, CMPI_ref); 22.495 + } else { 22.496 + CMSetProperty(refinstance, _RHSPROPERTYNAME, &data.value.ref, CMPI_ref); 22.497 + CMSetProperty(refinstance, _LHSPROPERTYNAME, &reference, CMPI_ref); 22.498 + } 22.499 + 22.500 + /* Only return entries whose name matches the reference. */ 22.501 + namedata = CMGetKey(data.value.ref, targetkeyname, &status); 22.502 + char * resultname = CMGetCharPtr(namedata.value.string); 22.503 + if (strcmp(sourcename, resultname) == 0) CMReturnInstance(results, refinstance); 22.504 + } 22.505 + } 22.506 + 22.507 +exit: 22.508 + _SBLIM_RETURNSTATUS(status); 22.509 +} 22.510 + 22.511 + 22.512 +// ---------------------------------------------------------------------------- 22.513 +// AssociationInitialize() 22.514 +// Perform any necessary initialization immediately after this provider is 22.515 +// first loaded. 22.516 +// ---------------------------------------------------------------------------- 22.517 +static void AssociationInitialize( 22.518 + CMPIAssociationMI * self, /* [in] Handle to this provider (i.e. 'self'). */ 22.519 + const CMPIContext * context) /* [in] Additional context info, if any. */ 22.520 +{ 22.521 + _SBLIM_ENTER("AssociationInitialize"); 22.522 + _SBLIM_TRACE(2, ("--- self=\"%s\"", self->ft->miName)); 22.523 + // _SBLIM_TRACE(2, ("--- context=\"%s\"", CMGetCharPtr(CDToString(_BROKER, context, NULL)))); 22.524 + 22.525 + /* Nothing needs to be done to initialize this provider */ 22.526 + _SBLIM_RETURN(); 22.527 +} 22.528 + 22.529 + 22.530 +// ============================================================================ 22.531 +// CMPI ASSOCIATION PROVIDER FUNCTION TABLE SETUP 22.532 +// ============================================================================ 22.533 +CMAssociationMIStub( , Xen_CSSettingsDefineState, _BROKER, AssociationInitialize(&mi, ctx));
23.1 --- a/src/Xen_ComputerSystemDisk.c Tue Jan 09 11:38:00 2007 -0700 23.2 +++ b/src/Xen_ComputerSystemDisk.c Wed Jan 10 16:52:37 2007 -0700 23.3 @@ -226,7 +226,6 @@ static CMPIStatus Associators( 23.4 _SBLIM_TRACE(2, ("--- Reference does not match required role. Ignoring request.")); 23.5 goto exit; 23.6 } 23.7 - CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_NOT_SUPPORTED, NULL); 23.8 23.9 /* Determine the target class from the source class. */ 23.10 if (strcmp(sourceclass, _LHSCLASSNAME) == 0) { 23.11 @@ -271,9 +270,9 @@ static CMPIStatus Associators( 23.12 /* Only return entries whose name matches the reference. */ 23.13 namedata = CMGetProperty(data.value.inst, targetkeyname, NULL); 23.14 char * resultname = CMGetCharPtr(namedata.value.string); 23.15 -// BUG - returning data causes crash !?! 23.16 -_SBLIM_TRACE(2, ("--- data.value.inst=\"%s\"", CMGetCharPtr(CDToString(_BROKER, data.value.inst, NULL)))); 23.17 -// if (strcmp(sourcename, resultname) == 0) CMReturnInstance(results, data.value.inst); 23.18 + // BUG - returning data causes crash !?! 23.19 + _SBLIM_TRACE(2, ("--- data.value.inst=\"%s\"", CMGetCharPtr(CDToString(_BROKER, data.value.inst, NULL)))); 23.20 + if (strcmp(sourcename, resultname) == 0) CMReturnInstance(results, data.value.inst); 23.21 } 23.22 } 23.23
24.1 --- a/src/Xen_ComputerSystemMemory.c Tue Jan 09 11:38:00 2007 -0700 24.2 +++ b/src/Xen_ComputerSystemMemory.c Wed Jan 10 16:52:37 2007 -0700 24.3 @@ -226,7 +226,6 @@ static CMPIStatus Associators( 24.4 _SBLIM_TRACE(2, ("--- Reference does not match required role. Ignoring request.")); 24.5 goto exit; 24.6 } 24.7 - CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_NOT_SUPPORTED, NULL); 24.8 24.9 /* Determine the target class from the source class. */ 24.10 if (strcmp(sourceclass, _LHSCLASSNAME) == 0) { 24.11 @@ -271,9 +270,9 @@ static CMPIStatus Associators( 24.12 /* Only return entries whose name matches the reference. */ 24.13 namedata = CMGetProperty(data.value.inst, targetkeyname, NULL); 24.14 char * resultname = CMGetCharPtr(namedata.value.string); 24.15 -// BUG - returning data causes crash !?! 24.16 -_SBLIM_TRACE(2, ("--- data.value.inst=\"%s\"", CMGetCharPtr(CDToString(_BROKER, data.value.inst, NULL)))); 24.17 -// if (strcmp(sourcename, resultname) == 0) CMReturnInstance(results, data.value.inst); 24.18 + // BUG - returning data causes crash !?! 24.19 + _SBLIM_TRACE(2, ("--- data.value.inst=\"%s\"", CMGetCharPtr(CDToString(_BROKER, data.value.inst, NULL)))); 24.20 + if (strcmp(sourcename, resultname) == 0) CMReturnInstance(results, data.value.inst); 24.21 } 24.22 } 24.23
25.1 --- a/src/Xen_ComputerSystemNetworkPort.c Tue Jan 09 11:38:00 2007 -0700 25.2 +++ b/src/Xen_ComputerSystemNetworkPort.c Wed Jan 10 16:52:37 2007 -0700 25.3 @@ -226,7 +226,6 @@ static CMPIStatus Associators( 25.4 _SBLIM_TRACE(2, ("--- Reference does not match required role. Ignoring request.")); 25.5 goto exit; 25.6 } 25.7 - CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_NOT_SUPPORTED, NULL); 25.8 25.9 /* Determine the target class from the source class. */ 25.10 if (strcmp(sourceclass, _LHSCLASSNAME) == 0) { 25.11 @@ -271,9 +270,9 @@ static CMPIStatus Associators( 25.12 /* Only return entries whose name matches the reference. */ 25.13 namedata = CMGetProperty(data.value.inst, targetkeyname, NULL); 25.14 char * resultname = CMGetCharPtr(namedata.value.string); 25.15 -// BUG - returning data causes crash !?! 25.16 -_SBLIM_TRACE(2, ("--- data.value.inst=\"%s\"", CMGetCharPtr(CDToString(_BROKER, data.value.inst, NULL)))); 25.17 -// if (strcmp(sourcename, resultname) == 0) CMReturnInstance(results, data.value.inst); 25.18 + // BUG - returning data causes crash !?! 25.19 + _SBLIM_TRACE(2, ("--- data.value.inst=\"%s\"", CMGetCharPtr(CDToString(_BROKER, data.value.inst, NULL)))); 25.20 + if (strcmp(sourcename, resultname) == 0) CMReturnInstance(results, data.value.inst); 25.21 } 25.22 } 25.23
26.1 --- a/src/Xen_ComputerSystemProcessor.c Tue Jan 09 11:38:00 2007 -0700 26.2 +++ b/src/Xen_ComputerSystemProcessor.c Wed Jan 10 16:52:37 2007 -0700 26.3 @@ -226,7 +226,6 @@ static CMPIStatus Associators( 26.4 _SBLIM_TRACE(2, ("--- Reference does not match required role. Ignoring request.")); 26.5 goto exit; 26.6 } 26.7 - CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_NOT_SUPPORTED, NULL); 26.8 26.9 /* Determine the target class from the source class. */ 26.10 if (strcmp(sourceclass, _LHSCLASSNAME) == 0) { 26.11 @@ -271,9 +270,9 @@ static CMPIStatus Associators( 26.12 /* Only return entries whose name matches the reference. */ 26.13 namedata = CMGetProperty(data.value.inst, targetkeyname, NULL); 26.14 char * resultname = CMGetCharPtr(namedata.value.string); 26.15 -// BUG - returning data causes crash !?! 26.16 -_SBLIM_TRACE(2, ("--- data.value.inst=\"%s\"", CMGetCharPtr(CDToString(_BROKER, data.value.inst, NULL)))); 26.17 -// if (strcmp(sourcename, resultname) == 0) CMReturnInstance(results, data.value.inst); 26.18 + // BUG - returning data causes crash !?! 26.19 + _SBLIM_TRACE(2, ("--- data.value.inst=\"%s\"", CMGetCharPtr(CDToString(_BROKER, data.value.inst, NULL)))); 26.20 + if (strcmp(sourcename, resultname) == 0) CMReturnInstance(results, data.value.inst); 26.21 } 26.22 } 26.23
27.1 --- a/src/Xen_DiskElementSettingData.c Tue Jan 09 11:38:00 2007 -0700 27.2 +++ b/src/Xen_DiskElementSettingData.c Wed Jan 10 16:52:37 2007 -0700 27.3 @@ -52,11 +52,11 @@ static const CMPIBroker *_BROKER; 27.4 /* Name of the left and right hand side classes of this association. */ 27.5 static char * _ASSOCCLASS = "Xen_DiskElementSettingData"; 27.6 static char * _LHSCLASSNAME = "Xen_DiskSettingData"; 27.7 -static char * _RHSCLASSNAME = "Xen_Disk"; 27.8 +static char * _RHSCLASSNAME = "Xen_DiskSettingData"; 27.9 static char * _LHSPROPERTYNAME = "SettingData"; 27.10 static char * _RHSPROPERTYNAME = "ManagedElement"; 27.11 static char * _LHSKEYNAME = "InstanceID"; 27.12 -static char * _RHSKEYNAME = "SystemName"; 27.13 +static char * _RHSKEYNAME = "InstanceID"; 27.14 27.15 // ---------------------------------------------------------------------------- 27.16 // AssociationCleanup() 27.17 @@ -226,7 +226,6 @@ static CMPIStatus Associators( 27.18 _SBLIM_TRACE(2, ("--- Reference does not match required role. Ignoring request.")); 27.19 goto exit; 27.20 } 27.21 - CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_NOT_SUPPORTED, NULL); 27.22 27.23 /* Determine the target class from the source class. */ 27.24 if (strcmp(sourceclass, _LHSCLASSNAME) == 0) { 27.25 @@ -271,9 +270,9 @@ static CMPIStatus Associators( 27.26 /* Only return entries whose name matches the reference. */ 27.27 namedata = CMGetProperty(data.value.inst, targetkeyname, NULL); 27.28 char * resultname = CMGetCharPtr(namedata.value.string); 27.29 -// BUG - returning data causes crash !?! 27.30 -_SBLIM_TRACE(2, ("--- data.value.inst=\"%s\"", CMGetCharPtr(CDToString(_BROKER, data.value.inst, NULL)))); 27.31 -// if (strcmp(sourcename, resultname) == 0) CMReturnInstance(results, data.value.inst); 27.32 + // BUG - returning data causes crash !?! 27.33 + _SBLIM_TRACE(2, ("--- data.value.inst=\"%s\"", CMGetCharPtr(CDToString(_BROKER, data.value.inst, NULL)))); 27.34 + if (strcmp(sourcename, resultname) == 0) CMReturnInstance(results, data.value.inst); 27.35 } 27.36 } 27.37
28.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 28.2 +++ b/src/Xen_DiskSettingsDefineState.c Wed Jan 10 16:52:37 2007 -0700 28.3 @@ -0,0 +1,530 @@ 28.4 +// Copyright (C) 2006 Novell, Inc. 28.5 +// 28.6 +// This library is free software; you can redistribute it and/or 28.7 +// modify it under the terms of the GNU Lesser General Public 28.8 +// License as published by the Free Software Foundation; either 28.9 +// version 2.1 of the License, or (at your option) any later version. 28.10 +// 28.11 +// This library is distributed in the hope that it will be useful, 28.12 +// but WITHOUT ANY WARRANTY; without even the implied warranty of 28.13 +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 28.14 +// Lesser General Public License for more details. 28.15 +// 28.16 +// You should have received a copy of the GNU Lesser General Public 28.17 +// License along with this library; if not, write to the Free Software 28.18 +// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 28.19 +// ============================================================================ 28.20 +// Authors: Jim Fehlig, <jfehlig@novell.com> 28.21 +// Description: 28.22 +// ============================================================================ 28.23 + 28.24 +#include <string.h> 28.25 + 28.26 +/* Include the required CMPI data types, function headers, and macros */ 28.27 +#include "cmpidt.h" 28.28 +#include "cmpift.h" 28.29 +#include "cmpimacs.h" 28.30 + 28.31 + 28.32 +// ---------------------------------------------------------------------------- 28.33 +// COMMON GLOBAL VARIABLES 28.34 +// ---------------------------------------------------------------------------- 28.35 + 28.36 +/* Handle to the CIM broker. Initialized when the provider lib is loaded. */ 28.37 +static const CMPIBroker *_BROKER; 28.38 + 28.39 +/* Include utility functions */ 28.40 +#include "cmpiutil.h" 28.41 +#include "provider_common.h" 28.42 + 28.43 +/* Include _SBLIM_TRACE() logging support */ 28.44 +#include "cmpitrace.h" 28.45 + 28.46 + 28.47 +// ============================================================================ 28.48 +// CMPI ASSOCIATION PROVIDER FUNCTION TABLE 28.49 +// ============================================================================ 28.50 + 28.51 +// ---------------------------------------------------------------------------- 28.52 +// Info for the class supported by the association provider 28.53 +// ---------------------------------------------------------------------------- 28.54 + 28.55 +/* Name of the left and right hand side classes of this association. */ 28.56 +static char * _ASSOCCLASS = "Xen_DiskSettingsDefineState"; 28.57 +static char * _LHSCLASSNAME = "Xen_DiskSettingData"; 28.58 +static char * _RHSCLASSNAME = "Xen_Disk"; 28.59 +static char * _LHSPROPERTYNAME = "SettingData"; 28.60 +static char * _RHSPROPERTYNAME = "ManagedElement"; 28.61 +static char * _LHSKEYNAME = "InstanceID"; 28.62 +static char * _RHSKEYNAME = "SystemName"; 28.63 + 28.64 +// ---------------------------------------------------------------------------- 28.65 +// AssociationCleanup() 28.66 +// Perform any necessary cleanup immediately before this provider is unloaded. 28.67 +// ---------------------------------------------------------------------------- 28.68 +static CMPIStatus AssociationCleanup( 28.69 + CMPIAssociationMI * self, /* [in] Handle to this provider (i.e. 'self'). */ 28.70 + const CMPIContext * context, /* [in] Additional context info, if any. */ 28.71 + CMPIBoolean terminating) /* [in] True if MB is terminating */ 28.72 +{ 28.73 + CMPIStatus status = { CMPI_RC_OK, NULL }; /* Return status of CIM operations. */ 28.74 + 28.75 + _SBLIM_ENTER("AssociationCleanup"); 28.76 + _SBLIM_TRACE(2, ("--- self=\"%s\"", self->ft->miName)); 28.77 + _SBLIM_TRACE(2, ("--- context=\"%s\"", CMGetCharPtr(CDToString(_BROKER, context, NULL)))); 28.78 + 28.79 + /* Nothing needs to be done for cleanup. */ 28.80 + _SBLIM_RETURNSTATUS(status); 28.81 +} 28.82 + 28.83 + 28.84 +// ---------------------------------------------------------------------------- 28.85 +// AssociatorNames() 28.86 +// ---------------------------------------------------------------------------- 28.87 +static CMPIStatus AssociatorNames( 28.88 + CMPIAssociationMI * self, /* [in] Handle to this provider (i.e. 'self'). */ 28.89 + const CMPIContext * context, /* [in] Additional context info, if any. */ 28.90 + const CMPIResult * results, /* [out] Results of this operation. */ 28.91 + const CMPIObjectPath * reference, /* [in] Contains source namespace, classname and object path. */ 28.92 + const char * assocClass, 28.93 + const char * resultClass, 28.94 + const char * role, 28.95 + const char * resultRole) 28.96 +{ 28.97 + CMPIStatus status = { CMPI_RC_OK, NULL }; /* Return status of CIM operations. */ 28.98 + char *namespace = CMGetCharPtr(CMGetNameSpace(reference, NULL)); /* Target namespace. */ 28.99 + char *sourceclass = CMGetCharPtr(CMGetClassName(reference, &status)); /* Class of the source reference object */ 28.100 + char *targetclass; /* Class of the target object(s). */ 28.101 + char *sourcekeyname; 28.102 + char *targetkeyname; 28.103 + 28.104 + _SBLIM_ENTER("AssociatorNames"); 28.105 + _SBLIM_TRACE(2, ("--- self=\"%s\"", self->ft->miName)); 28.106 + _SBLIM_TRACE(2, ("--- context=\"%s\"", CMGetCharPtr(CDToString(_BROKER, context, NULL)))); 28.107 + _SBLIM_TRACE(2, ("--- reference=\"%s\"", CMGetCharPtr(CDToString(_BROKER, reference, NULL)))); 28.108 + _SBLIM_TRACE(2, ("--- assocClass=\"%s\"", assocClass)); 28.109 + _SBLIM_TRACE(2, ("--- resultClass=\"%s\"", resultClass)); 28.110 + _SBLIM_TRACE(2, ("--- role=\"%s\"", role)); 28.111 + _SBLIM_TRACE(2, ("--- resultRole=\"%s\"", resultRole)); 28.112 + _SBLIM_TRACE(2, ("--- namespace=\"%s\"", namespace)); 28.113 + _SBLIM_TRACE(2, ("--- sourceclass=\"%s\"", sourceclass)); 28.114 + 28.115 + /* Check that the requested association class, if any, is supported. */ 28.116 + if (assocClass != NULL) { 28.117 + CMPIObjectPath * assoc = CMNewObjectPath(_BROKER, namespace, _ASSOCCLASS, NULL); 28.118 + if (!CMClassPathIsA(_BROKER, assoc, assocClass, NULL)) { 28.119 + _SBLIM_TRACE(2, ("--- Unrecognized association class. Ignoring request.")); 28.120 + goto exit; 28.121 + } 28.122 + } 28.123 + 28.124 + /* Check that the reference matches the required role, if any. */ 28.125 + if ((role != NULL) && strcmp(role, sourceclass) != 0) { 28.126 + _SBLIM_TRACE(2, ("--- Reference does not match required role. Ignoring request.")); 28.127 + goto exit; 28.128 + } 28.129 + 28.130 + /* Determine the target class from the source class. */ 28.131 + if (strcmp(sourceclass, _LHSCLASSNAME) == 0) { 28.132 + sourcekeyname = _LHSKEYNAME; 28.133 + targetclass = _RHSCLASSNAME; 28.134 + targetkeyname = _RHSKEYNAME; 28.135 + } else if (strcmp(sourceclass, _RHSCLASSNAME) == 0) { 28.136 + sourcekeyname = _RHSKEYNAME; 28.137 + targetclass = _LHSCLASSNAME; 28.138 + targetkeyname = _LHSKEYNAME; 28.139 + } else { 28.140 + _SBLIM_TRACE(2, ("--- Unrecognized source class. Ignoring request.")); 28.141 + goto exit; 28.142 + } 28.143 + _SBLIM_TRACE(2, ("--- targetclass=\"%s\"", targetclass)); 28.144 + 28.145 + CMPIData namedata = CMGetKey(reference, sourcekeyname, NULL); 28.146 + char * sourcename = CMGetCharPtr(namedata.value.string); 28.147 + _SBLIM_TRACE(2, ("--- sourcename=\"%s\"", sourcename)); 28.148 + 28.149 + /* Create an object path for the result class. */ 28.150 + CMPIObjectPath * objectpath = CMNewObjectPath(_BROKER, namespace, targetclass, &status); 28.151 + if ((status.rc != CMPI_RC_OK) || CMIsNullObject(objectpath)) { 28.152 + _SBLIM_TRACE(1,("--- CMNewObjectPath() failed - %s", CMGetCharPtr(status.msg))); 28.153 + CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERROR, "Cannot create new CMPIObjectPath"); 28.154 + goto exit; 28.155 + } 28.156 + 28.157 + /* Get the list of all target class object paths from the CIMOM. */ 28.158 + CMPIEnumeration * objectpaths = CBEnumInstanceNames(_BROKER, context, objectpath, &status); 28.159 + if ((status.rc != CMPI_RC_OK) || CMIsNullObject(objectpaths)) { 28.160 + _SBLIM_TRACE(1,("--- CBEnumInstanceNames() failed - %s", CMGetCharPtr(status.msg))); 28.161 + CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERROR, "Cannot enumerate target class"); 28.162 + goto exit; 28.163 + } 28.164 + 28.165 + /* Return all object paths that exactly match the target class and resultClass, if specified. */ 28.166 + while (CMHasNext(objectpaths, NULL)) { 28.167 + CMPIData data = CMGetNext(objectpaths, NULL); 28.168 + char *class = CMGetCharPtr(CMGetClassName(data.value.ref, NULL)); 28.169 + if ((strcmp(class,targetclass) == 0) && ((resultClass == NULL) || (strcmp(class,resultClass) == 0))) { 28.170 + /* Only return entries whose name matches the reference. */ 28.171 + namedata = CMGetKey(data.value.ref, targetkeyname, &status); 28.172 + char * resultname = CMGetCharPtr(namedata.value.string); 28.173 + if (strcmp(sourcename, resultname) == 0) CMReturnObjectPath(results, data.value.ref); 28.174 + } 28.175 + } 28.176 + 28.177 + CMReturnDone(results); 28.178 + 28.179 +exit: 28.180 + _SBLIM_RETURNSTATUS(status); 28.181 +} 28.182 + 28.183 + 28.184 +// ---------------------------------------------------------------------------- 28.185 +// Associators() 28.186 +// ---------------------------------------------------------------------------- 28.187 +static CMPIStatus Associators( 28.188 + CMPIAssociationMI * self, /* [in] Handle to this provider (i.e. 'self'). */ 28.189 + const CMPIContext * context, /* [in] Additional context info, if any. */ 28.190 + const CMPIResult * results, /* [out] Results of this operation. */ 28.191 + const CMPIObjectPath * reference, /* [in] Contains the source namespace, classname and object path. */ 28.192 + const char *assocClass, 28.193 + const char *resultClass, 28.194 + const char *role, 28.195 + const char *resultRole, 28.196 + const char ** properties) /* [in] List of desired properties (NULL=all). */ 28.197 +{ 28.198 + CMPIStatus status = { CMPI_RC_OK, NULL }; /* Return status of CIM operations. */ 28.199 + char *namespace = CMGetCharPtr(CMGetNameSpace(reference, NULL)); /* Target namespace. */ 28.200 + char *sourceclass = CMGetCharPtr(CMGetClassName(reference, &status)); /* Class of the source reference object */ 28.201 + char *targetclass; /* Class of the target object(s). */ 28.202 + char *sourcekeyname; 28.203 + char *targetkeyname; 28.204 + 28.205 + _SBLIM_ENTER("Associators"); 28.206 + _SBLIM_TRACE(2, ("--- self=\"%s\"", self->ft->miName)); 28.207 + _SBLIM_TRACE(2, ("--- context=\"%s\"", CMGetCharPtr(CDToString(_BROKER, context, NULL)))); 28.208 + _SBLIM_TRACE(2, ("--- reference=\"%s\"", CMGetCharPtr(CDToString(_BROKER, reference, NULL)))); 28.209 + _SBLIM_TRACE(2, ("--- assocClass=\"%s\"", assocClass)); 28.210 + _SBLIM_TRACE(2, ("--- resultClass=\"%s\"", resultClass)); 28.211 + _SBLIM_TRACE(2, ("--- role=\"%s\"", role)); 28.212 + _SBLIM_TRACE(2, ("--- resultRole=\"%s\"", resultRole)); 28.213 + _SBLIM_TRACE(2, ("--- namespace=\"%s\"", namespace)); 28.214 + _SBLIM_TRACE(2, ("--- sourceclass=\"%s\"", sourceclass)); 28.215 + 28.216 + /* Check that the requested association class, if any, is supported. */ 28.217 + if (assocClass != NULL) { 28.218 + CMPIObjectPath * assoc = CMNewObjectPath(_BROKER, namespace, _ASSOCCLASS, NULL); 28.219 + if (!CMClassPathIsA(_BROKER, assoc, assocClass, NULL)) { 28.220 + _SBLIM_TRACE(2, ("--- Unrecognized association class. Ignoring request.")); 28.221 + goto exit; 28.222 + } 28.223 + } 28.224 + 28.225 + /* Check that the reference matches the required role, if any. */ 28.226 + if ((role != NULL) && strcmp(role, sourceclass) != 0) { 28.227 + _SBLIM_TRACE(2, ("--- Reference does not match required role. Ignoring request.")); 28.228 + goto exit; 28.229 + } 28.230 + 28.231 + /* Determine the target class from the source class. */ 28.232 + if (strcmp(sourceclass, _LHSCLASSNAME) == 0) { 28.233 + sourcekeyname = _LHSKEYNAME; 28.234 + targetclass = _RHSCLASSNAME; 28.235 + targetkeyname = _RHSKEYNAME; 28.236 + } else if (strcmp(sourceclass, _RHSCLASSNAME) == 0) { 28.237 + sourcekeyname = _RHSKEYNAME; 28.238 + targetclass = _LHSCLASSNAME; 28.239 + targetkeyname = _LHSKEYNAME; 28.240 + } else { 28.241 + _SBLIM_TRACE(2, ("--- Unrecognized source class. Ignoring request.")); 28.242 + goto exit; 28.243 + } 28.244 + _SBLIM_TRACE(2, ("--- targetclass=\"%s\"", targetclass)); 28.245 + 28.246 + CMPIData namedata = CMGetKey(reference, sourcekeyname, NULL); 28.247 + char * sourcename = CMGetCharPtr(namedata.value.string); 28.248 + _SBLIM_TRACE(2, ("--- sourcename=\"%s\"", sourcename)); 28.249 + 28.250 + /* Create an object path for the result class. */ 28.251 + CMPIObjectPath * objectpath = CMNewObjectPath(_BROKER, namespace, targetclass, &status); 28.252 + if ((status.rc != CMPI_RC_OK) || CMIsNullObject(objectpath)) { 28.253 + _SBLIM_TRACE(1,("--- CMNewObjectPath() failed - %s", CMGetCharPtr(status.msg))); 28.254 + CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERROR, "Cannot create new CMPIObjectPath"); 28.255 + goto exit; 28.256 + } 28.257 + 28.258 + /* Get the list of all target class instances from the CIMOM. */ 28.259 + CMPIEnumeration * instances = CBEnumInstances(_BROKER, context, objectpath, NULL, &status); 28.260 + if ((status.rc != CMPI_RC_OK) || CMIsNullObject(instances)) { 28.261 + _SBLIM_TRACE(1,("--- CBEnumInstances() failed - %s", CMGetCharPtr(status.msg))); 28.262 + CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERROR, "Cannot enumerate target class"); 28.263 + goto exit; 28.264 + } 28.265 + 28.266 + /* Return all instances that exactly match the target class and resultClass, if specified. */ 28.267 + while (CMHasNext(instances, NULL)) { 28.268 + CMPIData data = CMGetNext(instances, NULL); 28.269 + char *class = CMGetCharPtr(CMGetClassName(CMGetObjectPath(data.value.inst,NULL), NULL)); 28.270 + if ((strcmp(class,targetclass) == 0) && ((resultClass == NULL) || (strcmp(class,resultClass) == 0))) { 28.271 + /* Only return entries whose name matches the reference. */ 28.272 + namedata = CMGetProperty(data.value.inst, targetkeyname, NULL); 28.273 + char * resultname = CMGetCharPtr(namedata.value.string); 28.274 + // BUG - returning data causes crash !?! 28.275 + _SBLIM_TRACE(2, ("--- data.value.inst=\"%s\"", CMGetCharPtr(CDToString(_BROKER, data.value.inst, NULL)))); 28.276 + if (strcmp(sourcename, resultname) == 0) CMReturnInstance(results, data.value.inst); 28.277 + } 28.278 + } 28.279 + 28.280 + CMReturnDone(results); 28.281 + 28.282 +exit: 28.283 + _SBLIM_RETURNSTATUS(status); 28.284 +} 28.285 + 28.286 + 28.287 +// ---------------------------------------------------------------------------- 28.288 +// ReferenceNames() 28.289 +// ---------------------------------------------------------------------------- 28.290 +static CMPIStatus ReferenceNames( 28.291 + CMPIAssociationMI * self, /* [in] Handle to this provider (i.e. 'self'). */ 28.292 + const CMPIContext * context, /* [in] Additional context info, if any. */ 28.293 + const CMPIResult * results, /* [out] Results of this operation. */ 28.294 + const CMPIObjectPath * reference, /* [in] Contains the source namespace, classname and object path. */ 28.295 + const char *assocClass, 28.296 + const char *role) 28.297 +{ 28.298 + CMPIStatus status = { CMPI_RC_OK, NULL }; /* Return status of CIM operations. */ 28.299 + char *namespace = CMGetCharPtr(CMGetNameSpace(reference, NULL)); /* Target namespace. */ 28.300 + char *sourceclass = CMGetCharPtr(CMGetClassName(reference, &status)); /* Class of the source reference object */ 28.301 + char *targetclass; /* Class of the target object(s). */ 28.302 + char *sourcekeyname; 28.303 + char *targetkeyname; 28.304 + 28.305 + _SBLIM_ENTER("ReferenceNames"); 28.306 + _SBLIM_TRACE(2, ("--- self=\"%s\"", self->ft->miName)); 28.307 + _SBLIM_TRACE(2, ("--- context=\"%s\"", CMGetCharPtr(CDToString(_BROKER, context, NULL)))); 28.308 + _SBLIM_TRACE(2, ("--- reference=\"%s\"", CMGetCharPtr(CDToString(_BROKER, reference, NULL)))); 28.309 + _SBLIM_TRACE(2, ("--- assocClass=\"%s\"", assocClass)); 28.310 + _SBLIM_TRACE(2, ("--- role=\"%s\"", role)); 28.311 + _SBLIM_TRACE(2, ("--- namespace=\"%s\"", namespace)); 28.312 + _SBLIM_TRACE(2, ("--- sourceclass=\"%s\"", sourceclass)); 28.313 + 28.314 + /* Check that the requested association class, if any, is supported. */ 28.315 + if (assocClass != NULL) { 28.316 + CMPIObjectPath * assoc = CMNewObjectPath(_BROKER, namespace, _ASSOCCLASS, NULL); 28.317 + if (!CMClassPathIsA(_BROKER, assoc, assocClass, NULL)) { 28.318 + _SBLIM_TRACE(2, ("--- Unrecognized association class. Ignoring request.")); 28.319 + goto exit; 28.320 + } 28.321 + } 28.322 + 28.323 + /* Check that the reference matches the required role, if any. */ 28.324 + if ((role != NULL) && strcmp(role, sourceclass) != 0) { 28.325 + _SBLIM_TRACE(2, ("--- Reference does not match required role. Ignoring request.")); 28.326 + goto exit; 28.327 + } 28.328 + 28.329 + /* Determine the target class from the source class. */ 28.330 + if (strcmp(sourceclass, _LHSCLASSNAME) == 0) { 28.331 + sourcekeyname = _LHSKEYNAME; 28.332 + targetclass = _RHSCLASSNAME; 28.333 + targetkeyname = _RHSKEYNAME; 28.334 + } else if (strcmp(sourceclass, _RHSCLASSNAME) == 0) { 28.335 + sourcekeyname = _RHSKEYNAME; 28.336 + targetclass = _LHSCLASSNAME; 28.337 + targetkeyname = _LHSKEYNAME; 28.338 + } else { 28.339 + _SBLIM_TRACE(2, ("--- Unrecognized source class. Ignoring request.")); 28.340 + goto exit; 28.341 + } 28.342 + _SBLIM_TRACE(2, ("--- targetclass=\"%s\"", targetclass)); 28.343 + 28.344 + CMPIData namedata = CMGetKey(reference, sourcekeyname, NULL); 28.345 + char * sourcename = CMGetCharPtr(namedata.value.string); 28.346 + _SBLIM_TRACE(2, ("--- sourcename=\"%s\"", sourcename)); 28.347 + 28.348 + /* Create an object path for the result class. */ 28.349 + CMPIObjectPath * objectpath = CMNewObjectPath(_BROKER, namespace, targetclass, &status); 28.350 + if ((status.rc != CMPI_RC_OK) || CMIsNullObject(objectpath)) { 28.351 + _SBLIM_TRACE(1,("--- CMNewObjectPath() failed - %s", CMGetCharPtr(status.msg))); 28.352 + CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERROR, "Cannot create new CMPIObjectPath"); 28.353 + goto exit; 28.354 + } 28.355 + 28.356 + /* Get the list of all target class object paths from the CIMOM. */ 28.357 + CMPIEnumeration * objectpaths = CBEnumInstanceNames(_BROKER, context, objectpath, &status); 28.358 + if ((status.rc != CMPI_RC_OK) || CMIsNullObject(objectpaths)) { 28.359 + _SBLIM_TRACE(1,("--- CBEnumInstanceNames() failed - %s", CMGetCharPtr(status.msg))); 28.360 + CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERROR, "Cannot enumerate target class"); 28.361 + goto exit; 28.362 + } 28.363 + 28.364 + /* Return all object paths that exactly match the target class and resultClass, if specified. */ 28.365 + while (CMHasNext(objectpaths, NULL)) { 28.366 + CMPIData data = CMGetNext(objectpaths, NULL); 28.367 + char *class = CMGetCharPtr(CMGetClassName(data.value.ref, NULL)); 28.368 + if (strcmp(class,targetclass) == 0) { 28.369 + 28.370 + /* Create an object path for the association. */ 28.371 + CMPIObjectPath * refobjectpath = CMNewObjectPath(_BROKER, namespace, _ASSOCCLASS, &status); 28.372 + if ((status.rc != CMPI_RC_OK) || CMIsNullObject(refobjectpath)) { 28.373 + _SBLIM_TRACE(1,("--- CMNewObjectPath() failed - %s", CMGetCharPtr(status.msg))); 28.374 + CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERROR, "Cannot create new CMPIObjectPath"); 28.375 + goto exit; 28.376 + } 28.377 + 28.378 + /* Assign the references in the association appropriately. */ 28.379 + if (strcmp(sourceclass, _RHSCLASSNAME) == 0) { 28.380 + CMAddKey(refobjectpath, _RHSPROPERTYNAME, &reference, CMPI_ref); 28.381 + CMAddKey(refobjectpath, _LHSPROPERTYNAME, &data.value.ref, CMPI_ref); 28.382 + } else { 28.383 + CMAddKey(refobjectpath, _RHSPROPERTYNAME, &data.value.ref, CMPI_ref); 28.384 + CMAddKey(refobjectpath, _LHSPROPERTYNAME, &reference, CMPI_ref); 28.385 + } 28.386 + 28.387 + /* Only return entries whose name matches the reference. */ 28.388 + namedata = CMGetKey(data.value.ref, targetkeyname, &status); 28.389 + char * resultname = CMGetCharPtr(namedata.value.string); 28.390 + if (strcmp(sourcename, resultname) == 0) CMReturnObjectPath(results, refobjectpath); 28.391 + } 28.392 + } 28.393 + 28.394 +exit: 28.395 + _SBLIM_RETURNSTATUS(status); 28.396 +} 28.397 + 28.398 + 28.399 +// ---------------------------------------------------------------------------- 28.400 +// References() 28.401 +// ---------------------------------------------------------------------------- 28.402 +static CMPIStatus References( 28.403 + CMPIAssociationMI * self, /* [in] Handle to this provider (i.e. 'self'). */ 28.404 + const CMPIContext * context, /* [in] Additional context info, if any. */ 28.405 + const CMPIResult * results, /* [out] Results of this operation. */ 28.406 + const CMPIObjectPath * reference, /* [in] Contains the namespace, classname and desired object path. */ 28.407 + const char *assocClass, 28.408 + const char *role, 28.409 + const char **properties) /* [in] List of desired properties (NULL=all). */ 28.410 +{ 28.411 + CMPIStatus status = { CMPI_RC_OK, NULL }; /* Return status of CIM operations. */ 28.412 + char *namespace = CMGetCharPtr(CMGetNameSpace(reference, NULL)); /* Target namespace. */ 28.413 + char *sourceclass = CMGetCharPtr(CMGetClassName(reference, &status)); /* Class of the source reference object */ 28.414 + char *targetclass; /* Class of the target object(s). */ 28.415 + char *sourcekeyname; 28.416 + char *targetkeyname; 28.417 + 28.418 + _SBLIM_ENTER("References"); 28.419 + _SBLIM_TRACE(2, ("--- self=\"%s\"", self->ft->miName)); 28.420 + _SBLIM_TRACE(2, ("--- context=\"%s\"", CMGetCharPtr(CDToString(_BROKER, context, NULL)))); 28.421 + _SBLIM_TRACE(2, ("--- reference=\"%s\"", CMGetCharPtr(CDToString(_BROKER, reference, NULL)))); 28.422 + _SBLIM_TRACE(2, ("--- assocClass=\"%s\"", assocClass)); 28.423 + _SBLIM_TRACE(2, ("--- role=\"%s\"", role)); 28.424 + _SBLIM_TRACE(2, ("--- namespace=\"%s\"", namespace)); 28.425 + _SBLIM_TRACE(2, ("--- sourceclass=\"%s\"", sourceclass)); 28.426 + 28.427 + /* Check that the requested association class, if any, is supported. */ 28.428 + if (assocClass != NULL) { 28.429 + CMPIObjectPath * assoc = CMNewObjectPath(_BROKER, namespace, _ASSOCCLASS, NULL); 28.430 + if (!CMClassPathIsA(_BROKER, assoc, assocClass, NULL)) { 28.431 + _SBLIM_TRACE(2, ("--- Unrecognized association class. Ignoring request.")); 28.432 + goto exit; 28.433 + } 28.434 + } 28.435 + 28.436 + /* Check that the reference matches the required role, if any. */ 28.437 + if ((role != NULL) && strcmp(role, sourceclass) != 0) { 28.438 + _SBLIM_TRACE(2, ("--- Reference does not match required role. Ignoring request.")); 28.439 + goto exit; 28.440 + } 28.441 + 28.442 + /* Determine the target class from the source class. */ 28.443 + if (strcmp(sourceclass, _LHSCLASSNAME) == 0) { 28.444 + sourcekeyname = _LHSKEYNAME; 28.445 + targetclass = _RHSCLASSNAME; 28.446 + targetkeyname = _RHSKEYNAME; 28.447 + } else if (strcmp(sourceclass, _RHSCLASSNAME) == 0) { 28.448 + sourcekeyname = _RHSKEYNAME; 28.449 + targetclass = _LHSCLASSNAME; 28.450 + targetkeyname = _LHSKEYNAME; 28.451 + } else { 28.452 + _SBLIM_TRACE(2, ("--- Unrecognized source class. Ignoring request.")); 28.453 + goto exit; 28.454 + } 28.455 + _SBLIM_TRACE(2, ("--- targetclass=\"%s\"", targetclass)); 28.456 + 28.457 + CMPIData namedata = CMGetKey(reference, sourcekeyname, NULL); 28.458 + char * sourcename = CMGetCharPtr(namedata.value.string); 28.459 + _SBLIM_TRACE(2, ("--- sourcename=\"%s\"", sourcename)); 28.460 + 28.461 + /* Create an object path for the result class. */ 28.462 + CMPIObjectPath * objectpath = CMNewObjectPath(_BROKER, namespace, targetclass, &status); 28.463 + if ((status.rc != CMPI_RC_OK) || CMIsNullObject(objectpath)) { 28.464 + _SBLIM_TRACE(1,("--- CMNewObjectPath() failed - %s", CMGetCharPtr(status.msg))); 28.465 + CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERROR, "Cannot create new CMPIObjectPath"); 28.466 + goto exit; 28.467 + } 28.468 + 28.469 + /* Get the list of all target class object paths from the CIMOM. */ 28.470 + CMPIEnumeration * objectpaths = CBEnumInstanceNames(_BROKER, context, objectpath, &status); 28.471 + if ((status.rc != CMPI_RC_OK) || CMIsNullObject(objectpaths)) { 28.472 + _SBLIM_TRACE(1,("--- CBEnumInstanceNames() failed - %s", CMGetCharPtr(status.msg))); 28.473 + CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERROR, "Cannot enumerate target class"); 28.474 + goto exit; 28.475 + } 28.476 + 28.477 + /* Return all object paths that exactly match the target class and resultClass, if specified. */ 28.478 + while (CMHasNext(objectpaths, NULL)) { 28.479 + CMPIData data = CMGetNext(objectpaths, NULL); 28.480 + char *class = CMGetCharPtr(CMGetClassName(data.value.ref, NULL)); 28.481 + if (strcmp(class,targetclass) == 0) { 28.482 + 28.483 + /* Create an instance for the association. */ 28.484 + CMPIInstance * refinstance = _CMNewInstance(_BROKER, namespace, _ASSOCCLASS, &status); 28.485 + if ((status.rc != CMPI_RC_OK) || CMIsNullObject(refinstance)) { 28.486 + _SBLIM_TRACE(1,("--- CMNewInstance() failed - %s", CMGetCharPtr(status.msg))); 28.487 + CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERROR, "Cannot create new CMPIInstance"); 28.488 + goto exit; 28.489 + } 28.490 + 28.491 + /* Assign the references in the association appropriately. */ 28.492 + if (strcmp(sourceclass, _RHSCLASSNAME) == 0) { 28.493 + CMSetProperty(refinstance, _RHSPROPERTYNAME, &reference, CMPI_ref); 28.494 + CMSetProperty(refinstance, _LHSPROPERTYNAME, &data.value.ref, CMPI_ref); 28.495 + } else { 28.496 + CMSetProperty(refinstance, _RHSPROPERTYNAME, &data.value.ref, CMPI_ref); 28.497 + CMSetProperty(refinstance, _LHSPROPERTYNAME, &reference, CMPI_ref); 28.498 + } 28.499 + 28.500 + /* Only return entries whose name matches the reference. */ 28.501 + namedata = CMGetKey(data.value.ref, targetkeyname, &status); 28.502 + char * resultname = CMGetCharPtr(namedata.value.string); 28.503 + if (strcmp(sourcename, resultname) == 0) CMReturnInstance(results, refinstance); 28.504 + } 28.505 + } 28.506 + 28.507 +exit: 28.508 + _SBLIM_RETURNSTATUS(status); 28.509 +} 28.510 + 28.511 + 28.512 +// ---------------------------------------------------------------------------- 28.513 +// AssociationInitialize() 28.514 +// Perform any necessary initialization immediately after this provider is 28.515 +// first loaded. 28.516 +// ---------------------------------------------------------------------------- 28.517 +static void AssociationInitialize( 28.518 + CMPIAssociationMI * self, /* [in] Handle to this provider (i.e. 'self'). */ 28.519 + const CMPIContext * context) /* [in] Additional context info, if any. */ 28.520 +{ 28.521 + _SBLIM_ENTER("AssociationInitialize"); 28.522 + _SBLIM_TRACE(2, ("--- self=\"%s\"", self->ft->miName)); 28.523 + // _SBLIM_TRACE(2, ("--- context=\"%s\"", CMGetCharPtr(CDToString(_BROKER, context, NULL)))); 28.524 + 28.525 + /* Nothing needs to be done to initialize this provider */ 28.526 + _SBLIM_RETURN(); 28.527 +} 28.528 + 28.529 + 28.530 +// ============================================================================ 28.531 +// CMPI ASSOCIATION PROVIDER FUNCTION TABLE SETUP 28.532 +// ============================================================================ 28.533 +CMAssociationMIStub( , Xen_DiskSettingsDefineState, _BROKER, AssociationInitialize(&mi, ctx));
29.1 --- a/src/Xen_HasVirtualizationCapabilities.c Tue Jan 09 11:38:00 2007 -0700 29.2 +++ b/src/Xen_HasVirtualizationCapabilities.c Wed Jan 10 16:52:37 2007 -0700 29.3 @@ -207,7 +207,6 @@ static CMPIStatus Associators( 29.4 _SBLIM_TRACE(2, ("--- Reference does not match required role. Ignoring request.")); 29.5 goto exit; 29.6 } 29.7 - CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_NOT_SUPPORTED, NULL); 29.8 29.9 /* Determine the target class from the source class. */ 29.10 if (strcmp(sourceclass, _LHSCLASSNAME) == 0) { 29.11 @@ -241,9 +240,9 @@ static CMPIStatus Associators( 29.12 CMPIData data = CMGetNext(instances, NULL); 29.13 char *class = CMGetCharPtr(CMGetClassName(CMGetObjectPath(data.value.inst,NULL), NULL)); 29.14 if ((strcmp(class,targetclass) == 0) && ((resultClass == NULL) || (strcmp(class,resultClass) == 0))) { 29.15 -// BUG - returning data causes crash !?! 29.16 -_SBLIM_TRACE(2, ("--- data.value.inst=\"%s\"", CMGetCharPtr(CDToString(_BROKER, data.value.inst, NULL)))); 29.17 -// CMReturnInstance(results, data.value.inst); 29.18 + // BUG - returning data causes crash !?! 29.19 + _SBLIM_TRACE(2, ("--- data.value.inst=\"%s\"", CMGetCharPtr(CDToString(_BROKER, data.value.inst, NULL)))); 29.20 + CMReturnInstance(results, data.value.inst); 29.21 } 29.22 } 29.23
30.1 --- a/src/Xen_HostedDisk.c Tue Jan 09 11:38:00 2007 -0700 30.2 +++ b/src/Xen_HostedDisk.c Wed Jan 10 16:52:37 2007 -0700 30.3 @@ -208,7 +208,6 @@ static CMPIStatus Associators( 30.4 _SBLIM_TRACE(2, ("--- Reference does not match required role. Ignoring request.")); 30.5 goto exit; 30.6 } 30.7 - CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_NOT_SUPPORTED, NULL); 30.8 30.9 /* Determine the target class from the source class. */ 30.10 if (strcmp(sourceclass, _LHSCLASSNAME) == 0) { 30.11 @@ -242,9 +241,9 @@ static CMPIStatus Associators( 30.12 CMPIData data = CMGetNext(instances, NULL); 30.13 char *class = CMGetCharPtr(CMGetClassName(CMGetObjectPath(data.value.inst,NULL), NULL)); 30.14 if ((strcmp(class,targetclass) == 0) && ((resultClass == NULL) || (strcmp(class,resultClass) == 0))) { 30.15 -// BUG - returning data causes crash !?! 30.16 -_SBLIM_TRACE(2, ("--- data.value.inst=\"%s\"", CMGetCharPtr(CDToString(_BROKER, data.value.inst, NULL)))); 30.17 -// CMReturnInstance(results, data.value.inst); 30.18 + // BUG - returning data causes crash !?! 30.19 + _SBLIM_TRACE(2, ("--- data.value.inst=\"%s\"", CMGetCharPtr(CDToString(_BROKER, data.value.inst, NULL)))); 30.20 + CMReturnInstance(results, data.value.inst); 30.21 } 30.22 } 30.23
31.1 --- a/src/Xen_HostedMemory.c Tue Jan 09 11:38:00 2007 -0700 31.2 +++ b/src/Xen_HostedMemory.c Wed Jan 10 16:52:37 2007 -0700 31.3 @@ -209,7 +209,6 @@ static CMPIStatus Associators( 31.4 _SBLIM_TRACE(2, ("--- Reference does not match required role. Ignoring request.")); 31.5 goto exit; 31.6 } 31.7 - CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_NOT_SUPPORTED, NULL); 31.8 31.9 /* Determine the target class from the source class. */ 31.10 if (strcmp(sourceclass, _LHSCLASSNAME) == 0) { 31.11 @@ -243,9 +242,9 @@ static CMPIStatus Associators( 31.12 CMPIData data = CMGetNext(instances, NULL); 31.13 char *class = CMGetCharPtr(CMGetClassName(CMGetObjectPath(data.value.inst,NULL), NULL)); 31.14 if ((strcmp(class,targetclass) == 0) && ((resultClass == NULL) || (strcmp(class,resultClass) == 0))) { 31.15 -// BUG - returning data causes crash !?! 31.16 -_SBLIM_TRACE(2, ("--- data.value.inst=\"%s\"", CMGetCharPtr(CDToString(_BROKER, data.value.inst, NULL)))); 31.17 -// CMReturnInstance(results, data.value.inst); 31.18 + // BUG - returning data causes crash !?! 31.19 + _SBLIM_TRACE(2, ("--- data.value.inst=\"%s\"", CMGetCharPtr(CDToString(_BROKER, data.value.inst, NULL)))); 31.20 + CMReturnInstance(results, data.value.inst); 31.21 } 31.22 } 31.23
32.1 --- a/src/Xen_HostedMemoryPool.c Tue Jan 09 11:38:00 2007 -0700 32.2 +++ b/src/Xen_HostedMemoryPool.c Wed Jan 10 16:52:37 2007 -0700 32.3 @@ -239,7 +239,6 @@ static CMPIStatus Associators( 32.4 _SBLIM_TRACE(2, ("--- Reference does not match required role. Ignoring request.")); 32.5 goto exit; 32.6 } 32.7 - CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_NOT_SUPPORTED, NULL); 32.8 32.9 /* Determine the target class from the source class. */ 32.10 if (CMClassPathIsA(_BROKER, reference, _LHSCLASSNAME, NULL)) {
33.1 --- a/src/Xen_HostedNetworkPort.c Tue Jan 09 11:38:00 2007 -0700 33.2 +++ b/src/Xen_HostedNetworkPort.c Wed Jan 10 16:52:37 2007 -0700 33.3 @@ -208,7 +208,6 @@ static CMPIStatus Associators( 33.4 _SBLIM_TRACE(2, ("--- Reference does not match required role. Ignoring request.")); 33.5 goto exit; 33.6 } 33.7 - CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_NOT_SUPPORTED, NULL); 33.8 33.9 /* Determine the target class from the source class. */ 33.10 if (strcmp(sourceclass, _LHSCLASSNAME) == 0) { 33.11 @@ -242,9 +241,9 @@ static CMPIStatus Associators( 33.12 CMPIData data = CMGetNext(instances, NULL); 33.13 char *class = CMGetCharPtr(CMGetClassName(CMGetObjectPath(data.value.inst,NULL), NULL)); 33.14 if ((strcmp(class,targetclass) == 0) && ((resultClass == NULL) || (strcmp(class,resultClass) == 0))) { 33.15 -// BUG - returning data causes crash !?! 33.16 -_SBLIM_TRACE(2, ("--- data.value.inst=\"%s\"", CMGetCharPtr(CDToString(_BROKER, data.value.inst, NULL)))); 33.17 -// CMReturnInstance(results, data.value.inst); 33.18 + // BUG - returning data causes crash !?! 33.19 + _SBLIM_TRACE(2, ("--- data.value.inst=\"%s\"", CMGetCharPtr(CDToString(_BROKER, data.value.inst, NULL)))); 33.20 + CMReturnInstance(results, data.value.inst); 33.21 } 33.22 } 33.23
34.1 --- a/src/Xen_HostedProcessor.c Tue Jan 09 11:38:00 2007 -0700 34.2 +++ b/src/Xen_HostedProcessor.c Wed Jan 10 16:52:37 2007 -0700 34.3 @@ -208,7 +208,6 @@ static CMPIStatus Associators( 34.4 _SBLIM_TRACE(2, ("--- Reference does not match required role. Ignoring request.")); 34.5 goto exit; 34.6 } 34.7 - CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_NOT_SUPPORTED, NULL); 34.8 34.9 /* Determine the target class from the source class. */ 34.10 if (strcmp(sourceclass, _LHSCLASSNAME) == 0) { 34.11 @@ -242,9 +241,9 @@ static CMPIStatus Associators( 34.12 CMPIData data = CMGetNext(instances, NULL); 34.13 char *class = CMGetCharPtr(CMGetClassName(CMGetObjectPath(data.value.inst,NULL), NULL)); 34.14 if ((strcmp(class,targetclass) == 0) && ((resultClass == NULL) || (strcmp(class,resultClass) == 0))) { 34.15 -// BUG - returning data causes crash !?! 34.16 -_SBLIM_TRACE(2, ("--- data.value.inst=\"%s\"", CMGetCharPtr(CDToString(_BROKER, data.value.inst, NULL)))); 34.17 -// CMReturnInstance(results, data.value.inst); 34.18 + // BUG - returning data causes crash !?! 34.19 + _SBLIM_TRACE(2, ("--- data.value.inst=\"%s\"", CMGetCharPtr(CDToString(_BROKER, data.value.inst, NULL)))); 34.20 + CMReturnInstance(results, data.value.inst); 34.21 } 34.22 } 34.23
35.1 --- a/src/Xen_HostedProcessorPool.c Tue Jan 09 11:38:00 2007 -0700 35.2 +++ b/src/Xen_HostedProcessorPool.c Wed Jan 10 16:52:37 2007 -0700 35.3 @@ -236,7 +236,6 @@ static CMPIStatus Associators( 35.4 _SBLIM_TRACE(2, ("--- Reference does not match required role. Ignoring request.")); 35.5 goto exit; 35.6 } 35.7 - CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_NOT_SUPPORTED, NULL); 35.8 35.9 /* Determine the target class from the source class. */ 35.10 if (CMClassPathIsA(_BROKER, reference, _LHSCLASSNAME, NULL)) {
36.1 --- a/src/Xen_HostedVirtualSystemManagementService.c Tue Jan 09 11:38:00 2007 -0700 36.2 +++ b/src/Xen_HostedVirtualSystemManagementService.c Wed Jan 10 16:52:37 2007 -0700 36.3 @@ -233,7 +233,6 @@ static CMPIStatus Associators( 36.4 _SBLIM_TRACE(2, ("--- Reference does not match required role. Ignoring request.")); 36.5 goto exit; 36.6 } 36.7 - CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_NOT_SUPPORTED, NULL); 36.8 36.9 /* Determine the target class from the source class. */ 36.10 if (CMClassPathIsA(_BROKER, reference, _LHSCLASSNAME, NULL)) {
37.1 --- a/src/Xen_MemoryAllocatedFromPool.c Tue Jan 09 11:38:00 2007 -0700 37.2 +++ b/src/Xen_MemoryAllocatedFromPool.c Wed Jan 10 16:52:37 2007 -0700 37.3 @@ -210,7 +210,6 @@ static CMPIStatus Associators( 37.4 _SBLIM_TRACE(2, ("--- Reference does not match required role. Ignoring request.")); 37.5 goto exit; 37.6 } 37.7 - CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_NOT_SUPPORTED, NULL); 37.8 37.9 /* Determine the target class from the source class. */ 37.10 if (strcmp(sourceclass, _LHSCLASSNAME) == 0) {
38.1 --- a/src/Xen_MemoryElementSettingData.c Tue Jan 09 11:38:00 2007 -0700 38.2 +++ b/src/Xen_MemoryElementSettingData.c Wed Jan 10 16:52:37 2007 -0700 38.3 @@ -52,11 +52,11 @@ static const CMPIBroker *_BROKER; 38.4 /* Name of the left and right hand side classes of this association. */ 38.5 static char * _ASSOCCLASS = "Xen_MemoryElementSettingData"; 38.6 static char * _LHSCLASSNAME = "Xen_MemorySettingData"; 38.7 -static char * _RHSCLASSNAME = "Xen_Memory"; 38.8 +static char * _RHSCLASSNAME = "Xen_MemorySettingData"; 38.9 static char * _LHSPROPERTYNAME = "SettingData"; 38.10 static char * _RHSPROPERTYNAME = "ManagedElement"; 38.11 static char * _LHSKEYNAME = "InstanceID"; 38.12 -static char * _RHSKEYNAME = "SystemName"; 38.13 +static char * _RHSKEYNAME = "InstanceID"; 38.14 38.15 // ---------------------------------------------------------------------------- 38.16 // AssociationCleanup() 38.17 @@ -226,7 +226,6 @@ static CMPIStatus Associators( 38.18 _SBLIM_TRACE(2, ("--- Reference does not match required role. Ignoring request.")); 38.19 goto exit; 38.20 } 38.21 - CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_NOT_SUPPORTED, NULL); 38.22 38.23 /* Determine the target class from the source class. */ 38.24 if (strcmp(sourceclass, _LHSCLASSNAME) == 0) { 38.25 @@ -271,9 +270,9 @@ static CMPIStatus Associators( 38.26 /* Only return entries whose name matches the reference. */ 38.27 namedata = CMGetProperty(data.value.inst, targetkeyname, NULL); 38.28 char * resultname = CMGetCharPtr(namedata.value.string); 38.29 -// BUG - returning data causes crash !?! 38.30 -_SBLIM_TRACE(2, ("--- data.value.inst=\"%s\"", CMGetCharPtr(CDToString(_BROKER, data.value.inst, NULL)))); 38.31 -// if (strcmp(sourcename, resultname) == 0) CMReturnInstance(results, data.value.inst); 38.32 + // BUG - returning data causes crash !?! 38.33 + _SBLIM_TRACE(2, ("--- data.value.inst=\"%s\"", CMGetCharPtr(CDToString(_BROKER, data.value.inst, NULL)))); 38.34 + if (strcmp(sourcename, resultname) == 0) CMReturnInstance(results, data.value.inst); 38.35 } 38.36 } 38.37
39.1 --- a/src/Xen_MemoryPoolComponent.c Tue Jan 09 11:38:00 2007 -0700 39.2 +++ b/src/Xen_MemoryPoolComponent.c Wed Jan 10 16:52:37 2007 -0700 39.3 @@ -249,7 +249,6 @@ static CMPIStatus Associators( 39.4 _SBLIM_TRACE(2, ("--- Reference does not match required role. Ignoring request.")); 39.5 goto exit; 39.6 } 39.7 - CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_NOT_SUPPORTED, NULL); 39.8 39.9 /* Determine the target class from the source class. */ 39.10 if (CMClassPathIsA(_BROKER, reference, _LHSCLASSNAME, NULL)) {
40.1 --- a/src/Xen_MemorySettingAllocationFromPool.c Tue Jan 09 11:38:00 2007 -0700 40.2 +++ b/src/Xen_MemorySettingAllocationFromPool.c Wed Jan 10 16:52:37 2007 -0700 40.3 @@ -209,7 +209,6 @@ static CMPIStatus Associators( 40.4 _SBLIM_TRACE(2, ("--- Reference does not match required role. Ignoring request.")); 40.5 goto exit; 40.6 } 40.7 - CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_NOT_SUPPORTED, NULL); 40.8 40.9 /* Determine the target class from the source class. */ 40.10 if (strcmp(sourceclass, _LHSCLASSNAME) == 0) {
41.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 41.2 +++ b/src/Xen_MemorySettingsDefineState.c Wed Jan 10 16:52:37 2007 -0700 41.3 @@ -0,0 +1,531 @@ 41.4 +// Copyright (C) 2006 Novell, Inc. 41.5 +// 41.6 +// This library is free software; you can redistribute it and/or 41.7 +// modify it under the terms of the GNU Lesser General Public 41.8 +// License as published by the Free Software Foundation; either 41.9 +// version 2.1 of the License, or (at your option) any later version. 41.10 +// 41.11 +// This library is distributed in the hope that it will be useful, 41.12 +// but WITHOUT ANY WARRANTY; without even the implied warranty of 41.13 +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 41.14 +// Lesser General Public License for more details. 41.15 +// 41.16 +// You should have received a copy of the GNU Lesser General Public 41.17 +// License along with this library; if not, write to the Free Software 41.18 +// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 41.19 +// ============================================================================ 41.20 +// Authors: Jim Fehlig, <jfehlig@novell.com> 41.21 +// Description: 41.22 +// ============================================================================ 41.23 + 41.24 +#include <string.h> 41.25 + 41.26 +/* Include the required CMPI data types, function headers, and macros */ 41.27 +#include "cmpidt.h" 41.28 +#include "cmpift.h" 41.29 +#include "cmpimacs.h" 41.30 + 41.31 + 41.32 +// ---------------------------------------------------------------------------- 41.33 +// COMMON GLOBAL VARIABLES 41.34 +// ---------------------------------------------------------------------------- 41.35 + 41.36 +/* Handle to the CIM broker. Initialized when the provider lib is loaded. */ 41.37 +static const CMPIBroker *_BROKER; 41.38 + 41.39 +/* Include utility functions */ 41.40 +#include "cmpiutil.h" 41.41 +#include "provider_common.h" 41.42 + 41.43 +/* Include _SBLIM_TRACE() logging support */ 41.44 +#include "cmpitrace.h" 41.45 + 41.46 + 41.47 +// ============================================================================ 41.48 +// CMPI ASSOCIATION PROVIDER FUNCTION TABLE 41.49 +// ============================================================================ 41.50 + 41.51 +// ---------------------------------------------------------------------------- 41.52 +// Info for the class supported by the association provider 41.53 +// ---------------------------------------------------------------------------- 41.54 + 41.55 +/* Name of the left and right hand side classes of this association. */ 41.56 +static char * _ASSOCCLASS = "Xen_MemorySettingsDefineState"; 41.57 +static char * _LHSCLASSNAME = "Xen_MemorySettingData"; 41.58 +static char * _RHSCLASSNAME = "Xen_Memory"; 41.59 +static char * _LHSPROPERTYNAME = "SettingData"; 41.60 +static char * _RHSPROPERTYNAME = "ManagedElement"; 41.61 +static char * _LHSKEYNAME = "InstanceID"; 41.62 +static char * _RHSKEYNAME = "SystemName"; 41.63 + 41.64 +// ---------------------------------------------------------------------------- 41.65 +// AssociationCleanup() 41.66 +// Perform any necessary cleanup immediately before this provider is unloaded. 41.67 +// ---------------------------------------------------------------------------- 41.68 +static CMPIStatus AssociationCleanup( 41.69 + CMPIAssociationMI * self, /* [in] Handle to this provider (i.e. 'self'). */ 41.70 + const CMPIContext * context, /* [in] Additional context info, if any. */ 41.71 + CMPIBoolean terminating) /* [in] True if MB is terminating */ 41.72 +{ 41.73 + CMPIStatus status = { CMPI_RC_OK, NULL }; /* Return status of CIM operations. */ 41.74 + 41.75 + _SBLIM_ENTER("AssociationCleanup"); 41.76 + _SBLIM_TRACE(2, ("--- self=\"%s\"", self->ft->miName)); 41.77 + _SBLIM_TRACE(2, ("--- context=\"%s\"", CMGetCharPtr(CDToString(_BROKER, context, NULL)))); 41.78 + 41.79 + /* Nothing needs to be done for cleanup. */ 41.80 + _SBLIM_RETURNSTATUS(status); 41.81 +} 41.82 + 41.83 + 41.84 +// ---------------------------------------------------------------------------- 41.85 +// AssociatorNames() 41.86 +// ---------------------------------------------------------------------------- 41.87 +static CMPIStatus AssociatorNames( 41.88 + CMPIAssociationMI * self, /* [in] Handle to this provider (i.e. 'self'). */ 41.89 + const CMPIContext * context, /* [in] Additional context info, if any. */ 41.90 + const CMPIResult * results, /* [out] Results of this operation. */ 41.91 + const CMPIObjectPath * reference, /* [in] Contains source namespace, classname and object path. */ 41.92 + const char * assocClass, 41.93 + const char * resultClass, 41.94 + const char * role, 41.95 + const char * resultRole) 41.96 +{ 41.97 + CMPIStatus status = { CMPI_RC_OK, NULL }; /* Return status of CIM operations. */ 41.98 + char *namespace = CMGetCharPtr(CMGetNameSpace(reference, NULL)); /* Target namespace. */ 41.99 + char *sourceclass = CMGetCharPtr(CMGetClassName(reference, &status)); /* Class of the source reference object */ 41.100 + char *targetclass; /* Class of the target object(s). */ 41.101 + char *sourcekeyname; 41.102 + char *targetkeyname; 41.103 + 41.104 + _SBLIM_ENTER("AssociatorNames"); 41.105 + _SBLIM_TRACE(2, ("--- self=\"%s\"", self->ft->miName)); 41.106 + _SBLIM_TRACE(2, ("--- context=\"%s\"", CMGetCharPtr(CDToString(_BROKER, context, NULL)))); 41.107 + _SBLIM_TRACE(2, ("--- reference=\"%s\"", CMGetCharPtr(CDToString(_BROKER, reference, NULL)))); 41.108 + _SBLIM_TRACE(2, ("--- assocClass=\"%s\"", assocClass)); 41.109 + _SBLIM_TRACE(2, ("--- resultClass=\"%s\"", resultClass)); 41.110 + _SBLIM_TRACE(2, ("--- role=\"%s\"", role)); 41.111 + _SBLIM_TRACE(2, ("--- resultRole=\"%s\"", resultRole)); 41.112 + _SBLIM_TRACE(2, ("--- namespace=\"%s\"", namespace)); 41.113 + _SBLIM_TRACE(2, ("--- sourceclass=\"%s\"", sourceclass)); 41.114 + 41.115 + /* Check that the requested association class, if any, is supported. */ 41.116 + if (assocClass != NULL) { 41.117 + CMPIObjectPath * assoc = CMNewObjectPath(_BROKER, namespace, _ASSOCCLASS, NULL); 41.118 + if (!CMClassPathIsA(_BROKER, assoc, assocClass, NULL)) { 41.119 + _SBLIM_TRACE(2, ("--- Unrecognized association class. Ignoring request.")); 41.120 + goto exit; 41.121 + } 41.122 + } 41.123 + 41.124 + /* Check that the reference matches the required role, if any. */ 41.125 + if ((role != NULL) && strcmp(role, sourceclass) != 0) { 41.126 + _SBLIM_TRACE(2, ("--- Reference does not match required role. Ignoring request.")); 41.127 + goto exit; 41.128 + } 41.129 + 41.130 + /* Determine the target class from the source class. */ 41.131 + if (strcmp(sourceclass, _LHSCLASSNAME) == 0) { 41.132 + sourcekeyname = _LHSKEYNAME; 41.133 + targetclass = _RHSCLASSNAME; 41.134 + targetkeyname = _RHSKEYNAME; 41.135 + } else if (strcmp(sourceclass, _RHSCLASSNAME) == 0) { 41.136 + sourcekeyname = _RHSKEYNAME; 41.137 + targetclass = _LHSCLASSNAME; 41.138 + targetkeyname = _LHSKEYNAME; 41.139 + } else { 41.140 + _SBLIM_TRACE(2, ("--- Unrecognized source class. Ignoring request.")); 41.141 + goto exit; 41.142 + } 41.143 + _SBLIM_TRACE(2, ("--- targetclass=\"%s\"", targetclass)); 41.144 + 41.145 + CMPIData namedata = CMGetKey(reference, sourcekeyname, NULL); 41.146 + char * sourcename = CMGetCharPtr(namedata.value.string); 41.147 + _SBLIM_TRACE(2, ("--- sourcename=\"%s\"", sourcename)); 41.148 + 41.149 + /* Create an object path for the result class. */ 41.150 + CMPIObjectPath * objectpath = CMNewObjectPath(_BROKER, namespace, targetclass, &status); 41.151 + if ((status.rc != CMPI_RC_OK) || CMIsNullObject(objectpath)) { 41.152 + _SBLIM_TRACE(1,("--- CMNewObjectPath() failed - %s", CMGetCharPtr(status.msg))); 41.153 + CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERROR, "Cannot create new CMPIObjectPath"); 41.154 + goto exit; 41.155 + } 41.156 + 41.157 + /* Get the list of all target class object paths from the CIMOM. */ 41.158 + CMPIEnumeration * objectpaths = CBEnumInstanceNames(_BROKER, context, objectpath, &status); 41.159 + if ((status.rc != CMPI_RC_OK) || CMIsNullObject(objectpaths)) { 41.160 + _SBLIM_TRACE(1,("--- CBEnumInstanceNames() failed - %s", CMGetCharPtr(status.msg))); 41.161 + CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERROR, "Cannot enumerate target class"); 41.162 + goto exit; 41.163 + } 41.164 + 41.165 + /* Return all object paths that exactly match the target class and resultClass, if specified. */ 41.166 + while (CMHasNext(objectpaths, NULL)) { 41.167 + CMPIData data = CMGetNext(objectpaths, NULL); 41.168 + char *class = CMGetCharPtr(CMGetClassName(data.value.ref, NULL)); 41.169 + if ((strcmp(class,targetclass) == 0) && ((resultClass == NULL) || (strcmp(class,resultClass) == 0))) { 41.170 + /* Only return entries whose name matches the reference. */ 41.171 + namedata = CMGetKey(data.value.ref, targetkeyname, &status); 41.172 + char * resultname = CMGetCharPtr(namedata.value.string); 41.173 + if (strcmp(sourcename, resultname) == 0) CMReturnObjectPath(results, data.value.ref); 41.174 + } 41.175 + } 41.176 + 41.177 + CMReturnDone(results); 41.178 + 41.179 +exit: 41.180 + _SBLIM_RETURNSTATUS(status); 41.181 +} 41.182 + 41.183 + 41.184 +// ---------------------------------------------------------------------------- 41.185 +// Associators() 41.186 +// ---------------------------------------------------------------------------- 41.187 +static CMPIStatus Associators( 41.188 + CMPIAssociationMI * self, /* [in] Handle to this provider (i.e. 'self'). */ 41.189 + const CMPIContext * context, /* [in] Additional context info, if any. */ 41.190 + const CMPIResult * results, /* [out] Results of this operation. */ 41.191 + const CMPIObjectPath * reference, /* [in] Contains the source namespace, classname and object path. */ 41.192 + const char *assocClass, 41.193 + const char *resultClass, 41.194 + const char *role, 41.195 + const char *resultRole, 41.196 + const char ** properties) /* [in] List of desired properties (NULL=all). */ 41.197 +{ 41.198 + CMPIStatus status = { CMPI_RC_OK, NULL }; /* Return status of CIM operations. */ 41.199 + char *namespace = CMGetCharPtr(CMGetNameSpace(reference, NULL)); /* Target namespace. */ 41.200 + char *sourceclass = CMGetCharPtr(CMGetClassName(reference, &status)); /* Class of the source reference object */ 41.201 + char *targetclass; /* Class of the target object(s). */ 41.202 + char *sourcekeyname; 41.203 + char *targetkeyname; 41.204 + 41.205 + _SBLIM_ENTER("Associators"); 41.206 + _SBLIM_TRACE(2, ("--- self=\"%s\"", self->ft->miName)); 41.207 + _SBLIM_TRACE(2, ("--- context=\"%s\"", CMGetCharPtr(CDToString(_BROKER, context, NULL)))); 41.208 + _SBLIM_TRACE(2, ("--- reference=\"%s\"", CMGetCharPtr(CDToString(_BROKER, reference, NULL)))); 41.209 + _SBLIM_TRACE(2, ("--- assocClass=\"%s\"", assocClass)); 41.210 + _SBLIM_TRACE(2, ("--- resultClass=\"%s\"", resultClass)); 41.211 + _SBLIM_TRACE(2, ("--- role=\"%s\"", role)); 41.212 + _SBLIM_TRACE(2, ("--- resultRole=\"%s\"", resultRole)); 41.213 + _SBLIM_TRACE(2, ("--- namespace=\"%s\"", namespace)); 41.214 + _SBLIM_TRACE(2, ("--- sourceclass=\"%s\"", sourceclass)); 41.215 + 41.216 + /* Check that the requested association class, if any, is supported. */ 41.217 + if (assocClass != NULL) { 41.218 + CMPIObjectPath * assoc = CMNewObjectPath(_BROKER, namespace, _ASSOCCLASS, NULL); 41.219 + if (!CMClassPathIsA(_BROKER, assoc, assocClass, NULL)) { 41.220 + _SBLIM_TRACE(2, ("--- Unrecognized association class. Ignoring request.")); 41.221 + goto exit; 41.222 + } 41.223 + } 41.224 + 41.225 + /* Check that the reference matches the required role, if any. */ 41.226 + if ((role != NULL) && strcmp(role, sourceclass) != 0) { 41.227 + _SBLIM_TRACE(2, ("--- Reference does not match required role. Ignoring request.")); 41.228 + goto exit; 41.229 + } 41.230 + 41.231 + /* Determine the target class from the source class. */ 41.232 + if (strcmp(sourceclass, _LHSCLASSNAME) == 0) { 41.233 + sourcekeyname = _LHSKEYNAME; 41.234 + targetclass = _RHSCLASSNAME; 41.235 + targetkeyname = _RHSKEYNAME; 41.236 + } else if (strcmp(sourceclass, _RHSCLASSNAME) == 0) { 41.237 + sourcekeyname = _RHSKEYNAME; 41.238 + targetclass = _LHSCLASSNAME; 41.239 + targetkeyname = _LHSKEYNAME; 41.240 + } else { 41.241 + _SBLIM_TRACE(2, ("--- Unrecognized source class. Ignoring request.")); 41.242 + goto exit; 41.243 + } 41.244 + _SBLIM_TRACE(2, ("--- targetclass=\"%s\"", targetclass)); 41.245 + 41.246 + CMPIData namedata = CMGetKey(reference, sourcekeyname, NULL); 41.247 + char * sourcename = CMGetCharPtr(namedata.value.string); 41.248 + _SBLIM_TRACE(2, ("--- sourcename=\"%s\"", sourcename)); 41.249 + 41.250 + /* Create an object path for the result class. */ 41.251 + CMPIObjectPath * objectpath = CMNewObjectPath(_BROKER, namespace, targetclass, &status); 41.252 + if ((status.rc != CMPI_RC_OK) || CMIsNullObject(objectpath)) { 41.253 + _SBLIM_TRACE(1,("--- CMNewObjectPath() failed - %s", CMGetCharPtr(status.msg))); 41.254 + CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERROR, "Cannot create new CMPIObjectPath"); 41.255 + goto exit; 41.256 + } 41.257 + 41.258 + /* Get the list of all target class instances from the CIMOM. */ 41.259 + CMPIEnumeration * instances = CBEnumInstances(_BROKER, context, objectpath, NULL, &status); 41.260 + if ((status.rc != CMPI_RC_OK) || CMIsNullObject(instances)) { 41.261 + _SBLIM_TRACE(1,("--- CBEnumInstances() failed - %s", CMGetCharPtr(status.msg))); 41.262 + CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERROR, "Cannot enumerate target class"); 41.263 + goto exit; 41.264 + } 41.265 + 41.266 + /* Return all instances that exactly match the target class and resultClass, if specified. */ 41.267 + while (CMHasNext(instances, NULL)) { 41.268 + CMPIData data = CMGetNext(instances, NULL); 41.269 + char *class = CMGetCharPtr(CMGetClassName(CMGetObjectPath(data.value.inst,NULL), NULL)); 41.270 + if ((strcmp(class,targetclass) == 0) && ((resultClass == NULL) || (strcmp(class,resultClass) == 0))) { 41.271 + /* Only return entries whose name matches the reference. */ 41.272 + namedata = CMGetProperty(data.value.inst, targetkeyname, NULL); 41.273 + char * resultname = CMGetCharPtr(namedata.value.string); 41.274 + // BUG - returning data causes crash !?! 41.275 + _SBLIM_TRACE(2, ("--- data.value.inst=\"%s\"", CMGetCharPtr(CDToString(_BROKER, data.value.inst, NULL)))); 41.276 + if (strcmp(sourcename, resultname) == 0) CMReturnInstance(results, data.value.inst); 41.277 + } 41.278 + } 41.279 + 41.280 + CMReturnDone(results); 41.281 + 41.282 +exit: 41.283 + _SBLIM_RETURNSTATUS(status); 41.284 +} 41.285 + 41.286 + 41.287 +// ---------------------------------------------------------------------------- 41.288 +// ReferenceNames() 41.289 +// ---------------------------------------------------------------------------- 41.290 +static CMPIStatus ReferenceNames( 41.291 + CMPIAssociationMI * self, /* [in] Handle to this provider (i.e. 'self'). */ 41.292 + const CMPIContext * context, /* [in] Additional context info, if any. */ 41.293 + const CMPIResult * results, /* [out] Results of this operation. */ 41.294 + const CMPIObjectPath * reference, /* [in] Contains the source namespace, classname and object path. */ 41.295 + const char *assocClass, 41.296 + const char *role) 41.297 +{ 41.298 + CMPIStatus status = { CMPI_RC_OK, NULL }; /* Return status of CIM operations. */ 41.299 + char *namespace = CMGetCharPtr(CMGetNameSpace(reference, NULL)); /* Target namespace. */ 41.300 + char *sourceclass = CMGetCharPtr(CMGetClassName(reference, &status)); /* Class of the source reference object */ 41.301 + char *targetclass; /* Class of the target object(s). */ 41.302 + char *sourcekeyname; 41.303 + char *targetkeyname; 41.304 + 41.305 + _SBLIM_ENTER("ReferenceNames"); 41.306 + _SBLIM_TRACE(2, ("--- self=\"%s\"", self->ft->miName)); 41.307 + _SBLIM_TRACE(2, ("--- context=\"%s\"", CMGetCharPtr(CDToString(_BROKER, context, NULL)))); 41.308 + _SBLIM_TRACE(2, ("--- reference=\"%s\"", CMGetCharPtr(CDToString(_BROKER, reference, NULL)))); 41.309 + _SBLIM_TRACE(2, ("--- assocClass=\"%s\"", assocClass)); 41.310 + _SBLIM_TRACE(2, ("--- role=\"%s\"", role)); 41.311 + _SBLIM_TRACE(2, ("--- namespace=\"%s\"", namespace)); 41.312 + _SBLIM_TRACE(2, ("--- sourceclass=\"%s\"", sourceclass)); 41.313 + 41.314 + /* Check that the requested association class, if any, is supported. */ 41.315 + if (assocClass != NULL) { 41.316 + CMPIObjectPath * assoc = CMNewObjectPath(_BROKER, namespace, _ASSOCCLASS, NULL); 41.317 + if (!CMClassPathIsA(_BROKER, assoc, assocClass, NULL)) { 41.318 + _SBLIM_TRACE(2, ("--- Unrecognized association class. Ignoring request.")); 41.319 + goto exit; 41.320 + } 41.321 + } 41.322 + 41.323 + /* Check that the reference matches the required role, if any. */ 41.324 + if ((role != NULL) && strcmp(role, sourceclass) != 0) { 41.325 + _SBLIM_TRACE(2, ("--- Reference does not match required role. Ignoring request.")); 41.326 + goto exit; 41.327 + } 41.328 + 41.329 + /* Determine the target class from the source class. */ 41.330 + if (strcmp(sourceclass, _LHSCLASSNAME) == 0) { 41.331 + sourcekeyname = _LHSKEYNAME; 41.332 + targetclass = _RHSCLASSNAME; 41.333 + targetkeyname = _RHSKEYNAME; 41.334 + } else if (strcmp(sourceclass, _RHSCLASSNAME) == 0) { 41.335 + sourcekeyname = _RHSKEYNAME; 41.336 + targetclass = _LHSCLASSNAME; 41.337 + targetkeyname = _LHSKEYNAME; 41.338 + } else { 41.339 + _SBLIM_TRACE(2, ("--- Unrecognized source class. Ignoring request.")); 41.340 + goto exit; 41.341 + } 41.342 + _SBLIM_TRACE(2, ("--- targetclass=\"%s\"", targetclass)); 41.343 + _SBLIM_TRACE(2, ("--- targetclass=\"%s\"", targetclass)); 41.344 + 41.345 + CMPIData namedata = CMGetKey(reference, sourcekeyname, NULL); 41.346 + char * sourcename = CMGetCharPtr(namedata.value.string); 41.347 + _SBLIM_TRACE(2, ("--- sourcename=\"%s\"", sourcename)); 41.348 + 41.349 + /* Create an object path for the result class. */ 41.350 + CMPIObjectPath * objectpath = CMNewObjectPath(_BROKER, namespace, targetclass, &status); 41.351 + if ((status.rc != CMPI_RC_OK) || CMIsNullObject(objectpath)) { 41.352 + _SBLIM_TRACE(1,("--- CMNewObjectPath() failed - %s", CMGetCharPtr(status.msg))); 41.353 + CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERROR, "Cannot create new CMPIObjectPath"); 41.354 + goto exit; 41.355 + } 41.356 + 41.357 + /* Get the list of all target class object paths from the CIMOM. */ 41.358 + CMPIEnumeration * objectpaths = CBEnumInstanceNames(_BROKER, context, objectpath, &status); 41.359 + if ((status.rc != CMPI_RC_OK) || CMIsNullObject(objectpaths)) { 41.360 + _SBLIM_TRACE(1,("--- CBEnumInstanceNames() failed - %s", CMGetCharPtr(status.msg))); 41.361 + CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERROR, "Cannot enumerate target class"); 41.362 + goto exit; 41.363 + } 41.364 + 41.365 + /* Return all object paths that exactly match the target class and resultClass, if specified. */ 41.366 + while (CMHasNext(objectpaths, NULL)) { 41.367 + CMPIData data = CMGetNext(objectpaths, NULL); 41.368 + char *class = CMGetCharPtr(CMGetClassName(data.value.ref, NULL)); 41.369 + if (strcmp(class,targetclass) == 0) { 41.370 + 41.371 + /* Create an object path for the association. */ 41.372 + CMPIObjectPath * refobjectpath = CMNewObjectPath(_BROKER, namespace, _ASSOCCLASS, &status); 41.373 + if ((status.rc != CMPI_RC_OK) || CMIsNullObject(refobjectpath)) { 41.374 + _SBLIM_TRACE(1,("--- CMNewObjectPath() failed - %s", CMGetCharPtr(status.msg))); 41.375 + CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERROR, "Cannot create new CMPIObjectPath"); 41.376 + goto exit; 41.377 + } 41.378 + 41.379 + /* Assign the references in the association appropriately. */ 41.380 + if (strcmp(sourceclass, _RHSCLASSNAME) == 0) { 41.381 + CMAddKey(refobjectpath, _RHSPROPERTYNAME, &reference, CMPI_ref); 41.382 + CMAddKey(refobjectpath, _LHSPROPERTYNAME, &data.value.ref, CMPI_ref); 41.383 + } else { 41.384 + CMAddKey(refobjectpath, _RHSPROPERTYNAME, &data.value.ref, CMPI_ref); 41.385 + CMAddKey(refobjectpath, _LHSPROPERTYNAME, &reference, CMPI_ref); 41.386 + } 41.387 + 41.388 + /* Only return entries whose name matches the reference. */ 41.389 + namedata = CMGetKey(data.value.ref, targetkeyname, &status); 41.390 + char * resultname = CMGetCharPtr(namedata.value.string); 41.391 + if (strcmp(sourcename, resultname) == 0) CMReturnObjectPath(results, refobjectpath); 41.392 + } 41.393 + } 41.394 + 41.395 +exit: 41.396 + _SBLIM_RETURNSTATUS(status); 41.397 +} 41.398 + 41.399 + 41.400 +// ---------------------------------------------------------------------------- 41.401 +// References() 41.402 +// ---------------------------------------------------------------------------- 41.403 +static CMPIStatus References( 41.404 + CMPIAssociationMI * self, /* [in] Handle to this provider (i.e. 'self'). */ 41.405 + const CMPIContext * context, /* [in] Additional context info, if any. */ 41.406 + const CMPIResult * results, /* [out] Results of this operation. */ 41.407 + const CMPIObjectPath * reference, /* [in] Contains the namespace, classname and desired object path. */ 41.408 + const char *assocClass, 41.409 + const char *role, 41.410 + const char **properties) /* [in] List of desired properties (NULL=all). */ 41.411 +{ 41.412 + CMPIStatus status = { CMPI_RC_OK, NULL }; /* Return status of CIM operations. */ 41.413 + char *namespace = CMGetCharPtr(CMGetNameSpace(reference, NULL)); /* Target namespace. */ 41.414 + char *sourceclass = CMGetCharPtr(CMGetClassName(reference, &status)); /* Class of the source reference object */ 41.415 + char *targetclass; /* Class of the target object(s). */ 41.416 + char *sourcekeyname; 41.417 + char *targetkeyname; 41.418 + 41.419 + _SBLIM_ENTER("References"); 41.420 + _SBLIM_TRACE(2, ("--- self=\"%s\"", self->ft->miName)); 41.421 + _SBLIM_TRACE(2, ("--- context=\"%s\"", CMGetCharPtr(CDToString(_BROKER, context, NULL)))); 41.422 + _SBLIM_TRACE(2, ("--- reference=\"%s\"", CMGetCharPtr(CDToString(_BROKER, reference, NULL)))); 41.423 + _SBLIM_TRACE(2, ("--- assocClass=\"%s\"", assocClass)); 41.424 + _SBLIM_TRACE(2, ("--- role=\"%s\"", role)); 41.425 + _SBLIM_TRACE(2, ("--- namespace=\"%s\"", namespace)); 41.426 + _SBLIM_TRACE(2, ("--- sourceclass=\"%s\"", sourceclass)); 41.427 + 41.428 + /* Check that the requested association class, if any, is supported. */ 41.429 + if (assocClass != NULL) { 41.430 + CMPIObjectPath * assoc = CMNewObjectPath(_BROKER, namespace, _ASSOCCLASS, NULL); 41.431 + if (!CMClassPathIsA(_BROKER, assoc, assocClass, NULL)) { 41.432 + _SBLIM_TRACE(2, ("--- Unrecognized association class. Ignoring request.")); 41.433 + goto exit; 41.434 + } 41.435 + } 41.436 + 41.437 + /* Check that the reference matches the required role, if any. */ 41.438 + if ((role != NULL) && strcmp(role, sourceclass) != 0) { 41.439 + _SBLIM_TRACE(2, ("--- Reference does not match required role. Ignoring request.")); 41.440 + goto exit; 41.441 + } 41.442 + 41.443 + /* Determine the target class from the source class. */ 41.444 + if (strcmp(sourceclass, _LHSCLASSNAME) == 0) { 41.445 + sourcekeyname = _LHSKEYNAME; 41.446 + targetclass = _RHSCLASSNAME; 41.447 + targetkeyname = _RHSKEYNAME; 41.448 + } else if (strcmp(sourceclass, _RHSCLASSNAME) == 0) { 41.449 + sourcekeyname = _RHSKEYNAME; 41.450 + targetclass = _LHSCLASSNAME; 41.451 + targetkeyname = _LHSKEYNAME; 41.452 + } else { 41.453 + _SBLIM_TRACE(2, ("--- Unrecognized source class. Ignoring request.")); 41.454 + goto exit; 41.455 + } 41.456 + _SBLIM_TRACE(2, ("--- targetclass=\"%s\"", targetclass)); 41.457 + 41.458 + CMPIData namedata = CMGetKey(reference, sourcekeyname, NULL); 41.459 + char * sourcename = CMGetCharPtr(namedata.value.string); 41.460 + _SBLIM_TRACE(2, ("--- sourcename=\"%s\"", sourcename)); 41.461 + 41.462 + /* Create an object path for the result class. */ 41.463 + CMPIObjectPath * objectpath = CMNewObjectPath(_BROKER, namespace, targetclass, &status); 41.464 + if ((status.rc != CMPI_RC_OK) || CMIsNullObject(objectpath)) { 41.465 + _SBLIM_TRACE(1,("--- CMNewObjectPath() failed - %s", CMGetCharPtr(status.msg))); 41.466 + CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERROR, "Cannot create new CMPIObjectPath"); 41.467 + goto exit; 41.468 + } 41.469 + 41.470 + /* Get the list of all target class object paths from the CIMOM. */ 41.471 + CMPIEnumeration * objectpaths = CBEnumInstanceNames(_BROKER, context, objectpath, &status); 41.472 + if ((status.rc != CMPI_RC_OK) || CMIsNullObject(objectpaths)) { 41.473 + _SBLIM_TRACE(1,("--- CBEnumInstanceNames() failed - %s", CMGetCharPtr(status.msg))); 41.474 + CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERROR, "Cannot enumerate target class"); 41.475 + goto exit; 41.476 + } 41.477 + 41.478 + /* Return all object paths that exactly match the target class and resultClass, if specified. */ 41.479 + while (CMHasNext(objectpaths, NULL)) { 41.480 + CMPIData data = CMGetNext(objectpaths, NULL); 41.481 + char *class = CMGetCharPtr(CMGetClassName(data.value.ref, NULL)); 41.482 + if (strcmp(class,targetclass) == 0) { 41.483 + 41.484 + /* Create an instance for the association. */ 41.485 + CMPIInstance * refinstance = _CMNewInstance(_BROKER, namespace, _ASSOCCLASS, &status); 41.486 + if ((status.rc != CMPI_RC_OK) || CMIsNullObject(refinstance)) { 41.487 + _SBLIM_TRACE(1,("--- CMNewInstance() failed - %s", CMGetCharPtr(status.msg))); 41.488 + CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERROR, "Cannot create new CMPIInstance"); 41.489 + goto exit; 41.490 + } 41.491 + 41.492 + /* Assign the references in the association appropriately. */ 41.493 + if (strcmp(sourceclass, _RHSCLASSNAME) == 0) { 41.494 + CMSetProperty(refinstance, _RHSPROPERTYNAME, &reference, CMPI_ref); 41.495 + CMSetProperty(refinstance, _LHSPROPERTYNAME, &data.value.ref, CMPI_ref); 41.496 + } else { 41.497 + CMSetProperty(refinstance, _RHSPROPERTYNAME, &data.value.ref, CMPI_ref); 41.498 + CMSetProperty(refinstance, _LHSPROPERTYNAME, &reference, CMPI_ref); 41.499 + } 41.500 + 41.501 + /* Only return entries whose name matches the reference. */ 41.502 + namedata = CMGetKey(data.value.ref, targetkeyname, &status); 41.503 + char * resultname = CMGetCharPtr(namedata.value.string); 41.504 + if (strcmp(sourcename, resultname) == 0) CMReturnInstance(results, refinstance); 41.505 + } 41.506 + } 41.507 + 41.508 +exit: 41.509 + _SBLIM_RETURNSTATUS(status); 41.510 +} 41.511 + 41.512 + 41.513 +// ---------------------------------------------------------------------------- 41.514 +// AssociationInitialize() 41.515 +// Perform any necessary initialization immediately after this provider is 41.516 +// first loaded. 41.517 +// ---------------------------------------------------------------------------- 41.518 +static void AssociationInitialize( 41.519 + CMPIAssociationMI * self, /* [in] Handle to this provider (i.e. 'self'). */ 41.520 + const CMPIContext * context) /* [in] Additional context info, if any. */ 41.521 +{ 41.522 + _SBLIM_ENTER("AssociationInitialize"); 41.523 + _SBLIM_TRACE(2, ("--- self=\"%s\"", self->ft->miName)); 41.524 + // _SBLIM_TRACE(2, ("--- context=\"%s\"", CMGetCharPtr(CDToString(_BROKER, context, NULL)))); 41.525 + 41.526 + /* Nothing needs to be done to initialize this provider */ 41.527 + _SBLIM_RETURN(); 41.528 +} 41.529 + 41.530 + 41.531 +// ============================================================================ 41.532 +// CMPI ASSOCIATION PROVIDER FUNCTION TABLE SETUP 41.533 +// ============================================================================ 41.534 +CMAssociationMIStub( , Xen_MemorySettingsDefineState, _BROKER, AssociationInitialize(&mi, ctx));
42.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 42.2 +++ b/src/Xen_NPSettingsDefineState.c Wed Jan 10 16:52:37 2007 -0700 42.3 @@ -0,0 +1,530 @@ 42.4 +// Copyright (C) 2006 Novell, Inc. 42.5 +// 42.6 +// This library is free software; you can redistribute it and/or 42.7 +// modify it under the terms of the GNU Lesser General Public 42.8 +// License as published by the Free Software Foundation; either 42.9 +// version 2.1 of the License, or (at your option) any later version. 42.10 +// 42.11 +// This library is distributed in the hope that it will be useful, 42.12 +// but WITHOUT ANY WARRANTY; without even the implied warranty of 42.13 +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 42.14 +// Lesser General Public License for more details. 42.15 +// 42.16 +// You should have received a copy of the GNU Lesser General Public 42.17 +// License along with this library; if not, write to the Free Software 42.18 +// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 42.19 +// ============================================================================ 42.20 +// Authors: Jim Fehlig, <jfehlig@novell.com> 42.21 +// Description: 42.22 +// ============================================================================ 42.23 + 42.24 +#include <string.h> 42.25 + 42.26 +/* Include the required CMPI data types, function headers, and macros */ 42.27 +#include "cmpidt.h" 42.28 +#include "cmpift.h" 42.29 +#include "cmpimacs.h" 42.30 + 42.31 + 42.32 +// ---------------------------------------------------------------------------- 42.33 +// COMMON GLOBAL VARIABLES 42.34 +// ---------------------------------------------------------------------------- 42.35 + 42.36 +/* Handle to the CIM broker. Initialized when the provider lib is loaded. */ 42.37 +static const CMPIBroker *_BROKER; 42.38 + 42.39 +/* Include utility functions */ 42.40 +#include "cmpiutil.h" 42.41 +#include "provider_common.h" 42.42 + 42.43 +/* Include _SBLIM_TRACE() logging support */ 42.44 +#include "cmpitrace.h" 42.45 + 42.46 + 42.47 +// ============================================================================ 42.48 +// CMPI ASSOCIATION PROVIDER FUNCTION TABLE 42.49 +// ============================================================================ 42.50 + 42.51 +// ---------------------------------------------------------------------------- 42.52 +// Info for the class supported by the association provider 42.53 +// ---------------------------------------------------------------------------- 42.54 + 42.55 +/* Name of the left and right hand side classes of this association. */ 42.56 +static char * _ASSOCCLASS = "Xen_NPSettingsDefineState"; 42.57 +static char * _LHSCLASSNAME = "Xen_NetworkPortSettingData"; 42.58 +static char * _RHSCLASSNAME = "Xen_NetworkPort"; 42.59 +static char * _LHSPROPERTYNAME = "SettingData"; 42.60 +static char * _RHSPROPERTYNAME = "ManagedElement"; 42.61 +static char * _LHSKEYNAME = "InstanceID"; 42.62 +static char * _RHSKEYNAME = "SystemName"; 42.63 + 42.64 +// ---------------------------------------------------------------------------- 42.65 +// AssociationCleanup() 42.66 +// Perform any necessary cleanup immediately before this provider is unloaded. 42.67 +// ---------------------------------------------------------------------------- 42.68 +static CMPIStatus AssociationCleanup( 42.69 + CMPIAssociationMI * self, /* [in] Handle to this provider (i.e. 'self'). */ 42.70 + const CMPIContext * context, /* [in] Additional context info, if any. */ 42.71 + CMPIBoolean terminating) /* [in] True if MB is terminating */ 42.72 +{ 42.73 + CMPIStatus status = { CMPI_RC_OK, NULL }; /* Return status of CIM operations. */ 42.74 + 42.75 + _SBLIM_ENTER("AssociationCleanup"); 42.76 + _SBLIM_TRACE(2, ("--- self=\"%s\"", self->ft->miName)); 42.77 + _SBLIM_TRACE(2, ("--- context=\"%s\"", CMGetCharPtr(CDToString(_BROKER, context, NULL)))); 42.78 + 42.79 + /* Nothing needs to be done for cleanup. */ 42.80 + _SBLIM_RETURNSTATUS(status); 42.81 +} 42.82 + 42.83 + 42.84 +// ---------------------------------------------------------------------------- 42.85 +// AssociatorNames() 42.86 +// ---------------------------------------------------------------------------- 42.87 +static CMPIStatus AssociatorNames( 42.88 + CMPIAssociationMI * self, /* [in] Handle to this provider (i.e. 'self'). */ 42.89 + const CMPIContext * context, /* [in] Additional context info, if any. */ 42.90 + const CMPIResult * results, /* [out] Results of this operation. */ 42.91 + const CMPIObjectPath * reference, /* [in] Contains source namespace, classname and object path. */ 42.92 + const char * assocClass, 42.93 + const char * resultClass, 42.94 + const char * role, 42.95 + const char * resultRole) 42.96 +{ 42.97 + CMPIStatus status = { CMPI_RC_OK, NULL }; /* Return status of CIM operations. */ 42.98 + char *namespace = CMGetCharPtr(CMGetNameSpace(reference, NULL)); /* Target namespace. */ 42.99 + char *sourceclass = CMGetCharPtr(CMGetClassName(reference, &status)); /* Class of the source reference object */ 42.100 + char *targetclass; /* Class of the target object(s). */ 42.101 + char *sourcekeyname; 42.102 + char *targetkeyname; 42.103 + 42.104 + _SBLIM_ENTER("AssociatorNames"); 42.105 + _SBLIM_TRACE(2, ("--- self=\"%s\"", self->ft->miName)); 42.106 + _SBLIM_TRACE(2, ("--- context=\"%s\"", CMGetCharPtr(CDToString(_BROKER, context, NULL)))); 42.107 + _SBLIM_TRACE(2, ("--- reference=\"%s\"", CMGetCharPtr(CDToString(_BROKER, reference, NULL)))); 42.108 + _SBLIM_TRACE(2, ("--- assocClass=\"%s\"", assocClass)); 42.109 + _SBLIM_TRACE(2, ("--- resultClass=\"%s\"", resultClass)); 42.110 + _SBLIM_TRACE(2, ("--- role=\"%s\"", role)); 42.111 + _SBLIM_TRACE(2, ("--- resultRole=\"%s\"", resultRole)); 42.112 + _SBLIM_TRACE(2, ("--- namespace=\"%s\"", namespace)); 42.113 + _SBLIM_TRACE(2, ("--- sourceclass=\"%s\"", sourceclass)); 42.114 + 42.115 + /* Check that the requested association class, if any, is supported. */ 42.116 + if (assocClass != NULL) { 42.117 + CMPIObjectPath * assoc = CMNewObjectPath(_BROKER, namespace, _ASSOCCLASS, NULL); 42.118 + if (!CMClassPathIsA(_BROKER, assoc, assocClass, NULL)) { 42.119 + _SBLIM_TRACE(2, ("--- Unrecognized association class. Ignoring request.")); 42.120 + goto exit; 42.121 + } 42.122 + } 42.123 + 42.124 + /* Check that the reference matches the required role, if any. */ 42.125 + if ((role != NULL) && strcmp(role, sourceclass) != 0) { 42.126 + _SBLIM_TRACE(2, ("--- Reference does not match required role. Ignoring request.")); 42.127 + goto exit; 42.128 + } 42.129 + 42.130 + /* Determine the target class from the source class. */ 42.131 + if (strcmp(sourceclass, _LHSCLASSNAME) == 0) { 42.132 + sourcekeyname = _LHSKEYNAME; 42.133 + targetclass = _RHSCLASSNAME; 42.134 + targetkeyname = _RHSKEYNAME; 42.135 + } else if (strcmp(sourceclass, _RHSCLASSNAME) == 0) { 42.136 + sourcekeyname = _RHSKEYNAME; 42.137 + targetclass = _LHSCLASSNAME; 42.138 + targetkeyname = _LHSKEYNAME; 42.139 + } else { 42.140 + _SBLIM_TRACE(2, ("--- Unrecognized source class. Ignoring request.")); 42.141 + goto exit; 42.142 + } 42.143 + _SBLIM_TRACE(2, ("--- targetclass=\"%s\"", targetclass)); 42.144 + 42.145 + CMPIData namedata = CMGetKey(reference, sourcekeyname, NULL); 42.146 + char * sourcename = CMGetCharPtr(namedata.value.string); 42.147 + _SBLIM_TRACE(2, ("--- sourcename=\"%s\"", sourcename)); 42.148 + 42.149 + /* Create an object path for the result class. */ 42.150 + CMPIObjectPath * objectpath = CMNewObjectPath(_BROKER, namespace, targetclass, &status); 42.151 + if ((status.rc != CMPI_RC_OK) || CMIsNullObject(objectpath)) { 42.152 + _SBLIM_TRACE(1,("--- CMNewObjectPath() failed - %s", CMGetCharPtr(status.msg))); 42.153 + CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERROR, "Cannot create new CMPIObjectPath"); 42.154 + goto exit; 42.155 + } 42.156 + 42.157 + /* Get the list of all target class object paths from the CIMOM. */ 42.158 + CMPIEnumeration * objectpaths = CBEnumInstanceNames(_BROKER, context, objectpath, &status); 42.159 + if ((status.rc != CMPI_RC_OK) || CMIsNullObject(objectpaths)) { 42.160 + _SBLIM_TRACE(1,("--- CBEnumInstanceNames() failed - %s", CMGetCharPtr(status.msg))); 42.161 + CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERROR, "Cannot enumerate target class"); 42.162 + goto exit; 42.163 + } 42.164 + 42.165 + /* Return all object paths that exactly match the target class and resultClass, if specified. */ 42.166 + while (CMHasNext(objectpaths, NULL)) { 42.167 + CMPIData data = CMGetNext(objectpaths, NULL); 42.168 + char *class = CMGetCharPtr(CMGetClassName(data.value.ref, NULL)); 42.169 + if ((strcmp(class,targetclass) == 0) && ((resultClass == NULL) || (strcmp(class,resultClass) == 0))) { 42.170 + /* Only return entries whose name matches the reference. */ 42.171 + namedata = CMGetKey(data.value.ref, targetkeyname, &status); 42.172 + char * resultname = CMGetCharPtr(namedata.value.string); 42.173 + if (strcmp(sourcename, resultname) == 0) CMReturnObjectPath(results, data.value.ref); 42.174 + } 42.175 + } 42.176 + 42.177 + CMReturnDone(results); 42.178 + 42.179 +exit: 42.180 + _SBLIM_RETURNSTATUS(status); 42.181 +} 42.182 + 42.183 + 42.184 +// ---------------------------------------------------------------------------- 42.185 +// Associators() 42.186 +// ---------------------------------------------------------------------------- 42.187 +static CMPIStatus Associators( 42.188 + CMPIAssociationMI * self, /* [in] Handle to this provider (i.e. 'self'). */ 42.189 + const CMPIContext * context, /* [in] Additional context info, if any. */ 42.190 + const CMPIResult * results, /* [out] Results of this operation. */ 42.191 + const CMPIObjectPath * reference, /* [in] Contains the source namespace, classname and object path. */ 42.192 + const char *assocClass, 42.193 + const char *resultClass, 42.194 + const char *role, 42.195 + const char *resultRole, 42.196 + const char ** properties) /* [in] List of desired properties (NULL=all). */ 42.197 +{ 42.198 + CMPIStatus status = { CMPI_RC_OK, NULL }; /* Return status of CIM operations. */ 42.199 + char *namespace = CMGetCharPtr(CMGetNameSpace(reference, NULL)); /* Target namespace. */ 42.200 + char *sourceclass = CMGetCharPtr(CMGetClassName(reference, &status)); /* Class of the source reference object */ 42.201 + char *targetclass; /* Class of the target object(s). */ 42.202 + char *sourcekeyname; 42.203 + char *targetkeyname; 42.204 + 42.205 + _SBLIM_ENTER("Associators"); 42.206 + _SBLIM_TRACE(2, ("--- self=\"%s\"", self->ft->miName)); 42.207 + _SBLIM_TRACE(2, ("--- context=\"%s\"", CMGetCharPtr(CDToString(_BROKER, context, NULL)))); 42.208 + _SBLIM_TRACE(2, ("--- reference=\"%s\"", CMGetCharPtr(CDToString(_BROKER, reference, NULL)))); 42.209 + _SBLIM_TRACE(2, ("--- assocClass=\"%s\"", assocClass)); 42.210 + _SBLIM_TRACE(2, ("--- resultClass=\"%s\"", resultClass)); 42.211 + _SBLIM_TRACE(2, ("--- role=\"%s\"", role)); 42.212 + _SBLIM_TRACE(2, ("--- resultRole=\"%s\"", resultRole)); 42.213 + _SBLIM_TRACE(2, ("--- namespace=\"%s\"", namespace)); 42.214 + _SBLIM_TRACE(2, ("--- sourceclass=\"%s\"", sourceclass)); 42.215 + 42.216 + /* Check that the requested association class, if any, is supported. */ 42.217 + if (assocClass != NULL) { 42.218 + CMPIObjectPath * assoc = CMNewObjectPath(_BROKER, namespace, _ASSOCCLASS, NULL); 42.219 + if (!CMClassPathIsA(_BROKER, assoc, assocClass, NULL)) { 42.220 + _SBLIM_TRACE(2, ("--- Unrecognized association class. Ignoring request.")); 42.221 + goto exit; 42.222 + } 42.223 + } 42.224 + 42.225 + /* Check that the reference matches the required role, if any. */ 42.226 + if ((role != NULL) && strcmp(role, sourceclass) != 0) { 42.227 + _SBLIM_TRACE(2, ("--- Reference does not match required role. Ignoring request.")); 42.228 + goto exit; 42.229 + } 42.230 + 42.231 + /* Determine the target class from the source class. */ 42.232 + if (strcmp(sourceclass, _LHSCLASSNAME) == 0) { 42.233 + sourcekeyname = _LHSKEYNAME; 42.234 + targetclass = _RHSCLASSNAME; 42.235 + targetkeyname = _RHSKEYNAME; 42.236 + } else if (strcmp(sourceclass, _RHSCLASSNAME) == 0) { 42.237 + sourcekeyname = _RHSKEYNAME; 42.238 + targetclass = _LHSCLASSNAME; 42.239 + targetkeyname = _LHSKEYNAME; 42.240 + } else { 42.241 + _SBLIM_TRACE(2, ("--- Unrecognized source class. Ignoring request.")); 42.242 + goto exit; 42.243 + } 42.244 + _SBLIM_TRACE(2, ("--- targetclass=\"%s\"", targetclass)); 42.245 + 42.246 + CMPIData namedata = CMGetKey(reference, sourcekeyname, NULL); 42.247 + char * sourcename = CMGetCharPtr(namedata.value.string); 42.248 + _SBLIM_TRACE(2, ("--- sourcename=\"%s\"", sourcename)); 42.249 + 42.250 + /* Create an object path for the result class. */ 42.251 + CMPIObjectPath * objectpath = CMNewObjectPath(_BROKER, namespace, targetclass, &status); 42.252 + if ((status.rc != CMPI_RC_OK) || CMIsNullObject(objectpath)) { 42.253 + _SBLIM_TRACE(1,("--- CMNewObjectPath() failed - %s", CMGetCharPtr(status.msg))); 42.254 + CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERROR, "Cannot create new CMPIObjectPath"); 42.255 + goto exit; 42.256 + } 42.257 + 42.258 + /* Get the list of all target class instances from the CIMOM. */ 42.259 + CMPIEnumeration * instances = CBEnumInstances(_BROKER, context, objectpath, NULL, &status); 42.260 + if ((status.rc != CMPI_RC_OK) || CMIsNullObject(instances)) { 42.261 + _SBLIM_TRACE(1,("--- CBEnumInstances() failed - %s", CMGetCharPtr(status.msg))); 42.262 + CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERROR, "Cannot enumerate target class"); 42.263 + goto exit; 42.264 + } 42.265 + 42.266 + /* Return all instances that exactly match the target class and resultClass, if specified. */ 42.267 + while (CMHasNext(instances, NULL)) { 42.268 + CMPIData data = CMGetNext(instances, NULL); 42.269 + char *class = CMGetCharPtr(CMGetClassName(CMGetObjectPath(data.value.inst,NULL), NULL)); 42.270 + if ((strcmp(class,targetclass) == 0) && ((resultClass == NULL) || (strcmp(class,resultClass) == 0))) { 42.271 + /* Only return entries whose name matches the reference. */ 42.272 + namedata = CMGetProperty(data.value.inst, targetkeyname, NULL); 42.273 + char * resultname = CMGetCharPtr(namedata.value.string); 42.274 + // BUG - returning data causes crash !?! 42.275 + _SBLIM_TRACE(2, ("--- data.value.inst=\"%s\"", CMGetCharPtr(CDToString(_BROKER, data.value.inst, NULL)))); 42.276 + if (strcmp(sourcename, resultname) == 0) CMReturnInstance(results, data.value.inst); 42.277 + } 42.278 + } 42.279 + 42.280 + CMReturnDone(results); 42.281 + 42.282 +exit: 42.283 + _SBLIM_RETURNSTATUS(status); 42.284 +} 42.285 + 42.286 + 42.287 +// ---------------------------------------------------------------------------- 42.288 +// ReferenceNames() 42.289 +// ---------------------------------------------------------------------------- 42.290 +static CMPIStatus ReferenceNames( 42.291 + CMPIAssociationMI * self, /* [in] Handle to this provider (i.e. 'self'). */ 42.292 + const CMPIContext * context, /* [in] Additional context info, if any. */ 42.293 + const CMPIResult * results, /* [out] Results of this operation. */ 42.294 + const CMPIObjectPath * reference, /* [in] Contains the source namespace, classname and object path. */ 42.295 + const char *assocClass, 42.296 + const char *role) 42.297 +{ 42.298 + CMPIStatus status = { CMPI_RC_OK, NULL }; /* Return status of CIM operations. */ 42.299 + char *namespace = CMGetCharPtr(CMGetNameSpace(reference, NULL)); /* Target namespace. */ 42.300 + char *sourceclass = CMGetCharPtr(CMGetClassName(reference, &status)); /* Class of the source reference object */ 42.301 + char *targetclass; /* Class of the target object(s). */ 42.302 + char *sourcekeyname; 42.303 + char *targetkeyname; 42.304 + 42.305 + _SBLIM_ENTER("ReferenceNames"); 42.306 + _SBLIM_TRACE(2, ("--- self=\"%s\"", self->ft->miName)); 42.307 + _SBLIM_TRACE(2, ("--- context=\"%s\"", CMGetCharPtr(CDToString(_BROKER, context, NULL)))); 42.308 + _SBLIM_TRACE(2, ("--- reference=\"%s\"", CMGetCharPtr(CDToString(_BROKER, reference, NULL)))); 42.309 + _SBLIM_TRACE(2, ("--- assocClass=\"%s\"", assocClass)); 42.310 + _SBLIM_TRACE(2, ("--- role=\"%s\"", role)); 42.311 + _SBLIM_TRACE(2, ("--- namespace=\"%s\"", namespace)); 42.312 + _SBLIM_TRACE(2, ("--- sourceclass=\"%s\"", sourceclass)); 42.313 + 42.314 + /* Check that the requested association class, if any, is supported. */ 42.315 + if (assocClass != NULL) { 42.316 + CMPIObjectPath * assoc = CMNewObjectPath(_BROKER, namespace, _ASSOCCLASS, NULL); 42.317 + if (!CMClassPathIsA(_BROKER, assoc, assocClass, NULL)) { 42.318 + _SBLIM_TRACE(2, ("--- Unrecognized association class. Ignoring request.")); 42.319 + goto exit; 42.320 + } 42.321 + } 42.322 + 42.323 + /* Check that the reference matches the required role, if any. */ 42.324 + if ((role != NULL) && strcmp(role, sourceclass) != 0) { 42.325 + _SBLIM_TRACE(2, ("--- Reference does not match required role. Ignoring request.")); 42.326 + goto exit; 42.327 + } 42.328 + 42.329 + /* Determine the target class from the source class. */ 42.330 + if (strcmp(sourceclass, _LHSCLASSNAME) == 0) { 42.331 + sourcekeyname = _LHSKEYNAME; 42.332 + targetclass = _RHSCLASSNAME; 42.333 + targetkeyname = _RHSKEYNAME; 42.334 + } else if (strcmp(sourceclass, _RHSCLASSNAME) == 0) { 42.335 + sourcekeyname = _RHSKEYNAME; 42.336 + targetclass = _LHSCLASSNAME; 42.337 + targetkeyname = _LHSKEYNAME; 42.338 + } else { 42.339 + _SBLIM_TRACE(2, ("--- Unrecognized source class. Ignoring request.")); 42.340 + goto exit; 42.341 + } 42.342 + _SBLIM_TRACE(2, ("--- targetclass=\"%s\"", targetclass)); 42.343 + 42.344 + CMPIData namedata = CMGetKey(reference, sourcekeyname, NULL); 42.345 + char * sourcename = CMGetCharPtr(namedata.value.string); 42.346 + _SBLIM_TRACE(2, ("--- sourcename=\"%s\"", sourcename)); 42.347 + 42.348 + /* Create an object path for the result class. */ 42.349 + CMPIObjectPath * objectpath = CMNewObjectPath(_BROKER, namespace, targetclass, &status); 42.350 + if ((status.rc != CMPI_RC_OK) || CMIsNullObject(objectpath)) { 42.351 + _SBLIM_TRACE(1,("--- CMNewObjectPath() failed - %s", CMGetCharPtr(status.msg))); 42.352 + CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERROR, "Cannot create new CMPIObjectPath"); 42.353 + goto exit; 42.354 + } 42.355 + 42.356 + /* Get the list of all target class object paths from the CIMOM. */ 42.357 + CMPIEnumeration * objectpaths = CBEnumInstanceNames(_BROKER, context, objectpath, &status); 42.358 + if ((status.rc != CMPI_RC_OK) || CMIsNullObject(objectpaths)) { 42.359 + _SBLIM_TRACE(1,("--- CBEnumInstanceNames() failed - %s", CMGetCharPtr(status.msg))); 42.360 + CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERROR, "Cannot enumerate target class"); 42.361 + goto exit; 42.362 + } 42.363 + 42.364 + /* Return all object paths that exactly match the target class and resultClass, if specified. */ 42.365 + while (CMHasNext(objectpaths, NULL)) { 42.366 + CMPIData data = CMGetNext(objectpaths, NULL); 42.367 + char *class = CMGetCharPtr(CMGetClassName(data.value.ref, NULL)); 42.368 + if (strcmp(class,targetclass) == 0) { 42.369 + 42.370 + /* Create an object path for the association. */ 42.371 + CMPIObjectPath * refobjectpath = CMNewObjectPath(_BROKER, namespace, _ASSOCCLASS, &status); 42.372 + if ((status.rc != CMPI_RC_OK) || CMIsNullObject(refobjectpath)) { 42.373 + _SBLIM_TRACE(1,("--- CMNewObjectPath() failed - %s", CMGetCharPtr(status.msg))); 42.374 + CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERROR, "Cannot create new CMPIObjectPath"); 42.375 + goto exit; 42.376 + } 42.377 + 42.378 + /* Assign the references in the association appropriately. */ 42.379 + if (strcmp(sourceclass, _RHSCLASSNAME) == 0) { 42.380 + CMAddKey(refobjectpath, _RHSPROPERTYNAME, &reference, CMPI_ref); 42.381 + CMAddKey(refobjectpath, _LHSPROPERTYNAME, &data.value.ref, CMPI_ref); 42.382 + } else { 42.383 + CMAddKey(refobjectpath, _RHSPROPERTYNAME, &data.value.ref, CMPI_ref); 42.384 + CMAddKey(refobjectpath, _LHSPROPERTYNAME, &reference, CMPI_ref); 42.385 + } 42.386 + 42.387 + /* Only return entries whose name matches the reference. */ 42.388 + namedata = CMGetKey(data.value.ref, targetkeyname, &status); 42.389 + char * resultname = CMGetCharPtr(namedata.value.string); 42.390 + if (strcmp(sourcename, resultname) == 0) CMReturnObjectPath(results, refobjectpath); 42.391 + } 42.392 + } 42.393 + 42.394 +exit: 42.395 + _SBLIM_RETURNSTATUS(status); 42.396 +} 42.397 + 42.398 + 42.399 +// ---------------------------------------------------------------------------- 42.400 +// References() 42.401 +// ---------------------------------------------------------------------------- 42.402 +static CMPIStatus References( 42.403 + CMPIAssociationMI * self, /* [in] Handle to this provider (i.e. 'self'). */ 42.404 + const CMPIContext * context, /* [in] Additional context info, if any. */ 42.405 + const CMPIResult * results, /* [out] Results of this operation. */ 42.406 + const CMPIObjectPath * reference, /* [in] Contains the namespace, classname and desired object path. */ 42.407 + const char *assocClass, 42.408 + const char *role, 42.409 + const char **properties) /* [in] List of desired properties (NULL=all). */ 42.410 +{ 42.411 + CMPIStatus status = { CMPI_RC_OK, NULL }; /* Return status of CIM operations. */ 42.412 + char *namespace = CMGetCharPtr(CMGetNameSpace(reference, NULL)); /* Target namespace. */ 42.413 + char *sourceclass = CMGetCharPtr(CMGetClassName(reference, &status)); /* Class of the source reference object */ 42.414 + char *targetclass; /* Class of the target object(s). */ 42.415 + char *sourcekeyname; 42.416 + char *targetkeyname; 42.417 + 42.418 + _SBLIM_ENTER("References"); 42.419 + _SBLIM_TRACE(2, ("--- self=\"%s\"", self->ft->miName)); 42.420 + _SBLIM_TRACE(2, ("--- context=\"%s\"", CMGetCharPtr(CDToString(_BROKER, context, NULL)))); 42.421 + _SBLIM_TRACE(2, ("--- reference=\"%s\"", CMGetCharPtr(CDToString(_BROKER, reference, NULL)))); 42.422 + _SBLIM_TRACE(2, ("--- assocClass=\"%s\"", assocClass)); 42.423 + _SBLIM_TRACE(2, ("--- role=\"%s\"", role)); 42.424 + _SBLIM_TRACE(2, ("--- namespace=\"%s\"", namespace)); 42.425 + _SBLIM_TRACE(2, ("--- sourceclass=\"%s\"", sourceclass)); 42.426 + 42.427 + /* Check that the requested association class, if any, is supported. */ 42.428 + if (assocClass != NULL) { 42.429 + CMPIObjectPath * assoc = CMNewObjectPath(_BROKER, namespace, _ASSOCCLASS, NULL); 42.430 + if (!CMClassPathIsA(_BROKER, assoc, assocClass, NULL)) { 42.431 + _SBLIM_TRACE(2, ("--- Unrecognized association class. Ignoring request.")); 42.432 + goto exit; 42.433 + } 42.434 + } 42.435 + 42.436 + /* Check that the reference matches the required role, if any. */ 42.437 + if ((role != NULL) && strcmp(role, sourceclass) != 0) { 42.438 + _SBLIM_TRACE(2, ("--- Reference does not match required role. Ignoring request.")); 42.439 + goto exit; 42.440 + } 42.441 + 42.442 + /* Determine the target class from the source class. */ 42.443 + if (strcmp(sourceclass, _LHSCLASSNAME) == 0) { 42.444 + sourcekeyname = _LHSKEYNAME; 42.445 + targetclass = _RHSCLASSNAME; 42.446 + targetkeyname = _RHSKEYNAME; 42.447 + } else if (strcmp(sourceclass, _RHSCLASSNAME) == 0) { 42.448 + sourcekeyname = _RHSKEYNAME; 42.449 + targetclass = _LHSCLASSNAME; 42.450 + targetkeyname = _LHSKEYNAME; 42.451 + } else { 42.452 + _SBLIM_TRACE(2, ("--- Unrecognized source class. Ignoring request.")); 42.453 + goto exit; 42.454 + } 42.455 + _SBLIM_TRACE(2, ("--- targetclass=\"%s\"", targetclass)); 42.456 + 42.457 + CMPIData namedata = CMGetKey(reference, sourcekeyname, NULL); 42.458 + char * sourcename = CMGetCharPtr(namedata.value.string); 42.459 + _SBLIM_TRACE(2, ("--- sourcename=\"%s\"", sourcename)); 42.460 + 42.461 + /* Create an object path for the result class. */ 42.462 + CMPIObjectPath * objectpath = CMNewObjectPath(_BROKER, namespace, targetclass, &status); 42.463 + if ((status.rc != CMPI_RC_OK) || CMIsNullObject(objectpath)) { 42.464 + _SBLIM_TRACE(1,("--- CMNewObjectPath() failed - %s", CMGetCharPtr(status.msg))); 42.465 + CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERROR, "Cannot create new CMPIObjectPath"); 42.466 + goto exit; 42.467 + } 42.468 + 42.469 + /* Get the list of all target class object paths from the CIMOM. */ 42.470 + CMPIEnumeration * objectpaths = CBEnumInstanceNames(_BROKER, context, objectpath, &status); 42.471 + if ((status.rc != CMPI_RC_OK) || CMIsNullObject(objectpaths)) { 42.472 + _SBLIM_TRACE(1,("--- CBEnumInstanceNames() failed - %s", CMGetCharPtr(status.msg))); 42.473 + CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERROR, "Cannot enumerate target class"); 42.474 + goto exit; 42.475 + } 42.476 + 42.477 + /* Return all object paths that exactly match the target class and resultClass, if specified. */ 42.478 + while (CMHasNext(objectpaths, NULL)) { 42.479 + CMPIData data = CMGetNext(objectpaths, NULL); 42.480 + char *class = CMGetCharPtr(CMGetClassName(data.value.ref, NULL)); 42.481 + if (strcmp(class,targetclass) == 0) { 42.482 + 42.483 + /* Create an instance for the association. */ 42.484 + CMPIInstance * refinstance = _CMNewInstance(_BROKER, namespace, _ASSOCCLASS, &status); 42.485 + if ((status.rc != CMPI_RC_OK) || CMIsNullObject(refinstance)) { 42.486 + _SBLIM_TRACE(1,("--- CMNewInstance() failed - %s", CMGetCharPtr(status.msg))); 42.487 + CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERROR, "Cannot create new CMPIInstance"); 42.488 + goto exit; 42.489 + } 42.490 + 42.491 + /* Assign the references in the association appropriately. */ 42.492 + if (strcmp(sourceclass, _RHSCLASSNAME) == 0) { 42.493 + CMSetProperty(refinstance, _RHSPROPERTYNAME, &reference, CMPI_ref); 42.494 + CMSetProperty(refinstance, _LHSPROPERTYNAME, &data.value.ref, CMPI_ref); 42.495 + } else { 42.496 + CMSetProperty(refinstance, _RHSPROPERTYNAME, &data.value.ref, CMPI_ref); 42.497 + CMSetProperty(refinstance, _LHSPROPERTYNAME, &reference, CMPI_ref); 42.498 + } 42.499 + 42.500 + /* Only return entries whose name matches the reference. */ 42.501 + namedata = CMGetKey(data.value.ref, targetkeyname, &status); 42.502 + char * resultname = CMGetCharPtr(namedata.value.string); 42.503 + if (strcmp(sourcename, resultname) == 0) CMReturnInstance(results, refinstance); 42.504 + } 42.505 + } 42.506 + 42.507 +exit: 42.508 + _SBLIM_RETURNSTATUS(status); 42.509 +} 42.510 + 42.511 + 42.512 +// ---------------------------------------------------------------------------- 42.513 +// AssociationInitialize() 42.514 +// Perform any necessary initialization immediately after this provider is 42.515 +// first loaded. 42.516 +// ---------------------------------------------------------------------------- 42.517 +static void AssociationInitialize( 42.518 + CMPIAssociationMI * self, /* [in] Handle to this provider (i.e. 'self'). */ 42.519 + const CMPIContext * context) /* [in] Additional context info, if any. */ 42.520 +{ 42.521 + _SBLIM_ENTER("AssociationInitialize"); 42.522 + _SBLIM_TRACE(2, ("--- self=\"%s\"", self->ft->miName)); 42.523 + // _SBLIM_TRACE(2, ("--- context=\"%s\"", CMGetCharPtr(CDToString(_BROKER, context, NULL)))); 42.524 + 42.525 + /* Nothing needs to be done to initialize this provider */ 42.526 + _SBLIM_RETURN(); 42.527 +} 42.528 + 42.529 + 42.530 +// ============================================================================ 42.531 +// CMPI ASSOCIATION PROVIDER FUNCTION TABLE SETUP 42.532 +// ============================================================================ 42.533 +CMAssociationMIStub( , Xen_NPSettingsDefineState, _BROKER, AssociationInitialize(&mi, ctx));
43.1 --- a/src/Xen_NetworkPortElementSettingData.c Tue Jan 09 11:38:00 2007 -0700 43.2 +++ b/src/Xen_NetworkPortElementSettingData.c Wed Jan 10 16:52:37 2007 -0700 43.3 @@ -52,11 +52,11 @@ static const CMPIBroker *_BROKER; 43.4 /* Name of the left and right hand side classes of this association. */ 43.5 static char * _ASSOCCLASS = "Xen_NetworkPortElementSettingData"; 43.6 static char * _LHSCLASSNAME = "Xen_NetworkPortSettingData"; 43.7 -static char * _RHSCLASSNAME = "Xen_NetworkPort"; 43.8 +static char * _RHSCLASSNAME = "Xen_NetworkPortSettingData"; 43.9 static char * _LHSPROPERTYNAME = "SettingData"; 43.10 static char * _RHSPROPERTYNAME = "ManagedElement"; 43.11 static char * _LHSKEYNAME = "InstanceID"; 43.12 -static char * _RHSKEYNAME = "SystemName"; 43.13 +static char * _RHSKEYNAME = "InstanceID"; 43.14 43.15 // ---------------------------------------------------------------------------- 43.16 // AssociationCleanup() 43.17 @@ -226,7 +226,6 @@ static CMPIStatus Associators( 43.18 _SBLIM_TRACE(2, ("--- Reference does not match required role. Ignoring request.")); 43.19 goto exit; 43.20 } 43.21 - CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_NOT_SUPPORTED, NULL); 43.22 43.23 /* Determine the target class from the source class. */ 43.24 if (strcmp(sourceclass, _LHSCLASSNAME) == 0) { 43.25 @@ -271,9 +270,9 @@ static CMPIStatus Associators( 43.26 /* Only return entries whose name matches the reference. */ 43.27 namedata = CMGetProperty(data.value.inst, targetkeyname, NULL); 43.28 char * resultname = CMGetCharPtr(namedata.value.string); 43.29 -// BUG - returning data causes crash !?! 43.30 -_SBLIM_TRACE(2, ("--- data.value.inst=\"%s\"", CMGetCharPtr(CDToString(_BROKER, data.value.inst, NULL)))); 43.31 -// if (strcmp(sourcename, resultname) == 0) CMReturnInstance(results, data.value.inst); 43.32 + // BUG - returning data causes crash !?! 43.33 + _SBLIM_TRACE(2, ("--- data.value.inst=\"%s\"", CMGetCharPtr(CDToString(_BROKER, data.value.inst, NULL)))); 43.34 + if (strcmp(sourcename, resultname) == 0) CMReturnInstance(results, data.value.inst); 43.35 } 43.36 } 43.37
44.1 --- a/src/Xen_ProcessorAllocatedFromPool.c Tue Jan 09 11:38:00 2007 -0700 44.2 +++ b/src/Xen_ProcessorAllocatedFromPool.c Wed Jan 10 16:52:37 2007 -0700 44.3 @@ -210,7 +210,6 @@ static CMPIStatus Associators( 44.4 _SBLIM_TRACE(2, ("--- Reference does not match required role. Ignoring request.")); 44.5 goto exit; 44.6 } 44.7 - CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_NOT_SUPPORTED, NULL); 44.8 44.9 /* Determine the target class from the source class. */ 44.10 if (strcmp(sourceclass, _LHSCLASSNAME) == 0) {
45.1 --- a/src/Xen_ProcessorElementSettingData.c Tue Jan 09 11:38:00 2007 -0700 45.2 +++ b/src/Xen_ProcessorElementSettingData.c Wed Jan 10 16:52:37 2007 -0700 45.3 @@ -52,11 +52,11 @@ static const CMPIBroker *_BROKER; 45.4 /* Name of the left and right hand side classes of this association. */ 45.5 static char * _ASSOCCLASS = "Xen_ProcessorElementSettingData"; 45.6 static char * _LHSCLASSNAME = "Xen_ProcessorSettingData"; 45.7 -static char * _RHSCLASSNAME = "Xen_Processor"; 45.8 +static char * _RHSCLASSNAME = "Xen_ProcessorSettingData"; 45.9 static char * _LHSPROPERTYNAME = "SettingData"; 45.10 static char * _RHSPROPERTYNAME = "ManagedElement"; 45.11 static char * _LHSKEYNAME = "InstanceID"; 45.12 -static char * _RHSKEYNAME = "SystemName"; 45.13 +static char * _RHSKEYNAME = "InstanceID"; 45.14 45.15 // ---------------------------------------------------------------------------- 45.16 // AssociationCleanup() 45.17 @@ -226,7 +226,6 @@ static CMPIStatus Associators( 45.18 _SBLIM_TRACE(2, ("--- Reference does not match required role. Ignoring request.")); 45.19 goto exit; 45.20 } 45.21 - CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_NOT_SUPPORTED, NULL); 45.22 45.23 /* Determine the target class from the source class. */ 45.24 if (strcmp(sourceclass, _LHSCLASSNAME) == 0) { 45.25 @@ -271,9 +270,9 @@ static CMPIStatus Associators( 45.26 /* Only return entries whose name matches the reference. */ 45.27 namedata = CMGetProperty(data.value.inst, targetkeyname, NULL); 45.28 char * resultname = CMGetCharPtr(namedata.value.string); 45.29 -// BUG - returning data causes crash !?! 45.30 -_SBLIM_TRACE(2, ("--- data.value.inst=\"%s\"", CMGetCharPtr(CDToString(_BROKER, data.value.inst, NULL)))); 45.31 -// if (strcmp(sourcename, resultname) == 0) CMReturnInstance(results, data.value.inst); 45.32 + // BUG - returning data causes crash !?! 45.33 + _SBLIM_TRACE(2, ("--- data.value.inst=\"%s\"", CMGetCharPtr(CDToString(_BROKER, data.value.inst, NULL)))); 45.34 + if (strcmp(sourcename, resultname) == 0) CMReturnInstance(results, data.value.inst); 45.35 } 45.36 } 45.37
46.1 --- a/src/Xen_ProcessorPoolComponent.c Tue Jan 09 11:38:00 2007 -0700 46.2 +++ b/src/Xen_ProcessorPoolComponent.c Wed Jan 10 16:52:37 2007 -0700 46.3 @@ -235,7 +235,6 @@ static CMPIStatus Associators( 46.4 _SBLIM_TRACE(2, ("--- Reference does not match required role. Ignoring request.")); 46.5 goto exit; 46.6 } 46.7 - CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_NOT_SUPPORTED, NULL); 46.8 46.9 /* Determine the target class from the source class. */ 46.10 if (CMClassPathIsA(_BROKER, reference, _LHSCLASSNAME, NULL)) {
47.1 --- a/src/Xen_ProcessorSettingAllocationFromPool.c Tue Jan 09 11:38:00 2007 -0700 47.2 +++ b/src/Xen_ProcessorSettingAllocationFromPool.c Wed Jan 10 16:52:37 2007 -0700 47.3 @@ -209,7 +209,6 @@ static CMPIStatus Associators( 47.4 _SBLIM_TRACE(2, ("--- Reference does not match required role. Ignoring request.")); 47.5 goto exit; 47.6 } 47.7 - CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_NOT_SUPPORTED, NULL); 47.8 47.9 /* Determine the target class from the source class. */ 47.10 if (strcmp(sourceclass, _LHSCLASSNAME) == 0) {
48.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 48.2 +++ b/src/Xen_ProcessorSettingsDefineState.c Wed Jan 10 16:52:37 2007 -0700 48.3 @@ -0,0 +1,530 @@ 48.4 +// Copyright (C) 2006 Novell, Inc. 48.5 +// 48.6 +// This library is free software; you can redistribute it and/or 48.7 +// modify it under the terms of the GNU Lesser General Public 48.8 +// License as published by the Free Software Foundation; either 48.9 +// version 2.1 of the License, or (at your option) any later version. 48.10 +// 48.11 +// This library is distributed in the hope that it will be useful, 48.12 +// but WITHOUT ANY WARRANTY; without even the implied warranty of 48.13 +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 48.14 +// Lesser General Public License for more details. 48.15 +// 48.16 +// You should have received a copy of the GNU Lesser General Public 48.17 +// License along with this library; if not, write to the Free Software 48.18 +// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 48.19 +// ============================================================================ 48.20 +// Authors: Jim Fehlig, <jfehlig@novell.com> 48.21 +// Description: 48.22 +// ============================================================================ 48.23 + 48.24 +#include <string.h> 48.25 + 48.26 +/* Include the required CMPI data types, function headers, and macros */ 48.27 +#include "cmpidt.h" 48.28 +#include "cmpift.h" 48.29 +#include "cmpimacs.h" 48.30 + 48.31 + 48.32 +// ---------------------------------------------------------------------------- 48.33 +// COMMON GLOBAL VARIABLES 48.34 +// ---------------------------------------------------------------------------- 48.35 + 48.36 +/* Handle to the CIM broker. Initialized when the provider lib is loaded. */ 48.37 +static const CMPIBroker *_BROKER; 48.38 + 48.39 +/* Include utility functions */ 48.40 +#include "cmpiutil.h" 48.41 +#include "provider_common.h" 48.42 + 48.43 +/* Include _SBLIM_TRACE() logging support */ 48.44 +#include "cmpitrace.h" 48.45 + 48.46 + 48.47 +// ============================================================================ 48.48 +// CMPI ASSOCIATION PROVIDER FUNCTION TABLE 48.49 +// ============================================================================ 48.50 + 48.51 +// ---------------------------------------------------------------------------- 48.52 +// Info for the class supported by the association provider 48.53 +// ---------------------------------------------------------------------------- 48.54 + 48.55 +/* Name of the left and right hand side classes of this association. */ 48.56 +static char * _ASSOCCLASS = "Xen_ProcessorSettingsDefineState"; 48.57 +static char * _LHSCLASSNAME = "Xen_ProcessorSettingData"; 48.58 +static char * _RHSCLASSNAME = "Xen_Processor"; 48.59 +static char * _LHSPROPERTYNAME = "SettingData"; 48.60 +static char * _RHSPROPERTYNAME = "ManagedElement"; 48.61 +static char * _LHSKEYNAME = "InstanceID"; 48.62 +static char * _RHSKEYNAME = "SystemName"; 48.63 + 48.64 +// ---------------------------------------------------------------------------- 48.65 +// AssociationCleanup() 48.66 +// Perform any necessary cleanup immediately before this provider is unloaded. 48.67 +// ---------------------------------------------------------------------------- 48.68 +static CMPIStatus AssociationCleanup( 48.69 + CMPIAssociationMI * self, /* [in] Handle to this provider (i.e. 'self'). */ 48.70 + const CMPIContext * context, /* [in] Additional context info, if any. */ 48.71 + CMPIBoolean terminating) /* [in] True if MB is terminating */ 48.72 +{ 48.73 + CMPIStatus status = { CMPI_RC_OK, NULL }; /* Return status of CIM operations. */ 48.74 + 48.75 + _SBLIM_ENTER("AssociationCleanup"); 48.76 + _SBLIM_TRACE(2, ("--- self=\"%s\"", self->ft->miName)); 48.77 + _SBLIM_TRACE(2, ("--- context=\"%s\"", CMGetCharPtr(CDToString(_BROKER, context, NULL)))); 48.78 + 48.79 + /* Nothing needs to be done for cleanup. */ 48.80 + _SBLIM_RETURNSTATUS(status); 48.81 +} 48.82 + 48.83 + 48.84 +// ---------------------------------------------------------------------------- 48.85 +// AssociatorNames() 48.86 +// ---------------------------------------------------------------------------- 48.87 +static CMPIStatus AssociatorNames( 48.88 + CMPIAssociationMI * self, /* [in] Handle to this provider (i.e. 'self'). */ 48.89 + const CMPIContext * context, /* [in] Additional context info, if any. */ 48.90 + const CMPIResult * results, /* [out] Results of this operation. */ 48.91 + const CMPIObjectPath * reference, /* [in] Contains source namespace, classname and object path. */ 48.92 + const char * assocClass, 48.93 + const char * resultClass, 48.94 + const char * role, 48.95 + const char * resultRole) 48.96 +{ 48.97 + CMPIStatus status = { CMPI_RC_OK, NULL }; /* Return status of CIM operations. */ 48.98 + char *namespace = CMGetCharPtr(CMGetNameSpace(reference, NULL)); /* Target namespace. */ 48.99 + char *sourceclass = CMGetCharPtr(CMGetClassName(reference, &status)); /* Class of the source reference object */ 48.100 + char *targetclass; /* Class of the target object(s). */ 48.101 + char *sourcekeyname; 48.102 + char *targetkeyname; 48.103 + 48.104 + _SBLIM_ENTER("AssociatorNames"); 48.105 + _SBLIM_TRACE(2, ("--- self=\"%s\"", self->ft->miName)); 48.106 + _SBLIM_TRACE(2, ("--- context=\"%s\"", CMGetCharPtr(CDToString(_BROKER, context, NULL)))); 48.107 + _SBLIM_TRACE(2, ("--- reference=\"%s\"", CMGetCharPtr(CDToString(_BROKER, reference, NULL)))); 48.108 + _SBLIM_TRACE(2, ("--- assocClass=\"%s\"", assocClass)); 48.109 + _SBLIM_TRACE(2, ("--- resultClass=\"%s\"", resultClass)); 48.110 + _SBLIM_TRACE(2, ("--- role=\"%s\"", role)); 48.111 + _SBLIM_TRACE(2, ("--- resultRole=\"%s\"", resultRole)); 48.112 + _SBLIM_TRACE(2, ("--- namespace=\"%s\"", namespace)); 48.113 + _SBLIM_TRACE(2, ("--- sourceclass=\"%s\"", sourceclass)); 48.114 + 48.115 + /* Check that the requested association class, if any, is supported. */ 48.116 + if (assocClass != NULL) { 48.117 + CMPIObjectPath * assoc = CMNewObjectPath(_BROKER, namespace, _ASSOCCLASS, NULL); 48.118 + if (!CMClassPathIsA(_BROKER, assoc, assocClass, NULL)) { 48.119 + _SBLIM_TRACE(2, ("--- Unrecognized association class. Ignoring request.")); 48.120 + goto exit; 48.121 + } 48.122 + } 48.123 + 48.124 + /* Check that the reference matches the required role, if any. */ 48.125 + if ((role != NULL) && strcmp(role, sourceclass) != 0) { 48.126 + _SBLIM_TRACE(2, ("--- Reference does not match required role. Ignoring request.")); 48.127 + goto exit; 48.128 + } 48.129 + 48.130 + /* Determine the target class from the source class. */ 48.131 + if (strcmp(sourceclass, _LHSCLASSNAME) == 0) { 48.132 + sourcekeyname = _LHSKEYNAME; 48.133 + targetclass = _RHSCLASSNAME; 48.134 + targetkeyname = _RHSKEYNAME; 48.135 + } else if (strcmp(sourceclass, _RHSCLASSNAME) == 0) { 48.136 + sourcekeyname = _RHSKEYNAME; 48.137 + targetclass = _LHSCLASSNAME; 48.138 + targetkeyname = _LHSKEYNAME; 48.139 + } else { 48.140 + _SBLIM_TRACE(2, ("--- Unrecognized source class. Ignoring request.")); 48.141 + goto exit; 48.142 + } 48.143 + _SBLIM_TRACE(2, ("--- targetclass=\"%s\"", targetclass)); 48.144 + 48.145 + CMPIData namedata = CMGetKey(reference, sourcekeyname, NULL); 48.146 + char * sourcename = CMGetCharPtr(namedata.value.string); 48.147 + _SBLIM_TRACE(2, ("--- sourcename=\"%s\"", sourcename)); 48.148 + 48.149 + /* Create an object path for the result class. */ 48.150 + CMPIObjectPath * objectpath = CMNewObjectPath(_BROKER, namespace, targetclass, &status); 48.151 + if ((status.rc != CMPI_RC_OK) || CMIsNullObject(objectpath)) { 48.152 + _SBLIM_TRACE(1,("--- CMNewObjectPath() failed - %s", CMGetCharPtr(status.msg))); 48.153 + CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERROR, "Cannot create new CMPIObjectPath"); 48.154 + goto exit; 48.155 + } 48.156 + 48.157 + /* Get the list of all target class object paths from the CIMOM. */ 48.158 + CMPIEnumeration * objectpaths = CBEnumInstanceNames(_BROKER, context, objectpath, &status); 48.159 + if ((status.rc != CMPI_RC_OK) || CMIsNullObject(objectpaths)) { 48.160 + _SBLIM_TRACE(1,("--- CBEnumInstanceNames() failed - %s", CMGetCharPtr(status.msg))); 48.161 + CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERROR, "Cannot enumerate target class"); 48.162 + goto exit; 48.163 + } 48.164 + 48.165 + /* Return all object paths that exactly match the target class and resultClass, if specified. */ 48.166 + while (CMHasNext(objectpaths, NULL)) { 48.167 + CMPIData data = CMGetNext(objectpaths, NULL); 48.168 + char *class = CMGetCharPtr(CMGetClassName(data.value.ref, NULL)); 48.169 + if ((strcmp(class,targetclass) == 0) && ((resultClass == NULL) || (strcmp(class,resultClass) == 0))) { 48.170 + /* Only return entries whose name matches the reference. */ 48.171 + namedata = CMGetKey(data.value.ref, targetkeyname, &status); 48.172 + char * resultname = CMGetCharPtr(namedata.value.string); 48.173 + if (strcmp(sourcename, resultname) == 0) CMReturnObjectPath(results, data.value.ref); 48.174 + } 48.175 + } 48.176 + 48.177 + CMReturnDone(results); 48.178 + 48.179 +exit: 48.180 + _SBLIM_RETURNSTATUS(status); 48.181 +} 48.182 + 48.183 + 48.184 +// ---------------------------------------------------------------------------- 48.185 +// Associators() 48.186 +// ---------------------------------------------------------------------------- 48.187 +static CMPIStatus Associators( 48.188 + CMPIAssociationMI * self, /* [in] Handle to this provider (i.e. 'self'). */ 48.189 + const CMPIContext * context, /* [in] Additional context info, if any. */ 48.190 + const CMPIResult * results, /* [out] Results of this operation. */ 48.191 + const CMPIObjectPath * reference, /* [in] Contains the source namespace, classname and object path. */ 48.192 + const char *assocClass, 48.193 + const char *resultClass, 48.194 + const char *role, 48.195 + const char *resultRole, 48.196 + const char ** properties) /* [in] List of desired properties (NULL=all). */ 48.197 +{ 48.198 + CMPIStatus status = { CMPI_RC_OK, NULL }; /* Return status of CIM operations. */ 48.199 + char *namespace = CMGetCharPtr(CMGetNameSpace(reference, NULL)); /* Target namespace. */ 48.200 + char *sourceclass = CMGetCharPtr(CMGetClassName(reference, &status)); /* Class of the source reference object */ 48.201 + char *targetclass; /* Class of the target object(s). */ 48.202 + char *sourcekeyname; 48.203 + char *targetkeyname; 48.204 + 48.205 + _SBLIM_ENTER("Associators"); 48.206 + _SBLIM_TRACE(2, ("--- self=\"%s\"", self->ft->miName)); 48.207 + _SBLIM_TRACE(2, ("--- context=\"%s\"", CMGetCharPtr(CDToString(_BROKER, context, NULL)))); 48.208 + _SBLIM_TRACE(2, ("--- reference=\"%s\"", CMGetCharPtr(CDToString(_BROKER, reference, NULL)))); 48.209 + _SBLIM_TRACE(2, ("--- assocClass=\"%s\"", assocClass)); 48.210 + _SBLIM_TRACE(2, ("--- resultClass=\"%s\"", resultClass)); 48.211 + _SBLIM_TRACE(2, ("--- role=\"%s\"", role)); 48.212 + _SBLIM_TRACE(2, ("--- resultRole=\"%s\"", resultRole)); 48.213 + _SBLIM_TRACE(2, ("--- namespace=\"%s\"", namespace)); 48.214 + _SBLIM_TRACE(2, ("--- sourceclass=\"%s\"", sourceclass)); 48.215 + 48.216 + /* Check that the requested association class, if any, is supported. */ 48.217 + if (assocClass != NULL) { 48.218 + CMPIObjectPath * assoc = CMNewObjectPath(_BROKER, namespace, _ASSOCCLASS, NULL); 48.219 + if (!CMClassPathIsA(_BROKER, assoc, assocClass, NULL)) { 48.220 + _SBLIM_TRACE(2, ("--- Unrecognized association class. Ignoring request.")); 48.221 + goto exit; 48.222 + } 48.223 + } 48.224 + 48.225 + /* Check that the reference matches the required role, if any. */ 48.226 + if ((role != NULL) && strcmp(role, sourceclass) != 0) { 48.227 + _SBLIM_TRACE(2, ("--- Reference does not match required role. Ignoring request.")); 48.228 + goto exit; 48.229 + } 48.230 + 48.231 + /* Determine the target class from the source class. */ 48.232 + if (strcmp(sourceclass, _LHSCLASSNAME) == 0) { 48.233 + sourcekeyname = _LHSKEYNAME; 48.234 + targetclass = _RHSCLASSNAME; 48.235 + targetkeyname = _RHSKEYNAME; 48.236 + } else if (strcmp(sourceclass, _RHSCLASSNAME) == 0) { 48.237 + sourcekeyname = _RHSKEYNAME; 48.238 + targetclass = _LHSCLASSNAME; 48.239 + targetkeyname = _LHSKEYNAME; 48.240 + } else { 48.241 + _SBLIM_TRACE(2, ("--- Unrecognized source class. Ignoring request.")); 48.242 + goto exit; 48.243 + } 48.244 + _SBLIM_TRACE(2, ("--- targetclass=\"%s\"", targetclass)); 48.245 + 48.246 + CMPIData namedata = CMGetKey(reference, sourcekeyname, NULL); 48.247 + char * sourcename = CMGetCharPtr(namedata.value.string); 48.248 + _SBLIM_TRACE(2, ("--- sourcename=\"%s\"", sourcename)); 48.249 + 48.250 + /* Create an object path for the result class. */ 48.251 + CMPIObjectPath * objectpath = CMNewObjectPath(_BROKER, namespace, targetclass, &status); 48.252 + if ((status.rc != CMPI_RC_OK) || CMIsNullObject(objectpath)) { 48.253 + _SBLIM_TRACE(1,("--- CMNewObjectPath() failed - %s", CMGetCharPtr(status.msg))); 48.254 + CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERROR, "Cannot create new CMPIObjectPath"); 48.255 + goto exit; 48.256 + } 48.257 + 48.258 + /* Get the list of all target class instances from the CIMOM. */ 48.259 + CMPIEnumeration * instances = CBEnumInstances(_BROKER, context, objectpath, NULL, &status); 48.260 + if ((status.rc != CMPI_RC_OK) || CMIsNullObject(instances)) { 48.261 + _SBLIM_TRACE(1,("--- CBEnumInstances() failed - %s", CMGetCharPtr(status.msg))); 48.262 + CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERROR, "Cannot enumerate target class"); 48.263 + goto exit; 48.264 + } 48.265 + 48.266 + /* Return all instances that exactly match the target class and resultClass, if specified. */ 48.267 + while (CMHasNext(instances, NULL)) { 48.268 + CMPIData data = CMGetNext(instances, NULL); 48.269 + char *class = CMGetCharPtr(CMGetClassName(CMGetObjectPath(data.value.inst,NULL), NULL)); 48.270 + if ((strcmp(class,targetclass) == 0) && ((resultClass == NULL) || (strcmp(class,resultClass) == 0))) { 48.271 + /* Only return entries whose name matches the reference. */ 48.272 + namedata = CMGetProperty(data.value.inst, targetkeyname, NULL); 48.273 + char * resultname = CMGetCharPtr(namedata.value.string); 48.274 + // BUG - returning data causes crash !?! 48.275 + _SBLIM_TRACE(2, ("--- data.value.inst=\"%s\"", CMGetCharPtr(CDToString(_BROKER, data.value.inst, NULL)))); 48.276 + if (strcmp(sourcename, resultname) == 0) CMReturnInstance(results, data.value.inst); 48.277 + } 48.278 + } 48.279 + 48.280 + CMReturnDone(results); 48.281 + 48.282 +exit: 48.283 + _SBLIM_RETURNSTATUS(status); 48.284 +} 48.285 + 48.286 + 48.287 +// ---------------------------------------------------------------------------- 48.288 +// ReferenceNames() 48.289 +// ---------------------------------------------------------------------------- 48.290 +static CMPIStatus ReferenceNames( 48.291 + CMPIAssociationMI * self, /* [in] Handle to this provider (i.e. 'self'). */ 48.292 + const CMPIContext * context, /* [in] Additional context info, if any. */ 48.293 + const CMPIResult * results, /* [out] Results of this operation. */ 48.294 + const CMPIObjectPath * reference, /* [in] Contains the source namespace, classname and object path. */ 48.295 + const char *assocClass, 48.296 + const char *role) 48.297 +{ 48.298 + CMPIStatus status = { CMPI_RC_OK, NULL }; /* Return status of CIM operations. */ 48.299 + char *namespace = CMGetCharPtr(CMGetNameSpace(reference, NULL)); /* Target namespace. */ 48.300 + char *sourceclass = CMGetCharPtr(CMGetClassName(reference, &status)); /* Class of the source reference object */ 48.301 + char *targetclass; /* Class of the target object(s). */ 48.302 + char *sourcekeyname; 48.303 + char *targetkeyname; 48.304 + 48.305 + _SBLIM_ENTER("ReferenceNames"); 48.306 + _SBLIM_TRACE(2, ("--- self=\"%s\"", self->ft->miName)); 48.307 + _SBLIM_TRACE(2, ("--- context=\"%s\"", CMGetCharPtr(CDToString(_BROKER, context, NULL)))); 48.308 + _SBLIM_TRACE(2, ("--- reference=\"%s\"", CMGetCharPtr(CDToString(_BROKER, reference, NULL)))); 48.309 + _SBLIM_TRACE(2, ("--- assocClass=\"%s\"", assocClass)); 48.310 + _SBLIM_TRACE(2, ("--- role=\"%s\"", role)); 48.311 + _SBLIM_TRACE(2, ("--- namespace=\"%s\"", namespace)); 48.312 + _SBLIM_TRACE(2, ("--- sourceclass=\"%s\"", sourceclass)); 48.313 + 48.314 + /* Check that the requested association class, if any, is supported. */ 48.315 + if (assocClass != NULL) { 48.316 + CMPIObjectPath * assoc = CMNewObjectPath(_BROKER, namespace, _ASSOCCLASS, NULL); 48.317 + if (!CMClassPathIsA(_BROKER, assoc, assocClass, NULL)) { 48.318 + _SBLIM_TRACE(2, ("--- Unrecognized association class. Ignoring request.")); 48.319 + goto exit; 48.320 + } 48.321 + } 48.322 + 48.323 + /* Check that the reference matches the required role, if any. */ 48.324 + if ((role != NULL) && strcmp(role, sourceclass) != 0) { 48.325 + _SBLIM_TRACE(2, ("--- Reference does not match required role. Ignoring request.")); 48.326 + goto exit; 48.327 + } 48.328 + 48.329 + /* Determine the target class from the source class. */ 48.330 + if (strcmp(sourceclass, _LHSCLASSNAME) == 0) { 48.331 + sourcekeyname = _LHSKEYNAME; 48.332 + targetclass = _RHSCLASSNAME; 48.333 + targetkeyname = _RHSKEYNAME; 48.334 + } else if (strcmp(sourceclass, _RHSCLASSNAME) == 0) { 48.335 + sourcekeyname = _RHSKEYNAME; 48.336 + targetclass = _LHSCLASSNAME; 48.337 + targetkeyname = _LHSKEYNAME; 48.338 + } else { 48.339 + _SBLIM_TRACE(2, ("--- Unrecognized source class. Ignoring request.")); 48.340 + goto exit; 48.341 + } 48.342 + _SBLIM_TRACE(2, ("--- targetclass=\"%s\"", targetclass)); 48.343 + 48.344 + CMPIData namedata = CMGetKey(reference, sourcekeyname, NULL); 48.345 + char * sourcename = CMGetCharPtr(namedata.value.string); 48.346 + _SBLIM_TRACE(2, ("--- sourcename=\"%s\"", sourcename)); 48.347 + 48.348 + /* Create an object path for the result class. */ 48.349 + CMPIObjectPath * objectpath = CMNewObjectPath(_BROKER, namespace, targetclass, &status); 48.350 + if ((status.rc != CMPI_RC_OK) || CMIsNullObject(objectpath)) { 48.351 + _SBLIM_TRACE(1,("--- CMNewObjectPath() failed - %s", CMGetCharPtr(status.msg))); 48.352 + CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERROR, "Cannot create new CMPIObjectPath"); 48.353 + goto exit; 48.354 + } 48.355 + 48.356 + /* Get the list of all target class object paths from the CIMOM. */ 48.357 + CMPIEnumeration * objectpaths = CBEnumInstanceNames(_BROKER, context, objectpath, &status); 48.358 + if ((status.rc != CMPI_RC_OK) || CMIsNullObject(objectpaths)) { 48.359 + _SBLIM_TRACE(1,("--- CBEnumInstanceNames() failed - %s", CMGetCharPtr(status.msg))); 48.360 + CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERROR, "Cannot enumerate target class"); 48.361 + goto exit; 48.362 + } 48.363 + 48.364 + /* Return all object paths that exactly match the target class and resultClass, if specified. */ 48.365 + while (CMHasNext(objectpaths, NULL)) { 48.366 + CMPIData data = CMGetNext(objectpaths, NULL); 48.367 + char *class = CMGetCharPtr(CMGetClassName(data.value.ref, NULL)); 48.368 + if (strcmp(class,targetclass) == 0) { 48.369 + 48.370 + /* Create an object path for the association. */ 48.371 + CMPIObjectPath * refobjectpath = CMNewObjectPath(_BROKER, namespace, _ASSOCCLASS, &status); 48.372 + if ((status.rc != CMPI_RC_OK) || CMIsNullObject(refobjectpath)) { 48.373 + _SBLIM_TRACE(1,("--- CMNewObjectPath() failed - %s", CMGetCharPtr(status.msg))); 48.374 + CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERROR, "Cannot create new CMPIObjectPath"); 48.375 + goto exit; 48.376 + } 48.377 + 48.378 + /* Assign the references in the association appropriately. */ 48.379 + if (strcmp(sourceclass, _RHSCLASSNAME) == 0) { 48.380 + CMAddKey(refobjectpath, _RHSPROPERTYNAME, &reference, CMPI_ref); 48.381 + CMAddKey(refobjectpath, _LHSPROPERTYNAME, &data.value.ref, CMPI_ref); 48.382 + } else { 48.383 + CMAddKey(refobjectpath, _RHSPROPERTYNAME, &data.value.ref, CMPI_ref); 48.384 + CMAddKey(refobjectpath, _LHSPROPERTYNAME, &reference, CMPI_ref); 48.385 + } 48.386 + 48.387 + /* Only return entries whose name matches the reference. */ 48.388 + namedata = CMGetKey(data.value.ref, targetkeyname, &status); 48.389 + char * resultname = CMGetCharPtr(namedata.value.string); 48.390 + if (strcmp(sourcename, resultname) == 0) CMReturnObjectPath(results, refobjectpath); 48.391 + } 48.392 + } 48.393 + 48.394 +exit: 48.395 + _SBLIM_RETURNSTATUS(status); 48.396 +} 48.397 + 48.398 + 48.399 +// ---------------------------------------------------------------------------- 48.400 +// References() 48.401 +// ---------------------------------------------------------------------------- 48.402 +static CMPIStatus References( 48.403 + CMPIAssociationMI * self, /* [in] Handle to this provider (i.e. 'self'). */ 48.404 + const CMPIContext * context, /* [in] Additional context info, if any. */ 48.405 + const CMPIResult * results, /* [out] Results of this operation. */ 48.406 + const CMPIObjectPath * reference, /* [in] Contains the namespace, classname and desired object path. */ 48.407 + const char *assocClass, 48.408 + const char *role, 48.409 + const char **properties) /* [in] List of desired properties (NULL=all). */ 48.410 +{ 48.411 + CMPIStatus status = { CMPI_RC_OK, NULL }; /* Return status of CIM operations. */ 48.412 + char *namespace = CMGetCharPtr(CMGetNameSpace(reference, NULL)); /* Target namespace. */ 48.413 + char *sourceclass = CMGetCharPtr(CMGetClassName(reference, &status)); /* Class of the source reference object */ 48.414 + char *targetclass; /* Class of the target object(s). */ 48.415 + char *sourcekeyname; 48.416 + char *targetkeyname; 48.417 + 48.418 + _SBLIM_ENTER("References"); 48.419 + _SBLIM_TRACE(2, ("--- self=\"%s\"", self->ft->miName)); 48.420 + _SBLIM_TRACE(2, ("--- context=\"%s\"", CMGetCharPtr(CDToString(_BROKER, context, NULL)))); 48.421 + _SBLIM_TRACE(2, ("--- reference=\"%s\"", CMGetCharPtr(CDToString(_BROKER, reference, NULL)))); 48.422 + _SBLIM_TRACE(2, ("--- assocClass=\"%s\"", assocClass)); 48.423 + _SBLIM_TRACE(2, ("--- role=\"%s\"", role)); 48.424 + _SBLIM_TRACE(2, ("--- namespace=\"%s\"", namespace)); 48.425 + _SBLIM_TRACE(2, ("--- sourceclass=\"%s\"", sourceclass)); 48.426 + 48.427 + /* Check that the requested association class, if any, is supported. */ 48.428 + if (assocClass != NULL) { 48.429 + CMPIObjectPath * assoc = CMNewObjectPath(_BROKER, namespace, _ASSOCCLASS, NULL); 48.430 + if (!CMClassPathIsA(_BROKER, assoc, assocClass, NULL)) { 48.431 + _SBLIM_TRACE(2, ("--- Unrecognized association class. Ignoring request.")); 48.432 + goto exit; 48.433 + } 48.434 + } 48.435 + 48.436 + /* Check that the reference matches the required role, if any. */ 48.437 + if ((role != NULL) && strcmp(role, sourceclass) != 0) { 48.438 + _SBLIM_TRACE(2, ("--- Reference does not match required role. Ignoring request.")); 48.439 + goto exit; 48.440 + } 48.441 + 48.442 + /* Determine the target class from the source class. */ 48.443 + if (strcmp(sourceclass, _LHSCLASSNAME) == 0) { 48.444 + sourcekeyname = _LHSKEYNAME; 48.445 + targetclass = _RHSCLASSNAME; 48.446 + targetkeyname = _RHSKEYNAME; 48.447 + } else if (strcmp(sourceclass, _RHSCLASSNAME) == 0) { 48.448 + sourcekeyname = _RHSKEYNAME; 48.449 + targetclass = _LHSCLASSNAME; 48.450 + targetkeyname = _LHSKEYNAME; 48.451 + } else { 48.452 + _SBLIM_TRACE(2, ("--- Unrecognized source class. Ignoring request.")); 48.453 + goto exit; 48.454 + } 48.455 + _SBLIM_TRACE(2, ("--- targetclass=\"%s\"", targetclass)); 48.456 + 48.457 + CMPIData namedata = CMGetKey(reference, sourcekeyname, NULL); 48.458 + char * sourcename = CMGetCharPtr(namedata.value.string); 48.459 + _SBLIM_TRACE(2, ("--- sourcename=\"%s\"", sourcename)); 48.460 + 48.461 + /* Create an object path for the result class. */ 48.462 + CMPIObjectPath * objectpath = CMNewObjectPath(_BROKER, namespace, targetclass, &status); 48.463 + if ((status.rc != CMPI_RC_OK) || CMIsNullObject(objectpath)) { 48.464 + _SBLIM_TRACE(1,("--- CMNewObjectPath() failed - %s", CMGetCharPtr(status.msg))); 48.465 + CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERROR, "Cannot create new CMPIObjectPath"); 48.466 + goto exit; 48.467 + } 48.468 + 48.469 + /* Get the list of all target class object paths from the CIMOM. */ 48.470 + CMPIEnumeration * objectpaths = CBEnumInstanceNames(_BROKER, context, objectpath, &status); 48.471 + if ((status.rc != CMPI_RC_OK) || CMIsNullObject(objectpaths)) { 48.472 + _SBLIM_TRACE(1,("--- CBEnumInstanceNames() failed - %s", CMGetCharPtr(status.msg))); 48.473 + CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERROR, "Cannot enumerate target class"); 48.474 + goto exit; 48.475 + } 48.476 + 48.477 + /* Return all object paths that exactly match the target class and resultClass, if specified. */ 48.478 + while (CMHasNext(objectpaths, NULL)) { 48.479 + CMPIData data = CMGetNext(objectpaths, NULL); 48.480 + char *class = CMGetCharPtr(CMGetClassName(data.value.ref, NULL)); 48.481 + if (strcmp(class,targetclass) == 0) { 48.482 + 48.483 + /* Create an instance for the association. */ 48.484 + CMPIInstance * refinstance = _CMNewInstance(_BROKER, namespace, _ASSOCCLASS, &status); 48.485 + if ((status.rc != CMPI_RC_OK) || CMIsNullObject(refinstance)) { 48.486 + _SBLIM_TRACE(1,("--- CMNewInstance() failed - %s", CMGetCharPtr(status.msg))); 48.487 + CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERROR, "Cannot create new CMPIInstance"); 48.488 + goto exit; 48.489 + } 48.490 + 48.491 + /* Assign the references in the association appropriately. */ 48.492 + if (strcmp(sourceclass, _RHSCLASSNAME) == 0) { 48.493 + CMSetProperty(refinstance, _RHSPROPERTYNAME, &reference, CMPI_ref); 48.494 + CMSetProperty(refinstance, _LHSPROPERTYNAME, &data.value.ref, CMPI_ref); 48.495 + } else { 48.496 + CMSetProperty(refinstance, _RHSPROPERTYNAME, &data.value.ref, CMPI_ref); 48.497 + CMSetProperty(refinstance, _LHSPROPERTYNAME, &reference, CMPI_ref); 48.498 + } 48.499 + 48.500 + /* Only return entries whose name matches the reference. */ 48.501 + namedata = CMGetKey(data.value.ref, targetkeyname, &status); 48.502 + char * resultname = CMGetCharPtr(namedata.value.string); 48.503 + if (strcmp(sourcename, resultname) == 0) CMReturnInstance(results, refinstance); 48.504 + } 48.505 + } 48.506 + 48.507 +exit: 48.508 + _SBLIM_RETURNSTATUS(status); 48.509 +} 48.510 + 48.511 + 48.512 +// ---------------------------------------------------------------------------- 48.513 +// AssociationInitialize() 48.514 +// Perform any necessary initialization immediately after this provider is 48.515 +// first loaded. 48.516 +// ---------------------------------------------------------------------------- 48.517 +static void AssociationInitialize( 48.518 + CMPIAssociationMI * self, /* [in] Handle to this provider (i.e. 'self'). */ 48.519 + const CMPIContext * context) /* [in] Additional context info, if any. */ 48.520 +{ 48.521 + _SBLIM_ENTER("AssociationInitialize"); 48.522 + _SBLIM_TRACE(2, ("--- self=\"%s\"", self->ft->miName)); 48.523 + // _SBLIM_TRACE(2, ("--- context=\"%s\"", CMGetCharPtr(CDToString(_BROKER, context, NULL)))); 48.524 + 48.525 + /* Nothing needs to be done to initialize this provider */ 48.526 + _SBLIM_RETURN(); 48.527 +} 48.528 + 48.529 + 48.530 +// ============================================================================ 48.531 +// CMPI ASSOCIATION PROVIDER FUNCTION TABLE SETUP 48.532 +// ============================================================================ 48.533 +CMAssociationMIStub( , Xen_ProcessorSettingsDefineState, _BROKER, AssociationInitialize(&mi, ctx));
49.1 --- a/src/Xen_RegisteredProfiles.c Tue Jan 09 11:38:00 2007 -0700 49.2 +++ b/src/Xen_RegisteredProfiles.c Wed Jan 10 16:52:37 2007 -0700 49.3 @@ -66,7 +66,7 @@ const static char * SVP_INST_ID = "Xen:S 49.4 const static char * SVP_VERSION = "0.7.2"; 49.5 const static char * VSP_NAME = "Virtual System Profile"; 49.6 const static char * VSP_INST_ID = "Xen:VirtualSystemProfile"; 49.7 -const static char * VSP_VERSION = "0.7.2"; 49.8 +const static char * VSP_VERSION = "0.7.7"; 49.9 49.10 49.11 static int generateObjectPath(const char *className,
50.1 --- a/src/Xen_RunningOS.c Tue Jan 09 11:38:00 2007 -0700 50.2 +++ b/src/Xen_RunningOS.c Wed Jan 10 16:52:37 2007 -0700 50.3 @@ -230,7 +230,6 @@ static CMPIStatus Associators( 50.4 _SBLIM_TRACE(2, ("--- Reference does not match required role. Ignoring request.")); 50.5 goto exit; 50.6 } 50.7 - CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_NOT_SUPPORTED, NULL); 50.8 50.9 /* Determine the target class from the source class. */ 50.10 if (strcmp(sourceclass, _LHSCLASSNAME) == 0) { 50.11 @@ -275,9 +274,9 @@ static CMPIStatus Associators( 50.12 /* Only return entries whose name matches the reference. */ 50.13 namedata = CMGetProperty(data.value.inst, targetkeyname, NULL); 50.14 char * resultname = CMGetCharPtr(namedata.value.string); 50.15 -// BUG - returning data causes crash !?! 50.16 -_SBLIM_TRACE(2, ("--- data.value.inst=\"%s\"", CMGetCharPtr(CDToString(_BROKER, data.value.inst, NULL)))); 50.17 -// if (strcmp(sourcename, resultname) == 0) CMReturnInstance(results, data.value.inst); 50.18 + // BUG - returning data causes crash !?! 50.19 + _SBLIM_TRACE(2, ("--- data.value.inst=\"%s\"", CMGetCharPtr(CDToString(_BROKER, data.value.inst, NULL)))); 50.20 + if (strcmp(sourcename, resultname) == 0) CMReturnInstance(results, data.value.inst); 50.21 } 50.22 } 50.23
51.1 --- a/src/Xen_VSMSElementCapabilities.c Tue Jan 09 11:38:00 2007 -0700 51.2 +++ b/src/Xen_VSMSElementCapabilities.c Wed Jan 10 16:52:37 2007 -0700 51.3 @@ -215,7 +215,6 @@ static CMPIStatus Associators( 51.4 _SBLIM_TRACE(2, ("--- Reference does not match required role. Ignoring request.")); 51.5 goto exit; 51.6 } 51.7 - CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_NOT_SUPPORTED, NULL); 51.8 51.9 /* Determine the target class from the source class. */ 51.10 if (strcmp(sourceclass, _LHSCLASSNAME) == 0) {