os-cmpi-xen

changeset 0:72b83cde6b72

Initial checkin
author jbulpin@ubuntu.eng.hq.xensource.com
date Wed Mar 22 14:05:14 2006 -0700 (2006-03-22)
parents
children bdf24cd56bed
files AUTHORS COPYING ChangeLog Makefile.am NEWS README VERSION acinclude.m4 autoconfiscate.sh configure.ac provider-register.sh sblim-cmpi-xen.spec.in schema/Xen_CSElementSettingData.mof schema/Xen_CSElementSettingData.registration schema/Xen_CSSettingDataComponent.mof schema/Xen_CSSettingDataComponent.registration schema/Xen_ComputerSystem.mof schema/Xen_ComputerSystem.registration schema/Xen_ComputerSystemConfiguration.mof schema/Xen_ComputerSystemConfiguration.registration schema/Xen_ComputerSystemDisk.mof schema/Xen_ComputerSystemDisk.registration schema/Xen_ComputerSystemIndication.mof schema/Xen_ComputerSystemIndication.registration schema/Xen_ComputerSystemMemory.mof schema/Xen_ComputerSystemMemory.registration schema/Xen_ComputerSystemNetworkPort.mof schema/Xen_ComputerSystemNetworkPort.registration schema/Xen_ComputerSystemProcessor.mof schema/Xen_ComputerSystemProcessor.registration schema/Xen_ComputerSystemSetting.mof schema/Xen_ComputerSystemSetting.registration schema/Xen_ComputerSystemSettingData.mof schema/Xen_ComputerSystemSettingData.registration schema/Xen_ConfigurationForComputerSystem.mof schema/Xen_ConfigurationForComputerSystem.registration schema/Xen_Disk.mof schema/Xen_Disk.registration schema/Xen_DiskElementSettingData.mof schema/Xen_DiskElementSettingData.registration schema/Xen_DiskSettingData.mof schema/Xen_DiskSettingData.registration schema/Xen_HasVirtualizationCapabilities.mof schema/Xen_HasVirtualizationCapabilities.registration schema/Xen_HostedComputerSystem.mof schema/Xen_HostedComputerSystem.registration schema/Xen_HostedDisk.mof schema/Xen_HostedDisk.registration schema/Xen_HostedMemory.mof schema/Xen_HostedMemory.registration schema/Xen_HostedMemoryPool.mof schema/Xen_HostedMemoryPool.registration schema/Xen_HostedNetworkPort.mof schema/Xen_HostedNetworkPort.registration schema/Xen_HostedProcessor.mof schema/Xen_HostedProcessor.registration schema/Xen_HostedProcessorPool.mof schema/Xen_HostedProcessorPool.registration schema/Xen_HostedVirtualizationManagementService.mof schema/Xen_HostedVirtualizationManagementService.registration schema/Xen_Memory.mof schema/Xen_Memory.registration schema/Xen_MemoryCapabilitiesSettingData.mof schema/Xen_MemoryCapabilitiesSettingData.registration schema/Xen_MemoryElementSettingData.mof schema/Xen_MemoryElementSettingData.registration schema/Xen_MemoryPool.mof schema/Xen_MemoryPool.registration schema/Xen_MemorySettingData.mof schema/Xen_MemorySettingData.registration schema/Xen_NetworkPort.mof schema/Xen_NetworkPort.registration schema/Xen_NetworkPortElementSettingData.mof schema/Xen_NetworkPortElementSettingData.registration schema/Xen_NetworkPortSettingData.mof schema/Xen_NetworkPortSettingData.registration schema/Xen_OperatingSystem.mof schema/Xen_OperatingSystem.registration schema/Xen_Processor.mof schema/Xen_Processor.registration schema/Xen_ProcessorCapabilitiesSettingData.mof schema/Xen_ProcessorCapabilitiesSettingData.registration schema/Xen_ProcessorElementSettingData.mof schema/Xen_ProcessorElementSettingData.registration schema/Xen_ProcessorPool.mof schema/Xen_ProcessorPool.registration schema/Xen_ProcessorSettingData.mof schema/Xen_ProcessorSettingData.registration schema/Xen_ResourcePool.mof schema/Xen_RunningOS.mof schema/Xen_RunningOS.registration schema/Xen_SettingForComputerSystem.mof schema/Xen_SettingForComputerSystem.registration schema/Xen_VirtualDeviceSettingData.mof schema/Xen_VirtualizationCapabilities.mof schema/Xen_VirtualizationCapabilities.registration schema/Xen_VirtualizationManagementService.mof schema/Xen_VirtualizationManagementService.registration src/Xen_CSElementSettingData.c src/Xen_CSSettingDataComponent.c src/Xen_ComputerSystem.c src/Xen_ComputerSystemConfiguration.c src/Xen_ComputerSystemConfiguration_Resource.c src/Xen_ComputerSystemConfiguration_Resource.h src/Xen_ComputerSystemDisk.c src/Xen_ComputerSystemIndication.c src/Xen_ComputerSystemMemory.c src/Xen_ComputerSystemNetworkPort.c src/Xen_ComputerSystemProcessor.c src/Xen_ComputerSystemSetting.c src/Xen_ComputerSystemSettingData.c src/Xen_ComputerSystemSettingData_Resource.c src/Xen_ComputerSystemSettingData_Resource.h src/Xen_ComputerSystemSetting_Resource.c src/Xen_ComputerSystemSetting_Resource.h src/Xen_ComputerSystem_Resource.c src/Xen_ComputerSystem_Resource.h src/Xen_ConfigurationForComputerSystem.c src/Xen_Disk.c src/Xen_DiskElementSettingData.c src/Xen_DiskSettingData.c src/Xen_DiskSettingData_Resource.c src/Xen_DiskSettingData_Resource.h src/Xen_Disk_Resource.c src/Xen_Disk_Resource.h src/Xen_HasVirtualizationCapabilities.c src/Xen_HostedComputerSystem.c src/Xen_HostedDisk.c src/Xen_HostedMemory.c src/Xen_HostedMemoryPool.c src/Xen_HostedNetworkPort.c src/Xen_HostedProcessor.c src/Xen_HostedProcessorPool.c src/Xen_HostedVirtualizationManagementService.c src/Xen_Memory.c src/Xen_MemoryCapabilitiesSettingData.c src/Xen_MemoryCapabilitiesSettingData_Resource.c src/Xen_MemoryCapabilitiesSettingData_Resource.h src/Xen_MemoryElementSettingData.c src/Xen_MemoryPool.c src/Xen_MemoryPool_Resource.c src/Xen_MemoryPool_Resource.h src/Xen_MemorySettingData.c src/Xen_MemorySettingData_Resource.c src/Xen_MemorySettingData_Resource.h src/Xen_Memory_Resource.c src/Xen_Memory_Resource.h src/Xen_NetworkPort.c src/Xen_NetworkPortElementSettingData.c src/Xen_NetworkPortSettingData.c src/Xen_NetworkPortSettingData_Resource.c src/Xen_NetworkPortSettingData_Resource.h src/Xen_NetworkPort_Resource.c src/Xen_NetworkPort_Resource.h src/Xen_OperatingSystem.c src/Xen_OperatingSystem_Resource.c src/Xen_OperatingSystem_Resource.h src/Xen_Processor.c src/Xen_ProcessorCapabilitiesSettingData.c src/Xen_ProcessorCapabilitiesSettingData_Resource.c src/Xen_ProcessorCapabilitiesSettingData_Resource.h src/Xen_ProcessorElementSettingData.c src/Xen_ProcessorPool.c src/Xen_ProcessorPool_Resource.c src/Xen_ProcessorPool_Resource.h src/Xen_ProcessorSettingData.c src/Xen_ProcessorSettingData_Resource.c src/Xen_ProcessorSettingData_Resource.h src/Xen_Processor_Resource.c src/Xen_Processor_Resource.h src/Xen_RunningOS.c src/Xen_SettingForComputerSystem.c src/Xen_VirtualizationCapabilities.c src/Xen_VirtualizationCapabilities_Resource.c src/Xen_VirtualizationCapabilities_Resource.h src/Xen_VirtualizationManagementService.c src/Xen_VirtualizationManagementService_Resource.c src/Xen_VirtualizationManagementService_Resource.h src/cmpitrace.c src/cmpitrace.h src/cmpiutil.c src/cmpiutil.h
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/AUTHORS	Wed Mar 22 14:05:14 2006 -0700
     1.3 @@ -0,0 +1,3 @@
     1.4 +Dr. Gareth S. Bestor <bestor@us.ibm.com>
     1.5 +Tokunbo Adeshiyan <tokunbo@us.ibm.com>
     1.6 +
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/COPYING	Wed Mar 22 14:05:14 2006 -0700
     2.3 @@ -0,0 +1,504 @@
     2.4 +		  GNU LESSER GENERAL PUBLIC LICENSE
     2.5 +		       Version 2.1, February 1999
     2.6 +
     2.7 + Copyright (C) 1991, 1999 Free Software Foundation, Inc.
     2.8 +     51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
     2.9 + Everyone is permitted to copy and distribute verbatim copies
    2.10 + of this license document, but changing it is not allowed.
    2.11 +
    2.12 +[This is the first released version of the Lesser GPL.  It also counts
    2.13 + as the successor of the GNU Library Public License, version 2, hence
    2.14 + the version number 2.1.]
    2.15 +
    2.16 +			    Preamble
    2.17 +
    2.18 +  The licenses for most software are designed to take away your
    2.19 +freedom to share and change it.  By contrast, the GNU General Public
    2.20 +Licenses are intended to guarantee your freedom to share and change
    2.21 +free software--to make sure the software is free for all its users.
    2.22 +
    2.23 +  This license, the Lesser General Public License, applies to some
    2.24 +specially designated software packages--typically libraries--of the
    2.25 +Free Software Foundation and other authors who decide to use it.  You
    2.26 +can use it too, but we suggest you first think carefully about whether
    2.27 +this license or the ordinary General Public License is the better
    2.28 +strategy to use in any particular case, based on the explanations below.
    2.29 +
    2.30 +  When we speak of free software, we are referring to freedom of use,
    2.31 +not price.  Our General Public Licenses are designed to make sure that
    2.32 +you have the freedom to distribute copies of free software (and charge
    2.33 +for this service if you wish); that you receive source code or can get
    2.34 +it if you want it; that you can change the software and use pieces of
    2.35 +it in new free programs; and that you are informed that you can do
    2.36 +these things.
    2.37 +
    2.38 +  To protect your rights, we need to make restrictions that forbid
    2.39 +distributors to deny you these rights or to ask you to surrender these
    2.40 +rights.  These restrictions translate to certain responsibilities for
    2.41 +you if you distribute copies of the library or if you modify it.
    2.42 +
    2.43 +  For example, if you distribute copies of the library, whether gratis
    2.44 +or for a fee, you must give the recipients all the rights that we gave
    2.45 +you.  You must make sure that they, too, receive or can get the source
    2.46 +code.  If you link other code with the library, you must provide
    2.47 +complete object files to the recipients, so that they can relink them
    2.48 +with the library after making changes to the library and recompiling
    2.49 +it.  And you must show them these terms so they know their rights.
    2.50 +
    2.51 +  We protect your rights with a two-step method: (1) we copyright the
    2.52 +library, and (2) we offer you this license, which gives you legal
    2.53 +permission to copy, distribute and/or modify the library.
    2.54 +
    2.55 +  To protect each distributor, we want to make it very clear that
    2.56 +there is no warranty for the free library.  Also, if the library is
    2.57 +modified by someone else and passed on, the recipients should know
    2.58 +that what they have is not the original version, so that the original
    2.59 +author's reputation will not be affected by problems that might be
    2.60 +introduced by others.
    2.61 +
    2.62 +  Finally, software patents pose a constant threat to the existence of
    2.63 +any free program.  We wish to make sure that a company cannot
    2.64 +effectively restrict the users of a free program by obtaining a
    2.65 +restrictive license from a patent holder.  Therefore, we insist that
    2.66 +any patent license obtained for a version of the library must be
    2.67 +consistent with the full freedom of use specified in this license.
    2.68 +
    2.69 +  Most GNU software, including some libraries, is covered by the
    2.70 +ordinary GNU General Public License.  This license, the GNU Lesser
    2.71 +General Public License, applies to certain designated libraries, and
    2.72 +is quite different from the ordinary General Public License.  We use
    2.73 +this license for certain libraries in order to permit linking those
    2.74 +libraries into non-free programs.
    2.75 +
    2.76 +  When a program is linked with a library, whether statically or using
    2.77 +a shared library, the combination of the two is legally speaking a
    2.78 +combined work, a derivative of the original library.  The ordinary
    2.79 +General Public License therefore permits such linking only if the
    2.80 +entire combination fits its criteria of freedom.  The Lesser General
    2.81 +Public License permits more lax criteria for linking other code with
    2.82 +the library.
    2.83 +
    2.84 +  We call this license the "Lesser" General Public License because it
    2.85 +does Less to protect the user's freedom than the ordinary General
    2.86 +Public License.  It also provides other free software developers Less
    2.87 +of an advantage over competing non-free programs.  These disadvantages
    2.88 +are the reason we use the ordinary General Public License for many
    2.89 +libraries.  However, the Lesser license provides advantages in certain
    2.90 +special circumstances.
    2.91 +
    2.92 +  For example, on rare occasions, there may be a special need to
    2.93 +encourage the widest possible use of a certain library, so that it becomes
    2.94 +a de-facto standard.  To achieve this, non-free programs must be
    2.95 +allowed to use the library.  A more frequent case is that a free
    2.96 +library does the same job as widely used non-free libraries.  In this
    2.97 +case, there is little to gain by limiting the free library to free
    2.98 +software only, so we use the Lesser General Public License.
    2.99 +
   2.100 +  In other cases, permission to use a particular library in non-free
   2.101 +programs enables a greater number of people to use a large body of
   2.102 +free software.  For example, permission to use the GNU C Library in
   2.103 +non-free programs enables many more people to use the whole GNU
   2.104 +operating system, as well as its variant, the GNU/Linux operating
   2.105 +system.
   2.106 +
   2.107 +  Although the Lesser General Public License is Less protective of the
   2.108 +users' freedom, it does ensure that the user of a program that is
   2.109 +linked with the Library has the freedom and the wherewithal to run
   2.110 +that program using a modified version of the Library.
   2.111 +
   2.112 +  The precise terms and conditions for copying, distribution and
   2.113 +modification follow.  Pay close attention to the difference between a
   2.114 +"work based on the library" and a "work that uses the library".  The
   2.115 +former contains code derived from the library, whereas the latter must
   2.116 +be combined with the library in order to run.
   2.117 +
   2.118 +		  GNU LESSER GENERAL PUBLIC LICENSE
   2.119 +   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
   2.120 +
   2.121 +  0. This License Agreement applies to any software library or other
   2.122 +program which contains a notice placed by the copyright holder or
   2.123 +other authorized party saying it may be distributed under the terms of
   2.124 +this Lesser General Public License (also called "this License").
   2.125 +Each licensee is addressed as "you".
   2.126 +
   2.127 +  A "library" means a collection of software functions and/or data
   2.128 +prepared so as to be conveniently linked with application programs
   2.129 +(which use some of those functions and data) to form executables.
   2.130 +
   2.131 +  The "Library", below, refers to any such software library or work
   2.132 +which has been distributed under these terms.  A "work based on the
   2.133 +Library" means either the Library or any derivative work under
   2.134 +copyright law: that is to say, a work containing the Library or a
   2.135 +portion of it, either verbatim or with modifications and/or translated
   2.136 +straightforwardly into another language.  (Hereinafter, translation is
   2.137 +included without limitation in the term "modification".)
   2.138 +
   2.139 +  "Source code" for a work means the preferred form of the work for
   2.140 +making modifications to it.  For a library, complete source code means
   2.141 +all the source code for all modules it contains, plus any associated
   2.142 +interface definition files, plus the scripts used to control compilation
   2.143 +and installation of the library.
   2.144 +
   2.145 +  Activities other than copying, distribution and modification are not
   2.146 +covered by this License; they are outside its scope.  The act of
   2.147 +running a program using the Library is not restricted, and output from
   2.148 +such a program is covered only if its contents constitute a work based
   2.149 +on the Library (independent of the use of the Library in a tool for
   2.150 +writing it).  Whether that is true depends on what the Library does
   2.151 +and what the program that uses the Library does.
   2.152 +  
   2.153 +  1. You may copy and distribute verbatim copies of the Library's
   2.154 +complete source code as you receive it, in any medium, provided that
   2.155 +you conspicuously and appropriately publish on each copy an
   2.156 +appropriate copyright notice and disclaimer of warranty; keep intact
   2.157 +all the notices that refer to this License and to the absence of any
   2.158 +warranty; and distribute a copy of this License along with the
   2.159 +Library.
   2.160 +
   2.161 +  You may charge a fee for the physical act of transferring a copy,
   2.162 +and you may at your option offer warranty protection in exchange for a
   2.163 +fee.
   2.164 +
   2.165 +  2. You may modify your copy or copies of the Library or any portion
   2.166 +of it, thus forming a work based on the Library, and copy and
   2.167 +distribute such modifications or work under the terms of Section 1
   2.168 +above, provided that you also meet all of these conditions:
   2.169 +
   2.170 +    a) The modified work must itself be a software library.
   2.171 +
   2.172 +    b) You must cause the files modified to carry prominent notices
   2.173 +    stating that you changed the files and the date of any change.
   2.174 +
   2.175 +    c) You must cause the whole of the work to be licensed at no
   2.176 +    charge to all third parties under the terms of this License.
   2.177 +
   2.178 +    d) If a facility in the modified Library refers to a function or a
   2.179 +    table of data to be supplied by an application program that uses
   2.180 +    the facility, other than as an argument passed when the facility
   2.181 +    is invoked, then you must make a good faith effort to ensure that,
   2.182 +    in the event an application does not supply such function or
   2.183 +    table, the facility still operates, and performs whatever part of
   2.184 +    its purpose remains meaningful.
   2.185 +
   2.186 +    (For example, a function in a library to compute square roots has
   2.187 +    a purpose that is entirely well-defined independent of the
   2.188 +    application.  Therefore, Subsection 2d requires that any
   2.189 +    application-supplied function or table used by this function must
   2.190 +    be optional: if the application does not supply it, the square
   2.191 +    root function must still compute square roots.)
   2.192 +
   2.193 +These requirements apply to the modified work as a whole.  If
   2.194 +identifiable sections of that work are not derived from the Library,
   2.195 +and can be reasonably considered independent and separate works in
   2.196 +themselves, then this License, and its terms, do not apply to those
   2.197 +sections when you distribute them as separate works.  But when you
   2.198 +distribute the same sections as part of a whole which is a work based
   2.199 +on the Library, the distribution of the whole must be on the terms of
   2.200 +this License, whose permissions for other licensees extend to the
   2.201 +entire whole, and thus to each and every part regardless of who wrote
   2.202 +it.
   2.203 +
   2.204 +Thus, it is not the intent of this section to claim rights or contest
   2.205 +your rights to work written entirely by you; rather, the intent is to
   2.206 +exercise the right to control the distribution of derivative or
   2.207 +collective works based on the Library.
   2.208 +
   2.209 +In addition, mere aggregation of another work not based on the Library
   2.210 +with the Library (or with a work based on the Library) on a volume of
   2.211 +a storage or distribution medium does not bring the other work under
   2.212 +the scope of this License.
   2.213 +
   2.214 +  3. You may opt to apply the terms of the ordinary GNU General Public
   2.215 +License instead of this License to a given copy of the Library.  To do
   2.216 +this, you must alter all the notices that refer to this License, so
   2.217 +that they refer to the ordinary GNU General Public License, version 2,
   2.218 +instead of to this License.  (If a newer version than version 2 of the
   2.219 +ordinary GNU General Public License has appeared, then you can specify
   2.220 +that version instead if you wish.)  Do not make any other change in
   2.221 +these notices.
   2.222 +
   2.223 +  Once this change is made in a given copy, it is irreversible for
   2.224 +that copy, so the ordinary GNU General Public License applies to all
   2.225 +subsequent copies and derivative works made from that copy.
   2.226 +
   2.227 +  This option is useful when you wish to copy part of the code of
   2.228 +the Library into a program that is not a library.
   2.229 +
   2.230 +  4. You may copy and distribute the Library (or a portion or
   2.231 +derivative of it, under Section 2) in object code or executable form
   2.232 +under the terms of Sections 1 and 2 above provided that you accompany
   2.233 +it with the complete corresponding machine-readable source code, which
   2.234 +must be distributed under the terms of Sections 1 and 2 above on a
   2.235 +medium customarily used for software interchange.
   2.236 +
   2.237 +  If distribution of object code is made by offering access to copy
   2.238 +from a designated place, then offering equivalent access to copy the
   2.239 +source code from the same place satisfies the requirement to
   2.240 +distribute the source code, even though third parties are not
   2.241 +compelled to copy the source along with the object code.
   2.242 +
   2.243 +  5. A program that contains no derivative of any portion of the
   2.244 +Library, but is designed to work with the Library by being compiled or
   2.245 +linked with it, is called a "work that uses the Library".  Such a
   2.246 +work, in isolation, is not a derivative work of the Library, and
   2.247 +therefore falls outside the scope of this License.
   2.248 +
   2.249 +  However, linking a "work that uses the Library" with the Library
   2.250 +creates an executable that is a derivative of the Library (because it
   2.251 +contains portions of the Library), rather than a "work that uses the
   2.252 +library".  The executable is therefore covered by this License.
   2.253 +Section 6 states terms for distribution of such executables.
   2.254 +
   2.255 +  When a "work that uses the Library" uses material from a header file
   2.256 +that is part of the Library, the object code for the work may be a
   2.257 +derivative work of the Library even though the source code is not.
   2.258 +Whether this is true is especially significant if the work can be
   2.259 +linked without the Library, or if the work is itself a library.  The
   2.260 +threshold for this to be true is not precisely defined by law.
   2.261 +
   2.262 +  If such an object file uses only numerical parameters, data
   2.263 +structure layouts and accessors, and small macros and small inline
   2.264 +functions (ten lines or less in length), then the use of the object
   2.265 +file is unrestricted, regardless of whether it is legally a derivative
   2.266 +work.  (Executables containing this object code plus portions of the
   2.267 +Library will still fall under Section 6.)
   2.268 +
   2.269 +  Otherwise, if the work is a derivative of the Library, you may
   2.270 +distribute the object code for the work under the terms of Section 6.
   2.271 +Any executables containing that work also fall under Section 6,
   2.272 +whether or not they are linked directly with the Library itself.
   2.273 +
   2.274 +  6. As an exception to the Sections above, you may also combine or
   2.275 +link a "work that uses the Library" with the Library to produce a
   2.276 +work containing portions of the Library, and distribute that work
   2.277 +under terms of your choice, provided that the terms permit
   2.278 +modification of the work for the customer's own use and reverse
   2.279 +engineering for debugging such modifications.
   2.280 +
   2.281 +  You must give prominent notice with each copy of the work that the
   2.282 +Library is used in it and that the Library and its use are covered by
   2.283 +this License.  You must supply a copy of this License.  If the work
   2.284 +during execution displays copyright notices, you must include the
   2.285 +copyright notice for the Library among them, as well as a reference
   2.286 +directing the user to the copy of this License.  Also, you must do one
   2.287 +of these things:
   2.288 +
   2.289 +    a) Accompany the work with the complete corresponding
   2.290 +    machine-readable source code for the Library including whatever
   2.291 +    changes were used in the work (which must be distributed under
   2.292 +    Sections 1 and 2 above); and, if the work is an executable linked
   2.293 +    with the Library, with the complete machine-readable "work that
   2.294 +    uses the Library", as object code and/or source code, so that the
   2.295 +    user can modify the Library and then relink to produce a modified
   2.296 +    executable containing the modified Library.  (It is understood
   2.297 +    that the user who changes the contents of definitions files in the
   2.298 +    Library will not necessarily be able to recompile the application
   2.299 +    to use the modified definitions.)
   2.300 +
   2.301 +    b) Use a suitable shared library mechanism for linking with the
   2.302 +    Library.  A suitable mechanism is one that (1) uses at run time a
   2.303 +    copy of the library already present on the user's computer system,
   2.304 +    rather than copying library functions into the executable, and (2)
   2.305 +    will operate properly with a modified version of the library, if
   2.306 +    the user installs one, as long as the modified version is
   2.307 +    interface-compatible with the version that the work was made with.
   2.308 +
   2.309 +    c) Accompany the work with a written offer, valid for at
   2.310 +    least three years, to give the same user the materials
   2.311 +    specified in Subsection 6a, above, for a charge no more
   2.312 +    than the cost of performing this distribution.
   2.313 +
   2.314 +    d) If distribution of the work is made by offering access to copy
   2.315 +    from a designated place, offer equivalent access to copy the above
   2.316 +    specified materials from the same place.
   2.317 +
   2.318 +    e) Verify that the user has already received a copy of these
   2.319 +    materials or that you have already sent this user a copy.
   2.320 +
   2.321 +  For an executable, the required form of the "work that uses the
   2.322 +Library" must include any data and utility programs needed for
   2.323 +reproducing the executable from it.  However, as a special exception,
   2.324 +the materials to be distributed need not include anything that is
   2.325 +normally distributed (in either source or binary form) with the major
   2.326 +components (compiler, kernel, and so on) of the operating system on
   2.327 +which the executable runs, unless that component itself accompanies
   2.328 +the executable.
   2.329 +
   2.330 +  It may happen that this requirement contradicts the license
   2.331 +restrictions of other proprietary libraries that do not normally
   2.332 +accompany the operating system.  Such a contradiction means you cannot
   2.333 +use both them and the Library together in an executable that you
   2.334 +distribute.
   2.335 +
   2.336 +  7. You may place library facilities that are a work based on the
   2.337 +Library side-by-side in a single library together with other library
   2.338 +facilities not covered by this License, and distribute such a combined
   2.339 +library, provided that the separate distribution of the work based on
   2.340 +the Library and of the other library facilities is otherwise
   2.341 +permitted, and provided that you do these two things:
   2.342 +
   2.343 +    a) Accompany the combined library with a copy of the same work
   2.344 +    based on the Library, uncombined with any other library
   2.345 +    facilities.  This must be distributed under the terms of the
   2.346 +    Sections above.
   2.347 +
   2.348 +    b) Give prominent notice with the combined library of the fact
   2.349 +    that part of it is a work based on the Library, and explaining
   2.350 +    where to find the accompanying uncombined form of the same work.
   2.351 +
   2.352 +  8. You may not copy, modify, sublicense, link with, or distribute
   2.353 +the Library except as expressly provided under this License.  Any
   2.354 +attempt otherwise to copy, modify, sublicense, link with, or
   2.355 +distribute the Library is void, and will automatically terminate your
   2.356 +rights under this License.  However, parties who have received copies,
   2.357 +or rights, from you under this License will not have their licenses
   2.358 +terminated so long as such parties remain in full compliance.
   2.359 +
   2.360 +  9. You are not required to accept this License, since you have not
   2.361 +signed it.  However, nothing else grants you permission to modify or
   2.362 +distribute the Library or its derivative works.  These actions are
   2.363 +prohibited by law if you do not accept this License.  Therefore, by
   2.364 +modifying or distributing the Library (or any work based on the
   2.365 +Library), you indicate your acceptance of this License to do so, and
   2.366 +all its terms and conditions for copying, distributing or modifying
   2.367 +the Library or works based on it.
   2.368 +
   2.369 +  10. Each time you redistribute the Library (or any work based on the
   2.370 +Library), the recipient automatically receives a license from the
   2.371 +original licensor to copy, distribute, link with or modify the Library
   2.372 +subject to these terms and conditions.  You may not impose any further
   2.373 +restrictions on the recipients' exercise of the rights granted herein.
   2.374 +You are not responsible for enforcing compliance by third parties with
   2.375 +this License.
   2.376 +
   2.377 +  11. If, as a consequence of a court judgment or allegation of patent
   2.378 +infringement or for any other reason (not limited to patent issues),
   2.379 +conditions are imposed on you (whether by court order, agreement or
   2.380 +otherwise) that contradict the conditions of this License, they do not
   2.381 +excuse you from the conditions of this License.  If you cannot
   2.382 +distribute so as to satisfy simultaneously your obligations under this
   2.383 +License and any other pertinent obligations, then as a consequence you
   2.384 +may not distribute the Library at all.  For example, if a patent
   2.385 +license would not permit royalty-free redistribution of the Library by
   2.386 +all those who receive copies directly or indirectly through you, then
   2.387 +the only way you could satisfy both it and this License would be to
   2.388 +refrain entirely from distribution of the Library.
   2.389 +
   2.390 +If any portion of this section is held invalid or unenforceable under any
   2.391 +particular circumstance, the balance of the section is intended to apply,
   2.392 +and the section as a whole is intended to apply in other circumstances.
   2.393 +
   2.394 +It is not the purpose of this section to induce you to infringe any
   2.395 +patents or other property right claims or to contest validity of any
   2.396 +such claims; this section has the sole purpose of protecting the
   2.397 +integrity of the free software distribution system which is
   2.398 +implemented by public license practices.  Many people have made
   2.399 +generous contributions to the wide range of software distributed
   2.400 +through that system in reliance on consistent application of that
   2.401 +system; it is up to the author/donor to decide if he or she is willing
   2.402 +to distribute software through any other system and a licensee cannot
   2.403 +impose that choice.
   2.404 +
   2.405 +This section is intended to make thoroughly clear what is believed to
   2.406 +be a consequence of the rest of this License.
   2.407 +
   2.408 +  12. If the distribution and/or use of the Library is restricted in
   2.409 +certain countries either by patents or by copyrighted interfaces, the
   2.410 +original copyright holder who places the Library under this License may add
   2.411 +an explicit geographical distribution limitation excluding those countries,
   2.412 +so that distribution is permitted only in or among countries not thus
   2.413 +excluded.  In such case, this License incorporates the limitation as if
   2.414 +written in the body of this License.
   2.415 +
   2.416 +  13. The Free Software Foundation may publish revised and/or new
   2.417 +versions of the Lesser General Public License from time to time.
   2.418 +Such new versions will be similar in spirit to the present version,
   2.419 +but may differ in detail to address new problems or concerns.
   2.420 +
   2.421 +Each version is given a distinguishing version number.  If the Library
   2.422 +specifies a version number of this License which applies to it and
   2.423 +"any later version", you have the option of following the terms and
   2.424 +conditions either of that version or of any later version published by
   2.425 +the Free Software Foundation.  If the Library does not specify a
   2.426 +license version number, you may choose any version ever published by
   2.427 +the Free Software Foundation.
   2.428 +
   2.429 +  14. If you wish to incorporate parts of the Library into other free
   2.430 +programs whose distribution conditions are incompatible with these,
   2.431 +write to the author to ask for permission.  For software which is
   2.432 +copyrighted by the Free Software Foundation, write to the Free
   2.433 +Software Foundation; we sometimes make exceptions for this.  Our
   2.434 +decision will be guided by the two goals of preserving the free status
   2.435 +of all derivatives of our free software and of promoting the sharing
   2.436 +and reuse of software generally.
   2.437 +
   2.438 +			    NO WARRANTY
   2.439 +
   2.440 +  15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
   2.441 +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
   2.442 +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
   2.443 +OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
   2.444 +KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
   2.445 +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
   2.446 +PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
   2.447 +LIBRARY IS WITH YOU.  SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
   2.448 +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
   2.449 +
   2.450 +  16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
   2.451 +WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
   2.452 +AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
   2.453 +FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
   2.454 +CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
   2.455 +LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
   2.456 +RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
   2.457 +FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
   2.458 +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
   2.459 +DAMAGES.
   2.460 +
   2.461 +		     END OF TERMS AND CONDITIONS
   2.462 +
   2.463 +           How to Apply These Terms to Your New Libraries
   2.464 +
   2.465 +  If you develop a new library, and you want it to be of the greatest
   2.466 +possible use to the public, we recommend making it free software that
   2.467 +everyone can redistribute and change.  You can do so by permitting
   2.468 +redistribution under these terms (or, alternatively, under the terms of the
   2.469 +ordinary General Public License).
   2.470 +
   2.471 +  To apply these terms, attach the following notices to the library.  It is
   2.472 +safest to attach them to the start of each source file to most effectively
   2.473 +convey the exclusion of warranty; and each file should have at least the
   2.474 +"copyright" line and a pointer to where the full notice is found.
   2.475 +
   2.476 +    <one line to give the library's name and a brief idea of what it does.>
   2.477 +    Copyright (C) <year>  <name of author>
   2.478 +
   2.479 +    This library is free software; you can redistribute it and/or
   2.480 +    modify it under the terms of the GNU Lesser General Public
   2.481 +    License as published by the Free Software Foundation; either
   2.482 +    version 2.1 of the License, or (at your option) any later version.
   2.483 +
   2.484 +    This library is distributed in the hope that it will be useful,
   2.485 +    but WITHOUT ANY WARRANTY; without even the implied warranty of
   2.486 +    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   2.487 +    Lesser General Public License for more details.
   2.488 +
   2.489 +    You should have received a copy of the GNU Lesser General Public
   2.490 +    License along with this library; if not, write to the Free Software
   2.491 +    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
   2.492 +
   2.493 +Also add information on how to contact you by electronic and paper mail.
   2.494 +
   2.495 +You should also get your employer (if you work as a programmer) or your
   2.496 +school, if any, to sign a "copyright disclaimer" for the library, if
   2.497 +necessary.  Here is a sample; alter the names:
   2.498 +
   2.499 +  Yoyodyne, Inc., hereby disclaims all copyright interest in the
   2.500 +  library `Frob' (a library for tweaking knobs) written by James Random Hacker.
   2.501 +
   2.502 +  <signature of Ty Coon>, 1 April 1990
   2.503 +  Ty Coon, President of Vice
   2.504 +
   2.505 +That's all there is to it!
   2.506 +
   2.507 +
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/Makefile.am	Wed Mar 22 14:05:14 2006 -0700
     4.3 @@ -0,0 +1,395 @@
     4.4 +# =============================================================================
     4.5 +# (C) Copyright IBM Corp. 2006
     4.6 +#
     4.7 +#    This library is free software; you can redistribute it and/or
     4.8 +#    modify it under the terms of the GNU Lesser General Public
     4.9 +#    License as published by the Free Software Foundation; either
    4.10 +#    version 2.1 of the License, or (at your option) any later version.
    4.11 +#
    4.12 +#    This library is distributed in the hope that it will be useful,
    4.13 +#    but WITHOUT ANY WARRANTY; without even the implied warranty of
    4.14 +#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    4.15 +#    Lesser General Public License for more details.
    4.16 +#
    4.17 +#    You should have received a copy of the GNU Lesser General Public
    4.18 +#    License along with this library; if not, write to the Free Software
    4.19 +#    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
    4.20 +# =============================================================================
    4.21 +# Author:       Dr. Gareth S. Bestor <bestor@us.ibm.com>
    4.22 +# Contributors: Tokunbo Adeshiyan <tokunbo@us.ibm.com>
    4.23 +# Description:
    4.24 +#    Automake input file for the CMPI Xen CIM provider.
    4.25 +# =============================================================================
    4.26 +
    4.27 +# Start with an empty extra distribution file list
    4.28 +EXTRA_DIST=
    4.29 +
    4.30 +# Add the RPM spec file to the distribution file list
    4.31 +EXTRA_DIST+=$(PACKAGE).spec
    4.32 +
    4.33 +# Remove CVS directories when building a distribution package
    4.34 +dist-hook:
    4.35 +	test -d "$(distdir)" && (find $(distdir) -type d -name CVS | xargs -i rm -rf {})
    4.36 +
    4.37 +
    4.38 +# -----------------------------------------------------------------------------
    4.39 +# Automake instructions for documentation
    4.40 +# -----------------------------------------------------------------------------
    4.41 +
    4.42 +# MAKE CHANGES HERE TO INSTALL THE DOCUMENTATION FILES FOR YOUR PROVIDER
    4.43 +# docdir specifies where the documentation will be installed
    4.44 +docdir=$(datadir)/doc/$(PACKAGE)-$(VERSION)
    4.45 +
    4.46 +# Add standard package doc files
    4.47 +doc_DATA=README AUTHORS COPYING
    4.48 +
    4.49 +# ADD ANY EXTRA DOCUMENTATION FILES HERE
    4.50 +doc_DATA+=README.RPM README.DEBUG
    4.51 +EXTRA_DIST+=doc README.RPM README.DEBUG
    4.52 +
    4.53 +
    4.54 +# -----------------------------------------------------------------------------
    4.55 +# Automake instructions for source 
    4.56 +# -----------------------------------------------------------------------------
    4.57 +# MAKE CHANGES HERE TO COMPILE ALL THE SOURCE FILES FOR YOUR PROVIDER
    4.58 +
    4.59 +# providerdir specifies where provider libraries will be installed.
    4.60 +# @PROVIDERDIR@ is set by the configure script.
    4.61 +providerdir=@PROVIDERDIR@
    4.62 +
    4.63 +# LIST HEADER FILES USED TO COMPILE THIS PROVIDER BUT NOT INSTALLED HERE
    4.64 +noinst_HEADERS = \
    4.65 +	src/cmpiutil.h \
    4.66 +	src/cmpitrace.h \
    4.67 +	src/Xen_ComputerSystem_Resource.h \
    4.68 +	src/Xen_VirtualizationManagementService_Resource.h \
    4.69 +	src/Xen_ComputerSystemConfiguration_Resource.h \
    4.70 +	src/Xen_ComputerSystemSetting_Resource.h \
    4.71 +	src/Xen_Memory_Resource.h \
    4.72 +	src/Xen_Processor_Resource.h \
    4.73 +	src/Xen_Disk_Resource.h \
    4.74 +	src/Xen_NetworkPort_Resource.h \
    4.75 +	src/Xen_VirtualizationCapabilities_Resource.h \
    4.76 +	src/Xen_OperatingSystem_Resource.h \
    4.77 +	src/Xen_ComputerSystemSettingData_Resource.h \
    4.78 +	src/Xen_ProcessorSettingData_Resource.h \
    4.79 +	src/Xen_MemorySettingData_Resource.h \
    4.80 +	src/Xen_NetworkPortSettingData_Resource.h \
    4.81 +	src/Xen_DiskSettingData_Resource.h \
    4.82 +	src/Xen_MemoryPool_Resource.h \
    4.83 +	src/Xen_ProcessorPool_Resource.h \
    4.84 +	src/Xen_ProcessorCapabilitiesSettingData_Resource.h \
    4.85 +	src/Xen_MemoryCapabilitiesSettingData_Resource.h \
    4.86 +	libxm-cvs/xm.h
    4.87 +
    4.88 +# LIST EACH PROVIDER LIBRARY, ITS SOURCE FILE(S), AND ANY LIBS REQUIRED 
    4.89 +# FOR LINKING HERE
    4.90 +provider_LTLIBRARIES = \
    4.91 +	libXen_ComputerSystem.la \
    4.92 +	libXen_HostedComputerSystem.la \
    4.93 +	libXen_VirtualizationManagementService.la \
    4.94 +	libXen_HostedVirtualizationManagementService.la \
    4.95 +	libXen_ComputerSystemConfiguration.la \
    4.96 +	libXen_ConfigurationForComputerSystem.la \
    4.97 +	libXen_ComputerSystemSetting.la \
    4.98 +	libXen_SettingForComputerSystem.la \
    4.99 +	libXen_Memory.la \
   4.100 +	libXen_HostedMemory.la \
   4.101 +	libXen_ComputerSystemMemory.la \
   4.102 +	libXen_Processor.la \
   4.103 +	libXen_HostedProcessor.la \
   4.104 +	libXen_ComputerSystemProcessor.la \
   4.105 +	libXen_Disk.la \
   4.106 +	libXen_HostedDisk.la \
   4.107 +	libXen_ComputerSystemDisk.la \
   4.108 +	libXen_NetworkPort.la \
   4.109 +	libXen_HostedNetworkPort.la \
   4.110 +	libXen_ComputerSystemNetworkPort.la \
   4.111 +        libXen_ComputerSystemIndication.la \
   4.112 +	libXen_VirtualizationCapabilities.la \
   4.113 +	libXen_HasVirtualizationCapabilities.la \
   4.114 +	libXen_OperatingSystem.la \
   4.115 +	libXen_RunningOS.la \
   4.116 +	libXen_ComputerSystemSettingData.la \
   4.117 +        libXen_CSElementSettingData.la \
   4.118 +        libXen_ProcessorSettingData.la \
   4.119 +	libXen_ProcessorElementSettingData.la \
   4.120 +	libXen_MemorySettingData.la \
   4.121 +	libXen_MemoryElementSettingData.la \
   4.122 +	libXen_NetworkPortSettingData.la \
   4.123 +	libXen_NetworkPortElementSettingData.la \
   4.124 +	libXen_DiskSettingData.la \
   4.125 +	libXen_DiskElementSettingData.la \
   4.126 +	libXen_MemoryPool.la \
   4.127 +	libXen_HostedMemoryPool.la \
   4.128 +	libXen_ProcessorPool.la \
   4.129 +	libXen_HostedProcessorPool.la \
   4.130 +	libXen_CSSettingDataComponent.la \
   4.131 +	libXen_ProcessorCapabilitiesSettingData.la \
   4.132 +	libXen_MemoryCapabilitiesSettingData.la
   4.133 +
   4.134 +libXen_ComputerSystem_la_SOURCES = src/Xen_ComputerSystem.c src/Xen_ComputerSystem_Resource.c src/cmpiutil.c src/cmpitrace.c
   4.135 +libXen_ComputerSystem_la_LIBADD = -lxenstore -luuid -lxm 
   4.136 +libXen_ComputerSystem_la_CFLAGS = -Ilibxm-cvs
   4.137 +
   4.138 +libXen_HostedComputerSystem_la_SOURCES = src/Xen_HostedComputerSystem.c src/cmpiutil.c src/cmpitrace.c
   4.139 +libXen_HostedComputerSystem_la_LIBADD = 
   4.140 +
   4.141 +libXen_VirtualizationManagementService_la_SOURCES = src/Xen_VirtualizationManagementService.c src/Xen_VirtualizationManagementService_Resource.c src/cmpiutil.c src/cmpitrace.c
   4.142 +libXen_VirtualizationManagementService_la_LIBADD = -lxenstore -luuid -lxm
   4.143 +libXen_VirtualizationManagementService_la_CFLAGS = -Ilibxm-cvs
   4.144 +
   4.145 +libXen_HostedVirtualizationManagementService_la_SOURCES = src/Xen_HostedVirtualizationManagementService.c src/cmpiutil.c src/cmpitrace.c
   4.146 +libXen_HostedVirtualizationManagementService_la_LIBADD =
   4.147 +
   4.148 +libXen_ComputerSystemConfiguration_la_SOURCES = src/Xen_ComputerSystemConfiguration.c src/Xen_ComputerSystemConfiguration_Resource.c src/cmpiutil.c src/cmpitrace.c
   4.149 +libXen_ComputerSystemConfiguration_la_LIBADD = -lxenstore -luuid -lxm
   4.150 +libXen_ComputerSystemConfiguration_la_CFLAGS = -Ilibxm-cvs
   4.151 +
   4.152 +libXen_ConfigurationForComputerSystem_la_SOURCES = src/Xen_ConfigurationForComputerSystem.c src/cmpiutil.c src/cmpitrace.c
   4.153 +libXen_ConfigurationForComputerSystem_la_LIBADD =
   4.154 +
   4.155 +libXen_ComputerSystemSetting_la_SOURCES = src/Xen_ComputerSystemSetting.c src/Xen_ComputerSystemSetting_Resource.c src/cmpiutil.c src/cmpitrace.c
   4.156 +libXen_ComputerSystemSetting_la_LIBADD = -lxenstore -luuid -lxm
   4.157 +libXen_ComputerSystemSetting_la_CFLAGS = -Ilibxm-cvs
   4.158 +
   4.159 +libXen_SettingForComputerSystem_la_SOURCES = src/Xen_SettingForComputerSystem.c src/cmpiutil.c src/cmpitrace.c
   4.160 +libXen_SettingForComputerSystem_la_LIBADD =
   4.161 +
   4.162 +libXen_Memory_la_SOURCES = src/Xen_Memory.c src/Xen_Memory_Resource.c src/cmpiutil.c src/cmpitrace.c
   4.163 +libXen_Memory_la_LIBADD = -lxenstore -luuid -lxm
   4.164 +libXen_Memory_la_CFLAGS = -Ilibxm-cvs
   4.165 +
   4.166 +libXen_HostedMemory_la_SOURCES = src/Xen_HostedMemory.c src/cmpiutil.c src/cmpitrace.c
   4.167 +libXen_HostedMemory_la_LIBADD = 
   4.168 +
   4.169 +libXen_ComputerSystemMemory_la_SOURCES = src/Xen_ComputerSystemMemory.c src/cmpiutil.c src/cmpitrace.c
   4.170 +libXen_ComputerSystemMemory_la_LIBADD =
   4.171 +
   4.172 +libXen_Processor_la_SOURCES = src/Xen_Processor.c src/Xen_Processor_Resource.c src/cmpiutil.c src/cmpitrace.c
   4.173 +libXen_Processor_la_LIBADD = -lxenstore -luuid -lxm
   4.174 +libXen_Processor_la_CFLAGS = -Ilibxm-cvs
   4.175 +
   4.176 +libXen_HostedProcessor_la_SOURCES = src/Xen_HostedProcessor.c src/cmpiutil.c src/cmpitrace.c
   4.177 +libXen_HostedProcessor_la_LIBADD = 
   4.178 +
   4.179 +libXen_ComputerSystemProcessor_la_SOURCES = src/Xen_ComputerSystemProcessor.c src/cmpiutil.c src/cmpitrace.c
   4.180 +libXen_ComputerSystemProcessor_la_LIBADD =
   4.181 +
   4.182 +libXen_Disk_la_SOURCES = src/Xen_Disk.c src/Xen_Disk_Resource.c src/cmpiutil.c src/cmpitrace.c
   4.183 +libXen_Disk_la_LIBADD = -lxenstore -luuid -lxm
   4.184 +libXen_Disk_la_CFLAGS = -Ilibxm-cvs
   4.185 +
   4.186 +libXen_HostedDisk_la_SOURCES = src/Xen_HostedDisk.c src/cmpiutil.c src/cmpitrace.c
   4.187 +libXen_HostedDisk_la_LIBADD = 
   4.188 +
   4.189 +libXen_ComputerSystemDisk_la_SOURCES = src/Xen_ComputerSystemDisk.c src/cmpiutil.c src/cmpitrace.c
   4.190 +libXen_ComputerSystemDisk_la_LIBADD =
   4.191 +
   4.192 +libXen_NetworkPort_la_SOURCES = src/Xen_NetworkPort.c src/Xen_NetworkPort_Resource.c src/cmpiutil.c src/cmpitrace.c
   4.193 +libXen_NetworkPort_la_LIBADD = -lxenstore -luuid -lxm
   4.194 +libXen_NetworkPort_la_CFLAGS = -Ilibxm-cvs
   4.195 +
   4.196 +libXen_HostedNetworkPort_la_SOURCES = src/Xen_HostedNetworkPort.c src/cmpiutil.c src/cmpitrace.c
   4.197 +libXen_HostedNetworkPort_la_LIBADD = 
   4.198 +
   4.199 +libXen_ComputerSystemNetworkPort_la_SOURCES = src/Xen_ComputerSystemNetworkPort.c src/cmpiutil.c src/cmpitrace.c
   4.200 +libXen_ComputerSystemNetworkPort_la_LIBADD =
   4.201 +
   4.202 +libXen_ComputerSystemIndication_la_SOURCES = src/Xen_ComputerSystemIndication.c src/cmpiutil.c src/cmpitrace.c
   4.203 +libXen_ComputerSystemIndication_la_LIBADD =
   4.204 +
   4.205 +libXen_VirtualizationCapabilities_la_SOURCES = src/Xen_VirtualizationCapabilities.c src/Xen_VirtualizationCapabilities_Resource.c src/cmpiutil.c src/cmpitrace.c
   4.206 +libXen_VirtualizationCapabilities_la_LIBADD = 
   4.207 +
   4.208 +libXen_HasVirtualizationCapabilities_la_SOURCES = src/Xen_HasVirtualizationCapabilities.c src/cmpiutil.c src/cmpitrace.c
   4.209 +libXen_HasVirtualizationCapabilities_la_LIBADD =
   4.210 +
   4.211 +libXen_OperatingSystem_la_SOURCES = src/Xen_OperatingSystem.c src/Xen_OperatingSystem_Resource.c src/cmpiutil.c src/cmpitrace.c
   4.212 +libXen_OperatingSystem_la_LIBADD = -lxenstore -luuid -lxm
   4.213 +libXen_OperatingSystem_la_CFLAGS = -Ilibxm-cvs
   4.214 +
   4.215 +libXen_RunningOS_la_SOURCES = src/Xen_RunningOS.c src/cmpiutil.c src/cmpitrace.c
   4.216 +libXen_RunningOS_la_LIBADD =
   4.217 +
   4.218 +libXen_ComputerSystemSettingData_la_SOURCES = src/Xen_ComputerSystemSettingData.c src/Xen_ComputerSystemSettingData_Resource.c src/cmpiutil.c src/cmpitrace.c
   4.219 +libXen_ComputerSystemSettingData_la_LIBADD = -lxenstore -luuid -lxm
   4.220 +libXen_ComputerSystemSettingData_la_CFLAGS = -Ilibxm-cvs
   4.221 +
   4.222 +libXen_CSElementSettingData_la_SOURCES = src/Xen_CSElementSettingData.c src/cmpiutil.c src/cmpitrace.c
   4.223 +libXen_CSElementSettingData_la_LIBADD =
   4.224 +
   4.225 +libXen_ProcessorSettingData_la_SOURCES = src/Xen_ProcessorSettingData.c src/Xen_ProcessorSettingData_Resource.c src/cmpiutil.c src/cmpitrace.c
   4.226 +libXen_ProcessorSettingData_la_LIBADD = -lxenstore -luuid -lxm
   4.227 +libXen_ProcessorSettingData_la_CFLAGS = -Ilibxm-cvs
   4.228 +
   4.229 +libXen_ProcessorElementSettingData_la_SOURCES = src/Xen_ProcessorElementSettingData.c src/cmpiutil.c src/cmpitrace.c
   4.230 +libXen_ProcessorElementSettingData_la_LIBADD =
   4.231 +
   4.232 +libXen_MemorySettingData_la_SOURCES = src/Xen_MemorySettingData.c src/Xen_MemorySettingData_Resource.c src/cmpiutil.c src/cmpitrace.c
   4.233 +libXen_MemorySettingData_la_LIBADD = -lxenstore -luuid -lxm
   4.234 +libXen_MemorySettingData_la_CFLAGS = -Ilibxm-cvs
   4.235 +
   4.236 +libXen_MemoryElementSettingData_la_SOURCES = src/Xen_MemoryElementSettingData.c src/cmpiutil.c src/cmpitrace.c
   4.237 +libXen_MemoryElementSettingData_la_LIBADD =
   4.238 +
   4.239 +libXen_NetworkPortSettingData_la_SOURCES = src/Xen_NetworkPortSettingData.c src/Xen_NetworkPortSettingData_Resource.c src/cmpiutil.c src/cmpitrace.c
   4.240 +libXen_NetworkPortSettingData_la_LIBADD = -lxenstore -luuid -lxm
   4.241 +libXen_NetworkPortSettingData_la_CFLAGS = -Ilibxm-cvs
   4.242 +
   4.243 +libXen_NetworkPortElementSettingData_la_SOURCES = src/Xen_NetworkPortElementSettingData.c src/cmpiutil.c src/cmpitrace.c
   4.244 +libXen_NetworkPortElementSettingData_la_LIBADD =
   4.245 +
   4.246 +libXen_DiskSettingData_la_SOURCES = src/Xen_DiskSettingData.c src/Xen_DiskSettingData_Resource.c src/cmpiutil.c src/cmpitrace.c
   4.247 +libXen_DiskSettingData_la_LIBADD = -lxenstore -luuid -lxm
   4.248 +libXen_DiskSettingData_la_CFLAGS = -Ilibxm-cvs
   4.249 +
   4.250 +libXen_DiskElementSettingData_la_SOURCES = src/Xen_DiskElementSettingData.c src/cmpiutil.c src/cmpitrace.c
   4.251 +libXen_DiskElementSettingData_la_LIBADD =
   4.252 +
   4.253 +libXen_MemoryPool_la_SOURCES = src/Xen_MemoryPool.c src/Xen_MemoryPool_Resource.c src/cmpiutil.c src/cmpitrace.c
   4.254 +libXen_MemoryPool_la_LIBADD = -lxenstore -luuid -lxm
   4.255 +libXen_MemoryPool_la_CFLAGS = -Ilibxm-cvs
   4.256 +
   4.257 +libXen_HostedMemoryPool_la_SOURCES = src/Xen_HostedMemoryPool.c src/cmpiutil.c src/cmpitrace.c
   4.258 +libXen_HostedMemoryPool_la_LIBADD =
   4.259 +
   4.260 +libXen_ProcessorPool_la_SOURCES = src/Xen_ProcessorPool.c src/Xen_ProcessorPool_Resource.c src/cmpiutil.c src/cmpitrace.c
   4.261 +libXen_ProcessorPool_la_LIBADD = -lxenstore -luuid -lxm
   4.262 +libXen_ProcessorPool_la_CFLAGS = -Ilibxm-cvs
   4.263 +
   4.264 +libXen_HostedProcessorPool_la_SOURCES = src/Xen_HostedProcessorPool.c src/cmpiutil.c src/cmpitrace.c
   4.265 +libXen_HostedProcessorPool_la_LIBADD =
   4.266 +
   4.267 +libXen_CSSettingDataComponent_la_SOURCES = src/Xen_CSSettingDataComponent.c src/cmpiutil.c src/cmpitrace.c
   4.268 +libXen_CSSettingDataComponent_la_LIBADD =
   4.269 +
   4.270 +libXen_ProcessorCapabilitiesSettingData_la_SOURCES = src/Xen_ProcessorCapabilitiesSettingData.c src/Xen_ProcessorCapabilitiesSettingData_Resource.c src/cmpiutil.c src/cmpitrace.c
   4.271 +libXen_ProcessorCapabilitiesSettingData_la_LIBADD = 
   4.272 +libXen_ProcessorCapabilitiesSettingData_la_CFLAGS =
   4.273 +
   4.274 +libXen_MemoryCapabilitiesSettingData_la_SOURCES = src/Xen_MemoryCapabilitiesSettingData.c src/Xen_MemoryCapabilitiesSettingData_Resource.c src/cmpiutil.c src/cmpitrace.c
   4.275 +libXen_MemoryCapabilitiesSettingData_la_LIBADD =
   4.276 +libXen_MemoryCapabilitiesSettingData_la_CFLAGS =
   4.277 + 
   4.278 +# LIST ANY UTILITY LIBRARIES, THEIR SOURCE FILE(S), AND ANY LIBS REQUIRED FOR LINKING HERE
   4.279 +# libxm is the Xen API for the CMPI providers
   4.280 +lib_LTLIBRARIES = libxm.la
   4.281 +libxm_la_SOURCES = libxm-cvs/xm.c libxm-cvs/xm.h libxm-cvs/sexpr.c libxm-cvs/sexpr.h libxm-cvs/exec.c libxm-cvs/exec.h
   4.282 +libxm_la_LIBADD =
   4.283 +
   4.284 +# -----------------------------------------------------------------------------
   4.285 +# Automake instructions for schema
   4.286 +# -----------------------------------------------------------------------------
   4.287 +
   4.288 +# LIST ALL THE CLASS DEFINITION FILES (MOFS) HERE
   4.289 +MOFS = \
   4.290 +	schema/Xen_ComputerSystem.mof \
   4.291 +	schema/Xen_HostedComputerSystem.mof \
   4.292 +	schema/Xen_VirtualizationManagementService.mof \
   4.293 +	schema/Xen_HostedVirtualizationManagementService.mof \
   4.294 +	schema/Xen_ComputerSystemConfiguration.mof \
   4.295 +	schema/Xen_ConfigurationForComputerSystem.mof \
   4.296 +	schema/Xen_ComputerSystemSetting.mof \
   4.297 +	schema/Xen_SettingForComputerSystem.mof \
   4.298 +	schema/Xen_Memory.mof \
   4.299 +	schema/Xen_HostedMemory.mof \
   4.300 +	schema/Xen_ComputerSystemMemory.mof \
   4.301 +	schema/Xen_Processor.mof \
   4.302 +	schema/Xen_HostedProcessor.mof \
   4.303 +	schema/Xen_ComputerSystemProcessor.mof \
   4.304 +	schema/Xen_Disk.mof \
   4.305 +	schema/Xen_HostedDisk.mof \
   4.306 +	schema/Xen_ComputerSystemDisk.mof \
   4.307 +	schema/Xen_NetworkPort.mof \
   4.308 +	schema/Xen_HostedNetworkPort.mof \
   4.309 +	schema/Xen_ComputerSystemNetworkPort.mof \
   4.310 +        schema/Xen_ComputerSystemIndication.mof \
   4.311 +	schema/Xen_VirtualizationCapabilities.mof \
   4.312 +	schema/Xen_HasVirtualizationCapabilities.mof \
   4.313 +	schema/Xen_OperatingSystem.mof \
   4.314 +	schema/Xen_RunningOS.mof \
   4.315 +	schema/Xen_ComputerSystemSettingData.mof \
   4.316 +	schema/Xen_CSElementSettingData.mof \
   4.317 +	schema/Xen_VirtualDeviceSettingData.mof \
   4.318 +	schema/Xen_ProcessorSettingData.mof \
   4.319 +	schema/Xen_ProcessorElementSettingData.mof \
   4.320 +	schema/Xen_MemorySettingData.mof \
   4.321 +	schema/Xen_MemoryElementSettingData.mof \
   4.322 +	schema/Xen_NetworkPortSettingData.mof \
   4.323 +	schema/Xen_NetworkPortElementSettingData.mof \
   4.324 +	schema/Xen_DiskSettingData.mof \
   4.325 +	schema/Xen_DiskElementSettingData.mof \
   4.326 +	schema/Xen_ResourcePool.mof \
   4.327 +	schema/Xen_MemoryPool.mof \
   4.328 +	schema/Xen_HostedMemoryPool.mof \
   4.329 +	schema/Xen_ProcessorPool.mof \
   4.330 +	schema/Xen_HostedProcessorPool.mof \
   4.331 +	schema/Xen_CSSettingDataComponent.mof \
   4.332 +	schema/Xen_ProcessorCapabilitiesSettingData.mof \
   4.333 +	schema/Xen_MemoryCapabilitiesSettingData.mof
   4.334 +
   4.335 +# LIST ALL THE CLASS CIMOM REGISTRATION FILES HERE
   4.336 +REGS = \
   4.337 +	schema/Xen_ComputerSystem.registration \
   4.338 +	schema/Xen_HostedComputerSystem.registration \
   4.339 +	schema/Xen_VirtualizationManagementService.registration \
   4.340 +	schema/Xen_HostedVirtualizationManagementService.registration \
   4.341 +	schema/Xen_ComputerSystemConfiguration.registration \
   4.342 +	schema/Xen_ConfigurationForComputerSystem.registration \
   4.343 +	schema/Xen_ComputerSystemSetting.registration \
   4.344 +	schema/Xen_SettingForComputerSystem.registration \
   4.345 +	schema/Xen_Memory.registration \
   4.346 +	schema/Xen_HostedMemory.registration \
   4.347 +	schema/Xen_ComputerSystemMemory.registration \
   4.348 +	schema/Xen_Processor.registration \
   4.349 +	schema/Xen_HostedProcessor.registration \
   4.350 +	schema/Xen_ComputerSystemProcessor.registration \
   4.351 +	schema/Xen_Disk.registration \
   4.352 +	schema/Xen_HostedDisk.registration \
   4.353 +	schema/Xen_ComputerSystemDisk.registration \
   4.354 +	schema/Xen_NetworkPort.registration \
   4.355 +	schema/Xen_HostedNetworkPort.registration \
   4.356 +	schema/Xen_ComputerSystemNetworkPort.registration \
   4.357 +        schema/Xen_ComputerSystemIndication.registration \
   4.358 +	schema/Xen_VirtualizationCapabilities.registration \
   4.359 +	schema/Xen_HasVirtualizationCapabilities.registration \
   4.360 +	schema/Xen_OperatingSystem.registration \
   4.361 +	schema/Xen_RunningOS.registration \
   4.362 +	schema/Xen_ComputerSystemSettingData.registration \
   4.363 +	schema/Xen_CSElementSettingData.registration \
   4.364 +	schema/Xen_ProcessorSettingData.registration \
   4.365 +	schema/Xen_ProcessorElementSettingData.registration \
   4.366 +	schema/Xen_MemorySettingData.registration \
   4.367 +	schema/Xen_MemoryElementSettingData.registration \
   4.368 +	schema/Xen_NetworkPortSettingData.registration \
   4.369 +	schema/Xen_NetworkPortElementSettingData.registration \
   4.370 +	schema/Xen_DiskSettingData.registration \
   4.371 +	schema/Xen_DiskElementSettingData.registration \
   4.372 +	schema/Xen_MemoryPool.registration \
   4.373 +	schema/Xen_HostedMemoryPool.registration \
   4.374 +	schema/Xen_ProcessorPool.registration \
   4.375 +	schema/Xen_HostedProcessorPool.registration \
   4.376 +	schema/Xen_CSSettingDataComponent.registration \
   4.377 +	schema/Xen_ProcessorCapabilitiesSettingData.registration \
   4.378 +	schema/Xen_MemoryCapabilitiesSettingData.registration
   4.379 +
   4.380 +# Un/Register the providers and class definitions from/to the current CIMOM.
   4.381 +# @CIMSERVER@ is set by the configure script
   4.382 +postinstall:
   4.383 +	sh provider-register.sh -t @CIMSERVER@ -r $(REGS) -m $(MOFS)
   4.384 +
   4.385 +preuninstall:
   4.386 +	sh provider-register.sh -d -t @CIMSERVER@ -r $(REGS) -m $(MOFS)
   4.387 +
   4.388 +# Add the schema files to the distribution file list
   4.389 +pkgdata_DATA=$(MOFS) $(REGS)
   4.390 +pkgdata_SCRIPTS=provider-register.sh
   4.391 +EXTRA_DIST+=schema $(pkgdata_DATA) $(pkgdata_SCRIPTS) 
   4.392 +
   4.393 +# -----------------------------------------------------------------------------
   4.394 +# Automake instructions to generate source tarball for cmpi-xen
   4.395 +# -----------------------------------------------------------------------------
   4.396 +
   4.397 +dist:
   4.398 +	sh make-srcpkg.sh
     7.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.2 +++ b/VERSION	Wed Mar 22 14:05:14 2006 -0700
     7.3 @@ -0,0 +1,1 @@
     7.4 +.02
     8.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     8.2 +++ b/acinclude.m4	Wed Mar 22 14:05:14 2006 -0700
     8.3 @@ -0,0 +1,358 @@
     8.4 +dnl
     8.5 +dnl $Id: acinclude.m4,v 1.1.1.1 2005/08/30 23:08:51 bestor Exp $
     8.6 +dnl
     8.7 + dnl 
     8.8 + dnl (C) Copyright IBM Corp. 2004, 2005
     8.9 + dnl
    8.10 + dnl THIS FILE IS PROVIDED UNDER THE TERMS OF THE COMMON PUBLIC LICENSE
    8.11 + dnl ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE
    8.12 + dnl CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT.
    8.13 + dnl
    8.14 + dnl You can obtain a current copy of the Common Public License from
    8.15 + dnl  http://www.opensource.org/licenses/cpl1.0.php
    8.16 + dnl
    8.17 + dnl Author:       Konrad Rzeszutek <konradr@us.ibm.com>
    8.18 + dnl Contributors: Viktor Mihajlovski <mihajlov@de.ibm.com>
    8.19 + dnl Date  :	      09/20/2004
    8.20 +dnl
    8.21 +dnl
    8.22 +dnl CHECK_CMPI: Check for CMPI headers and set the CPPFLAGS
    8.23 +dnl with the -I<directory>
    8.24 +dnl 
    8.25 +dnl CHECK_PEGASUS_2_3_2: Check for Pegasus 2.3.2 and set
    8.26 +dnl the HAVE_PEGASUS_2_3_2 
    8.27 +dnl flag 
    8.28 +dnl
    8.29 +
    8.30 +AC_DEFUN([CHECK_PEGASUS_2_3_2],
    8.31 +	[
    8.32 +	AC_MSG_CHECKING(for Pegasus 2.3.2)
    8.33 +	if which cimserver > /dev/null 2>&1 
    8.34 +	then
    8.35 +	   test_CIMSERVER=`cimserver -v`
    8.36 +	fi	
    8.37 +	if test "$test_CIMSERVER" == "2.3.2"; then
    8.38 +		AC_MSG_RESULT(yes)		
    8.39 +		AC_DEFINE_UNQUOTED(HAVE_PEGASUS_2_3_2,1,[Defined to 1 if Pegasus 2.3.2 is used])
    8.40 +	else
    8.41 +		AC_MSG_RESULT(no)
    8.42 +
    8.43 +	fi
    8.44 +	]
    8.45 +)
    8.46 +
    8.47 +dnl
    8.48 +dnl CHECK_PEGASUS_2_4: Check for Pegasus 2.4 and set the
    8.49 +dnl the -DPEGASUS_USE_EXPERIMENTAL_INTERFACES flag
    8.50 +dnl
    8.51 +AC_DEFUN([CHECK_PEGASUS_2_4],
    8.52 +	[
    8.53 +	AC_MSG_CHECKING(for Pegasus 2.4)
    8.54 +	if which cimserver > /dev/null 2>&1 
    8.55 +	then
    8.56 +	   test_CIMSERVER=`cimserver -v`
    8.57 +	fi	
    8.58 +	if test "$test_CIMSERVER" == "2.4"; then
    8.59 +		AC_MSG_RESULT(yes)		
    8.60 +		CPPFLAGS="$CPPFLAGS -DPEGASUS_USE_EXPERIMENTAL_INTERFACES"
    8.61 +		AC_DEFINE_UNQUOTED(HAVE_PEGASUS_2_4,1,[Defined to 1 if Pegasus 2.4 is used])
    8.62 +	else
    8.63 +		AC_MSG_RESULT(no)
    8.64 +
    8.65 +	fi
    8.66 +	]
    8.67 +)
    8.68 +	
    8.69 +	
    8.70 +dnl
    8.71 +dnl Helper functions
    8.72 +dnl
    8.73 +AC_DEFUN([_CHECK_CMPI],
    8.74 +	[
    8.75 +	AC_MSG_CHECKING($1)
    8.76 +	AC_TRY_LINK(
    8.77 +	[
    8.78 +		#include <cmpimacs.h>
    8.79 +		#include <cmpidt.h>
    8.80 +		#include <cmpift.h>
    8.81 +	],
    8.82 +	[
    8.83 +		CMPIBroker broker;
    8.84 +		CMPIStatus status = {CMPI_RC_OK, NULL};
    8.85 +		CMPIString *s = CMNewString(&broker, "TEST", &status);
    8.86 +	],
    8.87 +	[
    8.88 +		have_CMPI=yes
    8.89 +		dnl AC_MSG_RESULT(yes)
    8.90 +	],
    8.91 +	[
    8.92 +		have_CMPI=no
    8.93 +		dnl AC_MSG_RESULT(no)
    8.94 +	])
    8.95 +
    8.96 +])
    8.97 +
    8.98 +AC_DEFUN([_CHECK_INDHELP_HEADER],
    8.99 +	[
   8.100 +	AC_MSG_CHECKING($1)
   8.101 +	AC_TRY_COMPILE(
   8.102 +	[
   8.103 +                #include <stdio.h>
   8.104 +		#include <ind_helper.h>
   8.105 +	],
   8.106 +	[
   8.107 +		CMPISelectExp *filter = NULL;
   8.108 +	        ind_set_select("/root/cimv2",NULL,filter);
   8.109 +	],
   8.110 +	[
   8.111 +		have_INDHELP=yes
   8.112 +		dnl AC_MSG_RESULT(yes)
   8.113 +	],
   8.114 +	[
   8.115 +		have_INDHELP=no
   8.116 +		dnl AC_MSG_RESULT(no)
   8.117 +	])
   8.118 +
   8.119 +])
   8.120 +
   8.121 +dnl
   8.122 +dnl The main function to check for CMPI headers
   8.123 +dnl Modifies the CPPFLAGS with the right include directory and sets
   8.124 +dnl the 'have_CMPI' to either 'no' or 'yes'
   8.125 +dnl
   8.126 +
   8.127 +AC_DEFUN([CHECK_CMPI],
   8.128 +	[
   8.129 +	AC_MSG_CHECKING(for CMPI headers)
   8.130 +	dnl Check just with the standard include paths
   8.131 +	CMPI_CPP_FLAGS="$CPPFLAGS"
   8.132 +	_CHECK_CMPI(standard)
   8.133 +	if test "$have_CMPI" == "yes"; then
   8.134 +		dnl The standard include paths worked.
   8.135 +		AC_MSG_RESULT(yes)
   8.136 +	else
   8.137 +	  _DIRS_="/usr/include/cmpi \
   8.138 +                  /usr/local/include/cmpi \
   8.139 +		  $PEGASUS_ROOT/src/Pegasus/Provider/CMPI \
   8.140 +		  /opt/tog-pegasus/include/Pegasus/Provider/CMPI \
   8.141 +		  /usr/include/Pegasus/Provider/CMPI \
   8.142 +		  /usr/include/openwbem \
   8.143 +		  /usr/sniacimom/include"
   8.144 +	  for _DIR_ in $_DIRS_
   8.145 +	  do
   8.146 +		 _cppflags=$CPPFLAGS
   8.147 +		 _include_CMPI="$_DIR_"
   8.148 +		 CPPFLAGS="$CPPFLAGS -I$_include_CMPI"
   8.149 +		 _CHECK_CMPI($_DIR_)
   8.150 +		 if test "$have_CMPI" == "yes"; then
   8.151 +		  	dnl Found it
   8.152 +		  	AC_MSG_RESULT(yes)
   8.153 +			dnl Save the new -I parameter  
   8.154 +			CMPI_CPP_FLAGS="$CPPFLAGS"
   8.155 +			break
   8.156 +		 fi
   8.157 +	         CPPFLAGS=$_cppflags
   8.158 +	  done
   8.159 +	fi	
   8.160 +	CPPFLAGS="$CMPI_CPP_FLAGS"	
   8.161 +	if test "$have_CMPI" == "no"; then
   8.162 +		AC_MSG_ERROR(no. Sorry cannot find CMPI headers files.)
   8.163 +	fi
   8.164 +	]
   8.165 +)
   8.166 +
   8.167 +dnl
   8.168 +dnl The main function to check for the indication_helper header.
   8.169 +dnl Modifies the CPPFLAGS with the right include directory and sets
   8.170 +dnl the 'have_INDHELP' to either 'no' or 'yes'
   8.171 +dnl
   8.172 +
   8.173 +AC_DEFUN([CHECK_INDHELP_HEADER],
   8.174 +	[
   8.175 +        INDHELP_CPP_FLAGS="$CPPFLAGS"
   8.176 +	AC_MSG_CHECKING(for indication helper header)
   8.177 +	dnl Check just with the standard include paths
   8.178 +	_CHECK_INDHELP_HEADER(standard)
   8.179 +	if test "$have_INDHELP" == "yes"; then
   8.180 +		dnl The standard include paths worked.
   8.181 +		AC_MSG_RESULT(yes)
   8.182 +	else
   8.183 +	  _DIRS_="/usr/include/sblim \
   8.184 +                  /usr/local/include/sblim"
   8.185 +	  for _DIR_ in $_DIRS_
   8.186 +	  do
   8.187 +		 _cppflags=$CPPFLAGS
   8.188 +		 _include_INDHELP="$_DIR_"
   8.189 +		 CPPFLAGS="$CPPFLAGS -I$_include_INDHELP"
   8.190 +		 _CHECK_INDHELP_HEADER($_DIR_)
   8.191 +		 if test "$have_INDHELP" == "yes"; then
   8.192 +		  	dnl Found it
   8.193 +		  	AC_MSG_RESULT(yes)
   8.194 +			dnl Save the new -I parameter  
   8.195 +			INDHELP_CPP_FLAGS="$CPPFLAGS"
   8.196 +			break
   8.197 +		 fi
   8.198 +	         CPPFLAGS=$_cppflags
   8.199 +	  done
   8.200 +	fi	
   8.201 +	CPPFLAGS="$INDHELP_CPP_FLAGS"	
   8.202 +	if test "$have_INDHELP" == "no"; then
   8.203 +		AC_MSG_RESULT(no)
   8.204 +        fi
   8.205 +	]
   8.206 +)
   8.207 +
   8.208 +dnl
   8.209 +dnl The check for the CMPI provider directory
   8.210 +dnl Sets the PROVIDERDIR  variable.
   8.211 +dnl
   8.212 +
   8.213 +AC_DEFUN([CHECK_PROVIDERDIR],
   8.214 +	[
   8.215 +	AC_MSG_CHECKING(for CMPI provider directory)
   8.216 +	_DIRS="$libdir/cmpi"
   8.217 +	save_exec_prefix=${exec_prefix}
   8.218 +	save_prefix=${prefix}
   8.219 +	if test xNONE == x${prefix}; then
   8.220 +		prefix=/usr/local
   8.221 +	fi
   8.222 +	if test xNONE == x${exec_prefix}; then
   8.223 +		exec_prefix=$prefix
   8.224 +	fi
   8.225 +	for _dir in $_DIRS
   8.226 +	do
   8.227 +		_xdir=`eval echo $_dir`
   8.228 +		AC_MSG_CHECKING( $_dir )
   8.229 +		if test -d $_xdir ; then
   8.230 +		  dnl Found it
   8.231 +		  AC_MSG_RESULT(yes)
   8.232 +		  if test x"$PROVIDERDIR" == x ; then
   8.233 +			PROVIDERDIR=$_dir
   8.234 +		  fi
   8.235 +		  break
   8.236 +		fi
   8.237 +        done
   8.238 +	if test x"$PROVIDERDIR" == x ; then
   8.239 +		PROVIDERDIR="$libdir"/cmpi
   8.240 +		AC_MSG_RESULT(implied: $PROVIDERDIR)
   8.241 +	fi
   8.242 +	exec_prefix=$save_exec_prefix
   8.243 +	prefix=$save_prefix
   8.244 +	]
   8.245 +)
   8.246 +
   8.247 +dnl
   8.248 +dnl The "check" for the CIM server type
   8.249 +dnl Sets the CIMSERVER variable.
   8.250 +dnl
   8.251 +
   8.252 +AC_DEFUN([CHECK_CIMSERVER],
   8.253 +	[
   8.254 +	AC_MSG_CHECKING(for CIM servers)
   8.255 +	_SERVERS="sfcbd cimserver owcimomd"
   8.256 +	for _name in $_SERVERS
   8.257 +	do
   8.258 +	 	AC_MSG_CHECKING( $_name )
   8.259 +	        which $_name > /dev/null 2>&1
   8.260 +		if test $? == 0 ; then
   8.261 +		  dnl Found it
   8.262 +		  AC_MSG_RESULT(yes)
   8.263 +		  if test x"$CIMSERVER" == x ; then
   8.264 +			case $_name in
   8.265 +			   sfcbd) CIMSERVER=sfcb;;
   8.266 +			   cimserver) CIMSERVER=pegasus;;
   8.267 +			   owcimomd) CIMSERVER=openwbem;;
   8.268 +			esac
   8.269 +		  fi
   8.270 +		  break;
   8.271 +		fi
   8.272 +        done
   8.273 +	if test x"$CIMSERVER" == x ; then
   8.274 +		CIMSERVER=sfcb
   8.275 +		AC_MSG_RESULT(implied: $CIMSERVER)
   8.276 +	fi
   8.277 +	]
   8.278 +)
   8.279 +
   8.280 +dnl
   8.281 +dnl The check for the SBLIM test suite
   8.282 +dnl Sets the TESTSUITEDIR variable and the TESTSUITE conditional
   8.283 +dnl
   8.284 +
   8.285 +AC_DEFUN([CHECK_TESTSUITE],
   8.286 +	[
   8.287 +	AC_MSG_CHECKING(for SBLIM testsuite)
   8.288 +	_DIRS="$datadir/sblim-testsuite"
   8.289 +	save_exec_prefix=${exec_prefix}
   8.290 +	save_prefix=${prefix}
   8.291 +	if test xNONE == x${prefix}; then
   8.292 +		prefix=/usr/local
   8.293 +	fi
   8.294 +	if test xNONE == x${exec_prefix}; then
   8.295 +		exec_prefix=$prefix
   8.296 +	fi
   8.297 +	for _name in $_DIRS
   8.298 +	do
   8.299 +	 	AC_MSG_CHECKING( $_name )
   8.300 +		_xname=`eval echo $_name`
   8.301 +		if test -x $_xname/run.sh ; then
   8.302 +		  dnl Found it
   8.303 +		  AC_MSG_RESULT(yes)
   8.304 +		  if test x"$TESTSUITEDIR" == x; then
   8.305 +		  	TESTSUITEDIR=$_name
   8.306 +		  fi
   8.307 +		  AC_SUBST(TESTSUITEDIR)
   8.308 +		  break;
   8.309 +		fi
   8.310 +        done
   8.311 +	if test x"$TESTSUITEDIR" == x ; then
   8.312 +		AC_MSG_RESULT(no)
   8.313 +	fi
   8.314 +	AM_CONDITIONAL(TESTSUITE,[test x"$TESTSUITEDIR" != x])
   8.315 +	exec_prefix=$save_exec_prefix
   8.316 +	prefix=$save_prefix
   8.317 +	]
   8.318 +)
   8.319 +
   8.320 +dnl
   8.321 +dnl The main function to check for the cmpi-base common header
   8.322 +dnl Modifies the CPPFLAGS with the right include directory and sets
   8.323 +dnl the 'have_SBLIMBASE' to either 'no' or 'yes'
   8.324 +dnl
   8.325 +
   8.326 +AC_DEFUN([CHECK_SBLIM_BASE],
   8.327 +	[
   8.328 +	AC_MSG_CHECKING(for SBLIM Base)
   8.329 +        SBLIMBASE_CPP_FLAGS="$CPPFLAGS"
   8.330 +	dnl Check just with the standard include paths
   8.331 +	_CHECK_SBLIM_BASE(standard)
   8.332 +	if test "$have_SBLIMBASE" == "yes"; then
   8.333 +		dnl The standard include paths worked.
   8.334 +		AC_MSG_RESULT(yes)
   8.335 +	else
   8.336 +	  _DIRS_="/usr/include/sblim \
   8.337 +                  /usr/local/include/sblim"
   8.338 +	  for _DIR_ in $_DIRS_
   8.339 +	  do
   8.340 +		 _cppflags=$CPPFLAGS
   8.341 +		 _include_SBLIMBASE="$_DIR_"
   8.342 +		 CPPFLAGS="$CPPFLAGS -I$_include_SBLIMBASE"
   8.343 +		 _CHECK_SBLIM_BASE($_DIR_)
   8.344 +		 if test "$have_SBLIMBASE" == "yes"; then
   8.345 +		  	dnl Found it
   8.346 +		  	AC_MSG_RESULT(yes)
   8.347 +			dnl Save the new -I parameter  
   8.348 +			SBLIMBASE_CPP_FLAGS="$CPPFLAGS"
   8.349 +			LIBSBLIMBASE=-lcmpiOSBase_Common	
   8.350 +			break
   8.351 +		 fi
   8.352 +	         CPPFLAGS=$_cppflags
   8.353 +	  done
   8.354 +	fi	
   8.355 +	CPPFLAGS=$SBLIMBASE_CPP_FLAGS
   8.356 +	AC_SUBST(LIBSBLIMBASE)
   8.357 +	if test "$have_SBLIMBASE" == "no"; then
   8.358 +		AC_MSG_ERROR(no. The required SBLIM Base package is missing.)
   8.359 +        fi
   8.360 +	]
   8.361 +)
     9.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     9.2 +++ b/autoconfiscate.sh	Wed Mar 22 14:05:14 2006 -0700
     9.3 @@ -0,0 +1,51 @@
     9.4 +#!/bin/sh
     9.5 +# ============================================================================
     9.6 +# Copyright (C) 2006 IBM Corporation
     9.7 +#
     9.8 +#    This library is free software; you can redistribute it and/or
     9.9 +#    modify it under the terms of the GNU Lesser General Public
    9.10 +#    License as published by the Free Software Foundation; either
    9.11 +#    version 2.1 of the License, or (at your option) any later version.
    9.12 +#
    9.13 +#    This library is distributed in the hope that it will be useful,
    9.14 +#    but WITHOUT ANY WARRANTY; without even the implied warranty of
    9.15 +#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    9.16 +#    Lesser General Public License for more details.
    9.17 +#
    9.18 +#    You should have received a copy of the GNU Lesser General Public
    9.19 +#    License along with this library; if not, write to the Free Software
    9.20 +#    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
    9.21 +# ============================================================================
    9.22 +# Author:       Dr. Gareth S. Bestor <bestor@us.ibm.com>
    9.23 +# Contributors: Viktor Mihajlovski <mihajlov@de.ibm.com>
    9.24 +# Summary:      Setup autoconf/automake build environment for SBLIM providers
    9.25 +# Description:
    9.26 +#    This script sets up this SBLIM provider package so that it can be built
    9.27 +#    using the GNU autoconf/automake/libtool suite across a wide variety of
    9.28 +#    Unix-based operating systems without modification. This script should be
    9.29 +#    run as the first step of building this SBLIM package.
    9.30 +# For more information about the SBLIM Project see:
    9.31 +#    http://sblim.sourceforge.net/
    9.32 +# ============================================================================
    9.33 +
    9.34 +# ----------------------------------------------------------------------------
    9.35 +# NO CHANGES SHOULD BE NECESSARY TO THIS FILE
    9.36 +# ----------------------------------------------------------------------------
    9.37 +
    9.38 +echo "Running aclocal ..." &&
    9.39 +aclocal --force &&
    9.40 +
    9.41 +echo "Running autoheader ..." &&
    9.42 +autoheader --force &&
    9.43 +
    9.44 +echo "Running libtool ..." &&
    9.45 +libtoolize --force && 
    9.46 +
    9.47 +echo "Running automake ..." &&
    9.48 +automake --add-missing --force-missing &&
    9.49 +
    9.50 +echo "Running autoconf ..." &&
    9.51 +autoconf --force &&
    9.52 +
    9.53 +echo "You may now run ./configure"
    9.54 +
    10.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    10.2 +++ b/configure.ac	Wed Mar 22 14:05:14 2006 -0700
    10.3 @@ -0,0 +1,139 @@
    10.4 +# ============================================================================
    10.5 +# (C) Copyright IBM Corp. 2006
    10.6 +#
    10.7 +#    This library is free software; you can redistribute it and/or
    10.8 +#    modify it under the terms of the GNU Lesser General Public
    10.9 +#    License as published by the Free Software Foundation; either
   10.10 +#    version 2.1 of the License, or (at your option) any later version.
   10.11 +#
   10.12 +#    This library is distributed in the hope that it will be useful,
   10.13 +#    but WITHOUT ANY WARRANTY; without even the implied warranty of
   10.14 +#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   10.15 +#    Lesser General Public License for more details.
   10.16 +#
   10.17 +#    You should have received a copy of the GNU Lesser General Public
   10.18 +#    License along with this library; if not, write to the Free Software
   10.19 +#    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
   10.20 +# ============================================================================
   10.21 +# Author:       Dr. Gareth S. Bestor <bestor@us.ibm.com>
   10.22 +# Contributors: Viktor Mihajlovski <mihajlov@de.ibm.com>
   10.23 +# Summary:      Autoconf input file for CMPI Xen Provider
   10.24 +# Description:
   10.25 +#    This file is processed by autoconf to generate the configure script for
   10.26 +#    building this SBLIM provider. This file must be customized for every
   10.27 +#    SBLIM provider package.
   10.28 +# For more information about the SBLIM Project see:
   10.29 +#    http://sblim.sourceforge.net/
   10.30 +# ============================================================================
   10.31 +
   10.32 +# ----------------------------------------------------------------------------
   10.33 +# PROVIDER SPECIFIC CONFIGURATION VALUES
   10.34 +# ----------------------------------------------------------------------------
   10.35 +
   10.36 +# Package information
   10.37 +# CHANGE THIS TO THE PACKAGE SUMMARY INFORMATION
   10.38 +# AC_INIT(<PACKAGE_NAME>, <PACKAGE_VERSION>, <PACKAGE_BUGREPORT>, <PACKAGE_TARBALL>)
   10.39 +AC_INIT(CMPI Xen Provider, 0.1.0, bestor@us.ibm.com, sblim-cmpi-xen)
   10.40 +
   10.41 +# Identify the source directory 
   10.42 +# CHANGE THIS TO THE RELATIVE PATHNAME OF *ONE* OF THE SOURCE FILES
   10.43 +AC_CONFIG_SRCDIR([src/Xen_ComputerSystem.c])
   10.44 +
   10.45 +# Create any necessary files from "<file>.in" templates
   10.46 +# CHANGE THIS TO THE NAME OF THE PACKAGE RPM SPEC FILE. E.G. "<PACKAGE_TARBALL>.spec"
   10.47 +AC_CONFIG_FILES([sblim-cmpi-xen.spec])
   10.48 +
   10.49 +# Check for required programs, such as commands used in system() calls or
   10.50 +# any special tools required for building this package (e.g. lex, yacc, etc)
   10.51 +# ADD CHECKS FOR ANY REQUIRED PROGRAMS HERE
   10.52 +#AC_CHECK_PROG(PS,xm,[xm list])
   10.53 +
   10.54 +# Check for required header files
   10.55 +# ADD CHECKS FOR ANY REQUIRED NON-CMPI HEADER FILES HERE
   10.56 +AC_CHECK_HEADERS([stdarg.h errno.h xm.h])
   10.57 +
   10.58 +# Check for required library functions
   10.59 +# ADD CHECKS FOR ANY REQUIRED NON_CMPI LIBRARY FUNCTIONS HERE
   10.60 +AC_CHECK_FUNCS([popen pclose fgets vfprintf fprintf sprintf sscanf])
   10.61 +
   10.62 +# Set compiler flag for CMPI API version compatibility
   10.63 +# SET THE PACKAGE CMPI_VERSION HERE
   10.64 +CPPFLAGS="$CPPFLAGS -DCMPI_VERSION=90"
   10.65 +
   10.66 +# By default compile in SBLIM_TRACE support
   10.67 +# REMOVE THIS FLAG TO DISABLE SBLIM_TRACE SUPPORT IN THE PROVIDER
   10.68 +CPPFLAGS="$CPPFLAGS -DSBLIM_DEBUG"
   10.69 +
   10.70 +
   10.71 +################### NO CHANGES SHOULD BE NECESSARY BELOW ######################
   10.72 +
   10.73 +# Configure command line options
   10.74 +AC_ARG_VAR([CIMSERVER],[the target CIM server (pegasus|sfcb|openwbem|sniacimom).])
   10.75 +AC_ARG_VAR([PROVIDERDIR],[the directory where the CMPI providers will be installed.])
   10.76 +AC_ARG_VAR([TESTSUITEDIR],[the directory where the SBLIM testsuite is installed.])
   10.77 +
   10.78 +# Autogenerate the autoconf header file to store build settings
   10.79 +AC_CONFIG_HEADER([config.h])
   10.80 +
   10.81 +# Autogenerate the Makefile
   10.82 +AC_CONFIG_FILES([Makefile])
   10.83 +AM_INIT_AUTOMAKE
   10.84 +
   10.85 +# Check for the required C compiler
   10.86 +AC_PROG_CC
   10.87 +
   10.88 +# Check if the C compiler supports 'const'
   10.89 +AC_C_CONST
   10.90 +
   10.91 +# Check for the required libtool
   10.92 +AC_PROG_LIBTOOL
   10.93 +
   10.94 +# Check for the required install program 
   10.95 +AC_PROG_INSTALL
   10.96 +
   10.97 +# Check for some common required headers
   10.98 +AC_CHECK_HEADERS([stdlib.h string.h unistd.h])
   10.99 +
  10.100 +# Check if the system headers conform to ANSI C
  10.101 +AC_HEADER_STDC
  10.102 +
  10.103 +# Check for the required CMPI header files (this macro is defined in acinclude.m4)
  10.104 +CHECK_CMPI
  10.105 +
  10.106 +# Check for where to install CMPI libraries (this macro is defined in acinclude.m4)
  10.107 +CHECK_PROVIDERDIR
  10.108 +
  10.109 +# Check for presense of a CIM server (this macro is defined in acinclude.m4)
  10.110 +CHECK_CIMSERVER
  10.111 +
  10.112 +# Check for the SBLIM testsuite (this macro is defined in acinclude.m4)
  10.113 +CHECK_TESTSUITE
  10.114 +if test x"$TESTSUITEDIR" == x; then
  10.115 +   TESTSUITE_SUPPORT=Disabled
  10.116 +else
  10.117 +   TESTSUITE_SUPPORT=Enabled
  10.118 +fi
  10.119 +
  10.120 +# Display configuration options
  10.121 +echo "----------------------------------------------------------"
  10.122 +echo "Configuration for $PACKAGE complete."
  10.123 +echo ""
  10.124 +echo "The following configuration options have been selected:"
  10.125 +echo "   CIMSERVER: " $CIMSERVER
  10.126 +echo "   PROVIDERDIR: " $PROVIDERDIR
  10.127 +echo "   TESTSUITE_SUPPORT: " $TESTSUITE_SUPPORT
  10.128 +if test x"$TESTSUITEDIR" != x; then
  10.129 +   echo "   TESTSUITEDIR: " $TESTSUITEDIR
  10.130 +fi
  10.131 +echo "   CPPFLAGS:" $CPPFLAGS
  10.132 +echo
  10.133 +echo "You can override these values by setting the corresponding"
  10.134 +echo "configure command-line option(s); e.g."
  10.135 +echo "   ./configure PROVIDERDIR=/home/me/lib/sblim/"
  10.136 +echo "----------------------------------------------------------"
  10.137 +
  10.138 +# Generate configure scripts for the Makefile
  10.139 +AC_OUTPUT
  10.140 +
  10.141 +echo "You may now run make"
  10.142 +
    11.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    11.2 +++ b/provider-register.sh	Wed Mar 22 14:05:14 2006 -0700
    11.3 @@ -0,0 +1,716 @@
    11.4 +#!/bin/sh
    11.5 +# $Id: provider-register.sh,v 1.7 2006/01/04 06:49:46 bestor Exp $
    11.6 +# ==================================================================
    11.7 +# (C) Copyright IBM Corp. 2006
    11.8 +#
    11.9 +# THIS FILE IS PROVIDED UNDER THE TERMS OF THE COMMON PUBLIC LICENSE
   11.10 +# ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE
   11.11 +# CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT.
   11.12 +#
   11.13 +# You can obtain a current copy of the Common Public License from
   11.14 +# http://www.opensource.org/licenses/cpl1.0.php
   11.15 +#
   11.16 +# Author:       Viktor Mihajlovski <mihajlov@de.ibm.com>
   11.17 +# Contributors:
   11.18 +# Description:  Script to install class definitions (MOFs) and 
   11.19 +#               registration data for a variety of supported CIMOMs
   11.20 +# ==================================================================
   11.21 +
   11.22 +pegasus_repository()
   11.23 +{
   11.24 +    for p in $PEGASUS_HOME /var/lib/Pegasus /var/lib/pegasus /usr/local/var/lib/pegasus \
   11.25 +	/var/local/lib/pegasus /var/opt/tog-pegasus 
   11.26 +    do
   11.27 +      if test -d $p/repository
   11.28 +      then
   11.29 +	  echo $p/$1
   11.30 +	  return 0
   11.31 +      fi
   11.32 +    done
   11.33 +    return 1
   11.34 +}
   11.35 +
   11.36 +pegasus_path()
   11.37 +{
   11.38 +    for p in $PEGASUS_HOME/bin /usr/bin /usr/sbin /usr/local/bin /usr/local/sbin \
   11.39 +	/opt/tog-pegasus/bin /opt/tog-pegasus/sbin 
   11.40 +    do
   11.41 +      if test -x $p/$1
   11.42 +      then
   11.43 +	  echo $p/$1
   11.44 +	  return 0
   11.45 +      fi
   11.46 +    done
   11.47 +    return 1
   11.48 +}
   11.49 +
   11.50 +pegasus_transform()
   11.51 +{
   11.52 +    OUTFILE=$1
   11.53 +    shift
   11.54 +    regfiles=$*
   11.55 +    PROVIDERMODULES=`cat $regfiles 2> /dev/null | grep -v '^[[:space:]]*#.*' | cut -d ' ' -f 4 | sort | uniq`
   11.56 +    if test x"$PROVIDERMODULES" = x
   11.57 +    then
   11.58 +	echo Failed to read registration files >&2
   11.59 +	return 1
   11.60 +    fi
   11.61 +    PROVIDERS=`cat $regfiles 2> /dev/null | grep -v '^[[:space:]]*#.*' | cut -d ' ' -f 3-4 | sort | uniq`
   11.62 +    
   11.63 +# produce ProviderModules
   11.64 +    echo > $OUTFILE
   11.65 +    chatter "Processing provider modules:" $PROVIDERMODULES
   11.66 +    for pm in $PROVIDERMODULES
   11.67 +    do
   11.68 +      cat >> $OUTFILE <<EOFPM
   11.69 +instance of PG_ProviderModule
   11.70 +{
   11.71 +   Name = "$pm";
   11.72 +   Location = "$pm";
   11.73 +   Vendor = "SBLIM";
   11.74 +   Version = "2.0.0";
   11.75 +   InterfaceType = "CMPI";
   11.76 +   InterfaceVersion = "2.0.0";
   11.77 +};
   11.78 +
   11.79 +EOFPM
   11.80 +    done
   11.81 +    
   11.82 +# produce Providers
   11.83 +    set -- $PROVIDERS
   11.84 +    while test x$1 != x
   11.85 +    do
   11.86 +      cat >> $OUTFILE <<EOFP
   11.87 +instance of PG_Provider
   11.88 +{
   11.89 +   Name = "$1";
   11.90 +   ProviderModuleName = "$2";
   11.91 +};
   11.92 +
   11.93 +EOFP
   11.94 +      shift 2
   11.95 +    done
   11.96 +
   11.97 +#produce Capabilities
   11.98 +    let serial=0
   11.99 +    for rf in $regfiles
  11.100 +    do
  11.101 +      cat $rf | grep -v '^[[:space:]]*#.*' | while read CLASSNAME NAMESPACE PROVIDERNAME PROVIDERMODULE CAPS
  11.102 +      do
  11.103 +	let serial=serial+1
  11.104 +	numcap=
  11.105 +	for cap in $CAPS
  11.106 +	do
  11.107 +	  case $cap in
  11.108 +	      instance) 
  11.109 +		  if test x$numcap = x 
  11.110 +		  then numcap=2
  11.111 +		  else numcap="$numcap,2"
  11.112 +		  fi;;
  11.113 +	      association) 
  11.114 +		  if test x$numcap = x 
  11.115 +		  then numcap=3
  11.116 +		  else numcap="$numcap,3"
  11.117 +		  fi;;
  11.118 +	      indication) 
  11.119 +		  if test x$numcap = x
  11.120 +		  then numcap=4
  11.121 +		  else numcap="$numcap,4"
  11.122 +		  fi;;
  11.123 +	      method) 
  11.124 +		  if test x$numcap = x 
  11.125 +		  then numcap=5
  11.126 +		  else numcap="$numcap,5"
  11.127 +		  fi;;
  11.128 +	      **) echo unknown provider type $cap >&2
  11.129 +		  return 1;;
  11.130 +	  esac	  
  11.131 +	done
  11.132 +	cat >> $OUTFILE <<EOFC
  11.133 +instance of PG_ProviderCapabilities
  11.134 +{
  11.135 +   ProviderModuleName = "$PROVIDERMODULE";
  11.136 +   ProviderName = "$PROVIDERNAME";
  11.137 +   ClassName = "$CLASSNAME";
  11.138 +   ProviderType = { $numcap };
  11.139 +   Namespaces = {"$NAMESPACE"};
  11.140 +   SupportedProperties = NULL;
  11.141 +   SupportedMethods = NULL;
  11.142 +   CapabilityID = "$CLASSNAME-$serial";
  11.143 +};
  11.144 +
  11.145 +EOFC
  11.146 +      done
  11.147 +    done
  11.148 +}
  11.149 +
  11.150 +pegasus_install()
  11.151 +{
  11.152 +    if ps -C cimserver > /dev/null 2>&1 
  11.153 +    then
  11.154 +	CIMMOF=`pegasus_path cimmof`
  11.155 +	if test $? != 0
  11.156 +	then
  11.157 +	    echo "Error: cimmof not found" >&2
  11.158 +	    return 1
  11.159 +	fi
  11.160 +	state=active
  11.161 +    else
  11.162 +	CIMMOF=`pegasus_path cimmofl`
  11.163 +	if test $? != 0
  11.164 +	then
  11.165 +	    echo "Error: cimmofl not found" >&2
  11.166 +	    return 1
  11.167 +	fi
  11.168 +	PEGASUSREPOSITORY=`pegasus_repository`
  11.169 +	if test $? != 0
  11.170 +	then
  11.171 +	    echo "Error: pegasus repository not found" >&2
  11.172 +	    return 1
  11.173 +	fi
  11.174 +	CIMMOF="$CIMMOF -R $PEGASUSREPOSITORY"
  11.175 +	state=inactive
  11.176 +    fi
  11.177 +
  11.178 +    mofpath=
  11.179 +    mymofs=
  11.180 +    mregs=
  11.181 +    mofmode=1
  11.182 +    while test x$1 != x
  11.183 +    do 
  11.184 +      if test $1 = ":"
  11.185 +      then 
  11.186 +	  mofmode=0
  11.187 +	  shift
  11.188 +	  continue
  11.189 +      fi
  11.190 +      if test $mofmode = 1
  11.191 +      then
  11.192 +	  if test x$mofpath = x
  11.193 +	  then
  11.194 +	      mofpath=`dirname $1`
  11.195 +	  fi
  11.196 +	  mymofs="$mymofs $1"
  11.197 +      else
  11.198 +	  myregs="$myregs $1"
  11.199 +      fi
  11.200 +      shift
  11.201 +    done
  11.202 +  
  11.203 +    for _TEMPDIR in /var/tmp /tmp
  11.204 +    do
  11.205 +      if test -w $_TEMPDIR
  11.206 +      then
  11.207 +	  _REGFILENAME=$_TEMPDIR/$$.mof
  11.208 +	  break
  11.209 +      fi
  11.210 +    done
  11.211 +
  11.212 +    
  11.213 +    trap "rm -f $_REGFILENAME" EXIT
  11.214 +
  11.215 +    if pegasus_transform $_REGFILENAME $myregs
  11.216 +    then
  11.217 +	chatter Registering providers with $state cimserver
  11.218 +	$CIMMOF -uc -I $mofpath -n root/cimv2 $mymofs &&
  11.219 +	$CIMMOF -uc -n root/PG_Interop $_REGFILENAME
  11.220 +    else
  11.221 +	echo "Failed to build pegasus registration MOF." >&2
  11.222 +	return 1
  11.223 +    fi
  11.224 +}
  11.225 +
  11.226 +pegasus_uninstall()
  11.227 +{
  11.228 +    mymofs=
  11.229 +    mregs=
  11.230 +    mofmode=1
  11.231 +    while test x$1 != x
  11.232 +    do 
  11.233 +      if test $1 = ":"
  11.234 +      then 
  11.235 +	  mofmode=0
  11.236 +	  shift
  11.237 +	  continue
  11.238 +      fi
  11.239 +      if test $mofmode = 1
  11.240 +      then
  11.241 +	  mymofs="$mymofs $1"
  11.242 +      else
  11.243 +	  myregs="$myregs $1"
  11.244 +      fi
  11.245 +      shift
  11.246 +    done
  11.247 +  
  11.248 +    if ps -C cimserver > /dev/null 2>&1 
  11.249 +    then
  11.250 +	PROVIDERMODULES=`cat $myregs 2> /dev/null | grep -v '^[[:space:]]*#.*' | cut -d ' ' -f 4 | sort | uniq`
  11.251 +	if test x"$PROVIDERMODULES" = x
  11.252 +	    then
  11.253 +	    echo Failed to read registration files >&2
  11.254 +	    return 1
  11.255 +	fi
  11.256 +	CIMPROVIDER=`pegasus_path cimprovider`	
  11.257 +	if test $? != 0
  11.258 +        then
  11.259 +	    echo "Error: cimprovider not found" >&2
  11.260 +	    return 1
  11.261 +	fi
  11.262 +	for pm in $PROVIDERMODULES
  11.263 +	do
  11.264 +	  chatter "Remove provider module" $pm
  11.265 +	  $CIMPROVIDER -d -m $pm > /dev/null &&
  11.266 +	  $CIMPROVIDER -r -m $pm > /dev/null
  11.267 +	done
  11.268 +	WBEMEXEC=`pegasus_path wbemexec`	
  11.269 +	if test $? != 0
  11.270 +        then
  11.271 +	    echo "Error: wbemexec not found" >&2
  11.272 +	    return 1
  11.273 +	fi
  11.274 +	CLASSES=`cat $myregs 2> /dev/null | grep -v '^[[:space:]]*#.*' | cut -d ' ' -f 1 | grep -v '^CIM_'`
  11.275 +	for cls in $CLASSES
  11.276 +	do
  11.277 +	  chatter Delete CIM Class $cls
  11.278 +	  $WBEMEXEC > /dev/null <<EOFWX
  11.279 +<?xml version="1.0" encoding="utf-8" ?>
  11.280 +<CIM CIMVERSION="2.0" DTDVERSION="2.0">
  11.281 + <MESSAGE ID="4711" PROTOCOLVERSION="1.0">
  11.282 +  <SIMPLEREQ>
  11.283 +   <IMETHODCALL NAME="DeleteClass">
  11.284 +    <LOCALNAMESPACEPATH>
  11.285 +     <NAMESPACE NAME="root"></NAMESPACE>
  11.286 +     <NAMESPACE NAME="cimv2"></NAMESPACE>
  11.287 +    </LOCALNAMESPACEPATH>
  11.288 +    <IPARAMVALUE NAME="ClassName">
  11.289 +     <CLASSNAME NAME="$cls"/>
  11.290 +    </IPARAMVALUE>
  11.291 +   </IMETHODCALL>
  11.292 +  </SIMPLEREQ>
  11.293 + </MESSAGE>
  11.294 +</CIM>
  11.295 +EOFWX
  11.296 +	done
  11.297 +    else
  11.298 +	echo "Sorry, cimserver must be running to deregister the providers." >&2
  11.299 +	return 1
  11.300 +    fi
  11.301 +}
  11.302 +
  11.303 +sfcb_transform()
  11.304 +{
  11.305 +    OUTFILE=$1
  11.306 +    shift
  11.307 +    regfiles=$*
  11.308 +
  11.309 +#produce sfcb registraion
  11.310 +    for rf in $regfiles
  11.311 +    do
  11.312 +      cat $rf | grep -v '^[[:space:]]*#.*' | while read CLASSNAME NAMESPACE PROVIDERNAME PROVIDERMODULE CAPS
  11.313 +      do
  11.314 +	chatter "Registering class" $CLASSNAME
  11.315 +	cat >> $OUTFILE <<EOFC
  11.316 +[$CLASSNAME]   
  11.317 +   provider: $PROVIDERNAME
  11.318 +   location: $PROVIDERMODULE
  11.319 +   type: $CAPS
  11.320 +   namespace: $NAMESPACE
  11.321 +#
  11.322 +EOFC
  11.323 +      done
  11.324 +    done
  11.325 +}
  11.326 +
  11.327 +sfcb_rebuild()
  11.328 +{
  11.329 +    if ps -C sfcbd > /dev/null 2>&1
  11.330 +    then
  11.331 +        # sfcb is running -- need to restart
  11.332 +	for INITSCRIPT in /etc/init.d/sfcb /usr/local/etc/init.d/sfcb none
  11.333 +	do
  11.334 +	  if test -x $INITSCRIPT
  11.335 +	  then
  11.336 +	      break;
  11.337 +	  fi
  11.338 +	done
  11.339 +	chatter "Shutting down sfcb."
  11.340 +	if test $INITSCRIPT = none
  11.341 +	then
  11.342 +	    killall sfcbd
  11.343 +	else
  11.344 +	    $INITSCRIPT stop
  11.345 +	fi
  11.346 +	t=0
  11.347 +	while ps -C sfcbd > /dev/null 2>&1
  11.348 +	do
  11.349 +	  sleep 1
  11.350 +	  t=`expr $t + 1`
  11.351 +	  if test $t -gt 10
  11.352 +	  then
  11.353 +	      echo "Timed out waiting for sfcb shutdown..." >&2
  11.354 +	      echo "Please stop sfcb manually and rebuild the repository using sfcbrepos." >&2
  11.355 +	      return 1
  11.356 +	  fi
  11.357 +	done
  11.358 +	chatter "Rebuilding repository."
  11.359 +	sfcbrepos -f
  11.360 +	if test $? != 0
  11.361 +	then
  11.362 +	    echo "Repository rebuild failed." >&2
  11.363 +	    return 1
  11.364 +	fi
  11.365 +	
  11.366 +	if test $INITSCRIPT = none
  11.367 +	then
  11.368 +	    echo "No init script found - you need to start sfcbd manually." >&2
  11.369 +	    return 1
  11.370 +	else
  11.371 +	    chatter "Restarting sfcb."
  11.372 +	    $INITSCRIPT start
  11.373 +	fi
  11.374 +    else
  11.375 +	# Not running - rebuild repository
  11.376 +	chatter "Rebuilding repository."
  11.377 +	sfcbrepos -f
  11.378 +    fi
  11.379 +}
  11.380 +
  11.381 +sfcb_install()
  11.382 +{    
  11.383 +    mymofs=
  11.384 +    mregs=
  11.385 +    mofmode=1
  11.386 +    while test x$1 != x
  11.387 +    do 
  11.388 +      if test $1 = ":"
  11.389 +      then 
  11.390 +	  mofmode=0
  11.391 +	  shift
  11.392 +	  baseregname=`basename $1 .registration`
  11.393 +	  continue
  11.394 +      fi
  11.395 +      if test $mofmode = 1
  11.396 +      then
  11.397 +	  mymofs="$mymofs $1"
  11.398 +      else
  11.399 +	  myregs="$myregs $1"
  11.400 +      fi
  11.401 +      shift
  11.402 +    done
  11.403 +
  11.404 +    for _TEMPDIR in /var/tmp /tmp
  11.405 +    do
  11.406 +      if test -w $_TEMPDIR
  11.407 +      then
  11.408 +	  _REGFILENAME=$_TEMPDIR/$baseregname.reg
  11.409 +	  break
  11.410 +      fi
  11.411 +    done
  11.412 +
  11.413 +    trap "rm -f $_REGFILENAME" EXIT
  11.414 +
  11.415 +    if sfcb_transform $_REGFILENAME $myregs
  11.416 +    then
  11.417 +	chatter "Staging provider registration."
  11.418 +	sfcbstage -r $_REGFILENAME $mymofs
  11.419 +	if test $? != 0 
  11.420 +	then
  11.421 +	    echo "Failed to stage provider registration." >&2
  11.422 +	    return 1
  11.423 +	fi
  11.424 +	sfcb_rebuild
  11.425 +    else
  11.426 +	echo "Failed to build sfcb registration file." >&2
  11.427 +	return 1
  11.428 +    fi
  11.429 +}
  11.430 +
  11.431 +sfcb_uninstall()
  11.432 +{    
  11.433 +    mymofs=
  11.434 +    while test x$1 != x
  11.435 +    do 
  11.436 +      if test $1 = ":"
  11.437 +      then 
  11.438 +	  shift
  11.439 +	  baseregname=`basename $1 .registration`
  11.440 +	  break
  11.441 +      fi
  11.442 +      mymofs="$mymofs `basename $1`"
  11.443 +      shift
  11.444 +    done
  11.445 +    
  11.446 +    # "Unstage" MOFs and the registration file
  11.447 +    chatter "Unstaging provider registrations."
  11.448 +    sfcbunstage -r $baseregname.reg $mymofs
  11.449 +
  11.450 +    # Rebuild repository
  11.451 +    sfcb_rebuild
  11.452 +}
  11.453 +
  11.454 +openwbem_transform()
  11.455 +{
  11.456 +    OUTFILE=$1
  11.457 +    shift
  11.458 +    moffiles=$*
  11.459 +    
  11.460 +    if rm -f $OUTFILE
  11.461 +    then
  11.462 +	for _f in $moffiles
  11.463 +	do
  11.464 +	  sed "s/Provider *( *\"cmpi:/Provider(\"cmpi::/g" < $_f >> $OUTFILE
  11.465 +	done
  11.466 +    fi
  11.467 +}
  11.468 +
  11.469 +openwbem_repository()
  11.470 +{
  11.471 +    for p in /var/lib/openwbem /usr/local/var/openwbem
  11.472 +    do
  11.473 +      if test -f $p/schema.dat
  11.474 +      then
  11.475 +	  echo $p
  11.476 +	  return 0
  11.477 +      fi
  11.478 +    done
  11.479 +    return 1
  11.480 +}
  11.481 +
  11.482 +openwbem_install()
  11.483 +{
  11.484 +    CIMMOF=`which owmofc 2> /dev/null`
  11.485 +    if test $? != 0
  11.486 +    then
  11.487 +	echo "Error: cimmof not found" >&2
  11.488 +	return 1
  11.489 +    fi
  11.490 +
  11.491 +    if ps -C owcimomd > /dev/null 2>&1 
  11.492 +    then
  11.493 +	state=active
  11.494 +    else
  11.495 +	CIMMOF="$CIMMOF -d `openwbem_repository`"
  11.496 +	if test $? != 0
  11.497 +	then
  11.498 +	    echo "Error: OpenWBEM repository not found" >&2
  11.499 +	    return 1
  11.500 +	fi
  11.501 +	state=inactive
  11.502 +    fi
  11.503 +
  11.504 +    for _TEMPDIR in /var/tmp /tmp
  11.505 +    do
  11.506 +      if test -w $_TEMPDIR
  11.507 +      then
  11.508 +	  _REGFILENAME=$_TEMPDIR/$$.mof
  11.509 +	  break
  11.510 +      fi
  11.511 +    done
  11.512 +
  11.513 +    trap "rm -f $_REGFILENAME" EXIT
  11.514 +
  11.515 +    if openwbem_transform $_REGFILENAME $*
  11.516 +    then
  11.517 +	chatter Registering providers with $state owcimomd
  11.518 +	$CIMMOF $_REGFILENAME > /dev/null
  11.519 +    else
  11.520 +	echo "Failed to build OpenWBEM registration MOF." >&2
  11.521 +	return 1
  11.522 +    fi       
  11.523 +}
  11.524 +
  11.525 +openwbem_uninstall()
  11.526 +{
  11.527 +    CIMMOF=`which owmofc 2> /dev/null`
  11.528 +    if test $? != 0
  11.529 +    then
  11.530 +	echo "Error: cimmof not found" >&2
  11.531 +	return 1
  11.532 +    fi
  11.533 +
  11.534 +    if ps -C owcimomd > /dev/null 2>&1 
  11.535 +    then
  11.536 +	state=active
  11.537 +    else
  11.538 +	CIMMOF="$CIMMOF -d `openwbem_repository`"
  11.539 +	if test $? != 0
  11.540 +	then
  11.541 +	    echo "Error: OpenWBEM repository not found" >&2
  11.542 +	    return 1
  11.543 +	fi
  11.544 +	state=inactive
  11.545 +    fi
  11.546 +
  11.547 +    for _TEMPDIR in /var/tmp /tmp
  11.548 +    do
  11.549 +      if test -w $_TEMPDIR
  11.550 +      then
  11.551 +	  _REGFILENAME=$_TEMPDIR/$$.mof
  11.552 +	  break
  11.553 +      fi
  11.554 +    done
  11.555 +
  11.556 +    trap "rm -f $_REGFILENAME" EXIT
  11.557 +
  11.558 +    if openwbem_transform $_REGFILENAME $*
  11.559 +    then
  11.560 +	chatter Deregistering providers with $state owcimomd
  11.561 +	$CIMMOF -r $_REGFILENAME > /dev/null
  11.562 +    else
  11.563 +	echo "Failed to build OpenWBEM registration MOF." >&2
  11.564 +	return 1
  11.565 +    fi       
  11.566 +}
  11.567 +
  11.568 +cim_server()
  11.569 +{
  11.570 +    for exname in sfcbd cimserver owcimomd
  11.571 +    do
  11.572 +      if pegasus_path $exname > /dev/null
  11.573 +      then
  11.574 +	  case $exname in
  11.575 +	      sfcbd) echo sfcb; return 0;;
  11.576 +	      cimserver) echo pegasus; return 0;;
  11.577 +	      owcimomd) echo openwbem; return 0;;
  11.578 +	  esac
  11.579 +	  break;
  11.580 +      fi
  11.581 +    done
  11.582 +    echo unknown
  11.583 +    return 1
  11.584 +}
  11.585 +
  11.586 +usage() 
  11.587 +{
  11.588 +    echo "usage: $0 [-h] [-v] [-d] [-t <cimserver>] -r regfile ... -m mof ..."
  11.589 +}
  11.590 +
  11.591 +chatter()
  11.592 +{
  11.593 +    if test x$verbose != x
  11.594 +    then
  11.595 +	echo $*
  11.596 +    fi
  11.597 +}
  11.598 +
  11.599 +gb_getopt()
  11.600 +{
  11.601 +    rmode=0
  11.602 +    mmode=0
  11.603 +    options=
  11.604 +    moffiles=
  11.605 +    registrations=
  11.606 +    while [ -n "$1" ]
  11.607 +    do
  11.608 +      case $1 in
  11.609 +	  -r) mmode=0;
  11.610 +	      rmode=1;
  11.611 +	      shift;;
  11.612 +	  -m) mmode=1;
  11.613 +	      rmode=0;
  11.614 +	      shift;;
  11.615 +	  -*) mmode=0;
  11.616 +	      rmode=0;
  11.617 +	      options="$options $1";
  11.618 +	      shift;;
  11.619 +	  **) if [ $mmode = 1 ] 
  11.620 +	      then moffiles="$moffiles $1"       
  11.621 +	      elif [ $rmode = 1 ]
  11.622 +	      then registrations="$registrations -r $1" 
  11.623 +	      else options="$options $1";
  11.624 +	      fi; 
  11.625 +	      shift;;
  11.626 +      esac
  11.627 +    done
  11.628 +    echo $options $registrations $moffiles 
  11.629 +}
  11.630 +
  11.631 +prepargs=`gb_getopt $*`
  11.632 +args=`getopt dvht:r: $prepargs`
  11.633 +rc=$?
  11.634 +
  11.635 +if [ $rc = 127 ]
  11.636 +then
  11.637 +    echo "warning: getopt not found ...continue without syntax check"
  11.638 +    args=$prepargs
  11.639 +elif [ $rc != 0 ]
  11.640 +then
  11.641 +    usage $0
  11.642 +    exit 1
  11.643 +fi
  11.644 +
  11.645 +set -- $args
  11.646 +
  11.647 +while [ -n "$1" ]
  11.648 +do
  11.649 +  case $1 in
  11.650 +      -h) help=1; 
  11.651 +	  shift;
  11.652 +	  break;;
  11.653 +      -v) verbose=1; 
  11.654 +	  shift;;
  11.655 +      -d) deregister=1; 
  11.656 +	  shift;;
  11.657 +      -t) cimserver=$2;
  11.658 +	  shift 2;;
  11.659 +      -r) regs="$regs $2";
  11.660 +	  shift 2;;
  11.661 +      --) shift;
  11.662 +	  break;;
  11.663 +      **) break;;
  11.664 +  esac
  11.665 +done
  11.666 +
  11.667 +mofs=$*
  11.668 +
  11.669 +if [ "$help" = "1" ]
  11.670 +then
  11.671 +    usage
  11.672 +    echo -e "\t-h display help message"
  11.673 +    echo -e "\t-v verbose mode"
  11.674 +    echo -e "\t-d deregister provider and uninstall schema"
  11.675 +    echo -e "\t-t specify cimserver type (pegasus|sfcb|openwbem|sniacimom)"
  11.676 +    echo -e "\t-r specify registration files"
  11.677 +    echo -e "\t-m specify schema mof files"
  11.678 +    echo
  11.679 +    echo Use this command to install schema mofs and register providers.
  11.680 +    echo CIM Server Type is required as well as at least one registration file and one mof.
  11.681 +    exit 0
  11.682 +fi
  11.683 +
  11.684 +if test x"$mofs" = x || test x"$regs" = x
  11.685 +then
  11.686 +    usage $0
  11.687 +    exit 1
  11.688 +fi
  11.689 +
  11.690 +if test x$cimserver = x
  11.691 +then
  11.692 +    cimserver=`cim_server`
  11.693 +    if test $? = 0
  11.694 +    then
  11.695 +	chatter "Autoselected CIM server type:" $cimserver
  11.696 +    else
  11.697 +	echo "CIM server type could not be determined, specify with -t." >&2
  11.698 +	exit 1
  11.699 +    fi
  11.700 +fi
  11.701 +
  11.702 +if test x$deregister = x
  11.703 +then
  11.704 +    case $cimserver in
  11.705 +	pegasus) pegasus_install $mofs ":" $regs;;
  11.706 +	sfcb)    sfcb_install $mofs ":" $regs;;
  11.707 +	openwbem) openwbem_install $mofs ;;
  11.708 +	sniacimom) echo sniacimom not yet supported && exit 1 ;;
  11.709 +	**)	echo "Invalid CIM Server Type " $cimserver && exit 1;;
  11.710 +    esac
  11.711 +else
  11.712 +    case $cimserver in
  11.713 +	pegasus) pegasus_uninstall $mofs ":" $regs;;
  11.714 +	sfcb)    sfcb_uninstall $mofs ":" $regs;;
  11.715 +	openwbem) openwbem_uninstall $mofs ;;
  11.716 +	sniacimom) echo sniacimom not yet supported && exit 1 ;;
  11.717 +	**)	echo "Invalid CIM Server Type " $cimserver && exit 1;;
  11.718 +    esac
  11.719 +fi    
    12.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    12.2 +++ b/sblim-cmpi-xen.spec.in	Wed Mar 22 14:05:14 2006 -0700
    12.3 @@ -0,0 +1,111 @@
    12.4 +# $Id:
    12.5 +# =============================================================================
    12.6 +# (C) Copyright IBM Corp. 2006
    12.7 +#
    12.8 +#    This library is free software; you can redistribute it and/or
    12.9 +#    modify it under the terms of the GNU Lesser General Public
   12.10 +#    License as published by the Free Software Foundation; either
   12.11 +#    version 2.1 of the License, or (at your option) any later version.
   12.12 +#
   12.13 +#    This library is distributed in the hope that it will be useful,
   12.14 +#    but WITHOUT ANY WARRANTY; without even the implied warranty of
   12.15 +#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   12.16 +#    Lesser General Public License for more details.
   12.17 +#
   12.18 +#    You should have received a copy of the GNU Lesser General Public
   12.19 +#    License along with this library; if not, write to the Free Software
   12.20 +#    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
   12.21 +# =============================================================================
   12.22 +# Author:       Dr. Gareth S. Bestor <bestor@us.ibm.com>
   12.23 +# Contributors:
   12.24 +# Description:
   12.25 +#    RPM spec file for the CMPI Xen provider.
   12.26 +# =============================================================================
   12.27 +
   12.28 +Summary: CMPI Xen provider
   12.29 +Name: @PACKAGE_TARNAME@
   12.30 +Version: @PACKAGE_VERSION@
   12.31 +Release: @CIMSERVER@
   12.32 +Group: Systems Management/Base
   12.33 +License: GNU Lesser General Public Version 2.1
   12.34 +Requires: cimserver
   12.35 +
   12.36 +BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}
   12.37 +BuildRequires: cmpi-devel
   12.38 +Source0: http://prdownloads.sourceforge.net/sblim/%{name}-%{version}.tar.bz2
   12.39 +
   12.40 +# -----------------------------------------------------------------------------
   12.41 +
   12.42 +%Description
   12.43 +TODO
   12.44 +
   12.45 +# -----------------------------------------------------------------------------
   12.46 +
   12.47 +%prep
   12.48 +%setup -n %{name}-%{version}
   12.49 +
   12.50 +export PATCH_GET=0
   12.51 +#%patch0 -p0
   12.52 +
   12.53 +# -----------------------------------------------------------------------------
   12.54 +
   12.55 +%build
   12.56 +%configure TESTSUITEDIR=%{_datadir}/sblim-testsuite CIMSERVER=@CIMSERVER@
   12.57 +make
   12.58 +
   12.59 +# -----------------------------------------------------------------------------
   12.60 +                                                                                                                
   12.61 +%clean
   12.62 +# paranoia check
   12.63 +if [ `id -ur` != 0 ]
   12.64 +then
   12.65 +   rm -rf $RPM_BUILD_ROOT
   12.66 +fi
   12.67 +
   12.68 +# -----------------------------------------------------------------------------
   12.69 +
   12.70 +%install
   12.71 +# paranoia check
   12.72 +if [ `id -ur` != 0 ]
   12.73 +then
   12.74 +   rm -rf $RPM_BUILD_ROOT 
   12.75 +fi
   12.76 +
   12.77 +make DESTDIR=$RPM_BUILD_ROOT install
   12.78 +
   12.79 +# Remove unused libtool files
   12.80 +rm -f $RPM_BUILD_ROOT/%{_libdir}/cmpi/*a
   12.81 +
   12.82 +# -----------------------------------------------------------------------------
   12.83 +
   12.84 +%post
   12.85 +
   12.86 +# LIST PROVIDER CLASS SCHEMA AND REGISTRATION FILES HERE
   12.87 +%define SCHEMA %{_datadir}/%{name}/Xen_ComputerSystem.mof
   12.88 +%define REGISTRATION %{_datadir}/%{name}/Xen_ComputerSystem.registration
   12.89 +
   12.90 +# Register Schema and Provider
   12.91 +%{_datadir}/%{name}/provider-register.sh -t @CIMSERVER@ \
   12.92 +        -r %{REGISTRATION} -m %{SCHEMA} > /dev/null
   12.93 +
   12.94 +/sbin/ldconfig
   12.95 +
   12.96 +# -----------------------------------------------------------------------------
   12.97 +                                                                                
   12.98 +%preun
   12.99 +
  12.100 +# De-Register Schema and Provider
  12.101 +%{_datadir}/%{name}/provider-register.sh -d -t @CIMSERVER@ \
  12.102 +        -r %{REGISTRATION} -m %{SCHEMA} > /dev/null
  12.103 +                                                                                
  12.104 +%postun
  12.105 +/sbin/ldconfig
  12.106 +                                                                                
  12.107 +# -----------------------------------------------------------------------------
  12.108 +
  12.109 +%files
  12.110 +%defattr(-,root,root)
  12.111 +%{_datadir}/%{name}
  12.112 +%{_datadir}/doc/%{name}-%{version}
  12.113 +%{_libdir}/cmpi/*.so*
  12.114 +
    13.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    13.2 +++ b/schema/Xen_CSElementSettingData.mof	Wed Mar 22 14:05:14 2006 -0700
    13.3 @@ -0,0 +1,23 @@
    13.4 +// Copyright (c) 2006 IBM. All rights reserved.
    13.5 +
    13.6 +// *******************************************************************
    13.7 +// Associations
    13.8 +// *******************************************************************
    13.9 +
   13.10 +// ==================================================================
   13.11 +// Xen_CSElementSettingData
   13.12 +// ==================================================================
   13.13 +[Association,
   13.14 + Description (
   13.15 +	"A class derived from CIM_ElementSettingData to represent "
   13.16 +	"the association of a Xen_ComputerSystem instance with its "
   13.17 +	"global (i.e. non-device specific) configuration settings.")]
   13.18 +class Xen_CSElementSettingData : CIM_ElementSettingData
   13.19 +{
   13.20 +   [Override("Dependent")]
   13.21 +   Xen_ComputerSystemSettingData REF SettingData;
   13.22 +
   13.23 +   [Override("ManagedElement")]
   13.24 +   Xen_ComputerSystem REF ManagedElement;
   13.25 +};
   13.26 +
    14.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    14.2 +++ b/schema/Xen_CSElementSettingData.registration	Wed Mar 22 14:05:14 2006 -0700
    14.3 @@ -0,0 +1,2 @@
    14.4 +# Classname Namespace ProviderName ProviderModule ProviderTypes ...
    14.5 +Xen_CSElementSettingData root/cimv2 Xen_CSElementSettingDataProvider Xen_CSElementSettingData association
    15.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    15.2 +++ b/schema/Xen_CSSettingDataComponent.mof	Wed Mar 22 14:05:14 2006 -0700
    15.3 @@ -0,0 +1,24 @@
    15.4 +// Copyright (c) 2006 IBM. All rights reserved.
    15.5 +
    15.6 +// *******************************************************************
    15.7 +// Associations
    15.8 +// *******************************************************************
    15.9 +
   15.10 +// ==================================================================
   15.11 +// Xen_CSSettingDataComponent
   15.12 +// ==================================================================
   15.13 +[Association,
   15.14 + Description (
   15.15 +	"A class derived from CIM_Component to represent "
   15.16 +	"the association of a Xen virtual machine/domain's "
   15.17 +	"'global' Xen_ComputerSystemSettingData with its component "
   15.18 +	"Xen_VirtualDeviceSettingData for each of its virtual resources.")]
   15.19 +class Xen_CSSettingDataComponent : CIM_Component
   15.20 +{
   15.21 +   [Override("PartComponent")]
   15.22 +   Xen_VirtualDeviceSettingData REF PartComponent;
   15.23 +
   15.24 +   [Override("GroupComponent")]
   15.25 +   Xen_ComputerSystemSettingData REF GroupComponent;
   15.26 +};
   15.27 +
    16.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    16.2 +++ b/schema/Xen_CSSettingDataComponent.registration	Wed Mar 22 14:05:14 2006 -0700
    16.3 @@ -0,0 +1,2 @@
    16.4 +# Classname Namespace ProviderName ProviderModule ProviderTypes ...
    16.5 +Xen_CSSettingDataComponent root/cimv2 Xen_CSSettingDataComponentProvider Xen_CSSettingDataComponent association
    17.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    17.2 +++ b/schema/Xen_ComputerSystem.mof	Wed Mar 22 14:05:14 2006 -0700
    17.3 @@ -0,0 +1,32 @@
    17.4 +// Copyright (c) 2006 IBM. All rights reserved.
    17.5 +
    17.6 +// ==================================================================
    17.7 +// Xen_ComputerSystem
    17.8 +// ==================================================================
    17.9 +[Description (
   17.10 +	"A class derived from CIM_VirtualComputerSystem to represent "
   17.11 +	"the Xen virtual machines/domains running on the system.")]
   17.12 +class Xen_ComputerSystem : CIM_VirtualComputerSystem
   17.13 +{
   17.14 +   [Description("Remove a DomU configuration, and stop the DomU if running.")]
   17.15 +   uint32 DestroyVirtualSystem();
   17.16 +
   17.17 +   [Description("Start a DomU from its initial configuration.")]
   17.18 +   uint32 StartVirtualSystem();
   17.19 +
   17.20 +   [Description("Stop a running DomU and free all its resources.")]
   17.21 +   uint32 StopVirtualSystem();
   17.22 +
   17.23 +   [Description("Suspend a running DomU and free all its resources.")]
   17.24 +   uint32 SuspendVirtualSystem();
   17.25 +
   17.26 +   [Description("Resume a suspended DomU.")]
   17.27 +   uint32 ResumeVirtualSystem();
   17.28 +
   17.29 +   [Description("Pause a running DomU but do not free its resources.")]
   17.30 +   uint32 PauseVirtualSystem();
   17.31 +
   17.32 +   [Description("Resume a paused DomU.")]
   17.33 +   uint32 UnpauseVirtualSystem();
   17.34 +};
   17.35 +
    18.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    18.2 +++ b/schema/Xen_ComputerSystem.registration	Wed Mar 22 14:05:14 2006 -0700
    18.3 @@ -0,0 +1,2 @@
    18.4 +# Classname Namespace ProviderName ProviderModule ProviderTypes ...
    18.5 +Xen_ComputerSystem root/cimv2 Xen_ComputerSystemProvider Xen_ComputerSystem instance method 
    19.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    19.2 +++ b/schema/Xen_ComputerSystemConfiguration.mof	Wed Mar 22 14:05:14 2006 -0700
    19.3 @@ -0,0 +1,56 @@
    19.4 +// Copyright (c) 2006 IBM. All rights reserved.
    19.5 +
    19.6 +// ==================================================================
    19.7 +// Xen_ComputerSystemConfiguration
    19.8 +// ==================================================================
    19.9 +[Description (
   19.10 +	"A class derived from CIM_SystemConfiguration to represent "
   19.11 +	"the Xen virtual machine/domain configuration information "
   19.12 +	"used to create each domain.")]
   19.13 +class Xen_ComputerSystemConfiguration : CIM_SystemConfiguration
   19.14 +{
   19.15 +   [Description ("Path to the kernel image.")]
   19.16 +   string Kernel;
   19.17 +
   19.18 +   [Description ("Path to a ramdisk image.")]
   19.19 +   string RAMDisk;
   19.20 +
   19.21 +   [Description ("Memory allocated to the domain, in megabytes.")]
   19.22 +   uint64 Memory;
   19.23 +   
   19.24 +   [Description ("Number of Virtual CPUs to assign to the domain.")]
   19.25 +   uint32 VCPUs = 1;
   19.26 +
   19.27 +   [Description ("UUID to assign to the domain.")]
   19.28 +   string UUID;
   19.29 +
   19.30 +   [Description ("Number of virtual network interfaces.")]
   19.31 +   uint32 NICs;
   19.32 +
   19.33 +   [Description ("Configuration info for each NIC")]
   19.34 +   string NICConfigInfo[];
   19.35 +
   19.36 +   [Description ("Number of virtual disks.")]
   19.37 +   uint32 Disks;
   19.38 +
   19.39 +   [Description ("Configuration info for each disk")]
   19.40 +   string DiskConfigInfo[];
   19.41 + 
   19.42 +   [Description ("Set if you want to use DHCP to configure networking.")]
   19.43 +   boolean DHCP;
   19.44 +
   19.45 +   [Description ("Manually configured IP netmask.")]
   19.46 +   string Netmask;
   19.47 +
   19.48 +   [Description ("Manually configured IP gateway.")]
   19.49 +   string Gateway;
   19.50 +
   19.51 +   [Description ("Manually configured the IP hostname.")]
   19.52 +   string Hostname;
   19.53 +
   19.54 +   [Description ("Command line options to pass to the kernel.")]
   19.55 +   string KernelOptions = "";
   19.56 +
   19.57 +   [Description ("Root boot device to pass to the kernel.")]
   19.58 +   string Root;
   19.59 +};
    20.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    20.2 +++ b/schema/Xen_ComputerSystemConfiguration.registration	Wed Mar 22 14:05:14 2006 -0700
    20.3 @@ -0,0 +1,2 @@
    20.4 +# Classname Namespace ProviderName ProviderModule ProviderTypes ...
    20.5 +Xen_ComputerSystemConfiguration root/cimv2 Xen_ComputerSystemConfigurationProvider Xen_ComputerSystemConfiguration instance 
    21.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    21.2 +++ b/schema/Xen_ComputerSystemDisk.mof	Wed Mar 22 14:05:14 2006 -0700
    21.3 @@ -0,0 +1,19 @@
    21.4 +// Copyright (c) 2006 IBM. All rights reserved.
    21.5 +
    21.6 +// ==================================================================
    21.7 +// Xen_ComputerSystemDisk
    21.8 +// ==================================================================
    21.9 +[Association,
   21.10 + Description (
   21.11 +	"A class derived from CIM_SystemDevice to represent "
   21.12 +	"the association of a Xen virtual machine/domain with its "
   21.13 +	"virtual block device(s).")]
   21.14 +class Xen_ComputerSystemDisk : CIM_SystemDevice
   21.15 +{
   21.16 +   [Override("PartComponent")]
   21.17 +   Xen_Disk REF PartComponent;
   21.18 +
   21.19 +   [Override("GroupComponent")]
   21.20 +   Xen_ComputerSystem REF GroupComponent;
   21.21 +};
   21.22 +
    22.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    22.2 +++ b/schema/Xen_ComputerSystemDisk.registration	Wed Mar 22 14:05:14 2006 -0700
    22.3 @@ -0,0 +1,2 @@
    22.4 +# Classname Namespace ProviderName ProviderModule ProviderTypes ...
    22.5 +Xen_ComputerSystemDisk root/cimv2 Xen_ComputerSystemDiskProvider Xen_ComputerSystemDisk association
    23.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    23.2 +++ b/schema/Xen_ComputerSystemIndication.mof	Wed Mar 22 14:05:14 2006 -0700
    23.3 @@ -0,0 +1,31 @@
    23.4 +// Copyright (c) 2006 IBM. All rights reserved.
    23.5 +
    23.6 +// ==================================================================
    23.7 +// Xen_ComputerSystemCreation
    23.8 +// ==================================================================
    23.9 +[Description (
   23.10 +	"A class derived from CIM_InstCreation to represent "
   23.11 +	"indications for Xen virtual machine/domain creation events.")]
   23.12 +class Xen_ComputerSystemCreation : CIM_InstCreation
   23.13 +{
   23.14 +};
   23.15 +
   23.16 +// ==================================================================
   23.17 +// Xen_ComputerSystemDeletion
   23.18 +// ==================================================================
   23.19 +[Description (
   23.20 +        "A class derived from CIM_InstDeletion to represent "
   23.21 +        "indications for Xen virtual machine/domain destruction events.")]
   23.22 +class Xen_ComputerSystemDeletion : CIM_InstDeletion
   23.23 +{
   23.24 +};
   23.25 +
   23.26 +// ==================================================================
   23.27 +// Xen_ComputerSystemModification
   23.28 +// ==================================================================
   23.29 +[Description (
   23.30 +        "A class derived from CIM_InstModification to represent "
   23.31 +        "indications for Xen virtual machine/domain state change events.")]
   23.32 +class Xen_ComputerSystemModification : CIM_InstModification
   23.33 +{
   23.34 +};
    24.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    24.2 +++ b/schema/Xen_ComputerSystemIndication.registration	Wed Mar 22 14:05:14 2006 -0700
    24.3 @@ -0,0 +1,4 @@
    24.4 +# Classname Namespace ProviderName ProviderModule ProviderTypes ...
    24.5 +Xen_ComputerSystemCreation root/cimv2 Xen_ComputerSystemIndicationProvider Xen_ComputerSystemIndication indication
    24.6 +Xen_ComputerSystemDeletion root/cimv2 Xen_ComputerSystemIndicationProvider Xen_ComputerSystemIndication indication
    24.7 +Xen_ComputerSystemModification root/cimv2 Xen_ComputerSystemIndicationProvider Xen_ComputerSystemIndication indication
    25.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    25.2 +++ b/schema/Xen_ComputerSystemMemory.mof	Wed Mar 22 14:05:14 2006 -0700
    25.3 @@ -0,0 +1,19 @@
    25.4 +// Copyright (c) 2006 IBM. All rights reserved.
    25.5 +
    25.6 +// ==================================================================
    25.7 +// Xen_ComputerSystemMemory 
    25.8 +// ==================================================================
    25.9 +[Association,
   25.10 + Description (
   25.11 +	"A class derived from CIM_SystemDevice to represent "
   25.12 +	"the association of a Xen virtual machine/domain with its "
   25.13 +	"main memory device.")]
   25.14 +class Xen_ComputerSystemMemory : CIM_SystemDevice
   25.15 +{
   25.16 +   [Override("PartComponent")]
   25.17 +   Xen_Memory REF PartComponent;
   25.18 +
   25.19 +   [Override("GroupComponent")]
   25.20 +   Xen_ComputerSystem REF GroupComponent;
   25.21 +};
   25.22 +
    26.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    26.2 +++ b/schema/Xen_ComputerSystemMemory.registration	Wed Mar 22 14:05:14 2006 -0700
    26.3 @@ -0,0 +1,2 @@
    26.4 +# Classname Namespace ProviderName ProviderModule ProviderTypes ...
    26.5 +Xen_ComputerSystemMemory root/cimv2 Xen_ComputerSystemMemoryProvider Xen_ComputerSystemMemory association
    27.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    27.2 +++ b/schema/Xen_ComputerSystemNetworkPort.mof	Wed Mar 22 14:05:14 2006 -0700
    27.3 @@ -0,0 +1,19 @@
    27.4 +// Copyright (c) 2006 IBM. All rights reserved.
    27.5 +
    27.6 +// ==================================================================
    27.7 +// Xen_ComputerSystemNetworkPort
    27.8 +// ==================================================================
    27.9 +[Association,
   27.10 + Description (
   27.11 +	"A class derived from CIM_SystemDevice to represent "
   27.12 +	"the association of a Xen virtual machine/domain with its "
   27.13 +	"virtual network interface(s).")]
   27.14 +class Xen_ComputerSystemNetworkPort : CIM_SystemDevice
   27.15 +{
   27.16 +   [Override("PartComponent")]
   27.17 +   Xen_NetworkPort REF PartComponent;
   27.18 +
   27.19 +   [Override("GroupComponent")]
   27.20 +   Xen_ComputerSystem REF GroupComponent;
   27.21 +};
   27.22 +
    28.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    28.2 +++ b/schema/Xen_ComputerSystemNetworkPort.registration	Wed Mar 22 14:05:14 2006 -0700
    28.3 @@ -0,0 +1,2 @@
    28.4 +# Classname Namespace ProviderName ProviderModule ProviderTypes ...
    28.5 +Xen_ComputerSystemNetworkPort root/cimv2 Xen_ComputerSystemNetworkPortProvider Xen_ComputerSystemNetworkPort association
    29.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    29.2 +++ b/schema/Xen_ComputerSystemProcessor.mof	Wed Mar 22 14:05:14 2006 -0700
    29.3 @@ -0,0 +1,19 @@
    29.4 +// Copyright (c) 2006 IBM. All rights reserved.
    29.5 +
    29.6 +// ==================================================================
    29.7 +// Xen_ComputerSystemProcessor
    29.8 +// ==================================================================
    29.9 +[Association,
   29.10 + Description (
   29.11 +	"A class derived from CIM_SystemDevice to represent "
   29.12 +	"the association of a Xen virtual machine/domain with its "
   29.13 +	"virtual processor device(s).")]
   29.14 +class Xen_ComputerSystemProcessor : CIM_SystemDevice
   29.15 +{
   29.16 +   [Override("PartComponent")]
   29.17 +   Xen_Processor REF PartComponent;
   29.18 +
   29.19 +   [Override("GroupComponent")]
   29.20 +   Xen_ComputerSystem REF GroupComponent;
   29.21 +};
   29.22 +
    30.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    30.2 +++ b/schema/Xen_ComputerSystemProcessor.registration	Wed Mar 22 14:05:14 2006 -0700
    30.3 @@ -0,0 +1,2 @@
    30.4 +# Classname Namespace ProviderName ProviderModule ProviderTypes ...
    30.5 +Xen_ComputerSystemProcessor root/cimv2 Xen_ComputerSystemProcessorProvider Xen_ComputerSystemProcessor association
    31.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    31.2 +++ b/schema/Xen_ComputerSystemSetting.mof	Wed Mar 22 14:05:14 2006 -0700
    31.3 @@ -0,0 +1,31 @@
    31.4 +// Copyright (c) 2006 IBM. All rights reserved.
    31.5 +
    31.6 +// ==================================================================
    31.7 +// Xen_ComputerSystemSetting
    31.8 +// ==================================================================
    31.9 +[Description (
   31.10 +	"A class derived from CIM_SystemSetting to represent "
   31.11 +	"the Xen virtual machine/domain runtime system settings "
   31.12 +	"of each domain.")]
   31.13 +class Xen_ComputerSystemSetting : CIM_SystemSetting
   31.14 +{
   31.15 +   uint32 ID;
   31.16 +
   31.17 +   uint32 SSID;
   31.18 +
   31.19 +   uint64 MemoryCurrent;
   31.20 +   uint64 MemoryMaximum;
   31.21 +
   31.22 +   uint32 CPU;
   31.23 +
   31.24 +   uint32 VCPUs;
   31.25 +
   31.26 +   boolean Running;
   31.27 +   boolean Blocked;
   31.28 +   boolean Crashed;
   31.29 +   boolean Shutdown;
   31.30 +   boolean Paused;
   31.31 +   boolean Dying;
   31.32 +
   31.33 +   uint64 Uptime;
   31.34 +};
    32.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    32.2 +++ b/schema/Xen_ComputerSystemSetting.registration	Wed Mar 22 14:05:14 2006 -0700
    32.3 @@ -0,0 +1,2 @@
    32.4 +# Classname Namespace ProviderName ProviderModule ProviderTypes ...
    32.5 +Xen_ComputerSystemSetting root/cimv2 Xen_ComputerSystemSettingProvider Xen_ComputerSystemSetting instance 
    33.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    33.2 +++ b/schema/Xen_ComputerSystemSettingData.mof	Wed Mar 22 14:05:14 2006 -0700
    33.3 @@ -0,0 +1,43 @@
    33.4 +// Copyright (c) 2006 IBM. All rights reserved.
    33.5 +
    33.6 +// ==================================================================
    33.7 +// Xen_ComputerSystemSettingData
    33.8 +// ==================================================================
    33.9 +[Description (
   33.10 +        "A class derived from CIM_SettingData to represent "
   33.11 +        "the current and/or recorded settings of the"
   33.12 +	"a Xen domain.")]
   33.13 +class Xen_ComputerSystemSettingData : CIM_SettingData
   33.14 +{
   33.15 +   [Description ("Path to the kernel image.")]
   33.16 +   string Kernel;
   33.17 +
   33.18 +   [Description ("Path to a ramdisk image.")]
   33.19 +   string RAMDisk;
   33.20 +
   33.21 +   [Description ("UUID assigned to this domain.")]
   33.22 +   string UUID;
   33.23 +
   33.24 +   [Description ("Set if you want to use DHCP to configure networking.")]
   33.25 +   boolean DHCP;
   33.26 +
   33.27 +   [Description ("Manually configured IP netmask.")]
   33.28 +   string Netmask;
   33.29 +
   33.30 +   [Description ("Manually configured IP gateway.")]
   33.31 +   string Gateway;
   33.32 +
   33.33 +   [Description ("Manually configured the IP hostname.")]
   33.34 +   string Hostname;
   33.35 +
   33.36 +   [Description ("Command line options to pass to the kernel.")]
   33.37 +   string KernelOptions = "";
   33.38 +
   33.39 +   [Description ("Root boot device to pass to the kernel.")]
   33.40 +   string Root;
   33.41 +
   33.42 +   [Description(
   33.43 +        "Can these settings be modified after being used to "
   33.44 +        "instantiate the respective Xen domain.")]
   33.45 +   boolean Mutable;
   33.46 +};
    34.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    34.2 +++ b/schema/Xen_ComputerSystemSettingData.registration	Wed Mar 22 14:05:14 2006 -0700
    34.3 @@ -0,0 +1,2 @@
    34.4 +# Classname Namespace ProviderName ProviderModule ProviderTypes ...
    34.5 +Xen_ComputerSystemSettingData root/cimv2 Xen_ComputerSystemSettingDataProvider Xen_ComputerSystemSettingData instance 
    35.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    35.2 +++ b/schema/Xen_ConfigurationForComputerSystem.mof	Wed Mar 22 14:05:14 2006 -0700
    35.3 @@ -0,0 +1,23 @@
    35.4 +// Copyright (c) 2006 IBM. All rights reserved.
    35.5 +
    35.6 +// *******************************************************************
    35.7 +// Associations
    35.8 +// *******************************************************************
    35.9 +
   35.10 +// ==================================================================
   35.11 +// Xen_ConfigurationForComputerSystem
   35.12 +// ==================================================================
   35.13 +[Association,
   35.14 + Description (
   35.15 +	"A class derived from CIM_ConfigurationForSystem to represent "
   35.16 +	"the association of a Xen virtual machine/domain with its "
   35.17 +	"initial configuration information.")]
   35.18 +class Xen_ConfigurationForComputerSystem : CIM_ConfigurationForSystem
   35.19 +{
   35.20 +   [Override("Dependent")]
   35.21 +   Xen_ComputerSystemConfiguration REF Dependent;
   35.22 +
   35.23 +   [Override("Antecedent")]
   35.24 +   Xen_ComputerSystem REF Antecedent;
   35.25 +};
   35.26 +
    36.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    36.2 +++ b/schema/Xen_ConfigurationForComputerSystem.registration	Wed Mar 22 14:05:14 2006 -0700
    36.3 @@ -0,0 +1,2 @@
    36.4 +# Classname Namespace ProviderName ProviderModule ProviderTypes ...
    36.5 +Xen_ConfigurationForComputerSystem root/cimv2 Xen_ConfigurationForComputerSystemProvider Xen_ConfigurationForComputerSystem association
    37.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    37.2 +++ b/schema/Xen_Disk.mof	Wed Mar 22 14:05:14 2006 -0700
    37.3 @@ -0,0 +1,27 @@
    37.4 +// Copyright (c) 2006 IBM. All rights reserved.
    37.5 +
    37.6 +// ==================================================================
    37.7 +// Xen_Disk
    37.8 +// ==================================================================
    37.9 +[Description (
   37.10 +        "A class derived from CIM_LogicalDisk to represent "
   37.11 +        "block device(s) in a Xen domain.")]
   37.12 +class Xen_Disk : CIM_LogicalDisk
   37.13 +{
   37.14 +    [Description ("Configuration information for this disk")]
   37.15 +    string DiskConfigInfo;	
   37.16 +
   37.17 +    [Description ("The physical disk device or file that is "
   37.18 +	 "exported to the domain for primary storage, e.g., "
   37.19 +	 "phy:hda1 or file:/full/path/to/file")]
   37.20 +    string Device;
   37.21 +
   37.22 +    [Description ("The device name the disk device is exported as, "
   37.23 +         "e.g., /dev/hda1 or /dev/ram0")]	
   37.24 +    string DeviceName;
   37.25 +
   37.26 +    [Description ("The access mode for this disk device; r is for "
   37.27 +	 "read-only, w is for read-write")]	
   37.28 +    string Mode;	
   37.29 +};
   37.30 +
    38.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    38.2 +++ b/schema/Xen_Disk.registration	Wed Mar 22 14:05:14 2006 -0700
    38.3 @@ -0,0 +1,2 @@
    38.4 +# Classname Namespace ProviderName ProviderModule ProviderTypes ...
    38.5 +Xen_Disk root/cimv2 Xen_DiskProvider Xen_Disk instance
    39.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    39.2 +++ b/schema/Xen_DiskElementSettingData.mof	Wed Mar 22 14:05:14 2006 -0700
    39.3 @@ -0,0 +1,23 @@
    39.4 +// Copyright (c) 2006 IBM. All rights reserved.
    39.5 +
    39.6 +// *******************************************************************
    39.7 +// Associations
    39.8 +// *******************************************************************
    39.9 +
   39.10 +// ==================================================================
   39.11 +// Xen_DiskElementSettingData
   39.12 +// ==================================================================
   39.13 +[Association,
   39.14 + Description (
   39.15 +	"A class derived from CIM_ElementSettingData to represent "
   39.16 +	"the association of a Xen_Disk instance with its "
   39.17 +	"device specific configuration settings.")]
   39.18 +class Xen_DiskElementSettingData : CIM_ElementSettingData
   39.19 +{
   39.20 +   [Override("Dependent")]
   39.21 +   Xen_DiskSettingData REF SettingData;
   39.22 +
   39.23 +   [Override("ManagedElement")]
   39.24 +   Xen_Disk REF ManagedElement;
   39.25 +};
   39.26 +
    40.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    40.2 +++ b/schema/Xen_DiskElementSettingData.registration	Wed Mar 22 14:05:14 2006 -0700
    40.3 @@ -0,0 +1,2 @@
    40.4 +# Classname Namespace ProviderName ProviderModule ProviderTypes ...
    40.5 +Xen_DiskElementSettingData root/cimv2 Xen_DiskElementSettingDataProvider Xen_DiskElementSettingData association
    41.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    41.2 +++ b/schema/Xen_DiskSettingData.mof	Wed Mar 22 14:05:14 2006 -0700
    41.3 @@ -0,0 +1,12 @@
    41.4 +// Copyright (c) 2006 IBM. All rights reserved.
    41.5 +
    41.6 +// ==================================================================
    41.7 +// Xen_DiskSettingData
    41.8 +// ==================================================================
    41.9 +[Description (
   41.10 +        "A class derived from Xen_VirtualDeviceSettingData to represent "
   41.11 +        "the current and/or recorded Xen_Disk settings of "
   41.12 +	"a virtualized disk device in a Xen domain.")]
   41.13 +class Xen_DiskSettingData : Xen_VirtualDeviceSettingData
   41.14 +{
   41.15 +};
    42.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    42.2 +++ b/schema/Xen_DiskSettingData.registration	Wed Mar 22 14:05:14 2006 -0700
    42.3 @@ -0,0 +1,2 @@
    42.4 +# Classname Namespace ProviderName ProviderModule ProviderTypes ...
    42.5 +Xen_DiskSettingData root/cimv2 Xen_DiskSettingDataProvider Xen_DiskSettingData instance 
    43.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    43.2 +++ b/schema/Xen_HasVirtualizationCapabilities.mof	Wed Mar 22 14:05:14 2006 -0700
    43.3 @@ -0,0 +1,24 @@
    43.4 +// Copyright (c) 2006 IBM. All rights reserved.
    43.5 +
    43.6 +// *******************************************************************
    43.7 +// Associations
    43.8 +// *******************************************************************
    43.9 +
   43.10 +// ==================================================================
   43.11 +// Xen_HasVirtualizationCapabilities
   43.12 +// ==================================================================
   43.13 +[Association,
   43.14 + Description (
   43.15 +	"A class derived from CIM_ElementCapabilities to represent "
   43.16 +	"the association of the virtualization capabilities of Xen "
   43.17 +	"(e.g. virtual CPUs, virtual memory, virtual disks, etc) "
   43.18 +	"with the host Linux_ComputerSystem.")]
   43.19 +class Xen_HasVirtualizationCapabilities : CIM_ElementCapabilities
   43.20 +{
   43.21 +   [Override("Capabilities")]
   43.22 +   Xen_VirtualizationCapabilities REF Capabilities;
   43.23 +
   43.24 +   [Override("ManagedElement")]
   43.25 +   Linux_ComputerSystem REF ManagedElement;
   43.26 +};
   43.27 +
    44.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    44.2 +++ b/schema/Xen_HasVirtualizationCapabilities.registration	Wed Mar 22 14:05:14 2006 -0700
    44.3 @@ -0,0 +1,2 @@
    44.4 +# Classname Namespace ProviderName ProviderModule ProviderTypes ...
    44.5 +Xen_HasVirtualizationCapabilities root/cimv2 Xen_HasVirtualizationCapabilitiesProvider Xen_HasVirtualizationCapabilities association
    45.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    45.2 +++ b/schema/Xen_HostedComputerSystem.mof	Wed Mar 22 14:05:14 2006 -0700
    45.3 @@ -0,0 +1,23 @@
    45.4 +// Copyright (c) 2006 IBM. All rights reserved.
    45.5 +
    45.6 +// *******************************************************************
    45.7 +// Associations
    45.8 +// *******************************************************************
    45.9 +
   45.10 +// ==================================================================
   45.11 +// Xen_HostedComputerSystem
   45.12 +// ==================================================================
   45.13 +[Association,
   45.14 + Description (
   45.15 +	"A class derived from CIM_HostedDependency to represent "
   45.16 +	"the association of a Xen virtual machine/domain with the "
   45.17 +	"host Linux_ComputerSystem.")]
   45.18 +class Xen_HostedComputerSystem : CIM_HostedDependency
   45.19 +{
   45.20 +   [Override("Dependent")]
   45.21 +   Xen_ComputerSystem REF Dependent;
   45.22 +
   45.23 +   [Override("Antecedent")]
   45.24 +   Linux_ComputerSystem REF Antecedent;
   45.25 +};
   45.26 +
    46.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    46.2 +++ b/schema/Xen_HostedComputerSystem.registration	Wed Mar 22 14:05:14 2006 -0700
    46.3 @@ -0,0 +1,2 @@
    46.4 +# Classname Namespace ProviderName ProviderModule ProviderTypes ...
    46.5 +Xen_HostedComputerSystem root/cimv2 Xen_HostedComputerSystemProvider Xen_HostedComputerSystem association
    47.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    47.2 +++ b/schema/Xen_HostedDisk.mof	Wed Mar 22 14:05:14 2006 -0700
    47.3 @@ -0,0 +1,23 @@
    47.4 +// Copyright (c) 2006 IBM. All rights reserved.
    47.5 +
    47.6 +// *******************************************************************
    47.7 +// Associations
    47.8 +// *******************************************************************
    47.9 +
   47.10 +// ==================================================================
   47.11 +// Xen_HostedDisk
   47.12 +// ==================================================================
   47.13 +[Association,
   47.14 + Description (
   47.15 +	"A class derived from CIM_HostedDependency to represent "
   47.16 +	"the association of a Xen domain's disk devices with the " 
   47.17 +	"host's Linux_LogicalDisk.")]
   47.18 +class Xen_HostedDisk : CIM_HostedDependency
   47.19 +{
   47.20 +   [Override("Dependent")]
   47.21 +   Xen_Disk REF Dependent;
   47.22 +
   47.23 +   [Override("Antecedent")]
   47.24 +   Linux_LogicalDisk REF Antecedent;
   47.25 +};
   47.26 +
    48.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    48.2 +++ b/schema/Xen_HostedDisk.registration	Wed Mar 22 14:05:14 2006 -0700
    48.3 @@ -0,0 +1,2 @@
    48.4 +# Classname Namespace ProviderName ProviderModule ProviderTypes ...
    48.5 +Xen_HostedDisk root/cimv2 Xen_HostedDiskProvider Xen_HostedDisk association
    49.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    49.2 +++ b/schema/Xen_HostedMemory.mof	Wed Mar 22 14:05:14 2006 -0700
    49.3 @@ -0,0 +1,23 @@
    49.4 +// Copyright (c) 2006 IBM. All rights reserved.
    49.5 +
    49.6 +// *******************************************************************
    49.7 +// Associations
    49.8 +// *******************************************************************
    49.9 +
   49.10 +// ==================================================================
   49.11 +// Xen_HostedMemory
   49.12 +// ==================================================================
   49.13 +[Association,
   49.14 + Description (
   49.15 +	"A class derived from CIM_HostedDependency to represent "
   49.16 +	"the association of a Xen domain's main memory with the "
   49.17 +	"host's Linux_CacheMemory.")]
   49.18 +class Xen_HostedMemory : CIM_HostedDependency
   49.19 +{
   49.20 +   [Override("Dependent")]
   49.21 +   Xen_Memory REF Dependent;
   49.22 +
   49.23 +   [Override("Antecedent")]
   49.24 +   Linux_CacheMemory REF Antecedent;
   49.25 +};
   49.26 +
    50.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    50.2 +++ b/schema/Xen_HostedMemory.registration	Wed Mar 22 14:05:14 2006 -0700
    50.3 @@ -0,0 +1,2 @@
    50.4 +# Classname Namespace ProviderName ProviderModule ProviderTypes ...
    50.5 +Xen_HostedMemory root/cimv2 Xen_HostedMemoryProvider Xen_HostedMemory association
    51.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    51.2 +++ b/schema/Xen_HostedMemoryPool.mof	Wed Mar 22 14:05:14 2006 -0700
    51.3 @@ -0,0 +1,23 @@
    51.4 +// Copyright (c) 2006 IBM. All rights reserved.
    51.5 +
    51.6 +// *******************************************************************
    51.7 +// Associations
    51.8 +// *******************************************************************
    51.9 +
   51.10 +// ==================================================================
   51.11 +// Xen_HostedMemoryPool
   51.12 +// ==================================================================
   51.13 +[Association,
   51.14 + Description (
   51.15 +	"A class derived from CIM_SystemComponent to represent "
   51.16 +	"the association of the host Linux_ComputerSystem with its "
   51.17 +	"memory resource pool(s).")]
   51.18 +class Xen_HostedMemoryPool : CIM_SystemComponent
   51.19 +{
   51.20 +   [Override("PartComponent")]
   51.21 +   Xen_MemoryPool REF PartComponent;
   51.22 +
   51.23 +   [Override("GroupComponent")]
   51.24 +   Linux_ComputerSystem REF GroupComponent;
   51.25 +};
   51.26 +
    52.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    52.2 +++ b/schema/Xen_HostedMemoryPool.registration	Wed Mar 22 14:05:14 2006 -0700
    52.3 @@ -0,0 +1,2 @@
    52.4 +# Classname Namespace ProviderName ProviderModule ProviderTypes ...
    52.5 +Xen_HostedMemoryPool root/cimv2 Xen_HostedMemoryPoolProvider Xen_HostedMemoryPool association
    53.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    53.2 +++ b/schema/Xen_HostedNetworkPort.mof	Wed Mar 22 14:05:14 2006 -0700
    53.3 @@ -0,0 +1,23 @@
    53.4 +// Copyright (c) 2006 IBM. All rights reserved.
    53.5 +
    53.6 +// *******************************************************************
    53.7 +// Associations
    53.8 +// *******************************************************************
    53.9 +
   53.10 +// ==================================================================
   53.11 +// Xen_HostedNetworkPort
   53.12 +// ==================================================================
   53.13 +[Association,
   53.14 + Description (
   53.15 +	"A class derived from CIM_HostedDependency to represent "
   53.16 +	"the association of a Xen domain's virtual network intefaces "
   53.17 +	"with the host's Linux_LogicalNetworkAdapter.")]
   53.18 +class Xen_HostedNetworkPort : CIM_HostedDependency
   53.19 +{
   53.20 +   [Override("Dependent")]
   53.21 +   Xen_NetworkPort REF Dependent;
   53.22 +
   53.23 +   [Override("Antecedent")]
   53.24 +   Linux_LogicalNetworkAdapter REF Antecedent;
   53.25 +};
   53.26 +
    54.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    54.2 +++ b/schema/Xen_HostedNetworkPort.registration	Wed Mar 22 14:05:14 2006 -0700
    54.3 @@ -0,0 +1,2 @@
    54.4 +# Classname Namespace ProviderName ProviderModule ProviderTypes ...
    54.5 +Xen_HostedNetworkPort root/cimv2 Xen_HostedNetworkPortProvider Xen_HostedNetworkPort association
    55.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    55.2 +++ b/schema/Xen_HostedProcessor.mof	Wed Mar 22 14:05:14 2006 -0700
    55.3 @@ -0,0 +1,23 @@
    55.4 +// Copyright (c) 2006 IBM. All rights reserved.
    55.5 +
    55.6 +// *******************************************************************
    55.7 +// Associations
    55.8 +// *******************************************************************
    55.9 +
   55.10 +// ==================================================================
   55.11 +// Xen_HostedProcessor
   55.12 +// ==================================================================
   55.13 +[Association,
   55.14 + Description (
   55.15 +	"A class derived from CIM_HostedDependency to represent "
   55.16 +	"the association of a Xen domain's virtual processor with "
   55.17 +	"the host Linux_Processor.")]
   55.18 +class Xen_HostedProcessor : CIM_HostedDependency
   55.19 +{
   55.20 +   [Override("Dependent")]
   55.21 +   Xen_Processor REF Dependent;
   55.22 +
   55.23 +   [Override("Antecedent")]
   55.24 +   Linux_Processor REF Antecedent;
   55.25 +};
   55.26 +
    56.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    56.2 +++ b/schema/Xen_HostedProcessor.registration	Wed Mar 22 14:05:14 2006 -0700
    56.3 @@ -0,0 +1,2 @@
    56.4 +# Classname Namespace ProviderName ProviderModule ProviderTypes ...
    56.5 +Xen_HostedProcessor root/cimv2 Xen_HostedProcessorProvider Xen_HostedProcessor association
    57.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    57.2 +++ b/schema/Xen_HostedProcessorPool.mof	Wed Mar 22 14:05:14 2006 -0700
    57.3 @@ -0,0 +1,23 @@
    57.4 +// Copyright (c) 2006 IBM. All rights reserved.
    57.5 +
    57.6 +// *******************************************************************
    57.7 +// Associations
    57.8 +// *******************************************************************
    57.9 +
   57.10 +// ==================================================================
   57.11 +// Xen_HostedProcessorPool
   57.12 +// ==================================================================
   57.13 +[Association,
   57.14 + Description (
   57.15 +	"A class derived from CIM_SystemComponent to represent "
   57.16 +	"the association of the host Linux_ComputerSystem with its "
   57.17 +	"processor resource pool(s).")]
   57.18 +class Xen_HostedProcessorPool : CIM_SystemComponent
   57.19 +{
   57.20 +   [Override("PartComponent")]
   57.21 +   Xen_ProcessorPool REF PartComponent;
   57.22 +
   57.23 +   [Override("GroupComponent")]
   57.24 +   Linux_ComputerSystem REF GroupComponent;
   57.25 +};
   57.26 +
    58.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    58.2 +++ b/schema/Xen_HostedProcessorPool.registration	Wed Mar 22 14:05:14 2006 -0700
    58.3 @@ -0,0 +1,2 @@
    58.4 +# Classname Namespace ProviderName ProviderModule ProviderTypes ...
    58.5 +Xen_HostedProcessorPool root/cimv2 Xen_HostedProcessorPoolProvider Xen_HostedProcessorPool association
    59.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    59.2 +++ b/schema/Xen_HostedVirtualizationManagementService.mof	Wed Mar 22 14:05:14 2006 -0700
    59.3 @@ -0,0 +1,12 @@
    59.4 +// Copyright (c) 2006 IBM. All rights reserved.
    59.5 +
    59.6 +[Association]
    59.7 +class Xen_HostedVirtualizationManagementService : CIM_HostedService
    59.8 +{
    59.9 +   [Override("Dependent")]
   59.10 +   Xen_VirtualizationManagementService REF Dependent;
   59.11 +
   59.12 +   [Override("Antecedent")]
   59.13 +   Linux_ComputerSystem REF Antecedent;
   59.14 +};
   59.15 +
    60.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    60.2 +++ b/schema/Xen_HostedVirtualizationManagementService.registration	Wed Mar 22 14:05:14 2006 -0700
    60.3 @@ -0,0 +1,2 @@
    60.4 +# Classname Namespace ProviderName ProviderModule ProviderTypes ...
    60.5 +Xen_HostedVirtualizationManagementService root/cimv2 Xen_HostedVirtualizationManagementServiceProvider Xen_HostedVirtualizationManagementService association
    61.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    61.2 +++ b/schema/Xen_Memory.mof	Wed Mar 22 14:05:14 2006 -0700
    61.3 @@ -0,0 +1,12 @@
    61.4 +// Copyright (c) 2006 IBM. All rights reserved.
    61.5 +
    61.6 +// ==================================================================
    61.7 +// Xen_Memory
    61.8 +// ==================================================================
    61.9 +[Description (
   61.10 +	"A class derived from CIM_Memory to represent "
   61.11 +	"the virtualized memory in a Xen domain.")]
   61.12 +class Xen_Memory : CIM_Memory
   61.13 +{
   61.14 +};
   61.15 +
    62.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    62.2 +++ b/schema/Xen_Memory.registration	Wed Mar 22 14:05:14 2006 -0700
    62.3 @@ -0,0 +1,2 @@
    62.4 +# Classname Namespace ProviderName ProviderModule ProviderTypes ...
    62.5 +Xen_Memory root/cimv2 Xen_MemoryProvider Xen_Memory instance 
    63.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    63.2 +++ b/schema/Xen_MemoryCapabilitiesSettingData.mof	Wed Mar 22 14:05:14 2006 -0700
    63.3 @@ -0,0 +1,12 @@
    63.4 +// Copyright (c) 2006 IBM. All rights reserved.
    63.5 +
    63.6 +// ==================================================================
    63.7 +// Xen_MemoryCapabilitiesSettingData
    63.8 +// ==================================================================
    63.9 +[Description (
   63.10 +        "A class derived from Xen_MemorySettingData to represent "
   63.11 +        "the min, max, increment and default Xen_MemorySettingData values "
   63.12 +        "used when defining memory resources for a new Xen domain.")]
   63.13 +class Xen_MemoryCapabilitiesSettingData : Xen_MemorySettingData
   63.14 +{
   63.15 +};
    64.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    64.2 +++ b/schema/Xen_MemoryCapabilitiesSettingData.registration	Wed Mar 22 14:05:14 2006 -0700
    64.3 @@ -0,0 +1,2 @@
    64.4 +# Classname Namespace ProviderName ProviderModule ProviderTypes ...
    64.5 +Xen_MemoryCapabilitiesSettingData root/cimv2 Xen_MemoryCapabilitiesSettingDataProvider Xen_MemoryCapabilitiesSettingData instance 
    65.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    65.2 +++ b/schema/Xen_MemoryElementSettingData.mof	Wed Mar 22 14:05:14 2006 -0700
    65.3 @@ -0,0 +1,23 @@
    65.4 +// Copyright (c) 2006 IBM. All rights reserved.
    65.5 +
    65.6 +// *******************************************************************
    65.7 +// Associations
    65.8 +// *******************************************************************
    65.9 +
   65.10 +// ==================================================================
   65.11 +// Xen_MemoryElementSettingData
   65.12 +// ==================================================================
   65.13 +[Association,
   65.14 + Description (
   65.15 +	"A class derived from CIM_ElementSettingData to represent "
   65.16 +	"the association of a Xen_Memory instance with its "
   65.17 +	"device specific configuration settings.")]
   65.18 +class Xen_MemoryElementSettingData : CIM_ElementSettingData
   65.19 +{
   65.20 +   [Override("Dependent")]
   65.21 +   Xen_MemorySettingData REF SettingData;
   65.22 +
   65.23 +   [Override("ManagedElement")]
   65.24 +   Xen_Memory REF ManagedElement;
   65.25 +};
   65.26 +
    66.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    66.2 +++ b/schema/Xen_MemoryElementSettingData.registration	Wed Mar 22 14:05:14 2006 -0700
    66.3 @@ -0,0 +1,2 @@
    66.4 +# Classname Namespace ProviderName ProviderModule ProviderTypes ...
    66.5 +Xen_MemoryElementSettingData root/cimv2 Xen_MemoryElementSettingDataProvider Xen_MemoryElementSettingData association
    67.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    67.2 +++ b/schema/Xen_MemoryPool.mof	Wed Mar 22 14:05:14 2006 -0700
    67.3 @@ -0,0 +1,14 @@
    67.4 +// Copyright (c) 2006 IBM. All rights reserved.
    67.5 +
    67.6 +// ==================================================================
    67.7 +// Xen_MemoryPool
    67.8 +// ==================================================================
    67.9 +[Description (
   67.10 +	"A class derived from Xen_ResourcePool to represent "
   67.11 +	"the 'pool' of memory resources that exist on the Xen host "
   67.12 +	"computer system that are available for allocation to "
   67.13 +	"specific Xen domains.")]
   67.14 +class Xen_MemoryPool : Xen_ResourcePool
   67.15 +{
   67.16 +};
   67.17 +
    68.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    68.2 +++ b/schema/Xen_MemoryPool.registration	Wed Mar 22 14:05:14 2006 -0700
    68.3 @@ -0,0 +1,2 @@
    68.4 +# Classname Namespace ProviderName ProviderModule ProviderTypes ...
    68.5 +Xen_MemoryPool root/cimv2 Xen_MemoryPoolProvider Xen_MemoryPool instance 
    69.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    69.2 +++ b/schema/Xen_MemorySettingData.mof	Wed Mar 22 14:05:14 2006 -0700
    69.3 @@ -0,0 +1,12 @@
    69.4 +// Copyright (c) 2006 IBM. All rights reserved.
    69.5 +
    69.6 +// ==================================================================
    69.7 +// Xen_MemorySettingData
    69.8 +// ==================================================================
    69.9 +[Description (
   69.10 +        "A class derived from Xen_VirtualDeviceSettingData to represent "
   69.11 +        "the current and/or recorded Xen_Memory settings of "
   69.12 +	"a virtualized memory in a Xen domain.")]
   69.13 +class Xen_MemorySettingData : Xen_VirtualDeviceSettingData
   69.14 +{
   69.15 +};
    70.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    70.2 +++ b/schema/Xen_MemorySettingData.registration	Wed Mar 22 14:05:14 2006 -0700
    70.3 @@ -0,0 +1,2 @@
    70.4 +# Classname Namespace ProviderName ProviderModule ProviderTypes ...
    70.5 +Xen_MemorySettingData root/cimv2 Xen_MemorySettingDataProvider Xen_MemorySettingData instance 
    71.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    71.2 +++ b/schema/Xen_NetworkPort.mof	Wed Mar 22 14:05:14 2006 -0700
    71.3 @@ -0,0 +1,36 @@
    71.4 +// Copyright (c) 2006 IBM. All rights reserved.
    71.5 +
    71.6 +// ==================================================================
    71.7 +// Xen_NetworkPort
    71.8 +// ==================================================================
    71.9 +[Description (
   71.10 +        "A class derived from CIM_NetworkPort to represent "
   71.11 +        "network device(s) in a Xen domain.")]
   71.12 +class Xen_NetworkPort : CIM_NetworkPort
   71.13 +{
   71.14 +	[Description ("Configuration information for this NIC")]
   71.15 +	string NICConfigInfo;
   71.16 +
   71.17 +	[Description ("The network bridge to add the virtual "
   71.18 +		"interface to")]
   71.19 +	string Bridge;
   71.20 +
   71.21 +	[Description ("The virtual interface name")]
   71.22 +	string VIFName;
   71.23 +
   71.24 +	[Description ("The ip address to assign to the virtual "
   71.25 +		"interface")]
   71.26 +	string IPAddress;
   71.27 +
   71.28 +	[Description ("")]
   71.29 +	string Type;
   71.30 +
   71.31 +	[Description ("The script used to configure the virtual "
   71.32 +		"interface in bridged mode")]
   71.33 +	string Script;
   71.34 +
   71.35 +	[Description ("The interface used to make requests for "
   71.36 +		"access to the physical network")]
   71.37 +	string Backend;
   71.38 +};
   71.39 +
    72.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    72.2 +++ b/schema/Xen_NetworkPort.registration	Wed Mar 22 14:05:14 2006 -0700
    72.3 @@ -0,0 +1,2 @@
    72.4 +# Classname Namespace ProviderName ProviderModule ProviderTypes ...
    72.5 +Xen_NetworkPort root/cimv2 Xen_NetworkPortProvider Xen_NetworkPort instance
    73.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    73.2 +++ b/schema/Xen_NetworkPortElementSettingData.mof	Wed Mar 22 14:05:14 2006 -0700
    73.3 @@ -0,0 +1,23 @@
    73.4 +// Copyright (c) 2006 IBM. All rights reserved.
    73.5 +
    73.6 +// *******************************************************************
    73.7 +// Associations
    73.8 +// *******************************************************************
    73.9 +
   73.10 +// ==================================================================
   73.11 +// Xen_NetworkPortElementSettingData
   73.12 +// ==================================================================
   73.13 +[Association,
   73.14 + Description (
   73.15 +	"A class derived from CIM_ElementSettingData to represent "
   73.16 +	"the association of a Xen_NetworkPort instance with its "
   73.17 +	"device specific configuration settings.")]
   73.18 +class Xen_NetworkPortElementSettingData : CIM_ElementSettingData
   73.19 +{
   73.20 +   [Override("Dependent")]
   73.21 +   Xen_NetworkPortSettingData REF SettingData;
   73.22 +
   73.23 +   [Override("ManagedElement")]
   73.24 +   Xen_NetworkPort REF ManagedElement;
   73.25 +};
   73.26 +
    74.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    74.2 +++ b/schema/Xen_NetworkPortElementSettingData.registration	Wed Mar 22 14:05:14 2006 -0700
    74.3 @@ -0,0 +1,2 @@
    74.4 +# Classname Namespace ProviderName ProviderModule ProviderTypes ...
    74.5 +Xen_NetworkPortElementSettingData root/cimv2 Xen_NetworkPortElementSettingDataProvider Xen_NetworkPortElementSettingData association
    75.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    75.2 +++ b/schema/Xen_NetworkPortSettingData.mof	Wed Mar 22 14:05:14 2006 -0700
    75.3 @@ -0,0 +1,12 @@
    75.4 +// Copyright (c) 2006 IBM. All rights reserved.
    75.5 +
    75.6 +// ==================================================================
    75.7 +// Xen_NetworkPortSettingData
    75.8 +// ==================================================================
    75.9 +[Description (
   75.10 +        "A class derived from Xen_VirtualDeviceSettingData to represent "
   75.11 +        "the current and/or recorded Xen_NetworkPort settings of "
   75.12 +	"a virtualized network interface in a Xen domain.")]
   75.13 +class Xen_NetworkPortSettingData : Xen_VirtualDeviceSettingData
   75.14 +{
   75.15 +};
    76.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    76.2 +++ b/schema/Xen_NetworkPortSettingData.registration	Wed Mar 22 14:05:14 2006 -0700
    76.3 @@ -0,0 +1,2 @@
    76.4 +# Classname Namespace ProviderName ProviderModule ProviderTypes ...
    76.5 +Xen_NetworkPortSettingData root/cimv2 Xen_NetworkPortSettingDataProvider Xen_NetworkPortSettingData instance 
    77.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    77.2 +++ b/schema/Xen_OperatingSystem.mof	Wed Mar 22 14:05:14 2006 -0700
    77.3 @@ -0,0 +1,13 @@
    77.4 +// Copyright (c) 2006 IBM. All rights reserved.
    77.5 +
    77.6 +// ==================================================================
    77.7 +// Xen_OperatingSystem
    77.8 +// ==================================================================
    77.9 +[Description (
   77.10 +	"A class derived from CIM_OperatingSystem to represent "
   77.11 +	"the out-of-band view of the para-virtualized Linux OS "
   77.12 +	"that is running in a Xen virtual machine/domain.")]
   77.13 +class Xen_OperatingSystem : CIM_OperatingSystem
   77.14 +{
   77.15 +};
   77.16 +
    78.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    78.2 +++ b/schema/Xen_OperatingSystem.registration	Wed Mar 22 14:05:14 2006 -0700
    78.3 @@ -0,0 +1,2 @@
    78.4 +# Classname Namespace ProviderName ProviderModule ProviderTypes ...
    78.5 +Xen_OperatingSystem root/cimv2 Xen_OperatingSystemProvider Xen_OperatingSystem instance method 
    79.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    79.2 +++ b/schema/Xen_Processor.mof	Wed Mar 22 14:05:14 2006 -0700
    79.3 @@ -0,0 +1,12 @@
    79.4 +// Copyright (c) 2006 IBM. All rights reserved.
    79.5 +
    79.6 +// ==================================================================
    79.7 +// Xen_Processor
    79.8 +// ==================================================================
    79.9 +[Description (
   79.10 +        "A class derived from CIM_Processor to represent "
   79.11 +        "processor device(s) in a Xen domain.")]
   79.12 +class Xen_Processor : CIM_Processor
   79.13 +{
   79.14 +};
   79.15 +
    80.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    80.2 +++ b/schema/Xen_Processor.registration	Wed Mar 22 14:05:14 2006 -0700
    80.3 @@ -0,0 +1,2 @@
    80.4 +# Classname Namespace ProviderName ProviderModule ProviderTypes ...
    80.5 +Xen_Processor root/cimv2 Xen_ProcessorProvider Xen_Processor instance
    81.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    81.2 +++ b/schema/Xen_ProcessorCapabilitiesSettingData.mof	Wed Mar 22 14:05:14 2006 -0700
    81.3 @@ -0,0 +1,12 @@
    81.4 +// Copyright (c) 2006 IBM. All rights reserved.
    81.5 +
    81.6 +// ==================================================================
    81.7 +// Xen_ProcessorCapabilitiesSettingData
    81.8 +// ==================================================================
    81.9 +[Description (
   81.10 +        "A class derived from Xen_ProcessorSettingData to represent "
   81.11 +        "the min, max, increment and default Xen_ProcessorSettingData values "
   81.12 +	"used when defining processor resources for a new Xen domain.")]
   81.13 +class Xen_ProcessorCapabilitiesSettingData : Xen_ProcessorSettingData
   81.14 +{
   81.15 +};
    82.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    82.2 +++ b/schema/Xen_ProcessorCapabilitiesSettingData.registration	Wed Mar 22 14:05:14 2006 -0700
    82.3 @@ -0,0 +1,2 @@
    82.4 +# Classname Namespace ProviderName ProviderModule ProviderTypes ...
    82.5 +Xen_ProcessorCapabilitiesSettingData root/cimv2 Xen_ProcessorCapabilitiesSettingDataProvider Xen_ProcessorCapabilitiesSettingData instance 
    83.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    83.2 +++ b/schema/Xen_ProcessorElementSettingData.mof	Wed Mar 22 14:05:14 2006 -0700
    83.3 @@ -0,0 +1,23 @@
    83.4 +// Copyright (c) 2006 IBM. All rights reserved.
    83.5 +
    83.6 +// *******************************************************************
    83.7 +// Associations
    83.8 +// *******************************************************************
    83.9 +
   83.10 +// ==================================================================
   83.11 +// Xen_ProcessorElementSettingData
   83.12 +// ==================================================================
   83.13 +[Association,
   83.14 + Description (
   83.15 +	"A class derived from CIM_ElementSettingData to represent "
   83.16 +	"the association of a Xen_Processor instance with its "
   83.17 +	"device specific configuration settings.")]
   83.18 +class Xen_ProcessorElementSettingData : CIM_ElementSettingData
   83.19 +{
   83.20 +   [Override("Dependent")]
   83.21 +   Xen_ProcessorSettingData REF SettingData;
   83.22 +
   83.23 +   [Override("ManagedElement")]
   83.24 +   Xen_Processor REF ManagedElement;
   83.25 +};
   83.26 +
    84.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    84.2 +++ b/schema/Xen_ProcessorElementSettingData.registration	Wed Mar 22 14:05:14 2006 -0700
    84.3 @@ -0,0 +1,2 @@
    84.4 +# Classname Namespace ProviderName ProviderModule ProviderTypes ...
    84.5 +Xen_ProcessorElementSettingData root/cimv2 Xen_ProcessorElementSettingDataProvider Xen_ProcessorElementSettingData association
    85.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    85.2 +++ b/schema/Xen_ProcessorPool.mof	Wed Mar 22 14:05:14 2006 -0700
    85.3 @@ -0,0 +1,14 @@
    85.4 +// Copyright (c) 2006 IBM. All rights reserved.
    85.5 +
    85.6 +// ==================================================================
    85.7 +// Xen_ProcessorPool
    85.8 +// ==================================================================
    85.9 +[Description (
   85.10 +	"A class derived from Xen_ResourcePool to represent "
   85.11 +	"the 'pool' of processor resources that exist on the Xen host "
   85.12 +	"computer system that are available for allocation to "
   85.13 +	"specific Xen domains.")]
   85.14 +class Xen_ProcessorPool : Xen_ResourcePool
   85.15 +{
   85.16 +};
   85.17 +
    86.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    86.2 +++ b/schema/Xen_ProcessorPool.registration	Wed Mar 22 14:05:14 2006 -0700
    86.3 @@ -0,0 +1,2 @@
    86.4 +# Classname Namespace ProviderName ProviderModule ProviderTypes ...
    86.5 +Xen_ProcessorPool root/cimv2 Xen_ProcessorPoolProvider Xen_ProcessorPool instance 
    87.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    87.2 +++ b/schema/Xen_ProcessorSettingData.mof	Wed Mar 22 14:05:14 2006 -0700
    87.3 @@ -0,0 +1,12 @@
    87.4 +// Copyright (c) 2006 IBM. All rights reserved.
    87.5 +
    87.6 +// ==================================================================
    87.7 +// Xen_ProcessorSettingData
    87.8 +// ==================================================================
    87.9 +[Description (
   87.10 +        "A class derived from Xen_VirtualDeviceSettingData to represent "
   87.11 +        "the current and/or recorded Xen_Processor settings of "
   87.12 +	"a virtualized processor device in a Xen domain.")]
   87.13 +class Xen_ProcessorSettingData : Xen_VirtualDeviceSettingData
   87.14 +{
   87.15 +};
    88.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    88.2 +++ b/schema/Xen_ProcessorSettingData.registration	Wed Mar 22 14:05:14 2006 -0700
    88.3 @@ -0,0 +1,2 @@
    88.4 +# Classname Namespace ProviderName ProviderModule ProviderTypes ...
    88.5 +Xen_ProcessorSettingData root/cimv2 Xen_ProcessorSettingDataProvider Xen_ProcessorSettingData instance 
    89.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    89.2 +++ b/schema/Xen_ResourcePool.mof	Wed Mar 22 14:05:14 2006 -0700
    89.3 @@ -0,0 +1,40 @@
    89.4 +// Copyright (c) 2006 IBM. All rights reserved.
    89.5 +
    89.6 +// ==================================================================
    89.7 +// Xen_ResourcePool
    89.8 +// ==================================================================
    89.9 +[Description (
   89.10 +	"An abstract superclass derived from CIM_LogicalElement to represent "
   89.11 +	"a 'pool' of arbitrary resources that exist on the Xen host "
   89.12 +	"computer system that are available for allocation to "
   89.13 +	"specific Xen domains.")]
   89.14 +class Xen_ResourcePool : CIM_LogicalElement 
   89.15 +{
   89.16 +   [Key]
   89.17 +   string SystemName;
   89.18 +
   89.19 +   [Key]
   89.20 +   string SystemCreationClassName;
   89.21 +
   89.22 +   [Key]
   89.23 +   string PoolID;
   89.24 +
   89.25 +   [Description(
   89.26 +        "Type of resource to be virtualized."),
   89.27 +    ValueMap{"Processor", "Memory", "Disk", "NetworkPort"}]
   89.28 +   string ResourceType;
   89.29 +
   89.30 +   [Description (
   89.31 +        "The total number of units of this resource that can be allocated to virtual devices.")]
   89.32 +   uint64 Capacity;
   89.33 +
   89.34 +   [Description (
   89.35 +        "The number of units of this resource that are currently allocated; "
   89.36 +	"i.e. the number of currently available units = Capacity - Reserved")]
   89.37 +   uint64 Reserved;
   89.38 +
   89.39 +   [Description (
   89.40 +        "Units of allocation for capacity and reserved. e.g. MHz, MB")]
   89.41 +   string AllocationUnits;
   89.42 +};
   89.43 +
    90.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    90.2 +++ b/schema/Xen_RunningOS.mof	Wed Mar 22 14:05:14 2006 -0700
    90.3 @@ -0,0 +1,19 @@
    90.4 +// Copyright (c) 2006 IBM. All rights reserved.
    90.5 +
    90.6 +// ==================================================================
    90.7 +// Xen_RunningOS
    90.8 +// ==================================================================
    90.9 +[Association,
   90.10 + Description (
   90.11 +	"A class derived from CIM_RunningOS to represent "
   90.12 +	"the association of a Xen virtual machine/domain with the "
   90.13 +	"para-virtualized Linux OS running in it.")]
   90.14 +class Xen_RunningOS : CIM_RunningOS
   90.15 +{
   90.16 +   [Override("Dependent")]
   90.17 +   Xen_ComputerSystem REF Dependent;
   90.18 +
   90.19 +   [Override("Antecedent")]
   90.20 +   Xen_OperatingSystem REF Antecedent;
   90.21 +};
   90.22 +
    91.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    91.2 +++ b/schema/Xen_RunningOS.registration	Wed Mar 22 14:05:14 2006 -0700
    91.3 @@ -0,0 +1,2 @@
    91.4 +# Classname Namespace ProviderName ProviderModule ProviderTypes ...
    91.5 +Xen_RunningOS root/cimv2 Xen_RunningOSProvider Xen_RunningOS association
    92.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    92.2 +++ b/schema/Xen_SettingForComputerSystem.mof	Wed Mar 22 14:05:14 2006 -0700
    92.3 @@ -0,0 +1,23 @@
    92.4 +// Copyright (c) 2006 IBM. All rights reserved.
    92.5 +
    92.6 +// *******************************************************************
    92.7 +// Associations
    92.8 +// *******************************************************************
    92.9 +
   92.10 +// ==================================================================
   92.11 +// Xen_SettingForComputerSystem
   92.12 +// ==================================================================
   92.13 +[Association,
   92.14 + Description (
   92.15 +	"A class derived from CIM_SettingForSystem to represent "
   92.16 +	"the association of a Xen virtual machine/domain with its "
   92.17 +	"runtime setting information.")]
   92.18 +class Xen_SettingForComputerSystem : CIM_SettingForSystem
   92.19 +{
   92.20 +   [Override("Dependent")]
   92.21 +   Xen_ComputerSystemSetting REF Dependent;
   92.22 +
   92.23 +   [Override("Antecedent")]
   92.24 +   Xen_ComputerSystem REF Antecedent;
   92.25 +};
   92.26 +
    93.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    93.2 +++ b/schema/Xen_SettingForComputerSystem.registration	Wed Mar 22 14:05:14 2006 -0700
    93.3 @@ -0,0 +1,2 @@
    93.4 +# Classname Namespace ProviderName ProviderModule ProviderTypes ...
    93.5 +Xen_SettingForComputerSystem root/cimv2 Xen_SettingForComputerSystemProvider Xen_SettingForComputerSystem association
    94.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    94.2 +++ b/schema/Xen_VirtualDeviceSettingData.mof	Wed Mar 22 14:05:14 2006 -0700
    94.3 @@ -0,0 +1,68 @@
    94.4 +// Copyright (c) 2006 IBM. All rights reserved.
    94.5 +
    94.6 +// ==================================================================
    94.7 +// Xen_VirtualDeviceSettingData
    94.8 +// ==================================================================
    94.9 +[Description (
   94.10 +        "A class derived from CIM_SettingData to represent "
   94.11 +        "the current and/or recorded allocation settings of "
   94.12 +	"a virtualized device in a Xen domain.")]
   94.13 +class Xen_VirtualDeviceSettingData : CIM_SettingData
   94.14 +{
   94.15 +   string SystemName;
   94.16 +
   94.17 +   string SystemCreationClassName;
   94.18 +
   94.19 +   [Description(
   94.20 +        "Type of resource to be virtualized."),
   94.21 +    ValueMap{"Processor", "Memory", "Disk", "NetworkPort"}]
   94.22 +   string ResourceType;
   94.23 +
   94.24 +   [Description (
   94.25 +        "Is the allocated device virtualized from a hosting resource, "
   94.26 +	"or just a pass-thru assignment of a specific/partitioned "
   94.27 +	"resource instance.")]
   94.28 +   boolean Virtualized;
   94.29 +
   94.30 +   [Description (
   94.31 +        "ID of the actual hosting resource instance, if known.")]
   94.32 +   string HostedDeviceID;
   94.33 +
   94.34 +   [Description (
   94.35 +        "The minimum resource allocation guaranteed for the virtual device.")]
   94.36 +   uint64 Reservation;
   94.37 +
   94.38 +   [Description (
   94.39 +        "The maximum resource allocation available for the virtual device.")]
   94.40 +   uint64 Limit;
   94.41 +
   94.42 +   [Description (
   94.43 +        "Units for reservation and limit. e.g. MHz, MB")]
   94.44 +   string AllocationUnits;
   94.45 +
   94.46 +   [Description (
   94.47 +        "Number of virtual resource units presented to the guest. "
   94.48 +	"e.g. number of CPUS, number of MB")]
   94.49 +   uint64 Quantity;
   94.50 +
   94.51 +   [Description (
   94.52 +        "Weight/priority of the allocation to the containing computer system. "
   94.53 +	"When applicable, this is used to dynamically adjust the amount of "
   94.54 +	"the hosting resource that is consumed by the virtualized device.")]
   94.55 +   uint32 Weight;
   94.56 +
   94.57 +   [Description (
   94.58 +        "Will the resource be allocated automatically when the "
   94.59 +        "containing virtual computer system is started.")]
   94.60 +   boolean AllocatedOnStart = true;
   94.61 +
   94.62 +   [Description (
   94.63 +        "Will the resource be deallocated automatically when the "
   94.64 +        "containing virtual computer system is stopped.")]
   94.65 +   boolean DeallocatedOnStop = true;
   94.66 +
   94.67 +   [Description(
   94.68 +        "Can this virtual resource allocation be modified after "
   94.69 +        "it has initially been allocated to a virtual machine.")]
   94.70 +   boolean Mutable;
   94.71 +};
    95.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    95.2 +++ b/schema/Xen_VirtualizationCapabilities.mof	Wed Mar 22 14:05:14 2006 -0700
    95.3 @@ -0,0 +1,28 @@
    95.4 +// Copyright (c) 2006 IBM. All rights reserved.
    95.5 +
    95.6 +// ==================================================================
    95.7 +// Xen_VirtualizationCapabilities
    95.8 +// ==================================================================
    95.9 +[Description (
   95.10 +	"A class derived from CIM_Capabilities to represent "
   95.11 +	"the capability(ies) of the Xen hypervisor to virtualize "
   95.12 +	"different types/classes of resources in Xen domains.")]
   95.13 +class Xen_VirtualizationCapabilities : CIM_Capabilities
   95.14 +{
   95.15 +   [Description(
   95.16 +	"Type of resource to be virtualized."),
   95.17 +    ValueMap{"Processor", "Memory", "Disk", "NetworkPort"}]
   95.18 +   string ResourceType;
   95.19 +
   95.20 +   [Description(
   95.21 +	"Is the underlying physical resource shared with other "
   95.22 +	"virtual machines, or is the physical resource allocated "
   95.23 +        "exclusively to the virtual machine.")]
   95.24 +   boolean Shared;
   95.25 +
   95.26 +   [Description(
   95.27 +	"Can the virtual resource allocation be modified after "
   95.28 +	"it has initially been allocated to a virtual machine.")]
   95.29 +   boolean Mutable;
   95.30 +};
   95.31 +
    96.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    96.2 +++ b/schema/Xen_VirtualizationCapabilities.registration	Wed Mar 22 14:05:14 2006 -0700
    96.3 @@ -0,0 +1,2 @@
    96.4 +# Classname Namespace ProviderName ProviderModule ProviderTypes ...
    96.5 +Xen_VirtualizationCapabilities root/cimv2 Xen_VirtualizationCapabilitiesProvider Xen_VirtualizationCapabilities instance
    97.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    97.2 +++ b/schema/Xen_VirtualizationManagementService.mof	Wed Mar 22 14:05:14 2006 -0700
    97.3 @@ -0,0 +1,49 @@
    97.4 +// Copyright (c) 2006 IBM. All rights reserved.
    97.5 +
    97.6 +class Xen_VirtualizationManagementService : CIM_Service
    97.7 +{
    97.8 +   [Description("Xen build version. Format is <major#>.<minor#>-<extra>")]
    97.9 +   string Version;
   97.10 +
   97.11 +   [Description("Create and register a new DomU configuration.")]
   97.12 +   uint32 CreateVirtualSystem(
   97.13 +      [IN, ArrayType("Indexed"), EmbeddedObject] string VirtualSystemSettings[],
   97.14 +      [OUT] Xen_ComputerSystem REF VirtualSystem
   97.15 +   );
   97.16 +
   97.17 +   [Description("Remove a DomU configuration, and stop the DomU if running.")]
   97.18 +   uint32 DestroyVirtualSystem(
   97.19 +      [IN] Xen_ComputerSystem REF VirtualSystem
   97.20 +   );
   97.21 + 
   97.22 +   [Description("Start a DomU from its initial configuration.")]
   97.23 +   uint32 StartVirtualSystem(
   97.24 +      [IN] Xen_ComputerSystem REF VirtualSystem
   97.25 +   );
   97.26 +
   97.27 +   [Description("Stop a running DomU and free all its resources.")]
   97.28 +   uint32 StopVirtualSystem(
   97.29 +      [IN] Xen_ComputerSystem REF VirtualSystem
   97.30 +   );
   97.31 +
   97.32 +   [Description("Suspend a running DomU and free all its resources.")]
   97.33 +   uint32 SuspendVirtualSystem(
   97.34 +      [IN] Xen_ComputerSystem REF VirtualSystem
   97.35 +   );
   97.36 +
   97.37 +   [Description("Resume a suspended DomU.")]
   97.38 +   uint32 ResumeVirtualSystem(
   97.39 +      [IN] Xen_ComputerSystem REF VirtualSystem
   97.40 +   );
   97.41 +
   97.42 +   [Description("Pause a running DomU but do not free its resources.")]
   97.43 +   uint32 PauseVirtualSystem(
   97.44 +      [IN] Xen_ComputerSystem REF VirtualSystem
   97.45 +   );
   97.46 +
   97.47 +   [Description("Resume a paused DomU.")]
   97.48 +   uint32 UnpauseVirtualSystem(
   97.49 +      [IN] Xen_ComputerSystem REF VirtualSystem
   97.50 +   );
   97.51 +};
   97.52 +
    98.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    98.2 +++ b/schema/Xen_VirtualizationManagementService.registration	Wed Mar 22 14:05:14 2006 -0700
    98.3 @@ -0,0 +1,2 @@
    98.4 +# Classname Namespace ProviderName ProviderModule ProviderTypes ...
    98.5 +Xen_VirtualizationManagementService root/cimv2 Xen_VirtualizationManagementServiceProvider Xen_VirtualizationManagementService instance method 
    99.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    99.2 +++ b/src/Xen_CSElementSettingData.c	Wed Mar 22 14:05:14 2006 -0700
    99.3 @@ -0,0 +1,535 @@
    99.4 +// Copyright (C) 2006 IBM Corporation
    99.5 +//
    99.6 +//    This library is free software; you can redistribute it and/or
    99.7 +//    modify it under the terms of the GNU Lesser General Public
    99.8 +//    License as published by the Free Software Foundation; either
    99.9 +//    version 2.1 of the License, or (at your option) any later version.
   99.10 +//
   99.11 +//    This library is distributed in the hope that it will be useful,
   99.12 +//    but WITHOUT ANY WARRANTY; without even the implied warranty of
   99.13 +//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   99.14 +//    Lesser General Public License for more details.
   99.15 +//
   99.16 +//    You should have received a copy of the GNU Lesser General Public
   99.17 +//    License along with this library; if not, write to the Free Software
   99.18 +//    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
   99.19 +// ============================================================================
   99.20 +// Authors:       Dr. Gareth S. Bestor, <bestor@us.ibm.com>
   99.21 +// Contributors:
   99.22 +// Description:
   99.23 +// ============================================================================
   99.24 +
   99.25 +/* Include the required CMPI data types, function headers, and macros */
   99.26 +#include "cmpidt.h"
   99.27 +#include "cmpift.h"
   99.28 +#include "cmpimacs.h"
   99.29 +
   99.30 +
   99.31 +// ----------------------------------------------------------------------------
   99.32 +// COMMON GLOBAL VARIABLES
   99.33 +// ----------------------------------------------------------------------------
   99.34 +
   99.35 +/* Handle to the CIM broker. Initialized when the provider lib is loaded. */
   99.36 +static CMPIBroker *_BROKER;
   99.37 +
   99.38 +/* Include utility functions */
   99.39 +#include "cmpiutil.h"
   99.40 +
   99.41 +/* Include _SBLIM_TRACE() logging support */
   99.42 +#include "cmpitrace.h"
   99.43 +
   99.44 +
   99.45 +// ============================================================================
   99.46 +// CMPI ASSOCIATION PROVIDER FUNCTION TABLE
   99.47 +// ============================================================================
   99.48 +
   99.49 +// ----------------------------------------------------------------------------
   99.50 +// Info for the class supported by the association provider
   99.51 +// ----------------------------------------------------------------------------
   99.52 +                                                                                                                                 
   99.53 +/* Name of the left and right hand side classes of this association. */
   99.54 +static char * _ASSOCCLASS = "Xen_CSElementSettingData";
   99.55 +static char * _LHSCLASSNAME = "Xen_ComputerSystemSettingData";
   99.56 +static char * _RHSCLASSNAME = "Xen_ComputerSystem";
   99.57 +static char * _LHSPROPERTYNAME = "SettingData"; 
   99.58 +static char * _RHSPROPERTYNAME = "ManagedElement";
   99.59 +static char * _LHSKEYNAME = "InstanceID";
   99.60 +static char * _RHSKEYNAME = "Name";
   99.61 +
   99.62 +// ----------------------------------------------------------------------------
   99.63 +// AssociationCleanup()
   99.64 +// Perform any necessary cleanup immediately before this provider is unloaded.
   99.65 +// ----------------------------------------------------------------------------
   99.66 +static CMPIStatus AssociationCleanup(
   99.67 +		CMPIAssociationMI * self,	/* [in] Handle to this provider (i.e. 'self'). */
   99.68 +		CMPIContext * context)		/* [in] Additional context info, if any. */
   99.69 +{
   99.70 +   CMPIStatus status = { CMPI_RC_OK, NULL };	/* Return status of CIM operations. */
   99.71 +
   99.72 +   _SBLIM_ENTER("AssociationCleanup");
   99.73 +   _SBLIM_TRACE(2, ("--- self=\"%s\"", self->ft->miName));
   99.74 +   _SBLIM_TRACE(2, ("--- context=\"%s\"", CMGetCharPtr(CDToString(_BROKER, context, NULL))));
   99.75 +
   99.76 +   /* Nothing needs to be done for cleanup. */
   99.77 +
   99.78 +exit:
   99.79 +   _SBLIM_RETURNSTATUS(status);
   99.80 +}
   99.81 +
   99.82 +
   99.83 +// ----------------------------------------------------------------------------
   99.84 +// AssociatorNames()
   99.85 +// ----------------------------------------------------------------------------
   99.86 +static CMPIStatus AssociatorNames(
   99.87 +		CMPIAssociationMI * self,	/* [in] Handle to this provider (i.e. 'self'). */
   99.88 +		CMPIContext * context,		/* [in] Additional context info, if any. */
   99.89 +		CMPIResult * results,		/* [out] Results of this operation. */
   99.90 +		CMPIObjectPath * reference,	/* [in] Contains source namespace, classname and object path. */
   99.91 +		const char * assocClass,
   99.92 +		const char * resultClass,
   99.93 +		const char * role,
   99.94 +		const char * resultRole)
   99.95 +{
   99.96 +   CMPIStatus status = { CMPI_RC_OK, NULL };    /* Return status of CIM operations. */
   99.97 +   char *namespace = CMGetCharPtr(CMGetNameSpace(reference, NULL)); /* Target namespace. */
   99.98 +   char *sourceclass = CMGetCharPtr(CMGetClassName(reference, &status)); /* Class of the source reference object */
   99.99 +   char *targetclass; 				/* Class of the target object(s). */
  99.100 +
  99.101 +   char *sourcekeyname;
  99.102 +   char *targetkeyname;
  99.103 +
  99.104 +   _SBLIM_ENTER("AssociatorNames");
  99.105 +   _SBLIM_TRACE(2, ("--- self=\"%s\"", self->ft->miName));
  99.106 +   _SBLIM_TRACE(2, ("--- context=\"%s\"", CMGetCharPtr(CDToString(_BROKER, context, NULL))));
  99.107 +   _SBLIM_TRACE(2, ("--- reference=\"%s\"", CMGetCharPtr(CDToString(_BROKER, reference, NULL))));
  99.108 +   _SBLIM_TRACE(2, ("--- assocClass=\"%s\"", assocClass));
  99.109 +   _SBLIM_TRACE(2, ("--- resultClass=\"%s\"", resultClass));
  99.110 +   _SBLIM_TRACE(2, ("--- role=\"%s\"", role));
  99.111 +   _SBLIM_TRACE(2, ("--- resultRole=\"%s\"", resultRole));
  99.112 +   _SBLIM_TRACE(2, ("--- namespace=\"%s\"", namespace));
  99.113 +   _SBLIM_TRACE(2, ("--- sourceclass=\"%s\"", sourceclass));
  99.114 +
  99.115 +   /* Check that the requested association class, if any, is supported. */
  99.116 +   if (assocClass != NULL) {
  99.117 +      CMPIObjectPath * assoc = CMNewObjectPath(_BROKER, namespace, _ASSOCCLASS, NULL);
  99.118 +      if (!CMClassPathIsA(_BROKER, assoc, assocClass, NULL)) {
  99.119 +         _SBLIM_TRACE(2, ("--- Unrecognized association class. Ignoring request."));
  99.120 +         goto exit;
  99.121 +      }
  99.122 +   }
  99.123 +
  99.124 +   /* Check that the reference matches the required role, if any. */
  99.125 +   if ((role != NULL) && strcmp(role, sourceclass) != 0) {
  99.126 +      _SBLIM_TRACE(2, ("--- Reference does not match required role. Ignoring request."));
  99.127 +      goto exit;
  99.128 +   }
  99.129 +
  99.130 +   /* Determine the target class from the source class. */
  99.131 +   if (strcmp(sourceclass, _LHSCLASSNAME) == 0) {
  99.132 +      sourcekeyname = _LHSKEYNAME;
  99.133 +      targetclass = _RHSCLASSNAME;
  99.134 +      targetkeyname = _RHSKEYNAME;
  99.135 +   } else if (strcmp(sourceclass, _RHSCLASSNAME) == 0) {
  99.136 +      sourcekeyname = _RHSKEYNAME;
  99.137 +      targetclass = _LHSCLASSNAME;
  99.138 +      targetkeyname = _LHSKEYNAME;
  99.139 +   } else {
  99.140 +      _SBLIM_TRACE(2, ("--- Unrecognized source class. Ignoring request."));
  99.141 +      goto exit;
  99.142 +   }
  99.143 +   _SBLIM_TRACE(2, ("--- targetclass=\"%s\"", targetclass));
  99.144 +
  99.145 +   CMPIData namedata = CMGetKey(reference, sourcekeyname, NULL);
  99.146 +   char * sourcename = CMGetCharPtr(namedata.value.string);
  99.147 +   _SBLIM_TRACE(2, ("--- sourcename=\"%s\"", sourcename));
  99.148 +
  99.149 +   /* Create an object path for the result class. */
  99.150 +   CMPIObjectPath * objectpath = CMNewObjectPath(_BROKER, namespace, targetclass, &status);
  99.151 +   if ((status.rc != CMPI_RC_OK) || CMIsNullObject(objectpath)) {
  99.152 +      _SBLIM_TRACE(1,("--- CMNewObjectPath() failed - %s", CMGetCharPtr(status.msg)));
  99.153 +      CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERROR, "Cannot create new CMPIObjectPath");
  99.154 +      goto exit;
  99.155 +   }
  99.156 +
  99.157 +   /* Get the list of all target class object paths from the CIMOM. */
  99.158 +   CMPIEnumeration * objectpaths = CBEnumInstanceNames(_BROKER, context, objectpath, &status);
  99.159 +   if ((status.rc != CMPI_RC_OK) || CMIsNullObject(objectpaths)) {
  99.160 +      _SBLIM_TRACE(1,("--- CBEnumInstanceNames() failed - %s", CMGetCharPtr(status.msg)));
  99.161 +      CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERROR, "Cannot enumerate target class");
  99.162 +      goto exit;
  99.163 +   }
  99.164 +
  99.165 +   /* Return all object paths that exactly match the target class and resultClass, if specified. */
  99.166 +   while (CMHasNext(objectpaths, NULL)) {
  99.167 +      CMPIData data = CMGetNext(objectpaths, NULL);
  99.168 +      char *class = CMGetCharPtr(CMGetClassName(data.value.ref, NULL));
  99.169 +      if ((strcmp(class,targetclass) == 0) && ((resultClass == NULL) || (strcmp(class,resultClass) == 0))) {
  99.170 +         /* Only return entries whose name matches the reference. */
  99.171 +         namedata = CMGetKey(data.value.ref, targetkeyname, &status);
  99.172 +         char * resultname = CMGetCharPtr(namedata.value.string);
  99.173 +         if (strcmp(sourcename, resultname) == 0) CMReturnObjectPath(results, data.value.ref);
  99.174 +      }
  99.175 +   }
  99.176 +
  99.177 +   CMReturnDone(results);
  99.178 +
  99.179 +exit:
  99.180 +   _SBLIM_RETURNSTATUS(status);
  99.181 +}
  99.182 +
  99.183 +
  99.184 +// ----------------------------------------------------------------------------
  99.185 +// Associators()
  99.186 +// ----------------------------------------------------------------------------
  99.187 +static CMPIStatus Associators(
  99.188 +		CMPIAssociationMI * self,	/* [in] Handle to this provider (i.e. 'self'). */
  99.189 +		CMPIContext * context,		/* [in] Additional context info, if any. */
  99.190 +		CMPIResult * results,		/* [out] Results of this operation. */
  99.191 +		CMPIObjectPath * reference,	/* [in] Contains the source namespace, classname and object path. */
  99.192 +		const char *assocClass,
  99.193 +		const char *resultClass,
  99.194 +		const char *role,
  99.195 +		const char *resultRole,
  99.196 +		char ** properties)		/* [in] List of desired properties (NULL=all). */
  99.197 +{
  99.198 +   CMPIStatus status = { CMPI_RC_OK, NULL };    /* Return status of CIM operations. */
  99.199 +   char *namespace = CMGetCharPtr(CMGetNameSpace(reference, NULL)); /* Target namespace. */
  99.200 +   char *sourceclass = CMGetCharPtr(CMGetClassName(reference, &status)); /* Class of the source reference object */
  99.201 +   char *targetclass;                           /* Class of the target object(s). */
  99.202 +
  99.203 +   char *sourcekeyname;
  99.204 +   char *targetkeyname;
  99.205 +
  99.206 +   _SBLIM_ENTER("Associators");
  99.207 +   _SBLIM_TRACE(2, ("--- self=\"%s\"", self->ft->miName));
  99.208 +   _SBLIM_TRACE(2, ("--- context=\"%s\"", CMGetCharPtr(CDToString(_BROKER, context, NULL))));
  99.209 +   _SBLIM_TRACE(2, ("--- reference=\"%s\"", CMGetCharPtr(CDToString(_BROKER, reference, NULL))));
  99.210 +   _SBLIM_TRACE(2, ("--- assocClass=\"%s\"", assocClass));
  99.211 +   _SBLIM_TRACE(2, ("--- resultClass=\"%s\"", resultClass));
  99.212 +   _SBLIM_TRACE(2, ("--- role=\"%s\"", role));
  99.213 +   _SBLIM_TRACE(2, ("--- resultRole=\"%s\"", resultRole));
  99.214 +   _SBLIM_TRACE(2, ("--- namespace=\"%s\"", namespace));
  99.215 +   _SBLIM_TRACE(2, ("--- sourceclass=\"%s\"", sourceclass));
  99.216 +
  99.217 +   /* Check that the requested association class, if any, is supported. */
  99.218 +   if (assocClass != NULL) {
  99.219 +      CMPIObjectPath * assoc = CMNewObjectPath(_BROKER, namespace, _ASSOCCLASS, NULL);
  99.220 +      if (!CMClassPathIsA(_BROKER, assoc, assocClass, NULL)) {
  99.221 +         _SBLIM_TRACE(2, ("--- Unrecognized association class. Ignoring request."));
  99.222 +         goto exit;
  99.223 +      }
  99.224 +   }
  99.225 +
  99.226 +   /* Check that the reference matches the required role, if any. */
  99.227 +   if ((role != NULL) && strcmp(role, sourceclass) != 0) {
  99.228 +      _SBLIM_TRACE(2, ("--- Reference does not match required role. Ignoring request."));
  99.229 +      goto exit;
  99.230 +   }
  99.231 +   CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_NOT_SUPPORTED, NULL);
  99.232 +
  99.233 +   /* Determine the target class from the source class. */
  99.234 +   if (strcmp(sourceclass, _LHSCLASSNAME) == 0) {
  99.235 +      sourcekeyname = _LHSKEYNAME;
  99.236 +      targetclass = _RHSCLASSNAME;
  99.237 +      targetkeyname = _RHSKEYNAME;
  99.238 +   } else if (strcmp(sourceclass, _RHSCLASSNAME) == 0) {
  99.239 +      sourcekeyname = _RHSKEYNAME;
  99.240 +      targetclass = _LHSCLASSNAME;
  99.241 +      targetkeyname = _LHSKEYNAME;
  99.242 +   } else {
  99.243 +      _SBLIM_TRACE(2, ("--- Unrecognized source class. Ignoring request."));
  99.244 +      goto exit;
  99.245 +   }
  99.246 +   _SBLIM_TRACE(2, ("--- targetclass=\"%s\"", targetclass));
  99.247 +
  99.248 +   CMPIData namedata = CMGetKey(reference, sourcekeyname, NULL);
  99.249 +   char * sourcename = CMGetCharPtr(namedata.value.string);
  99.250 +   _SBLIM_TRACE(2, ("--- sourcename=\"%s\"", sourcename));
  99.251 +
  99.252 +   /* Create an object path for the result class. */
  99.253 +   CMPIObjectPath * objectpath = CMNewObjectPath(_BROKER, namespace, targetclass, &status);
  99.254 +   if ((status.rc != CMPI_RC_OK) || CMIsNullObject(objectpath)) {
  99.255 +      _SBLIM_TRACE(1,("--- CMNewObjectPath() failed - %s", CMGetCharPtr(status.msg)));
  99.256 +      CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERROR, "Cannot create new CMPIObjectPath");
  99.257 +      goto exit;
  99.258 +   }
  99.259 +
  99.260 +   /* Get the list of all target class instances from the CIMOM. */
  99.261 +   CMPIEnumeration * instances = CBEnumInstances(_BROKER, context, objectpath, NULL, &status);
  99.262 +   if ((status.rc != CMPI_RC_OK) || CMIsNullObject(instances)) {
  99.263 +      _SBLIM_TRACE(1,("--- CBEnumInstances() failed - %s", CMGetCharPtr(status.msg)));
  99.264 +      CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERROR, "Cannot enumerate target class");
  99.265 +      goto exit;
  99.266 +   }
  99.267 +
  99.268 +   /* Return all instances that exactly match the target class and resultClass, if specified. */
  99.269 +   while (CMHasNext(instances, NULL)) {
  99.270 +      CMPIData data = CMGetNext(instances, NULL);
  99.271 +      char *class = CMGetCharPtr(CMGetClassName(CMGetObjectPath(data.value.inst,NULL), NULL));
  99.272 +      if ((strcmp(class,targetclass) == 0) && ((resultClass == NULL) || (strcmp(class,resultClass) == 0))) {
  99.273 +         /* Only return entries whose name matches the reference. */
  99.274 +         namedata = CMGetProperty(data.value.inst, targetkeyname, NULL);
  99.275 +         char * resultname = CMGetCharPtr(namedata.value.string);
  99.276 +// BUG - returning data causes crash !?!
  99.277 +_SBLIM_TRACE(2, ("--- data.value.inst=\"%s\"", CMGetCharPtr(CDToString(_BROKER, data.value.inst, NULL))));
  99.278 +//         if (strcmp(sourcename, resultname) == 0) CMReturnInstance(results, data.value.inst);
  99.279 +      }
  99.280 +   }
  99.281 +
  99.282 +   CMReturnDone(results);
  99.283 +
  99.284 +exit:
  99.285 +   _SBLIM_RETURNSTATUS(status);
  99.286 +}
  99.287 +
  99.288 +
  99.289 +// ----------------------------------------------------------------------------
  99.290 +// ReferenceNames()
  99.291 +// ----------------------------------------------------------------------------
  99.292 +static CMPIStatus ReferenceNames(
  99.293 +		CMPIAssociationMI * self,	/* [in] Handle to this provider (i.e. 'self'). */
  99.294 +		CMPIContext * context,		/* [in] Additional context info, if any. */
  99.295 +		CMPIResult * results,		/* [out] Results of this operation. */
  99.296 +		CMPIObjectPath * reference,	/* [in] Contains the source namespace, classname and object path. */
  99.297 +		const char *assocClass, 
  99.298 +		const char *role)
  99.299 +{
  99.300 +   CMPIStatus status = { CMPI_RC_OK, NULL };    /* Return status of CIM operations. */
  99.301 +   char *namespace = CMGetCharPtr(CMGetNameSpace(reference, NULL)); /* Target namespace. */
  99.302 +   char *sourceclass = CMGetCharPtr(CMGetClassName(reference, &status)); /* Class of the source reference object */
  99.303 +   char *targetclass;                           /* Class of the target object(s). */
  99.304 +
  99.305 +   char *sourcekeyname;
  99.306 +   char *targetkeyname;
  99.307 +
  99.308 +   _SBLIM_ENTER("ReferenceNames");
  99.309 +   _SBLIM_TRACE(2, ("--- self=\"%s\"", self->ft->miName));
  99.310 +   _SBLIM_TRACE(2, ("--- context=\"%s\"", CMGetCharPtr(CDToString(_BROKER, context, NULL))));
  99.311 +   _SBLIM_TRACE(2, ("--- reference=\"%s\"", CMGetCharPtr(CDToString(_BROKER, reference, NULL))));
  99.312 +   _SBLIM_TRACE(2, ("--- assocClass=\"%s\"", assocClass));
  99.313 +   _SBLIM_TRACE(2, ("--- role=\"%s\"", role));
  99.314 +   _SBLIM_TRACE(2, ("--- namespace=\"%s\"", namespace));
  99.315 +   _SBLIM_TRACE(2, ("--- sourceclass=\"%s\"", sourceclass));
  99.316 +
  99.317 +   /* Check that the requested association class, if any, is supported. */
  99.318 +   if (assocClass != NULL) {
  99.319 +      CMPIObjectPath * assoc = CMNewObjectPath(_BROKER, namespace, _ASSOCCLASS, NULL);
  99.320 +      if (!CMClassPathIsA(_BROKER, assoc, assocClass, NULL)) {
  99.321 +         _SBLIM_TRACE(2, ("--- Unrecognized association class. Ignoring request."));
  99.322 +         goto exit;
  99.323 +      }
  99.324 +   }
  99.325 +
  99.326 +   /* Check that the reference matches the required role, if any. */
  99.327 +   if ((role != NULL) && strcmp(role, sourceclass) != 0) {
  99.328 +      _SBLIM_TRACE(2, ("--- Reference does not match required role. Ignoring request."));
  99.329 +      goto exit;
  99.330 +   }
  99.331 +
  99.332 +   /* Determine the target class from the source class. */
  99.333 +   if (strcmp(sourceclass, _LHSCLASSNAME) == 0) {
  99.334 +      sourcekeyname = _LHSKEYNAME;
  99.335 +      targetclass = _RHSCLASSNAME;
  99.336 +      targetkeyname = _RHSKEYNAME;
  99.337 +   } else if (strcmp(sourceclass, _RHSCLASSNAME) == 0) {
  99.338 +      sourcekeyname = _RHSKEYNAME;
  99.339 +      targetclass = _LHSCLASSNAME;
  99.340 +      targetkeyname = _LHSKEYNAME;
  99.341 +   } else {
  99.342 +      _SBLIM_TRACE(2, ("--- Unrecognized source class. Ignoring request."));
  99.343 +      goto exit;
  99.344 +   }
  99.345 +   _SBLIM_TRACE(2, ("--- targetclass=\"%s\"", targetclass));
  99.346 +
  99.347 +   CMPIData namedata = CMGetKey(reference, sourcekeyname, NULL);
  99.348 +   char * sourcename = CMGetCharPtr(namedata.value.string);
  99.349 +   _SBLIM_TRACE(2, ("--- sourcename=\"%s\"", sourcename));
  99.350 +
  99.351 +   /* Create an object path for the result class. */
  99.352 +   CMPIObjectPath * objectpath = CMNewObjectPath(_BROKER, namespace, targetclass, &status);
  99.353 +   if ((status.rc != CMPI_RC_OK) || CMIsNullObject(objectpath)) {
  99.354 +      _SBLIM_TRACE(1,("--- CMNewObjectPath() failed - %s", CMGetCharPtr(status.msg)));
  99.355 +      CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERROR, "Cannot create new CMPIObjectPath");
  99.356 +      goto exit;
  99.357 +   }
  99.358 +
  99.359 +   /* Get the list of all target class object paths from the CIMOM. */
  99.360 +   CMPIEnumeration * objectpaths = CBEnumInstanceNames(_BROKER, context, objectpath, &status);
  99.361 +   if ((status.rc != CMPI_RC_OK) || CMIsNullObject(objectpaths)) {
  99.362 +      _SBLIM_TRACE(1,("--- CBEnumInstanceNames() failed - %s", CMGetCharPtr(status.msg)));
  99.363 +      CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERROR, "Cannot enumerate target class");
  99.364 +      goto exit;
  99.365 +   }
  99.366 +
  99.367 +   /* Return all object paths that exactly match the target class and resultClass, if specified. */
  99.368 +   while (CMHasNext(objectpaths, NULL)) {
  99.369 +      CMPIData data = CMGetNext(objectpaths, NULL);
  99.370 +      char *class = CMGetCharPtr(CMGetClassName(data.value.ref, NULL));
  99.371 +      if (strcmp(class,targetclass) == 0) {
  99.372 +
  99.373 +         /* Create an object path for the association. */
  99.374 +         CMPIObjectPath * refobjectpath = CMNewObjectPath(_BROKER, namespace, _ASSOCCLASS, &status);
  99.375 +         if ((status.rc != CMPI_RC_OK) || CMIsNullObject(refobjectpath)) {
  99.376 +            _SBLIM_TRACE(1,("--- CMNewObjectPath() failed - %s", CMGetCharPtr(status.msg)));
  99.377 +            CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERROR, "Cannot create new CMPIObjectPath");
  99.378 +            goto exit;
  99.379 +         }
  99.380 +
  99.381 +         /* Assign the references in the association appropriately. */
  99.382 +         if (strcmp(sourceclass, _RHSCLASSNAME) == 0) {
  99.383 +            CMAddKey(refobjectpath, _RHSPROPERTYNAME, &reference, CMPI_ref);
  99.384 +            CMAddKey(refobjectpath, _LHSPROPERTYNAME, &data.value.ref, CMPI_ref);
  99.385 +         } else {
  99.386 +            CMAddKey(refobjectpath, _RHSPROPERTYNAME, &data.value.ref, CMPI_ref);
  99.387 +            CMAddKey(refobjectpath, _LHSPROPERTYNAME, &reference, CMPI_ref);
  99.388 +         }
  99.389 +
  99.390 +         /* Only return entries whose name matches the reference. */
  99.391 +         namedata = CMGetKey(data.value.ref, targetkeyname, &status);
  99.392 +         char * resultname = CMGetCharPtr(namedata.value.string);
  99.393 +         if (strcmp(sourcename, resultname) == 0) CMReturnObjectPath(results, refobjectpath);
  99.394 +      }
  99.395 +   }
  99.396 +
  99.397 +exit:
  99.398 +   _SBLIM_RETURNSTATUS(status);
  99.399 +}
  99.400 +
  99.401 +
  99.402 +// ----------------------------------------------------------------------------
  99.403 +// References()
  99.404 +// ----------------------------------------------------------------------------
  99.405 +static CMPIStatus References(
  99.406 +		CMPIAssociationMI * self,	/* [in] Handle to this provider (i.e. 'self'). */
  99.407 +		CMPIContext * context,		/* [in] Additional context info, if any. */
  99.408 +		CMPIResult * results,		/* [out] Results of this operation. */
  99.409 +		CMPIObjectPath * reference,	/* [in] Contains the namespace, classname and desired object path. */
  99.410 +		const char *assocClass,
  99.411 +		const char *role,
  99.412 +		char **properties)		/* [in] List of desired properties (NULL=all). */
  99.413 +{
  99.414 +   CMPIStatus status = { CMPI_RC_OK, NULL };    /* Return status of CIM operations. */
  99.415 +   char *namespace = CMGetCharPtr(CMGetNameSpace(reference, NULL)); /* Target namespace. */
  99.416 +   char *sourceclass = CMGetCharPtr(CMGetClassName(reference, &status)); /* Class of the source reference object */
  99.417 +   char *targetclass;                           /* Class of the target object(s). */
  99.418 +
  99.419 +   char *sourcekeyname;
  99.420 +   char *targetkeyname;
  99.421 +
  99.422 +   _SBLIM_ENTER("References");
  99.423 +   _SBLIM_TRACE(2, ("--- self=\"%s\"", self->ft->miName));
  99.424 +   _SBLIM_TRACE(2, ("--- context=\"%s\"", CMGetCharPtr(CDToString(_BROKER, context, NULL))));
  99.425 +   _SBLIM_TRACE(2, ("--- reference=\"%s\"", CMGetCharPtr(CDToString(_BROKER, reference, NULL))));
  99.426 +   _SBLIM_TRACE(2, ("--- assocClass=\"%s\"", assocClass));
  99.427 +   _SBLIM_TRACE(2, ("--- role=\"%s\"", role));
  99.428 +   _SBLIM_TRACE(2, ("--- namespace=\"%s\"", namespace));
  99.429 +   _SBLIM_TRACE(2, ("--- sourceclass=\"%s\"", sourceclass));
  99.430 +
  99.431 +   /* Check that the requested association class, if any, is supported. */
  99.432 +   if (assocClass != NULL) {
  99.433 +      CMPIObjectPath * assoc = CMNewObjectPath(_BROKER, namespace, _ASSOCCLASS, NULL);
  99.434 +      if (!CMClassPathIsA(_BROKER, assoc, assocClass, NULL)) {
  99.435 +         _SBLIM_TRACE(2, ("--- Unrecognized association class. Ignoring request."));
  99.436 +         goto exit;
  99.437 +      }
  99.438 +   }
  99.439 +
  99.440 +   /* Check that the reference matches the required role, if any. */
  99.441 +   if ((role != NULL) && strcmp(role, sourceclass) != 0) {
  99.442 +      _SBLIM_TRACE(2, ("--- Reference does not match required role. Ignoring request."));
  99.443 +      goto exit;
  99.444 +   }
  99.445 +
  99.446 +   /* Determine the target class from the source class. */
  99.447 +   if (strcmp(sourceclass, _LHSCLASSNAME) == 0) {
  99.448 +      sourcekeyname = _LHSKEYNAME;
  99.449 +      targetclass = _RHSCLASSNAME;
  99.450 +      targetkeyname = _RHSKEYNAME;
  99.451 +   } else if (strcmp(sourceclass, _RHSCLASSNAME) == 0) {
  99.452 +      sourcekeyname = _RHSKEYNAME;
  99.453 +      targetclass = _LHSCLASSNAME;
  99.454 +      targetkeyname = _LHSKEYNAME;
  99.455 +   } else {
  99.456 +      _SBLIM_TRACE(2, ("--- Unrecognized source class. Ignoring request."));
  99.457 +      goto exit;
  99.458 +   }
  99.459 +   _SBLIM_TRACE(2, ("--- targetclass=\"%s\"", targetclass));
  99.460 +
  99.461 +   CMPIData namedata = CMGetKey(reference, sourcekeyname, NULL);
  99.462 +   char * sourcename = CMGetCharPtr(namedata.value.string);
  99.463 +   _SBLIM_TRACE(2, ("--- sourcename=\"%s\"", sourcename));
  99.464 +
  99.465 +   /* Create an object path for the result class. */
  99.466 +   CMPIObjectPath * objectpath = CMNewObjectPath(_BROKER, namespace, targetclass, &status);
  99.467 +   if ((status.rc != CMPI_RC_OK) || CMIsNullObject(objectpath)) {
  99.468 +      _SBLIM_TRACE(1,("--- CMNewObjectPath() failed - %s", CMGetCharPtr(status.msg)));
  99.469 +      CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERROR, "Cannot create new CMPIObjectPath");
  99.470 +      goto exit;
  99.471 +   }
  99.472 +
  99.473 +   /* Get the list of all target class object paths from the CIMOM. */
  99.474 +   CMPIEnumeration * objectpaths = CBEnumInstanceNames(_BROKER, context, objectpath, &status);
  99.475 +   if ((status.rc != CMPI_RC_OK) || CMIsNullObject(objectpaths)) {
  99.476 +      _SBLIM_TRACE(1,("--- CBEnumInstanceNames() failed - %s", CMGetCharPtr(status.msg)));
  99.477 +      CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERROR, "Cannot enumerate target class");
  99.478 +      goto exit;
  99.479 +   }
  99.480 +
  99.481 +   /* Return all object paths that exactly match the target class and resultClass, if specified. */
  99.482 +   while (CMHasNext(objectpaths, NULL)) {
  99.483 +      CMPIData data = CMGetNext(objectpaths, NULL);
  99.484 +      char *class = CMGetCharPtr(CMGetClassName(data.value.ref, NULL));
  99.485 +      if (strcmp(class,targetclass) == 0) {
  99.486 +
  99.487 +         /* Create an instance for the association. */
  99.488 +         CMPIInstance * refinstance = _CMNewInstance(_BROKER, namespace, _ASSOCCLASS, &status);
  99.489 +         if ((status.rc != CMPI_RC_OK) || CMIsNullObject(refinstance)) {
  99.490 +            _SBLIM_TRACE(1,("--- CMNewInstance() failed - %s", CMGetCharPtr(status.msg)));
  99.491 +            CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERROR, "Cannot create new CMPIInstance");
  99.492 +            goto exit;
  99.493 +         }
  99.494 +
  99.495 +         /* Assign the references in the association appropriately. */
  99.496 +         if (strcmp(sourceclass, _RHSCLASSNAME) == 0) {
  99.497 +            CMSetProperty(refinstance, _RHSPROPERTYNAME, &reference, CMPI_ref);
  99.498 +            CMSetProperty(refinstance, _LHSPROPERTYNAME, &data.value.ref, CMPI_ref);
  99.499 +         } else {
  99.500 +            CMSetProperty(refinstance, _RHSPROPERTYNAME, &data.value.ref, CMPI_ref);
  99.501 +            CMSetProperty(refinstance, _LHSPROPERTYNAME, &reference, CMPI_ref);
  99.502 +         }
  99.503 +
  99.504 +         /* Only return entries whose name matches the reference. */
  99.505 +         namedata = CMGetKey(data.value.ref, targetkeyname, &status);
  99.506 +         char * resultname = CMGetCharPtr(namedata.value.string);
  99.507 +         if (strcmp(sourcename, resultname) == 0) CMReturnInstance(results, refinstance);
  99.508 +      }
  99.509 +   }
  99.510 +exit:
  99.511 +   _SBLIM_RETURNSTATUS(status);
  99.512 +}
  99.513 +
  99.514 +
  99.515 +// ----------------------------------------------------------------------------
  99.516 +// AssociationInitialize()
  99.517 +// Perform any necessary initialization immediately after this provider is
  99.518 +// first loaded.
  99.519 +// ----------------------------------------------------------------------------
  99.520 +static void AssociationInitialize(
  99.521 +		CMPIAssociationMI * self,	/* [in] Handle to this provider (i.e. 'self'). */
  99.522 +		CMPIContext * context)		/* [in] Additional context info, if any. */
  99.523 +{
  99.524 +   _SBLIM_ENTER("AssociationInitialize");
  99.525 +   _SBLIM_TRACE(2, ("--- self=\"%s\"", self->ft->miName));
  99.526 +   _SBLIM_TRACE(2, ("--- context=\"%s\"", CMGetCharPtr(CDToString(_BROKER, context, NULL))));
  99.527 +
  99.528 +   /* Nothing needs to be done to initialize this provider */
  99.529 +
  99.530 +exit:
  99.531 +   _SBLIM_RETURN();
  99.532 +}
  99.533 +
  99.534 +
  99.535 +// ============================================================================
  99.536 +// CMPI ASSOCIATION PROVIDER FUNCTION TABLE SETUP
  99.537 +// ============================================================================
  99.538 +CMAssociationMIStub( , Xen_CSElementSettingDataProvider, _BROKER, AssociationInitialize(&mi, ctx));
   100.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   100.2 +++ b/src/Xen_CSSettingDataComponent.c	Wed Mar 22 14:05:14 2006 -0700
   100.3 @@ -0,0 +1,555 @@
   100.4 +// Copyright (C) 2006 IBM Corporation
   100.5 +//
   100.6 +//    This library is free software; you can redistribute it and/or
   100.7 +//    modify it under the terms of the GNU Lesser General Public
   100.8 +//    License as published by the Free Software Foundation; either
   100.9 +//    version 2.1 of the License, or (at your option) any later version.
  100.10 +//
  100.11 +//    This library is distributed in the hope that it will be useful,
  100.12 +//    but WITHOUT ANY WARRANTY; without even the implied warranty of
  100.13 +//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  100.14 +//    Lesser General Public License for more details.
  100.15 +//
  100.16 +//    You should have received a copy of the GNU Lesser General Public
  100.17 +//    License along with this library; if not, write to the Free Software
  100.18 +//    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  100.19 +// ============================================================================
  100.20 +// Authors:       Dr. Gareth S. Bestor, <bestor@us.ibm.com>
  100.21 +// Contributors:
  100.22 +// Description:
  100.23 +// ============================================================================
  100.24 +
  100.25 +/* Include the required CMPI data types, function headers, and macros */
  100.26 +#include "cmpidt.h"
  100.27 +#include "cmpift.h"
  100.28 +#include "cmpimacs.h"
  100.29 +
  100.30 +
  100.31 +// ----------------------------------------------------------------------------
  100.32 +// COMMON GLOBAL VARIABLES
  100.33 +// ----------------------------------------------------------------------------
  100.34 +
  100.35 +/* Handle to the CIM broker. Initialized when the provider lib is loaded. */
  100.36 +static CMPIBroker *_BROKER;
  100.37 +
  100.38 +/* Include utility functions */
  100.39 +#include "cmpiutil.h"
  100.40 +
  100.41 +/* Include _SBLIM_TRACE() logging support */
  100.42 +#include "cmpitrace.h"
  100.43 +
  100.44 +
  100.45 +// ============================================================================
  100.46 +// CMPI ASSOCIATION PROVIDER FUNCTION TABLE
  100.47 +// ============================================================================
  100.48 +
  100.49 +// ----------------------------------------------------------------------------
  100.50 +// Info for the class supported by the association provider
  100.51 +// ----------------------------------------------------------------------------
  100.52 +                                                                                                                                 
  100.53 +/* Name of the left and right hand side classes of this association. */
  100.54 +static char * _ASSOCCLASS = "Xen_CSSettingDataComponent";
  100.55 +static char * _LHSCLASSNAME = "Xen_VirtualDeviceSettingData";
  100.56 +static char * _RHSCLASSNAME = "Xen_ComputerSystemSettingData";
  100.57 +static char * _LHSPROPERTYNAME = "PartComponent"; 
  100.58 +static char * _RHSPROPERTYNAME = "GroupComponent";
  100.59 +static char * _LHSKEYNAME = "InstanceID";
  100.60 +static char * _RHSKEYNAME = "InstanceID";
  100.61 +
  100.62 +// ----------------------------------------------------------------------------
  100.63 +// AssociationCleanup()
  100.64 +// Perform any necessary cleanup immediately before this provider is unloaded.
  100.65 +// ----------------------------------------------------------------------------
  100.66 +static CMPIStatus AssociationCleanup(
  100.67 +		CMPIAssociationMI * self,	/* [in] Handle to this provider (i.e. 'self'). */
  100.68 +		CMPIContext * context)		/* [in] Additional context info, if any. */
  100.69 +{
  100.70 +   CMPIStatus status = { CMPI_RC_OK, NULL };	/* Return status of CIM operations. */
  100.71 +
  100.72 +   _SBLIM_ENTER("AssociationCleanup");
  100.73 +   _SBLIM_TRACE(2, ("--- self=\"%s\"", self->ft->miName));
  100.74 +   _SBLIM_TRACE(2, ("--- context=\"%s\"", CMGetCharPtr(CDToString(_BROKER, context, NULL))));
  100.75 +
  100.76 +   /* Nothing needs to be done for cleanup. */
  100.77 +
  100.78 +exit:
  100.79 +   _SBLIM_RETURNSTATUS(status);
  100.80 +}
  100.81 +
  100.82 +
  100.83 +// ----------------------------------------------------------------------------
  100.84 +// AssociatorNames()
  100.85 +// ----------------------------------------------------------------------------
  100.86 +static CMPIStatus AssociatorNames(
  100.87 +		CMPIAssociationMI * self,	/* [in] Handle to this provider (i.e. 'self'). */
  100.88 +		CMPIContext * context,		/* [in] Additional context info, if any. */
  100.89 +		CMPIResult * results,		/* [out] Results of this operation. */
  100.90 +		CMPIObjectPath * reference,	/* [in] Contains source namespace, classname and object path. */
  100.91 +		const char * assocClass,
  100.92 +		const char * resultClass,
  100.93 +		const char * role,
  100.94 +		const char * resultRole)
  100.95 +{
  100.96 +   CMPIStatus status = { CMPI_RC_OK, NULL };    /* Return status of CIM operations. */
  100.97 +   char *namespace = CMGetCharPtr(CMGetNameSpace(reference, NULL)); /* Target namespace. */
  100.98 +   char *sourceclass = CMGetCharPtr(CMGetClassName(reference, &status)); /* Class of the source reference object */
  100.99 +   char *targetclass; 				/* Class of the target object(s). */
 100.100 +
 100.101 +   char *sourcekeyname;
 100.102 +   char *targetkeyname;
 100.103 +
 100.104 +   _SBLIM_ENTER("AssociatorNames");
 100.105 +   _SBLIM_TRACE(2, ("--- self=\"%s\"", self->ft->miName));
 100.106 +   _SBLIM_TRACE(2, ("--- context=\"%s\"", CMGetCharPtr(CDToString(_BROKER, context, NULL))));
 100.107 +   _SBLIM_TRACE(2, ("--- reference=\"%s\"", CMGetCharPtr(CDToString(_BROKER, reference, NULL))));
 100.108 +   _SBLIM_TRACE(2, ("--- assocClass=\"%s\"", assocClass));
 100.109 +   _SBLIM_TRACE(2, ("--- resultClass=\"%s\"", resultClass));
 100.110 +   _SBLIM_TRACE(2, ("--- role=\"%s\"", role));
 100.111 +   _SBLIM_TRACE(2, ("--- resultRole=\"%s\"", resultRole));
 100.112 +   _SBLIM_TRACE(2, ("--- namespace=\"%s\"", namespace));
 100.113 +   _SBLIM_TRACE(2, ("--- sourceclass=\"%s\"", sourceclass));
 100.114 +
 100.115 +   /* Check that the requested association class, if any, is supported. */
 100.116 +   if (assocClass != NULL) {
 100.117 +      CMPIObjectPath * assoc = CMNewObjectPath(_BROKER, namespace, _ASSOCCLASS, NULL);
 100.118 +      if (!CMClassPathIsA(_BROKER, assoc, assocClass, NULL)) {
 100.119 +         _SBLIM_TRACE(2, ("--- Unrecognized association class. Ignoring request."));
 100.120 +         goto exit;
 100.121 +      }
 100.122 +   }
 100.123 +
 100.124 +   /* Check that the reference matches the required role, if any. */
 100.125 +   if ((role != NULL) && strcmp(role, sourceclass) != 0) {
 100.126 +      _SBLIM_TRACE(2, ("--- Reference does not match required role. Ignoring request."));
 100.127 +      goto exit;
 100.128 +   }
 100.129 +
 100.130 +   /* Determine the target class from the source class. */
 100.131 +//   if (strcmp(sourceclass, _LHSCLASSNAME) == 0) {
 100.132 +   CMPIObjectPath * source = CMNewObjectPath(_BROKER, namespace, sourceclass, NULL);
 100.133 +   if (CMClassPathIsA(_BROKER, source, _LHSCLASSNAME, NULL)) {
 100.134 +      sourcekeyname = _LHSKEYNAME;
 100.135 +      targetclass = _RHSCLASSNAME;
 100.136 +      targetkeyname = _RHSKEYNAME;
 100.137 +//   } else if (strcmp(sourceclass, _RHSCLASSNAME) == 0) {
 100.138 +   } else if (CMClassPathIsA(_BROKER, source, _RHSCLASSNAME, NULL)) {
 100.139 +      sourcekeyname = _RHSKEYNAME;
 100.140 +      targetclass = _LHSCLASSNAME;
 100.141 +      targetkeyname = _LHSKEYNAME;
 100.142 +   } else {
 100.143 +      _SBLIM_TRACE(2, ("--- Unrecognized source class. Ignoring request."));
 100.144 +      goto exit;
 100.145 +   }
 100.146 +   _SBLIM_TRACE(2, ("--- targetclass=\"%s\"", targetclass));
 100.147 +
 100.148 +   CMPIData namedata = CMGetKey(reference, sourcekeyname, NULL);
 100.149 +   char * sourcename = CMGetCharPtr(namedata.value.string);
 100.150 +   _SBLIM_TRACE(2, ("--- sourcename=\"%s\"", sourcename));
 100.151 +
 100.152 +   /* Create an object path for the result class. */
 100.153 +   CMPIObjectPath * objectpath = CMNewObjectPath(_BROKER, namespace, targetclass, &status);
 100.154 +   if ((status.rc != CMPI_RC_OK) || CMIsNullObject(objectpath)) {
 100.155 +      _SBLIM_TRACE(1,("--- CMNewObjectPath() failed - %s", CMGetCharPtr(status.msg)));
 100.156 +      CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERROR, "Cannot create new CMPIObjectPath");
 100.157 +      goto exit;
 100.158 +   }
 100.159 +
 100.160 +   /* Get the list of all target class object paths from the CIMOM. */
 100.161 +   CMPIEnumeration * objectpaths = CBEnumInstanceNames(_BROKER, context, objectpath, &status);
 100.162 +   if ((status.rc != CMPI_RC_OK) || CMIsNullObject(objectpaths)) {
 100.163 +      _SBLIM_TRACE(1,("--- CBEnumInstanceNames() failed - %s", CMGetCharPtr(status.msg)));
 100.164 +      CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERROR, "Cannot enumerate target class");
 100.165 +      goto exit;
 100.166 +   }
 100.167 +
 100.168 +   /* Return all object paths that exactly match the target class and resultClass, if specified. */
 100.169 +   while (CMHasNext(objectpaths, NULL)) {
 100.170 +      CMPIData data = CMGetNext(objectpaths, NULL);
 100.171 +      char *class = CMGetCharPtr(CMGetClassName(data.value.ref, NULL));
 100.172 +      CMPIObjectPath * result = CMNewObjectPath(_BROKER, namespace, class, NULL);
 100.173 +//      if ((strcmp(class,targetclass) == 0) && ((resultClass == NULL) || (strcmp(class,resultClass) == 0))) {
 100.174 +      if (CMClassPathIsA(_BROKER, result, targetclass, NULL) && ((resultClass == NULL) || (strcmp(class,resultClass) == 0))) {
 100.175 +         /* Only return entries whose name matches the reference. */
 100.176 +         namedata = CMGetKey(data.value.ref, targetkeyname, &status);
 100.177 +         char * resultname = CMGetCharPtr(namedata.value.string);
 100.178 +         if (strcmp(sourcename, resultname) == 0) CMReturnObjectPath(results, data.value.ref);
 100.179 +      }
 100.180 +   }
 100.181 +
 100.182 +   CMReturnDone(results);
 100.183 +
 100.184 +exit:
 100.185 +   _SBLIM_RETURNSTATUS(status);
 100.186 +}
 100.187 +
 100.188 +
 100.189 +// ----------------------------------------------------------------------------
 100.190 +// Associators()
 100.191 +// ----------------------------------------------------------------------------
 100.192 +static CMPIStatus Associators(
 100.193 +		CMPIAssociationMI * self,	/* [in] Handle to this provider (i.e. 'self'). */
 100.194 +		CMPIContext * context,		/* [in] Additional context info, if any. */
 100.195 +		CMPIResult * results,		/* [out] Results of this operation. */
 100.196 +		CMPIObjectPath * reference,	/* [in] Contains the source namespace, classname and object path. */
 100.197 +		const char *assocClass,
 100.198 +		const char *resultClass,
 100.199 +		const char *role,
 100.200 +		const char *resultRole,
 100.201 +		char ** properties)		/* [in] List of desired properties (NULL=all). */
 100.202 +{
 100.203 +   CMPIStatus status = { CMPI_RC_OK, NULL };    /* Return status of CIM operations. */
 100.204 +   char *namespace = CMGetCharPtr(CMGetNameSpace(reference, NULL)); /* Target namespace. */
 100.205 +   char *sourceclass = CMGetCharPtr(CMGetClassName(reference, &status)); /* Class of the source reference object */
 100.206 +   char *targetclass;                           /* Class of the target object(s). */
 100.207 +
 100.208 +   char *sourcekeyname;
 100.209 +   char *targetkeyname;
 100.210 +
 100.211 +   _SBLIM_ENTER("Associators");
 100.212 +   _SBLIM_TRACE(2, ("--- self=\"%s\"", self->ft->miName));
 100.213 +   _SBLIM_TRACE(2, ("--- context=\"%s\"", CMGetCharPtr(CDToString(_BROKER, context, NULL))));
 100.214 +   _SBLIM_TRACE(2, ("--- reference=\"%s\"", CMGetCharPtr(CDToString(_BROKER, reference, NULL))));
 100.215 +   _SBLIM_TRACE(2, ("--- assocClass=\"%s\"", assocClass));
 100.216 +   _SBLIM_TRACE(2, ("--- resultClass=\"%s\"", resultClass));
 100.217 +   _SBLIM_TRACE(2, ("--- role=\"%s\"", role));
 100.218 +   _SBLIM_TRACE(2, ("--- resultRole=\"%s\"", resultRole));
 100.219 +   _SBLIM_TRACE(2, ("--- namespace=\"%s\"", namespace));
 100.220 +   _SBLIM_TRACE(2, ("--- sourceclass=\"%s\"", sourceclass));
 100.221 +
 100.222 +   /* Check that the requested association class, if any, is supported. */
 100.223 +   if (assocClass != NULL) {
 100.224 +      CMPIObjectPath * assoc = CMNewObjectPath(_BROKER, namespace, _ASSOCCLASS, NULL);
 100.225 +      if (!CMClassPathIsA(_BROKER, assoc, assocClass, NULL)) {
 100.226 +         _SBLIM_TRACE(2, ("--- Unrecognized association class. Ignoring request."));
 100.227 +         goto exit;
 100.228 +      }
 100.229 +   }
 100.230 +
 100.231 +   /* Check that the reference matches the required role, if any. */
 100.232 +   if ((role != NULL) && strcmp(role, sourceclass) != 0) {
 100.233 +      _SBLIM_TRACE(2, ("--- Reference does not match required role. Ignoring request."));
 100.234 +      goto exit;
 100.235 +   }
 100.236 +   CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_NOT_SUPPORTED, NULL);
 100.237 +
 100.238 +   /* Determine the target class from the source class. */
 100.239 +//   if (strcmp(sourceclass, _LHSCLASSNAME) == 0) {
 100.240 +   CMPIObjectPath * source = CMNewObjectPath(_BROKER, namespace, sourceclass, NULL);
 100.241 +   if (CMClassPathIsA(_BROKER, source, _LHSCLASSNAME, NULL)) {
 100.242 +      sourcekeyname = _LHSKEYNAME;
 100.243 +      targetclass = _RHSCLASSNAME;
 100.244 +      targetkeyname = _RHSKEYNAME;
 100.245 +//   } else if (strcmp(sourceclass, _RHSCLASSNAME) == 0) {
 100.246 +   } else if (CMClassPathIsA(_BROKER, source, _RHSCLASSNAME, NULL)) {
 100.247 +      sourcekeyname = _RHSKEYNAME;
 100.248 +      targetclass = _LHSCLASSNAME;
 100.249 +      targetkeyname = _LHSKEYNAME;
 100.250 +   } else {
 100.251 +      _SBLIM_TRACE(2, ("--- Unrecognized source class. Ignoring request."));
 100.252 +      goto exit;
 100.253 +   }
 100.254 +   _SBLIM_TRACE(2, ("--- targetclass=\"%s\"", targetclass));
 100.255 +
 100.256 +   CMPIData namedata = CMGetKey(reference, sourcekeyname, NULL);
 100.257 +   char * sourcename = CMGetCharPtr(namedata.value.string);
 100.258 +   _SBLIM_TRACE(2, ("--- sourcename=\"%s\"", sourcename));
 100.259 +
 100.260 +   /* Create an object path for the result class. */
 100.261 +   CMPIObjectPath * objectpath = CMNewObjectPath(_BROKER, namespace, targetclass, &status);
 100.262 +   if ((status.rc != CMPI_RC_OK) || CMIsNullObject(objectpath)) {
 100.263 +      _SBLIM_TRACE(1,("--- CMNewObjectPath() failed - %s", CMGetCharPtr(status.msg)));
 100.264 +      CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERROR, "Cannot create new CMPIObjectPath");
 100.265 +      goto exit;
 100.266 +   }
 100.267 +
 100.268 +   /* Get the list of all target class instances from the CIMOM. */
 100.269 +   CMPIEnumeration * instances = CBEnumInstances(_BROKER, context, objectpath, NULL, &status);
 100.270 +   if ((status.rc != CMPI_RC_OK) || CMIsNullObject(instances)) {
 100.271 +      _SBLIM_TRACE(1,("--- CBEnumInstances() failed - %s", CMGetCharPtr(status.msg)));
 100.272 +      CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERROR, "Cannot enumerate target class");
 100.273 +      goto exit;
 100.274 +   }
 100.275 +
 100.276 +   /* Return all instances that exactly match the target class and resultClass, if specified. */
 100.277 +   while (CMHasNext(instances, NULL)) {
 100.278 +      CMPIData data = CMGetNext(instances, NULL);
 100.279 +      char *class = CMGetCharPtr(CMGetClassName(CMGetObjectPath(data.value.inst,NULL), NULL));
 100.280 +//      if ((strcmp(class,targetclass) == 0) && ((resultClass == NULL) || (strcmp(class,resultClass) == 0))) {
 100.281 +      CMPIObjectPath * result = CMNewObjectPath(_BROKER, namespace, class, NULL);
 100.282 +      if (CMClassPathIsA(_BROKER, result, targetclass, NULL) && ((resultClass == NULL) || (strcmp(class,resultClass) == 0))) {
 100.283 +         /* Only return entries whose name matches the reference. */
 100.284 +         namedata = CMGetProperty(data.value.inst, targetkeyname, NULL);
 100.285 +         char * resultname = CMGetCharPtr(namedata.value.string);
 100.286 +// BUG - returning data causes crash !?!
 100.287 +_SBLIM_TRACE(2, ("--- data.value.inst=\"%s\"", CMGetCharPtr(CDToString(_BROKER, data.value.inst, NULL))));
 100.288 +//         if (strcmp(sourcename, resultname) == 0) CMReturnInstance(results, data.value.inst);
 100.289 +      }
 100.290 +   }
 100.291 +
 100.292 +   CMReturnDone(results);
 100.293 +
 100.294 +exit:
 100.295 +   _SBLIM_RETURNSTATUS(status);
 100.296 +}
 100.297 +
 100.298 +
 100.299 +// ----------------------------------------------------------------------------
 100.300 +// ReferenceNames()
 100.301 +// ----------------------------------------------------------------------------
 100.302 +static CMPIStatus ReferenceNames(
 100.303 +		CMPIAssociationMI * self,	/* [in] Handle to this provider (i.e. 'self'). */
 100.304 +		CMPIContext * context,		/* [in] Additional context info, if any. */
 100.305 +		CMPIResult * results,		/* [out] Results of this operation. */
 100.306 +		CMPIObjectPath * reference,	/* [in] Contains the source namespace, classname and object path. */
 100.307 +		const char *assocClass, 
 100.308 +		const char *role)
 100.309 +{
 100.310 +   CMPIStatus status = { CMPI_RC_OK, NULL };    /* Return status of CIM operations. */
 100.311 +   char *namespace = CMGetCharPtr(CMGetNameSpace(reference, NULL)); /* Target namespace. */
 100.312 +   char *sourceclass = CMGetCharPtr(CMGetClassName(reference, &status)); /* Class of the source reference object */
 100.313 +   char *targetclass;                           /* Class of the target object(s). */
 100.314 +
 100.315 +   char *sourcekeyname;
 100.316 +   char *targetkeyname;
 100.317 +
 100.318 +   _SBLIM_ENTER("ReferenceNames");
 100.319 +   _SBLIM_TRACE(2, ("--- self=\"%s\"", self->ft->miName));
 100.320 +   _SBLIM_TRACE(2, ("--- context=\"%s\"", CMGetCharPtr(CDToString(_BROKER, context, NULL))));
 100.321 +   _SBLIM_TRACE(2, ("--- reference=\"%s\"", CMGetCharPtr(CDToString(_BROKER, reference, NULL))));
 100.322 +   _SBLIM_TRACE(2, ("--- assocClass=\"%s\"", assocClass));
 100.323 +   _SBLIM_TRACE(2, ("--- role=\"%s\"", role));
 100.324 +   _SBLIM_TRACE(2, ("--- namespace=\"%s\"", namespace));
 100.325 +   _SBLIM_TRACE(2, ("--- sourceclass=\"%s\"", sourceclass));
 100.326 +
 100.327 +   /* Check that the requested association class, if any, is supported. */
 100.328 +   if (assocClass != NULL) {
 100.329 +      CMPIObjectPath * assoc = CMNewObjectPath(_BROKER, namespace, _ASSOCCLASS, NULL);
 100.330 +      if (!CMClassPathIsA(_BROKER, assoc, assocClass, NULL)) {
 100.331 +         _SBLIM_TRACE(2, ("--- Unrecognized association class. Ignoring request."));
 100.332 +         goto exit;
 100.333 +      }
 100.334 +   }
 100.335 +
 100.336 +   /* Check that the reference matches the required role, if any. */
 100.337 +   if ((role != NULL) && strcmp(role, sourceclass) != 0) {
 100.338 +      _SBLIM_TRACE(2, ("--- Reference does not match required role. Ignoring request."));
 100.339 +      goto exit;
 100.340 +   }
 100.341 +
 100.342 +   /* Determine the target class from the source class. */
 100.343 +//   if (strcmp(sourceclass, _LHSCLASSNAME) == 0) {
 100.344 +   CMPIObjectPath * source = CMNewObjectPath(_BROKER, namespace, sourceclass, NULL);
 100.345 +   if (CMClassPathIsA(_BROKER, source, _LHSCLASSNAME, NULL)) {
 100.346 +      sourcekeyname = _LHSKEYNAME;
 100.347 +      targetclass = _RHSCLASSNAME;
 100.348 +      targetkeyname = _RHSKEYNAME;
 100.349 +//   } else if (strcmp(sourceclass, _RHSCLASSNAME) == 0) {
 100.350 +   } else if (CMClassPathIsA(_BROKER, source, _RHSCLASSNAME, NULL)) {
 100.351 +      sourcekeyname = _RHSKEYNAME;
 100.352 +      targetclass = _LHSCLASSNAME;
 100.353 +      targetkeyname = _LHSKEYNAME;
 100.354 +   } else {
 100.355 +      _SBLIM_TRACE(2, ("--- Unrecognized source class. Ignoring request."));
 100.356 +      goto exit;
 100.357 +   }
 100.358 +   _SBLIM_TRACE(2, ("--- targetclass=\"%s\"", targetclass));
 100.359 +
 100.360 +   CMPIData namedata = CMGetKey(reference, sourcekeyname, NULL);
 100.361 +   char * sourcename = CMGetCharPtr(namedata.value.string);
 100.362 +   _SBLIM_TRACE(2, ("--- sourcename=\"%s\"", sourcename));
 100.363 +
 100.364 +   /* Create an object path for the result class. */
 100.365 +   CMPIObjectPath * objectpath = CMNewObjectPath(_BROKER, namespace, targetclass, &status);
 100.366 +   if ((status.rc != CMPI_RC_OK) || CMIsNullObject(objectpath)) {
 100.367 +      _SBLIM_TRACE(1,("--- CMNewObjectPath() failed - %s", CMGetCharPtr(status.msg)));
 100.368 +      CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERROR, "Cannot create new CMPIObjectPath");
 100.369 +      goto exit;
 100.370 +   }
 100.371 +
 100.372 +   /* Get the list of all target class object paths from the CIMOM. */
 100.373 +   CMPIEnumeration * objectpaths = CBEnumInstanceNames(_BROKER, context, objectpath, &status);
 100.374 +   if ((status.rc != CMPI_RC_OK) || CMIsNullObject(objectpaths)) {
 100.375 +      _SBLIM_TRACE(1,("--- CBEnumInstanceNames() failed - %s", CMGetCharPtr(status.msg)));
 100.376 +      CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERROR, "Cannot enumerate target class");
 100.377 +      goto exit;
 100.378 +   }
 100.379 +
 100.380 +   /* Return all object paths that exactly match the target class and resultClass, if specified. */
 100.381 +   while (CMHasNext(objectpaths, NULL)) {
 100.382 +      CMPIData data = CMGetNext(objectpaths, NULL);
 100.383 +      char *class = CMGetCharPtr(CMGetClassName(data.value.ref, NULL));
 100.384 +//      if (strcmp(class,targetclass) == 0) {
 100.385 +      CMPIObjectPath * result = CMNewObjectPath(_BROKER, namespace, class, NULL);
 100.386 +      if (CMClassPathIsA(_BROKER, result, targetclass, NULL)) {
 100.387 +
 100.388 +         /* Create an object path for the association. */
 100.389 +         CMPIObjectPath * refobjectpath = CMNewObjectPath(_BROKER, namespace, _ASSOCCLASS, &status);
 100.390 +         if ((status.rc != CMPI_RC_OK) || CMIsNullObject(refobjectpath)) {
 100.391 +            _SBLIM_TRACE(1,("--- CMNewObjectPath() failed - %s", CMGetCharPtr(status.msg)));
 100.392 +            CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERROR, "Cannot create new CMPIObjectPath");
 100.393 +            goto exit;
 100.394 +         }
 100.395 +
 100.396 +         /* Assign the references in the association appropriately. */
 100.397 +         if (strcmp(sourceclass, _RHSCLASSNAME) == 0) {
 100.398 +            CMAddKey(refobjectpath, _RHSPROPERTYNAME, &reference, CMPI_ref);
 100.399 +            CMAddKey(refobjectpath, _LHSPROPERTYNAME, &data.value.ref, CMPI_ref);
 100.400 +         } else {
 100.401 +            CMAddKey(refobjectpath, _RHSPROPERTYNAME, &data.value.ref, CMPI_ref);
 100.402 +            CMAddKey(refobjectpath, _LHSPROPERTYNAME, &reference, CMPI_ref);
 100.403 +         }
 100.404 +
 100.405 +         /* Only return entries whose name matches the reference. */
 100.406 +         namedata = CMGetKey(data.value.ref, targetkeyname, &status);
 100.407 +         char * resultname = CMGetCharPtr(namedata.value.string);
 100.408 +         if (strcmp(sourcename, resultname) == 0) CMReturnObjectPath(results, refobjectpath);
 100.409 +      }
 100.410 +   }
 100.411 +
 100.412 +exit:
 100.413 +   _SBLIM_RETURNSTATUS(status);
 100.414 +}
 100.415 +
 100.416 +
 100.417 +// ----------------------------------------------------------------------------
 100.418 +// References()
 100.419 +// ----------------------------------------------------------------------------
 100.420 +static CMPIStatus References(
 100.421 +		CMPIAssociationMI * self,	/* [in] Handle to this provider (i.e. 'self'). */
 100.422 +		CMPIContext * context,		/* [in] Additional context info, if any. */
 100.423 +		CMPIResult * results,		/* [out] Results of this operation. */
 100.424 +		CMPIObjectPath * reference,	/* [in] Contains the namespace, classname and desired object path. */
 100.425 +		const char *assocClass,
 100.426 +		const char *role,
 100.427 +		char **properties)		/* [in] List of desired properties (NULL=all). */
 100.428 +{
 100.429 +   CMPIStatus status = { CMPI_RC_OK, NULL };    /* Return status of CIM operations. */
 100.430 +   char *namespace = CMGetCharPtr(CMGetNameSpace(reference, NULL)); /* Target namespace. */
 100.431 +   char *sourceclass = CMGetCharPtr(CMGetClassName(reference, &status)); /* Class of the source reference object */
 100.432 +   char *targetclass;                           /* Class of the target object(s). */
 100.433 +
 100.434 +   char *sourcekeyname;
 100.435 +   char *targetkeyname;
 100.436 +
 100.437 +   _SBLIM_ENTER("References");
 100.438 +   _SBLIM_TRACE(2, ("--- self=\"%s\"", self->ft->miName));
 100.439 +   _SBLIM_TRACE(2, ("--- context=\"%s\"", CMGetCharPtr(CDToString(_BROKER, context, NULL))));
 100.440 +   _SBLIM_TRACE(2, ("--- reference=\"%s\"", CMGetCharPtr(CDToString(_BROKER, reference, NULL))));
 100.441 +   _SBLIM_TRACE(2, ("--- assocClass=\"%s\"", assocClass));
 100.442 +   _SBLIM_TRACE(2, ("--- role=\"%s\"", role));
 100.443 +   _SBLIM_TRACE(2, ("--- namespace=\"%s\"", namespace));
 100.444 +   _SBLIM_TRACE(2, ("--- sourceclass=\"%s\"", sourceclass));
 100.445 +
 100.446 +   /* Check that the requested association class, if any, is supported. */
 100.447 +   if (assocClass != NULL) {
 100.448 +      CMPIObjectPath * assoc = CMNewObjectPath(_BROKER, namespace, _ASSOCCLASS, NULL);
 100.449 +      if (!CMClassPathIsA(_BROKER, assoc, assocClass, NULL)) {
 100.450 +         _SBLIM_TRACE(2, ("--- Unrecognized association class. Ignoring request."));
 100.451 +         goto exit;
 100.452 +      }
 100.453 +   }
 100.454 +
 100.455 +   /* Check that the reference matches the required role, if any. */
 100.456 +   if ((role != NULL) && strcmp(role, sourceclass) != 0) {
 100.457 +      _SBLIM_TRACE(2, ("--- Reference does not match required role. Ignoring request."));
 100.458 +      goto exit;
 100.459 +   }
 100.460 +
 100.461 +   /* Determine the target class from the source class. */
 100.462 +//   if (strcmp(sourceclass, _LHSCLASSNAME) == 0) {
 100.463 +   CMPIObjectPath * source = CMNewObjectPath(_BROKER, namespace, sourceclass, NULL);
 100.464 +   if (CMClassPathIsA(_BROKER, source, _LHSCLASSNAME, NULL)) {
 100.465 +      sourcekeyname = _LHSKEYNAME;
 100.466 +      targetclass = _RHSCLASSNAME;
 100.467 +      targetkeyname = _RHSKEYNAME;
 100.468 +//   } else if (strcmp(sourceclass, _RHSCLASSNAME) == 0) {
 100.469 +   } else if (CMClassPathIsA(_BROKER, source, _RHSCLASSNAME, NULL)) {
 100.470 +      sourcekeyname = _RHSKEYNAME;
 100.471 +      targetclass = _LHSCLASSNAME;
 100.472 +      targetkeyname = _LHSKEYNAME;
 100.473 +   } else {
 100.474 +      _SBLIM_TRACE(2, ("--- Unrecognized source class. Ignoring request."));
 100.475 +      goto exit;
 100.476 +   }
 100.477 +   _SBLIM_TRACE(2, ("--- targetclass=\"%s\"", targetclass));
 100.478 +
 100.479 +   CMPIData namedata = CMGetKey(reference, sourcekeyname, NULL);
 100.480 +   char * sourcename = CMGetCharPtr(namedata.value.string);
 100.481 +   _SBLIM_TRACE(2, ("--- sourcename=\"%s\"", sourcename));
 100.482 +
 100.483 +   /* Create an object path for the result class. */
 100.484 +   CMPIObjectPath * objectpath = CMNewObjectPath(_BROKER, namespace, targetclass, &status);
 100.485 +   if ((status.rc != CMPI_RC_OK) || CMIsNullObject(objectpath)) {
 100.486 +      _SBLIM_TRACE(1,("--- CMNewObjectPath() failed - %s", CMGetCharPtr(status.msg)));
 100.487 +      CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERROR, "Cannot create new CMPIObjectPath");
 100.488 +      goto exit;
 100.489 +   }
 100.490 +
 100.491 +   /* Get the list of all target class object paths from the CIMOM. */
 100.492 +   CMPIEnumeration * objectpaths = CBEnumInstanceNames(_BROKER, context, objectpath, &status);
 100.493 +   if ((status.rc != CMPI_RC_OK) || CMIsNullObject(objectpaths)) {
 100.494 +      _SBLIM_TRACE(1,("--- CBEnumInstanceNames() failed - %s", CMGetCharPtr(status.msg)));
 100.495 +      CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERROR, "Cannot enumerate target class");
 100.496 +      goto exit;
 100.497 +   }
 100.498 +
 100.499 +   /* Return all object paths that exactly match the target class and resultClass, if specified. */
 100.500 +   while (CMHasNext(objectpaths, NULL)) {
 100.501 +      CMPIData data = CMGetNext(objectpaths, NULL);
 100.502 +      char *class = CMGetCharPtr(CMGetClassName(data.value.ref, NULL));
 100.503 +//      if (strcmp(class,targetclass) == 0) {
 100.504 +      CMPIObjectPath * result = CMNewObjectPath(_BROKER, namespace, class, NULL);
 100.505 +      if (CMClassPathIsA(_BROKER, result, targetclass, NULL)) { 
 100.506 +
 100.507 +         /* Create an instance for the association. */
 100.508 +         CMPIInstance * refinstance = _CMNewInstance(_BROKER, namespace, _ASSOCCLASS, &status);
 100.509 +         if ((status.rc != CMPI_RC_OK) || CMIsNullObject(refinstance)) {
 100.510 +            _SBLIM_TRACE(1,("--- CMNewInstance() failed - %s", CMGetCharPtr(status.msg)));
 100.511 +            CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERROR, "Cannot create new CMPIInstance");
 100.512 +            goto exit;
 100.513 +         }
 100.514 +
 100.515 +         /* Assign the references in the association appropriately. */
 100.516 +         if (strcmp(sourceclass, _RHSCLASSNAME) == 0) {
 100.517 +            CMSetProperty(refinstance, _RHSPROPERTYNAME, &reference, CMPI_ref);
 100.518 +            CMSetProperty(refinstance, _LHSPROPERTYNAME, &data.value.ref, CMPI_ref);
 100.519 +         } else {
 100.520 +            CMSetProperty(refinstance, _RHSPROPERTYNAME, &data.value.ref, CMPI_ref);
 100.521 +            CMSetProperty(refinstance, _LHSPROPERTYNAME, &reference, CMPI_ref);
 100.522 +         }
 100.523 +
 100.524 +         /* Only return entries whose name matches the reference. */
 100.525 +         namedata = CMGetKey(data.value.ref, targetkeyname, &status);
 100.526 +         char * resultname = CMGetCharPtr(namedata.value.string);
 100.527 +         if (strcmp(sourcename, resultname) == 0) CMReturnInstance(results, refinstance);
 100.528 +      }
 100.529 +   }
 100.530 +exit:
 100.531 +   _SBLIM_RETURNSTATUS(status);
 100.532 +}
 100.533 +
 100.534 +
 100.535 +// ----------------------------------------------------------------------------
 100.536 +// AssociationInitialize()
 100.537 +// Perform any necessary initialization immediately after this provider is
 100.538 +// first loaded.
 100.539 +// ----------------------------------------------------------------------------
 100.540 +static void AssociationInitialize(
 100.541 +		CMPIAssociationMI * self,	/* [in] Handle to this provider (i.e. 'self'). */
 100.542 +		CMPIContext * context)		/* [in] Additional context info, if any. */
 100.543 +{
 100.544 +   _SBLIM_ENTER("AssociationInitialize");
 100.545 +   _SBLIM_TRACE(2, ("--- self=\"%s\"", self->ft->miName));
 100.546 +   _SBLIM_TRACE(2, ("--- context=\"%s\"", CMGetCharPtr(CDToString(_BROKER, context, NULL))));
 100.547 +
 100.548 +   /* Nothing needs to be done to initialize this provider */
 100.549 +
 100.550 +exit:
 100.551 +   _SBLIM_RETURN();
 100.552 +}
 100.553 +
 100.554 +
 100.555 +// ============================================================================
 100.556 +// CMPI ASSOCIATION PROVIDER FUNCTION TABLE SETUP
 100.557 +// ============================================================================
 100.558 +CMAssociationMIStub( , Xen_CSSettingDataComponentProvider, _BROKER, AssociationInitialize(&mi, ctx));
   101.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   101.2 +++ b/src/Xen_ComputerSystem.c	Wed Mar 22 14:05:14 2006 -0700
   101.3 @@ -0,0 +1,886 @@
   101.4 +// Copyright (C) 2006 IBM Corporation
   101.5 +//
   101.6 +//    This library is free software; you can redistribute it and/or
   101.7 +//    modify it under the terms of the GNU Lesser General Public
   101.8 +//    License as published by the Free Software Foundation; either
   101.9 +//    version 2.1 of the License, or (at your option) any later version.
  101.10 +//
  101.11 +//    This library is distributed in the hope that it will be useful,
  101.12 +//    but WITHOUT ANY WARRANTY; without even the implied warranty of
  101.13 +//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  101.14 +//    Lesser General Public License for more details.
  101.15 +//
  101.16 +//    You should have received a copy of the GNU Lesser General Public
  101.17 +//    License along with this library; if not, write to the Free Software
  101.18 +//    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  101.19 +// ============================================================================
  101.20 +// Authors:       Dr. Gareth S. Bestor, <bestor@us.ibm.com>
  101.21 +//                Tokunbo Adeshiyan, <tokunbo@us.ibm.com>
  101.22 +// Contributors:
  101.23 +// Description:
  101.24 +// ============================================================================
  101.25 +
  101.26 +/* Include the required CMPI data types, function headers, and macros */
  101.27 +#include "cmpidt.h"
  101.28 +#include "cmpift.h"
  101.29 +#include "cmpimacs.h"
  101.30 +
  101.31 +
  101.32 +// ----------------------------------------------------------------------------
  101.33 +// COMMON GLOBAL VARIABLES
  101.34 +// ----------------------------------------------------------------------------
  101.35 +
  101.36 +/* Handle to the CIM broker. Initialized when the provider lib is loaded. */
  101.37 +static CMPIBroker *_BROKER;
  101.38 +
  101.39 +/* Include utility functions */
  101.40 +#include "cmpiutil.h"
  101.41 +
  101.42 +/* Include _SBLIM_TRACE() logging support */
  101.43 +#include "cmpitrace.h"
  101.44 +
  101.45 +/* Include the abstract resource access functions and abstracted _RESOURCES and _RESOURCE data types. */
  101.46 +#include "Xen_ComputerSystem_Resource.h"
  101.47 +
  101.48 +
  101.49 +// ============================================================================
  101.50 +// CMPI INSTANCE PROVIDER FUNCTION TABLE
  101.51 +// ============================================================================
  101.52 +
  101.53 +// ----------------------------------------------------------------------------
  101.54 +// Info for the class supported by the instance provider
  101.55 +// ----------------------------------------------------------------------------
  101.56 +
  101.57 +/* Name of the class implemented by this instance provider. */
  101.58 +/*** CUSTOMIZE FOR EACH PROVIDER ***/
  101.59 +static char * _CLASSNAME = "Xen_ComputerSystem";
  101.60 +
  101.61 +/* NULL terminated list of key properties of this class. */
  101.62 +/*** CUSTOMIZE FOR EACH PROVIDER ***/
  101.63 +const static char * _KEYNAMES[] = {"Name", "CreationClassName", NULL};
  101.64 +
  101.65 +// ----------------------------------------------------------------------------
  101.66 +// Cleanup()
  101.67 +// Perform any necessary cleanup immediately before this provider is unloaded.
  101.68 +// ----------------------------------------------------------------------------
  101.69 +static CMPIStatus Cleanup(
  101.70 +		CMPIInstanceMI * self,		/* [in] Handle to this provider (i.e. 'self'). */
  101.71 +		CMPIContext * context)		/* [in] Additional context info, if any. */
  101.72 +{
  101.73 +   CMPIStatus status = { CMPI_RC_OK, NULL };	/* Return status of CIM operations. */
  101.74 +
  101.75 +   _SBLIM_ENTER("Cleanup");
  101.76 +   _SBLIM_TRACE(2, ("--- self=\"%s\"", self->ft->miName));
  101.77 +   _SBLIM_TRACE(2, ("--- context=\"%s\"", CMGetCharPtr(CDToString(_BROKER, context, NULL))));
  101.78 +
  101.79 +   /* Nothing needs to be done for cleanup. */
  101.80 +
  101.81 +exit:
  101.82 +   _SBLIM_RETURNSTATUS(status);
  101.83 +}
  101.84 +
  101.85 +// ----------------------------------------------------------------------------
  101.86 +// EnumInstanceNames()
  101.87 +// Return a list of all the instances names (return their object paths only).
  101.88 +// ----------------------------------------------------------------------------
  101.89 +static CMPIStatus EnumInstanceNames(
  101.90 +		CMPIInstanceMI * self,		/* [in] Handle to this provider (i.e. 'self'). */
  101.91 +		CMPIContext * context,		/* [in] Additional context info, if any. */
  101.92 +		CMPIResult * results,		/* [out] Results of this operation. */
  101.93 +		CMPIObjectPath * reference) 	/* [in] Contains target namespace and classname. */
  101.94 +{
  101.95 +   CMPIStatus status = {CMPI_RC_OK, NULL};	/* Return status of CIM operations. */
  101.96 +   _RESOURCES * resources;			/* Handle to the list of system resources. */
  101.97 +   _RESOURCE * resource;			/* Handle to each system resource. */
  101.98 +   char * namespace = CMGetCharPtr(CMGetNameSpace(reference, NULL)); /* Target namespace. */
  101.99 +   int found = 0;				/* Found any instances? */
 101.100 +  
 101.101 +   _SBLIM_ENTER("EnumInstanceNames");
 101.102 +   _SBLIM_TRACE(2, ("--- self=\"%s\"", self->ft->miName));
 101.103 +   _SBLIM_TRACE(2, ("--- context=\"%s\"", CMGetCharPtr(CDToString(_BROKER, context, NULL))));
 101.104 +   _SBLIM_TRACE(2, ("--- reference=\"%s\"", CMGetCharPtr(CDToString(_BROKER, reference, NULL))));
 101.105 +   _SBLIM_TRACE(2, ("--- namespace=\"%s\"", namespace));
 101.106 +
 101.107 +   /* Get a handle to the list of system resources. */
 101.108 +   if (!Xen_ComputerSystem_getResources(&resources)) {
 101.109 +      _SBLIM_TRACE(1,("--- _getResources() failed"));
 101.110 +      CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_FAILED, "Failed to get list of system resources");
 101.111 +      goto exit;
 101.112 +   }
 101.113 +
 101.114 +   /* Enumerate thru the list of system resources and return a CMPIInstance for each. */
 101.115 +   while (Xen_ComputerSystem_getNextResource(resources, &resource)) {
 101.116 +      /* Create a new CMPIInstance to store this resource. */
 101.117 +      CMPIInstance * instance = _CMNewInstance(_BROKER, namespace, _CLASSNAME, &status);
 101.118 +      if ((status.rc != CMPI_RC_OK) || CMIsNullObject(instance)) {
 101.119 +         _SBLIM_TRACE(1,("--- CMNewInstance() failed - %s", CMGetCharPtr(status.msg)));
 101.120 +         CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERROR, "Cannot create new CMPIInstance");
 101.121 +         goto exit;
 101.122 +      }
 101.123 +
 101.124 +      /* Set the instance property values from the resource data. */
 101.125 +      if (!Xen_ComputerSystem_setInstanceFromResource(resource, instance, _BROKER)) {
 101.126 +         _SBLIM_TRACE(1,("--- _setInstanceFromResource() failed"));
 101.127 +         CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_FAILED, "Failed to set property values from resource data");
 101.128 +         goto exit;
 101.129 +      }
 101.130 +
 101.131 +      /* Free the resource data. */
 101.132 +      if (!Xen_ComputerSystem_freeResource(resource)) {
 101.133 +         _SBLIM_TRACE(1,("--- _freeResource() failed"));
 101.134 +         CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_FAILED, "Failed to free resource data");
 101.135 +         goto exit;
 101.136 +      }
 101.137 +
 101.138 +      /* Return the CMPIObjectPath for this instance. */
 101.139 +      CMPIObjectPath * objectpath = CMGetObjectPath(instance, &status);
 101.140 +      if ((status.rc != CMPI_RC_OK) || CMIsNullObject(objectpath)) {
 101.141 +         _SBLIM_TRACE(1,("--- CMGetObjectPath() failed - %s", CMGetCharPtr(status.msg)));
 101.142 +         CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERROR, "Cannot get CMPIObjectPath for instance");
 101.143 +         goto exit;
 101.144 +      }
 101.145 +      CMSetNameSpace(objectpath, namespace); /* Note - CMGetObjectPath() does not preserve the namespace! */
 101.146 +     
 101.147 +//      _SBLIM_TRACE(3,("--- objectpath=\"%s\"", CMGetCharPtr(CDToString(_BROKER, objectpath, NULL))));
 101.148 +      CMReturnObjectPath(results, objectpath);
 101.149 +      found++;
 101.150 +   }
 101.151 +
 101.152 +   _SBLIM_TRACE(2,("--- %d object paths found", found));
 101.153 +   CMReturnDone(results);
 101.154 +
 101.155 +exit:
 101.156 +   /* Free the list of system resources. */
 101.157 +   if (!Xen_ComputerSystem_freeResources(resources)) {
 101.158 +      _SBLIM_TRACE(1,("--- _freeResources() failed"));
 101.159 +      CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_FAILED, "Failed to free list of system resources");
 101.160 +   }
 101.161 +  
 101.162 +   _SBLIM_RETURNSTATUS(status);
 101.163 +}
 101.164 +
 101.165 +// ----------------------------------------------------------------------------
 101.166 +// EnumInstances()
 101.167 +// Return a list of all the instances (return all the instance data).
 101.168 +// ----------------------------------------------------------------------------
 101.169 +static CMPIStatus EnumInstances(
 101.170 +		CMPIInstanceMI * self,		/* [in] Handle to this provider (i.e. 'self'). */
 101.171 +		CMPIContext * context,		/* [in] Additional context info, if any. */
 101.172 +		CMPIResult * results,		/* [out] Results of this operation. */
 101.173 +		CMPIObjectPath * reference,	/* [in] Contains target namespace and classname. */
 101.174 +		const char ** properties)	/* [in] List of desired properties (NULL=all). */
 101.175 +{
 101.176 +   CMPIStatus status = {CMPI_RC_OK, NULL};	/* Return status of CIM operations. */
 101.177 +   _RESOURCES * resources;			/* Handle to the list of system resources. */
 101.178 +   _RESOURCE * resource;			/* Handle to each system resource. */
 101.179 +   char * namespace = CMGetCharPtr(CMGetNameSpace(reference, NULL)); /* Target namespace. */
 101.180 +   int found = 0;				/* Found any resource instances? */
 101.181 +
 101.182 +   _SBLIM_ENTER("EnumInstances");
 101.183 +   _SBLIM_TRACE(2, ("--- self=\"%s\"", self->ft->miName));
 101.184 +   _SBLIM_TRACE(2, ("--- context=\"%s\"", CMGetCharPtr(CDToString(_BROKER, context, NULL))));
 101.185 +   _SBLIM_TRACE(2, ("--- reference=\"%s\"", CMGetCharPtr(CDToString(_BROKER, reference, NULL))));
 101.186 +   _SBLIM_TRACE(2, ("--- namespace=\"%s\"", namespace));
 101.187 +
 101.188 +   /* Get a handle to the list of system resources. */
 101.189 +   if (!Xen_ComputerSystem_getResources(&resources)) {
 101.190 +      _SBLIM_TRACE(1,("--- _getResources() failed"));
 101.191 +      CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_FAILED, "Failed to get list of system resources");
 101.192 +      goto exit;
 101.193 +   }
 101.194 +
 101.195 +   /* Enumerate thru the list of system resources and return a CMPIInstance for each. */
 101.196 +   while (Xen_ComputerSystem_getNextResource(resources, &resource)) {
 101.197 +      /* Create a new CMPIInstance to store this resource. */
 101.198 +      CMPIInstance * instance = _CMNewInstance(_BROKER, namespace, _CLASSNAME, &status);
 101.199 +      if ((status.rc != CMPI_RC_OK) || CMIsNullObject(instance)) {
 101.200 +         _SBLIM_TRACE(1,("--- CMNewInstance() failed - %s", CMGetCharPtr(status.msg)));
 101.201 +         CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERROR, "Cannot create new CMPIInstance");
 101.202 +         goto exit;
 101.203 +      }
 101.204 +
 101.205 +      /* Setup a filter to only return the desired properties. */
 101.206 +      status = CMSetPropertyFilter(instance, properties, _KEYNAMES);
 101.207 +      if (status.rc != CMPI_RC_OK) {
 101.208 +         _SBLIM_TRACE(1, ("--- CMSetPropertyFilter() failed - %s", CMGetCharPtr(status.msg)));
 101.209 +         CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_FAILED, "Cannot set property filter");
 101.210 +         goto exit;
 101.211 +      }
 101.212 +
 101.213 +      /* Set the instance property values from the resource data. */
 101.214 +      if (!Xen_ComputerSystem_setInstanceFromResource(resource, instance, _BROKER)) {
 101.215 +         _SBLIM_TRACE(1,("--- _setInstanceFromResource() failed"));
 101.216 +         CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_FAILED, "Failed to set property values from resource data");
 101.217 +         goto exit;
 101.218 +      }
 101.219 +
 101.220 +      /* Free the resource data. */
 101.221 +      if (!Xen_ComputerSystem_freeResource(resource)) {
 101.222 +         _SBLIM_TRACE(1,("--- _freeResource() failed"));
 101.223 +         CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_FAILED, "Failed to free resource data");
 101.224 +         goto exit;
 101.225 +      }
 101.226 +
 101.227 +      /* Return the CMPIInstance for this instance. */
 101.228 +//      _SBLIM_TRACE(3,("--- instance=\"%s\"", CMGetCharPtr(CDToString(_BROKER, instance, NULL))));
 101.229 +      CMReturnInstance(results, instance);
 101.230 +      found++;
 101.231 +   }
 101.232 +
 101.233 +   _SBLIM_TRACE(2,("--- %d instances found", found));
 101.234 +   CMReturnDone(results);
 101.235 +
 101.236 +exit:
 101.237 +   /* Free the list of system resources. */
 101.238 +   if (!Xen_ComputerSystem_freeResources(resources)) {
 101.239 +      _SBLIM_TRACE(1,("--- _freeResources() failed"));
 101.240 +      CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_FAILED, "Failed to free list of system resources");
 101.241 +   }
 101.242 +
 101.243 +   _SBLIM_RETURNSTATUS(status);
 101.244 +}
 101.245 +
 101.246 +// ----------------------------------------------------------------------------
 101.247 +// GetInstance()
 101.248 +// Return the instance data for the specified instance only.
 101.249 +// ----------------------------------------------------------------------------
 101.250 +static CMPIStatus GetInstance(
 101.251 +		CMPIInstanceMI * self,		/* [in] Handle to this provider (i.e. 'self'). */
 101.252 +		CMPIContext * context,		/* [in] Additional context info, if any. */
 101.253 +		CMPIResult * results,		/* [out] Results of this operation. */
 101.254 +		CMPIObjectPath * reference,	/* [in] Contains the target namespace, classname and object path. */
 101.255 +		const char ** properties)		/* [in] List of desired properties (NULL=all). */
 101.256 +{
 101.257 +   CMPIStatus status = {CMPI_RC_OK, NULL};	/* Return status of CIM operations. */
 101.258 +   _RESOURCES * resources;			/* Handle to the list of system resources. */
 101.259 +   _RESOURCE * resource;			/* Handle to the system resource. */
 101.260 +   char * namespace = CMGetCharPtr(CMGetNameSpace(reference, NULL)); /* Target namespace. */
 101.261 +   int found = 0;				/* Found the target instance? */
 101.262 +
 101.263 +   _SBLIM_ENTER("GetInstance");
 101.264 +   _SBLIM_TRACE(2, ("--- self=\"%s\"", self->ft->miName));
 101.265 +   _SBLIM_TRACE(2, ("--- context=\"%s\"", CMGetCharPtr(CDToString(_BROKER, context, NULL))));
 101.266 +   _SBLIM_TRACE(2, ("--- reference=\"%s\"", CMGetCharPtr(CDToString(_BROKER, reference, NULL))));
 101.267 +   _SBLIM_TRACE(2, ("--- namespace=\"%s\"", namespace));
 101.268 +
 101.269 +   /* Get a handle to the list of system resources. */
 101.270 +   if (!Xen_ComputerSystem_getResources(&resources)) {
 101.271 +      _SBLIM_TRACE(1,("--- _getResources() failed"));
 101.272 +      CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_FAILED, "Failed to get list of system resources");
 101.273 +      goto exit;
 101.274 +   }
 101.275 +
 101.276 +   /* Get the target resource. */
 101.277 +   found = Xen_ComputerSystem_getResourceForObjectPath(resources, &resource, reference);
 101.278 +   if (!found || (resource == NULL)) {
 101.279 +      _SBLIM_TRACE(1,("--- Target instance not found"));
 101.280 +      CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_NOT_FOUND, "Target instance not found");
 101.281 +      goto exit;
 101.282 +   }
 101.283 +
 101.284 +   /* Create a new CMPIInstance to store this resource. */
 101.285 +   CMPIInstance * instance = _CMNewInstance(_BROKER, namespace, _CLASSNAME, &status);
 101.286 +   if ((status.rc != CMPI_RC_OK) || CMIsNullObject(instance)) {
 101.287 +      _SBLIM_TRACE(1,("--- CMNewInstance() failed - %s", CMGetCharPtr(status.msg)));
 101.288 +      CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERROR, "Cannot create new CMPIInstance");
 101.289 +      goto exit;
 101.290 +   }
 101.291 +
 101.292 +   /* Setup a filter to only return the desired properties. */
 101.293 +   status = CMSetPropertyFilter(instance, properties, _KEYNAMES);
 101.294 +   if (status.rc != CMPI_RC_OK) {
 101.295 +      _SBLIM_TRACE(1, ("--- CMSetPropertyFilter() failed - %s", CMGetCharPtr(status.msg)));
 101.296 +      CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_FAILED, "Cannot set property filter");
 101.297 +      goto exit;
 101.298 +   }
 101.299 +
 101.300 +   /* Set the instance property values from the resource data. */
 101.301 +   if (!Xen_ComputerSystem_setInstanceFromResource(resource, instance, _BROKER)) {
 101.302 +      _SBLIM_TRACE(1,("--- _setInstanceFromResource() failed"));
 101.303 +      CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_FAILED, "Failed to set property values from resource data");
 101.304 +      goto exit;
 101.305 +   }
 101.306 +
 101.307 +   /* Free the resource data. */
 101.308 +   if (!Xen_ComputerSystem_freeResource(resource)) {
 101.309 +      _SBLIM_TRACE(1,("--- _freeResource() failed"));
 101.310 +      CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_FAILED, "Failed to free resource data");
 101.311 +      goto exit;
 101.312 +   }
 101.313 +
 101.314 +   /* Return the CMPIInstance for this instance. */
 101.315 +//   _SBLIM_TRACE(3,("--- instance=\"%s\"", CMGetCharPtr(CDToString(_BROKER, instance, NULL))));
 101.316 +   CMReturnInstance(results, instance);
 101.317 +
 101.318 +   _SBLIM_TRACE(2,("--- instance found"));
 101.319 +   CMReturnDone(results);
 101.320 +
 101.321 +exit:
 101.322 +   /* Free the list of system resources. */
 101.323 +   if (!Xen_ComputerSystem_freeResources(resources)) {
 101.324 +      _SBLIM_TRACE(1,("--- _freeResources() failed"));
 101.325 +      CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_FAILED, "Failed to free list of system resources");
 101.326 +   }
 101.327 +
 101.328 +   _SBLIM_RETURNSTATUS(status);
 101.329 +}
 101.330 +
 101.331 +// ----------------------------------------------------------------------------
 101.332 +// SetInstance()
 101.333 +// Save modified instance data for the specified instance.
 101.334 +// ----------------------------------------------------------------------------
 101.335 +static CMPIStatus SetInstance(
 101.336 +		CMPIInstanceMI * self,		/* [in] Handle to this provider (i.e. 'self'). */
 101.337 +		CMPIContext * context,		/* [in] Additional context info, if any. */
 101.338 +		CMPIResult * results,		/* [out] Results of this operation. */
 101.339 +		CMPIObjectPath * reference,	/* [in] Contains the target namespace, classname and object path. */
 101.340 +		CMPIInstance * newinstance)	/* [in] Contains the new instance data. */
 101.341 +{
 101.342 +   CMPIStatus status = {CMPI_RC_OK, NULL};	/* Return status of CIM operations. */
 101.343 +   _RESOURCES * resources;			/* Handle to the list of system resources. */
 101.344 +   _RESOURCE * resource;	       		/* Handle to the system resource. */
 101.345 +   char * namespace = CMGetCharPtr(CMGetNameSpace(reference, NULL)); /* Target namespace. */
 101.346 +   int found = 0;				/* Found the target instance? */
 101.347 +
 101.348 +   _SBLIM_ENTER("SetInstance");
 101.349 +   _SBLIM_TRACE(2, ("--- self=\"%s\"", self->ft->miName));
 101.350 +   _SBLIM_TRACE(2, ("--- context=\"%s\"", CMGetCharPtr(CDToString(_BROKER, context, NULL))));
 101.351 +   _SBLIM_TRACE(2, ("--- reference=\"%s\"", CMGetCharPtr(CDToString(_BROKER, reference, NULL))));
 101.352 +   _SBLIM_TRACE(2, ("--- newinstance=\"%s\"", CMGetCharPtr(CDToString(_BROKER, newinstance, NULL))));
 101.353 +   _SBLIM_TRACE(2, ("--- namespace=\"%s\"", namespace));
 101.354 +
 101.355 +   /* Get a handle to the list of system resources. */
 101.356 +   if (!Xen_ComputerSystem_getResources(&resources)) {
 101.357 +      _SBLIM_TRACE(1,("--- _getResources() failed"));
 101.358 +      CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_FAILED, "Failed to get list of system resources");
 101.359 +      goto exit;
 101.360 +   }
 101.361 +
 101.362 +   /* Get the target resource. */
 101.363 +   found = Xen_ComputerSystem_getResourceForObjectPath(resources, &resource, reference);
 101.364 +   if (!found || (resource == NULL)) {
 101.365 +      _SBLIM_TRACE(1,("--- Target instance not found"));
 101.366 +      CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_NOT_FOUND, "Target instance not found");
 101.367 +      goto exit;
 101.368 +   }
 101.369 +
 101.370 +   _SBLIM_TRACE(2,("--- instance found", found));
 101.371 +
 101.372 +   /* Update the target resource data with the new instance property values. */
 101.373 +   int rc = Xen_ComputerSystem_setResourceFromInstance(resource, newinstance, _BROKER);
 101.374 +
 101.375 +   /* Free the resource data. */
 101.376 +   if (!Xen_ComputerSystem_freeResource(resource)) {
 101.377 +      _SBLIM_TRACE(1,("--- _freeResource() failed"));
 101.378 +      CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_FAILED, "Failed to free resource data");
 101.379 +      goto exit;
 101.380 +   }
 101.381 +
 101.382 +   if (rc != 1) {
 101.383 +      if (rc == -1) {
 101.384 +         _SBLIM_TRACE(1,("--- _setResourceFromInstance() unsupported"));
 101.385 +         CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_NOT_SUPPORTED, NULL);
 101.386 +      } else {
 101.387 +         _SBLIM_TRACE(1,("--- _setResourceFromInstance() failed"));
 101.388 +         CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_FAILED, "Failed to set resource data from instance properties");
 101.389 +      }
 101.390 +      goto exit;
 101.391 +   }
 101.392 +
 101.393 +exit:
 101.394 +   /* Free the list of system resources. */
 101.395 +   if (!Xen_ComputerSystem_freeResources(resources)) {
 101.396 +      _SBLIM_TRACE(1,("--- _freeResources() failed"));
 101.397 +      CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_FAILED, "Failed to free list of system resources");
 101.398 +   }
 101.399 +
 101.400 +   _SBLIM_RETURNSTATUS(status);
 101.401 +}
 101.402 +
 101.403 +// ----------------------------------------------------------------------------
 101.404 +// CreateInstance()
 101.405 +// Create a new instance from the specified instance data.
 101.406 +// ----------------------------------------------------------------------------
 101.407 +static CMPIStatus CreateInstance(
 101.408 +		CMPIInstanceMI * self,		/* [in] Handle to this provider (i.e. 'self'). */
 101.409 +		CMPIContext * context,		/* [in] Additional context info, if any. */
 101.410 +		CMPIResult * results,		/* [out] Results of this operation. */
 101.411 +		CMPIObjectPath * reference,	/* [in] Contains the target namespace, classname and object path. */
 101.412 +		CMPIInstance * newinstance)	/* [in] Contains the new instance data. */
 101.413 +{
 101.414 +   CMPIStatus status = {CMPI_RC_OK, NULL};	/* Return status of CIM operations. */
 101.415 +   _RESOURCES * resources;			/* Handle to the list of system resources. */
 101.416 +   _RESOURCE * resource;			/* Handle to the system resource. */
 101.417 +   char * namespace = CMGetCharPtr(CMGetNameSpace(reference, NULL)); /* Target namespace. */
 101.418 +   int found = 0;				/* Found the target instance? */
 101.419 +
 101.420 +   _SBLIM_ENTER("CreateInstance");
 101.421 +   _SBLIM_TRACE(2, ("--- self=\"%s\"", self->ft->miName));
 101.422 +   _SBLIM_TRACE(2, ("--- context=\"%s\"", CMGetCharPtr(CDToString(_BROKER, context, NULL))));
 101.423 +   _SBLIM_TRACE(2, ("--- reference=\"%s\"", CMGetCharPtr(CDToString(_BROKER, reference, NULL))));
 101.424 +   _SBLIM_TRACE(2, ("--- newinstance=\"%s\"", CMGetCharPtr(CDToString(_BROKER, newinstance, NULL))));
 101.425 +   _SBLIM_TRACE(2, ("--- namespace=\"%s\"", namespace));
 101.426 +
 101.427 +   /* WORKAROUND FOR PEGASUS BUG?! reference does not contain object path, only namespace & classname. */
 101.428 +   reference = CMGetObjectPath(newinstance, NULL);
 101.429 +
 101.430 +   /* Get a handle to the list of system resources. */
 101.431 +   if (!Xen_ComputerSystem_getResources(&resources)) {
 101.432 +      _SBLIM_TRACE(1,("--- _getResources() failed"));
 101.433 +      CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_FAILED, "Failed to get list of system resources");
 101.434 +      goto exit;
 101.435 +   }
 101.436 +
 101.437 +   /* Get the target resource. */
 101.438 +   found = Xen_ComputerSystem_getResourceForObjectPath(resources, &resource, reference);
 101.439 +
 101.440 +   /* Free the resource data. */
 101.441 +   if (!Xen_ComputerSystem_freeResource(resource)) {
 101.442 +      _SBLIM_TRACE(1,("--- _freeResource() failed"));
 101.443 +      CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_FAILED, "Failed to free resource data");
 101.444 +      goto exit;
 101.445 +   }
 101.446 +
 101.447 +   if (found) {
 101.448 +      _SBLIM_TRACE(1,("--- Target instance already exists"));
 101.449 +      CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_ALREADY_EXISTS, "Target instance already exists");
 101.450 +      goto exit;
 101.451 +   }
 101.452 +
 101.453 +   /* Create a new resource with the new instance property values. */
 101.454 +   int rc = Xen_ComputerSystem_createResourceFromInstance(resources, &resource, newinstance, _BROKER);
 101.455 +   if (rc != 1) {
 101.456 +      if (rc == -1) {
 101.457 +         _SBLIM_TRACE(1,("--- _createResourceFromInstance() unsupported"));
 101.458 +         CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_NOT_SUPPORTED, NULL);
 101.459 +      } else {
 101.460 +         _SBLIM_TRACE(1,("--- _createResourceFromInstance() failed"));
 101.461 +         CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_FAILED, "Failed to create resource data from instance properties");
 101.462 +      }
 101.463 +      goto exit;
 101.464 +   }
 101.465 +
 101.466 +   /* Return the object path for the newly created instance. */
 101.467 +   CMPIObjectPath * objectpath = CMGetObjectPath(newinstance, NULL);
 101.468 +   CMSetNameSpace(objectpath, namespace);
 101.469 +   CMReturnObjectPath(results, objectpath);
 101.470 +   CMReturnDone(results);
 101.471 +
 101.472 +exit:
 101.473 +   /* Free the list of system resources. */
 101.474 +   if (!Xen_ComputerSystem_freeResources(resources)) {
 101.475 +      _SBLIM_TRACE(1,("--- _freeResources() failed"));
 101.476 +      CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_FAILED, "Failed to free list of system resources");
 101.477 +   }
 101.478 +
 101.479 +   _SBLIM_RETURNSTATUS(status);
 101.480 +}
 101.481 +
 101.482 +// ----------------------------------------------------------------------------
 101.483 +// DeleteInstance()
 101.484 +// Delete or remove the specified instance from the system.
 101.485 +// ----------------------------------------------------------------------------
 101.486 +static CMPIStatus DeleteInstance(
 101.487 +		CMPIInstanceMI * self,		/* [in] Handle to this provider (i.e. 'self'). */
 101.488 +		CMPIContext * context,		/* [in] Additional context info, if any. */
 101.489 +		CMPIResult * results,		/* [out] Results of this operation. */
 101.490 +		CMPIObjectPath * reference)	/* [in] Contains the target namespace, classname and object path. */
 101.491 +{
 101.492 +   CMPIStatus status = {CMPI_RC_OK, NULL};	/* Return status of CIM operations. */
 101.493 +   _RESOURCES * resources;			/* Handle to the list of system resources. */
 101.494 +   _RESOURCE * resource;		/* Handle to the system resource. */
 101.495 +   char * namespace = CMGetCharPtr(CMGetNameSpace(reference, NULL)); /* Target namespace. */
 101.496 +   int found = 0;				/* Found the target instance? */
 101.497 +
 101.498 +   _SBLIM_ENTER("DeleteInstance");
 101.499 +   _SBLIM_TRACE(2, ("--- self=\"%s\"", self->ft->miName));
 101.500 +   _SBLIM_TRACE(2, ("--- context=\"%s\"", CMGetCharPtr(CDToString(_BROKER, context, NULL))));
 101.501 +   _SBLIM_TRACE(2, ("--- reference=\"%s\"", CMGetCharPtr(CDToString(_BROKER, reference, NULL))));
 101.502 +   _SBLIM_TRACE(2, ("--- namespace=\"%s\"", namespace));
 101.503 +
 101.504 +   /* Get a handle to the list of system resources. */
 101.505 +   if (!Xen_ComputerSystem_getResources(&resources)) {
 101.506 +      _SBLIM_TRACE(1,("--- _getResources() failed"));
 101.507 +      CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_FAILED, "Failed to get list of system resources");
 101.508 +      goto exit;
 101.509 +   }
 101.510 +
 101.511 +   /* Get the target resource. */
 101.512 +   found = Xen_ComputerSystem_getResourceForObjectPath(resources, &resource, reference);
 101.513 +   if (!found || (resource == NULL)) {
 101.514 +      _SBLIM_TRACE(1,("--- Target instance not found"));
 101.515 +      CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_NOT_FOUND, "Target instance not found");
 101.516 +      goto exit;
 101.517 +   }
 101.518 +
 101.519 +   _SBLIM_TRACE(2,("--- instance found", found));
 101.520 +
 101.521 +   /* Delete the target resource. */
 101.522 +   int rc = Xen_ComputerSystem_deleteResource(resources, resource);
 101.523 +
 101.524 +   /* Free the resource data. */
 101.525 +   if (!Xen_ComputerSystem_freeResource(resource)) {
 101.526 +      _SBLIM_TRACE(1,("--- _freeResource() failed"));
 101.527 +      CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_FAILED, "Failed to free resource data");
 101.528 +      goto exit;
 101.529 +   }
 101.530 +
 101.531 +   if (rc != 1) {
 101.532 +      if (rc == -1) {
 101.533 +         _SBLIM_TRACE(1,("--- __deleteResource() unsupported"));
 101.534 +         CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_NOT_SUPPORTED, NULL);
 101.535 +      } else {
 101.536 +         _SBLIM_TRACE(1,("--- _deleteResource() failed"));
 101.537 +         CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_FAILED, "Failed to delete resource");
 101.538 +      }
 101.539 +      goto exit;
 101.540 +   }
 101.541 +
 101.542 +exit:
 101.543 +   /* Free the list of system resources. */
 101.544 +   if (!Xen_ComputerSystem_freeResources(resources)) {
 101.545 +      _SBLIM_TRACE(1,("--- _freeResources() failed"));
 101.546 +      CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_FAILED, "Failed to free list of system resources");
 101.547 +   }
 101.548 +
 101.549 +   _SBLIM_RETURNSTATUS(status);
 101.550 +}
 101.551 +
 101.552 +
 101.553 +// ----------------------------------------------------------------------------
 101.554 +// ExecQuery()
 101.555 +// Return a list of all the instances that satisfy the specified query filter.
 101.556 +// ----------------------------------------------------------------------------
 101.557 +static CMPIStatus ExecQuery(
 101.558 +		CMPIInstanceMI * self,		/* [in] Handle to this provider (i.e. 'self'). */
 101.559 +		CMPIContext * context,		/* [in] Additional context info, if any. */
 101.560 +		CMPIResult * results,		/* [out] Results of this operation. */
 101.561 +		CMPIObjectPath * reference,	/* [in] Contains the target namespace and classname. */
 101.562 +		char * language,		/* [in] Name of the query language. */
 101.563 +		char * query)			/* [in] Text of the query written in the query language. */
 101.564 +{
 101.565 +   CMPIStatus status = {CMPI_RC_OK, NULL};      /* Return status of CIM operations. */
 101.566 +   char * namespace = CMGetCharPtr(CMGetNameSpace(reference, NULL)); /* Target namespace. */
 101.567 +
 101.568 +   _SBLIM_ENTER("ExecQuery");
 101.569 +   _SBLIM_TRACE(2, ("--- self=\"%s\"", self->ft->miName));
 101.570 +   _SBLIM_TRACE(2, ("--- context=\"%s\"", CMGetCharPtr(CDToString(_BROKER, context, NULL))));
 101.571 +   _SBLIM_TRACE(2, ("--- reference=\"%s\"", CMGetCharPtr(CDToString(_BROKER, reference, NULL))));
 101.572 +   _SBLIM_TRACE(2, ("--- language=\"%s\"", language));
 101.573 +   _SBLIM_TRACE(2, ("--- query=\"%s\"", query));
 101.574 +   _SBLIM_TRACE(2, ("--- namespace=\"%s\"", namespace));
 101.575 +
 101.576 +   /* EXECQUERY() IS NOT YET SUPPORTED FOR THIS CLASS */
 101.577 +   CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_NOT_SUPPORTED, NULL);
 101.578 +
 101.579 +   CMReturnDone(results);
 101.580 +
 101.581 +exit:
 101.582 +   _SBLIM_RETURNSTATUS(status);
 101.583 +}
 101.584 +
 101.585 +// ----------------------------------------------------------------------------
 101.586 +// Initialize()
 101.587 +// Perform any necessary initialization immediately after this provider is
 101.588 +// first loaded.
 101.589 +// ----------------------------------------------------------------------------
 101.590 +static void Initialize(
 101.591 +		CMPIInstanceMI * self,		/* [in] Handle to this provider (i.e. 'self'). */
 101.592 +		CMPIContext * context)		/* [in] Additional context info, if any. */
 101.593 +{
 101.594 +   _SBLIM_ENTER("Initialize");
 101.595 +   _SBLIM_TRACE(2, ("--- self=\"%s\"", self->ft->miName));
 101.596 +   _SBLIM_TRACE(2, ("--- context=\"%s\"", CMGetCharPtr(CDToString(_BROKER, context, NULL))));
 101.597 +
 101.598 +   /* Nothing needs to be done to initialize this provider */
 101.599 +
 101.600 +exit:
 101.601 +   _SBLIM_RETURN();
 101.602 +}
 101.603 +
 101.604 +// ============================================================================
 101.605 +// CMPI INSTANCE PROVIDER FUNCTION TABLE SETUP
 101.606 +// ============================================================================
 101.607 +CMInstanceMIStub( , Xen_ComputerSystemProvider, _BROKER, Initialize(&mi, ctx));
 101.608 +
 101.609 +
 101.610 +// ============================================================================
 101.611 +// CMPI METHOD PROVIDER FUNCTION TABLE
 101.612 +// ============================================================================
 101.613 +
 101.614 +// ----------------------------------------------------------------------------
 101.615 +// MethodCleanup()
 101.616 +// Perform any necessary cleanup immediately before this provider is unloaded.
 101.617 +// ----------------------------------------------------------------------------
 101.618 +static CMPIStatus MethodCleanup(
 101.619 +                CMPIInstanceMI * self,          /* [in] Handle to this provider (i.e. 'self'). */
 101.620 +                CMPIContext * context)          /* [in] Additional context info, if any. */
 101.621 +{
 101.622 +   CMPIStatus status = { CMPI_RC_OK, NULL };    /* Return status of CIM operations. */
 101.623 +
 101.624 +   _SBLIM_ENTER("MethodCleanup");
 101.625 +   _SBLIM_TRACE(2, ("--- self=\"%s\"", self->ft->miName));
 101.626 +   _SBLIM_TRACE(2, ("--- context=\"%s\"", CMGetCharPtr(CDToString(_BROKER, context, NULL))));
 101.627 +
 101.628 +   /* Nothing needs to be done for cleanup. */
 101.629 +
 101.630 +exit:
 101.631 +   _SBLIM_RETURNSTATUS(status);
 101.632 +}
 101.633 +
 101.634 +/* Needed for stat() */
 101.635 +#include <sys/types.h>
 101.636 +#include <sys/stat.h>
 101.637 +#include <unistd.h>
 101.638 +
 101.639 +// ----------------------------------------------------------------------------
 101.640 +// InvokeMethod()
 101.641 +// Execute an extrinsic method on the specified instance.
 101.642 +// ----------------------------------------------------------------------------
 101.643 +static CMPIStatus InvokeMethod(
 101.644 +                CMPIMethodMI * self,            /* [in] Handle to this provider (i.e. 'self') */
 101.645 +                CMPIContext * context,          /* [in] Additional context info, if any */
 101.646 +                CMPIResult * results,           /* [out] Results of this operation */
 101.647 +                CMPIObjectPath * reference,     /* [in] Contains the CIM namespace, classname and desired object path */
 101.648 +                char * methodname,              /* [in] Name of the method to apply against the reference object */
 101.649 +                CMPIArgs * argsin,              /* [in] Method input arguments */
 101.650 +                CMPIArgs * argsout)             /* [in] Method output arguments */
 101.651 +{
 101.652 +   CMPIStatus status = {CMPI_RC_OK, NULL};      /* Return status of CIM operations. */
 101.653 +   _RESOURCES * resources;                      /* Handle to the list of system resources. */
 101.654 +   _RESOURCE * resource;                /* Handle to the system resource. */
 101.655 +   char * namespace = CMGetCharPtr(CMGetNameSpace(reference, NULL)); /* Target namespace. */
 101.656 +   int found = 0;                               /* Found the target instance? */
 101.657 +   unsigned long rc = 0;
 101.658 +
 101.659 +   _SBLIM_ENTER("InvokeMethod");
 101.660 +   _SBLIM_TRACE(2, ("--- self=\"%s\"", self->ft->miName));
 101.661 +   _SBLIM_TRACE(2, ("--- context=\"%s\"", CMGetCharPtr(CDToString(_BROKER, context, NULL))));
 101.662 +   _SBLIM_TRACE(2, ("--- reference=\"%s\"", CMGetCharPtr(CDToString(_BROKER, reference, NULL))));
 101.663 +   _SBLIM_TRACE(2, ("--- methodname=\"%s\"", methodname));
 101.664 +   _SBLIM_TRACE(2, ("--- namespace=\"%s\"", namespace));
 101.665 +
 101.666 +   /* Check that the method has the correct number of arguments. */
 101.667 +   int argcount = CMGetArgCount(argsin, NULL);
 101.668 +   _SBLIM_TRACE(2, ("--- # argsin=%d", argcount));
 101.669 +   if (argcount != 0) {
 101.670 +      _SBLIM_TRACE(1,("--- Incorrect number of method arguments"));
 101.671 +      CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_INVALID_PARAMETER, "Incorrect number of method arguments");
 101.672 +      goto exit;
 101.673 +   }
 101.674 +
 101.675 +   /* Get a handle to the list of system resources. */
 101.676 +   if (!Xen_ComputerSystem_getResources(&resources)) {
 101.677 +      _SBLIM_TRACE(1,("--- _getResources() failed"));
 101.678 +      CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_FAILED, "Failed to get list of system resources");
 101.679 +      goto exit;
 101.680 +   }
 101.681 +
 101.682 +   /* Get the target resource. */
 101.683 +   found = Xen_ComputerSystem_getResourceForObjectPath(resources, &resource, reference);
 101.684 +   if (!found || (resource == NULL)) {
 101.685 +      _SBLIM_TRACE(1,("--- Target instance not found"));
 101.686 +      CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_NOT_FOUND, "Target instance not found");
 101.687 +      goto exit;
 101.688 +   }
 101.689 +
 101.690 +   _SBLIM_TRACE(2,("--- instance found", found));
 101.691 +
 101.692 +   /* Invoke the method on the target instance. */
 101.693 +   rc = 1;
 101.694 +
 101.695 +   /* ---------------------- */
 101.696 +   /* DestroyVirtualSystem() */
 101.697 +   /* ---------------------- */
 101.698 +   if (strcmp(methodname, "DestroyVirtualSystem") == 0) {
 101.699 +      /* If the Xen domain is active then shut it down. */
 101.700 +      if (resource->info != NULL) {
 101.701 +         /* Initiate an asynchronous graceful shutdown of the domain's OS.
 101.702 +            Note - this will also eventually destroy the domain! */
 101.703 +         if (xm_shutdown(resources->xen, resource->name) != 0) {
 101.704 +            _SBLIM_TRACE(1, ("--- xm_shutdown() failed"));
 101.705 +            CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_FAILED, "Failed to shutdown VirtualSystem");
 101.706 +            rc = 0;
 101.707 +         } else {
 101.708 +            /* Wait a bit for the OS to shut itself down... */
 101.709 +            sleep(5);
 101.710 + 
 101.711 +            /* Forcibly destroy the domain, if it is still active. */
 101.712 +            xm_destroy(resources->xen, resource->name);
 101.713 +         }
 101.714 +      }
 101.715 +
 101.716 +      /* Remove the configuration info for the domain. */ 
 101.717 +      if (xm_delete(resources->xen, resource->name) != 0) {
 101.718 +         _SBLIM_TRACE(1, ("--- xm_delete() failed"));
 101.719 +         CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_FAILED, "Failed to destroy VirtualSystem");
 101.720 +         rc = 0;
 101.721 +      }
 101.722 +
 101.723 +      /* Try to remove any previously saved image file for this domain. */
 101.724 +      char cmd[1024];
 101.725 +      sprintf(cmd, "rm -f /tmp/%s.image", resource->name);
 101.726 +      int cmdrc = system(cmd);
 101.727 +      if (cmdrc != 0) {
 101.728 +         _SBLIM_TRACE(1,("--- Failed to remove image file"));
 101.729 +      }
 101.730 +   }
 101.731 +
 101.732 +   /* -------------------- */
 101.733 +   /* StartVirtualSystem() */
 101.734 +   /* -------------------- */
 101.735 +   else if (strcmp(methodname, "StartVirtualSystem") == 0) {
 101.736 +      /* Make sure the domain is not already running. */
 101.737 +      if (resource->info != NULL) {
 101.738 +         _SBLIM_TRACE(1, ("--- Domain is already running"));
 101.739 +         CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_FAILED, "VirtualSystem is already active");
 101.740 +         rc = 0;
 101.741 +      } else if (xm_create(resources->xen, resource->name) != 0) {
 101.742 +         _SBLIM_TRACE(1, ("--- xm_create() failed"));
 101.743 +         CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_FAILED, "Failed to start VirtualSystem");
 101.744 +         rc = 0;
 101.745 +      }
 101.746 +   }
 101.747 +
 101.748 +   /* ------------------- */
 101.749 +   /* StopVirtualSystem() */
 101.750 +   /* ------------------- */
 101.751 +   else if (strcmp(methodname, "StopVirtualSystem") == 0) {
 101.752 +      /* Make sure the domain is running. */
 101.753 +      if (resource->info == NULL) {
 101.754 +         _SBLIM_TRACE(1, ("--- Domain is not running"));
 101.755 +         CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_FAILED, "VirtualSystem is not active");
 101.756 +         rc = 0;
 101.757 +      } else {
 101.758 +         /* Initiate an asynchronous graceful shutdown of the domain's OS. */
 101.759 +         if (xm_shutdown(resources->xen, resource->name) != 0) {
 101.760 +            _SBLIM_TRACE(1, ("--- xm_shutdown() failed"));
 101.761 +            CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_FAILED, "Failed to shutdown VirtualSystem");
 101.762 +            rc = 0;
 101.763 +         } else {
 101.764 +            /* Wait a bit for the OS to shut itself down... */
 101.765 +            sleep(5);
 101.766 +
 101.767 +            /* Forcibly destroy the domain, if it is still active. */
 101.768 +            xm_destroy(resources->xen, resource->name);
 101.769 +         }
 101.770 +      } 
 101.771 +   }
 101.772 +
 101.773 +   /* ---------------------- */
 101.774 +   /* SuspendVirtualSystem() */
 101.775 +   /* ---------------------- */
 101.776 +   else if (strcmp(methodname, "SuspendVirtualSystem") == 0) {
 101.777 +      /* Make sure the domain is running. */
 101.778 +      if (resource->info == NULL) {
 101.779 +         _SBLIM_TRACE(1, ("--- Domain is not running"));
 101.780 +         CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_FAILED, "VirtualSystem is not active");
 101.781 +         rc = 0;
 101.782 +      } else {
 101.783 +         /* Save (and stop) the domain to a predetermined image file. */
 101.784 +         char filename[1024];
 101.785 +         sprintf(filename, "/tmp/%s.image", resource->name);
 101.786 +         if (xm_save(resources->xen, resource->name, filename) != 0) {
 101.787 +            _SBLIM_TRACE(1, ("--- xm_save() failed"));
 101.788 +            CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_FAILED, "Failed to suspend VirtualSystem");
 101.789 +            rc = 0;
 101.790 +         }
 101.791 +      }
 101.792 +   }
 101.793 +
 101.794 +   /* --------------------- */
 101.795 +   /* ResumeVirtualSystem() */
 101.796 +   /* --------------------- */
 101.797 +   else if (strcmp(methodname, "ResumeVirtualSystem") == 0) {
 101.798 +      /* Make sure the domain is not already running. */
 101.799 +      if (resource->info != NULL) {
 101.800 +         _SBLIM_TRACE(1, ("--- Domain is already running"));
 101.801 +         CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_FAILED, "VirtualSystem is already active");
 101.802 +         rc = 0;
 101.803 +      } else {
 101.804 +         /* Resume the domain from a predetermined image file. */
 101.805 +         char filename[1024];
 101.806 +         sprintf(filename, "/tmp/%s.image", resource->name);
 101.807 +
 101.808 +         /* Check that the image file exists. */
 101.809 +         struct stat statinfo;
 101.810 +         int statrc = stat(filename, &statinfo);
 101.811 +         if (statrc != 0) {
 101.812 +            _SBLIM_TRACE(1, ("--- image file for %s not found", resource->name));
 101.813 +            CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_FAILED, "Failed to resume VirtualSystem");
 101.814 +            rc = 0;
 101.815 +         } else if (xm_restore(resources->xen, filename) != 0) {
 101.816 +            _SBLIM_TRACE(1, ("--- xm_restore() failed"));
 101.817 +            CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_FAILED, "Failed to resume VirtualSystem");
 101.818 +            rc = 0;
 101.819 +         }
 101.820 +      }
 101.821 +   }
 101.822 +
 101.823 +   /* -------------------- */
 101.824 +   /* PauseVirtualSystem() */
 101.825 +   /* -------------------- */
 101.826 +   else if (strcmp(methodname, "PauseVirtualSystem") == 0) {
 101.827 +      /* Make sure the domain is running. */
 101.828 +      if (resource->info == NULL) {
 101.829 +         _SBLIM_TRACE(1, ("--- Domain is not running"));
 101.830 +         CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_FAILED, "VirtualSystem is not active");
 101.831 +         rc = 0;
 101.832 +      } else {
 101.833 +         if (xm_pause(resources->xen, resource->name) != 0) {
 101.834 +            _SBLIM_TRACE(1, ("--- xm_pause() failed"));
 101.835 +            CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_FAILED, "Failed to pause VirtualSystem");
 101.836 +            rc = 0;
 101.837 +         }
 101.838 +      }
 101.839 +   }
 101.840 +
 101.841 +   /* ---------------------- */
 101.842 +   /* UnPauseVirtualSystem() */
 101.843 +   /* ---------------------- */
 101.844 +   else if (strcmp(methodname, "UnpauseVirtualSystem") == 0) {
 101.845 +      /* Make sure the domain is running. */
 101.846 +      if (resource->info == NULL) {
 101.847 +         _SBLIM_TRACE(1, ("--- Domain is not running"));
 101.848 +         CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_FAILED, "VirtualSystem is not active");
 101.849 +         rc = 0;
 101.850 +      } else {
 101.851 +         if (xm_unpause(resources->xen, resource->name) != 0) {
 101.852 +            _SBLIM_TRACE(1, ("--- xm_unpause() failed"));
 101.853 +            CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_FAILED, "Failed to uppause VirtualSystem");
 101.854 +            rc = 0;
 101.855 +         }
 101.856 +      }
 101.857 +   }
 101.858 +
 101.859 +   else {
 101.860 +      _SBLIM_TRACE(1, ("--- Unrecognized method name - \"%s\"", methodname));
 101.861 +      CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_METHOD_NOT_FOUND, "Unrecognized method name");
 101.862 +      rc = 0;
 101.863 +   }
 101.864 +
 101.865 +   /* Free the resource data. */
 101.866 +   if (!Xen_ComputerSystem_freeResource(resource)) {
 101.867 +      _SBLIM_TRACE(1,("--- _freeResource() failed"));
 101.868 +      CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_FAILED, "Failed to free resource data");
 101.869 +      goto exit;
 101.870 +   }
 101.871 +
 101.872 +   CMReturnData(results, (CMPIValue *)&rc, CMPI_uint32);
 101.873 +   CMReturnDone(results);
 101.874 +
 101.875 +exit:
 101.876 +   /* Free the list of system resources. */
 101.877 +   if (!Xen_ComputerSystem_freeResources(resources)) {
 101.878 +      _SBLIM_TRACE(1,("--- _freeResources() failed"));
 101.879 +      CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_FAILED, "Failed to free list of system resources");
 101.880 +   }
 101.881 +
 101.882 +   _SBLIM_RETURNSTATUS(status);
 101.883 +}
 101.884 +
 101.885 +// ============================================================================
 101.886 +// CMPI METHOD PROVIDER FUNCTION TABLE SETUP
 101.887 +// ============================================================================
 101.888 +CMMethodMIStub( , Xen_ComputerSystemProvider, _BROKER, CMNoHook);
 101.889 +
   102.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   102.2 +++ b/src/Xen_ComputerSystemConfiguration.c	Wed Mar 22 14:05:14 2006 -0700
   102.3 @@ -0,0 +1,603 @@
   102.4 +// Copyright (C) 2006 IBM Corporation
   102.5 +//
   102.6 +//    This library is free software; you can redistribute it and/or
   102.7 +//    modify it under the terms of the GNU Lesser General Public
   102.8 +//    License as published by the Free Software Foundation; either
   102.9 +//    version 2.1 of the License, or (at your option) any later version.
  102.10 +//
  102.11 +//    This library is distributed in the hope that it will be useful,
  102.12 +//    but WITHOUT ANY WARRANTY; without even the implied warranty of
  102.13 +//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  102.14 +//    Lesser General Public License for more details.
  102.15 +//
  102.16 +//    You should have received a copy of the GNU Lesser General Public
  102.17 +//    License along with this library; if not, write to the Free Software
  102.18 +//    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  102.19 +// ============================================================================
  102.20 +// Authors:       Dr. Gareth S. Bestor, <bestor@us.ibm.com>
  102.21 +// Contributors:
  102.22 +// Description:
  102.23 +// ============================================================================
  102.24 +
  102.25 +/* Include the required CMPI data types, function headers, and macros */
  102.26 +#include "cmpidt.h"
  102.27 +#include "cmpift.h"
  102.28 +#include "cmpimacs.h"
  102.29 +
  102.30 +
  102.31 +// ----------------------------------------------------------------------------
  102.32 +// COMMON GLOBAL VARIABLES
  102.33 +// ----------------------------------------------------------------------------
  102.34 +
  102.35 +/* Handle to the CIM broker. Initialized when the provider lib is loaded. */
  102.36 +static CMPIBroker *_BROKER;
  102.37 +
  102.38 +/* Include utility functions */
  102.39 +#include "cmpiutil.h"
  102.40 +
  102.41 +/* Include _SBLIM_TRACE() logging support */
  102.42 +#include "cmpitrace.h"
  102.43 +
  102.44 +/* Include the abstract resource access functions and abstracted _RESOURCES and _RESOURCE data types. */
  102.45 +#include "Xen_ComputerSystemConfiguration_Resource.h"
  102.46 +
  102.47 +
  102.48 +// ============================================================================
  102.49 +// CMPI INSTANCE PROVIDER FUNCTION TABLE
  102.50 +// ============================================================================
  102.51 +
  102.52 +// ----------------------------------------------------------------------------
  102.53 +// Info for the class supported by the instance provider
  102.54 +// ----------------------------------------------------------------------------
  102.55 +
  102.56 +/* Name of the class implemented by this instance provider. */
  102.57 +/*** CUSTOMIZE FOR EACH PROVIDER ***/
  102.58 +static char * _CLASSNAME = "Xen_ComputerSystemConfiguration";
  102.59 +
  102.60 +/* NULL terminated list of key properties of this class. */
  102.61 +/*** CUSTOMIZE FOR EACH PROVIDER ***/
  102.62 +const static char * _KEYNAMES[] = {"SystemName", "SystemCreationClassName", "Name", "CreationClassName", NULL};
  102.63 +
  102.64 +// ----------------------------------------------------------------------------
  102.65 +// Cleanup()
  102.66 +// Perform any necessary cleanup immediately before this provider is unloaded.
  102.67 +// ----------------------------------------------------------------------------
  102.68 +static CMPIStatus Cleanup(
  102.69 +		CMPIInstanceMI * self,		/* [in] Handle to this provider (i.e. 'self'). */
  102.70 +		CMPIContext * context)		/* [in] Additional context info, if any. */
  102.71 +{
  102.72 +   CMPIStatus status = { CMPI_RC_OK, NULL };	/* Return status of CIM operations. */
  102.73 +
  102.74 +   _SBLIM_ENTER("Cleanup");
  102.75 +   _SBLIM_TRACE(2, ("--- self=\"%s\"", self->ft->miName));
  102.76 +   _SBLIM_TRACE(2, ("--- context=\"%s\"", CMGetCharPtr(CDToString(_BROKER, context, NULL))));
  102.77 +
  102.78 +   /* Nothing needs to be done for cleanup. */
  102.79 +
  102.80 +exit:
  102.81 +   _SBLIM_RETURNSTATUS(status);
  102.82 +}
  102.83 +
  102.84 +// ----------------------------------------------------------------------------
  102.85 +// EnumInstanceNames()
  102.86 +// Return a list of all the instances names (return their object paths only).
  102.87 +// ----------------------------------------------------------------------------
  102.88 +static CMPIStatus EnumInstanceNames(
  102.89 +		CMPIInstanceMI * self,		/* [in] Handle to this provider (i.e. 'self'). */
  102.90 +		CMPIContext * context,		/* [in] Additional context info, if any. */
  102.91 +		CMPIResult * results,		/* [out] Results of this operation. */
  102.92 +		CMPIObjectPath * reference) 	/* [in] Contains target namespace and classname. */
  102.93 +{
  102.94 +   CMPIStatus status = {CMPI_RC_OK, NULL};	/* Return status of CIM operations. */
  102.95 +   _RESOURCES * resources;			/* Handle to the list of system resources. */
  102.96 +   _RESOURCE * resource;			/* Handle to each system resource. */
  102.97 +   char * namespace = CMGetCharPtr(CMGetNameSpace(reference, NULL)); /* Target namespace. */
  102.98 +   int found = 0;				/* Found any instances? */
  102.99 +  
 102.100 +   _SBLIM_ENTER("EnumInstanceNames");
 102.101 +   _SBLIM_TRACE(2, ("--- self=\"%s\"", self->ft->miName));
 102.102 +   _SBLIM_TRACE(2, ("--- context=\"%s\"", CMGetCharPtr(CDToString(_BROKER, context, NULL))));
 102.103 +   _SBLIM_TRACE(2, ("--- reference=\"%s\"", CMGetCharPtr(CDToString(_BROKER, reference, NULL))));
 102.104 +   _SBLIM_TRACE(2, ("--- namespace=\"%s\"", namespace));
 102.105 +
 102.106 +   /* Get a handle to the list of system resources. */
 102.107 +   if (!Xen_ComputerSystemConfiguration_getResources(&resources)) {
 102.108 +      _SBLIM_TRACE(1,("--- _getResources() failed"));
 102.109 +      CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_FAILED, "Failed to get list of system resources");
 102.110 +      goto exit;
 102.111 +   }
 102.112 +
 102.113 +   /* Enumerate thru the list of system resources and return a CMPIInstance for each. */
 102.114 +   while (Xen_ComputerSystemConfiguration_getNextResource(resources, &resource)) {
 102.115 +      /* Create a new CMPIInstance to store this resource. */
 102.116 +      CMPIInstance * instance = _CMNewInstance(_BROKER, namespace, _CLASSNAME, &status);
 102.117 +      if ((status.rc != CMPI_RC_OK) || CMIsNullObject(instance)) {
 102.118 +         _SBLIM_TRACE(1,("--- CMNewInstance() failed - %s", CMGetCharPtr(status.msg)));
 102.119 +         CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERROR, "Cannot create new CMPIInstance");
 102.120 +         goto exit;
 102.121 +      }
 102.122 +
 102.123 +      /* Set the instance property values from the resource data. */
 102.124 +      if (!Xen_ComputerSystemConfiguration_setInstanceFromResource(resource, instance, _BROKER)) {
 102.125 +         _SBLIM_TRACE(1,("--- _setInstanceFromResource() failed"));
 102.126 +         CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_FAILED, "Failed to set property values from resource data");
 102.127 +         goto exit;
 102.128 +      }
 102.129 +
 102.130 +      /* Free the resource data. */
 102.131 +      if (!Xen_ComputerSystemConfiguration_freeResource(resource)) {
 102.132 +         _SBLIM_TRACE(1,("--- _freeResource() failed"));
 102.133 +         CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_FAILED, "Failed to free resource data");
 102.134 +         goto exit;
 102.135 +      }
 102.136 +
 102.137 +      /* Return the CMPIObjectPath for this instance. */
 102.138 +      CMPIObjectPath * objectpath = CMGetObjectPath(instance, &status);
 102.139 +      if ((status.rc != CMPI_RC_OK) || CMIsNullObject(objectpath)) {
 102.140 +         _SBLIM_TRACE(1,("--- CMGetObjectPath() failed - %s", CMGetCharPtr(status.msg)));
 102.141 +         CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERROR, "Cannot get CMPIObjectPath for instance");
 102.142 +         goto exit;
 102.143 +      }
 102.144 +      CMSetNameSpace(objectpath, namespace); /* Note - CMGetObjectPath() does not preserve the namespace! */
 102.145 +     
 102.146 +      _SBLIM_TRACE(3,("--- objectpath=\"%s\"", CMGetCharPtr(CDToString(_BROKER, objectpath, NULL))));
 102.147 +      CMReturnObjectPath(results, objectpath);
 102.148 +      found++;
 102.149 +   }
 102.150 +
 102.151 +   _SBLIM_TRACE(2,("--- %d object paths found", found));
 102.152 +   CMReturnDone(results);
 102.153 +
 102.154 +exit:
 102.155 +   /* Free the list of system resources. */
 102.156 +   if (!Xen_ComputerSystemConfiguration_freeResources(resources)) {
 102.157 +      _SBLIM_TRACE(1,("--- _freeResources() failed"));
 102.158 +      CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_FAILED, "Failed to free list of system resources");
 102.159 +   }
 102.160 +  
 102.161 +   _SBLIM_RETURNSTATUS(status);
 102.162 +}
 102.163 +
 102.164 +// ----------------------------------------------------------------------------
 102.165 +// EnumInstances()
 102.166 +// Return a list of all the instances (return all the instance data).
 102.167 +// ----------------------------------------------------------------------------
 102.168 +static CMPIStatus EnumInstances(
 102.169 +		CMPIInstanceMI * self,		/* [in] Handle to this provider (i.e. 'self'). */
 102.170 +		CMPIContext * context,		/* [in] Additional context info, if any. */
 102.171 +		CMPIResult * results,		/* [out] Results of this operation. */
 102.172 +		CMPIObjectPath * reference,	/* [in] Contains target namespace and classname. */
 102.173 +		const char ** properties)	/* [in] List of desired properties (NULL=all). */
 102.174 +{
 102.175 +   CMPIStatus status = {CMPI_RC_OK, NULL};	/* Return status of CIM operations. */
 102.176 +   _RESOURCES * resources;			/* Handle to the list of system resources. */
 102.177 +   _RESOURCE * resource;			/* Handle to each system resource. */
 102.178 +   char * namespace = CMGetCharPtr(CMGetNameSpace(reference, NULL)); /* Target namespace. */
 102.179 +   int found = 0;				/* Found any resource instances? */
 102.180 +
 102.181 +   _SBLIM_ENTER("EnumInstances");
 102.182 +   _SBLIM_TRACE(2, ("--- self=\"%s\"", self->ft->miName));
 102.183 +   _SBLIM_TRACE(2, ("--- context=\"%s\"", CMGetCharPtr(CDToString(_BROKER, context, NULL))));
 102.184 +   _SBLIM_TRACE(2, ("--- reference=\"%s\"", CMGetCharPtr(CDToString(_BROKER, reference, NULL))));
 102.185 +   _SBLIM_TRACE(2, ("--- namespace=\"%s\"", namespace));
 102.186 +
 102.187 +   /* Get a handle to the list of system resources. */
 102.188 +   if (!Xen_ComputerSystemConfiguration_getResources(&resources)) {
 102.189 +      _SBLIM_TRACE(1,("--- _getResources() failed"));
 102.190 +      CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_FAILED, "Failed to get list of system resources");
 102.191 +      goto exit;
 102.192 +   }
 102.193 +
 102.194 +   /* Enumerate thru the list of system resources and return a CMPIInstance for each. */
 102.195 +   while (Xen_ComputerSystemConfiguration_getNextResource(resources, &resource)) {
 102.196 +      /* Create a new CMPIInstance to store this resource. */
 102.197 +      CMPIInstance * instance = _CMNewInstance(_BROKER, namespace, _CLASSNAME, &status);
 102.198 +      if ((status.rc != CMPI_RC_OK) || CMIsNullObject(instance)) {
 102.199 +         _SBLIM_TRACE(1,("--- CMNewInstance() failed - %s", CMGetCharPtr(status.msg)));
 102.200 +         CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERROR, "Cannot create new CMPIInstance");
 102.201 +         goto exit;
 102.202 +      }
 102.203 +
 102.204 +      /* Setup a filter to only return the desired properties. */
 102.205 +      status = CMSetPropertyFilter(instance, properties, _KEYNAMES);
 102.206 +      if (status.rc != CMPI_RC_OK) {
 102.207 +         _SBLIM_TRACE(1, ("--- CMSetPropertyFilter() failed - %s", CMGetCharPtr(status.msg)));
 102.208 +         CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_FAILED, "Cannot set property filter");
 102.209 +         goto exit;
 102.210 +      }
 102.211 +
 102.212 +      /* Set the instance property values from the resource data. */
 102.213 +      if (!Xen_ComputerSystemConfiguration_setInstanceFromResource(resource, instance, _BROKER)) {
 102.214 +         _SBLIM_TRACE(1,("--- _setInstanceFromResource() failed"));
 102.215 +         CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_FAILED, "Failed to set property values from resource data");
 102.216 +         goto exit;
 102.217 +      }
 102.218 +
 102.219 +      /* Free the resource data. */
 102.220 +      if (!Xen_ComputerSystemConfiguration_freeResource(resource)) {
 102.221 +         _SBLIM_TRACE(1,("--- _freeResource() failed"));
 102.222 +         CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_FAILED, "Failed to free resource data");
 102.223 +         goto exit;
 102.224 +      }
 102.225 +
 102.226 +      /* Return the CMPIInstance for this instance. */
 102.227 +      _SBLIM_TRACE(3,("--- instance=\"%s\"", CMGetCharPtr(CDToString(_BROKER, instance, NULL))));
 102.228 +      CMReturnInstance(results, instance);
 102.229 +      found++;
 102.230 +   }
 102.231 +
 102.232 +   _SBLIM_TRACE(2,("--- %d instances found", found));
 102.233 +   CMReturnDone(results);
 102.234 +
 102.235 +exit:
 102.236 +   /* Free the list of system resources. */
 102.237 +   if (!Xen_ComputerSystemConfiguration_freeResources(resources)) {
 102.238 +      _SBLIM_TRACE(1,("--- _freeResources() failed"));
 102.239 +      CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_FAILED, "Failed to free list of system resources");
 102.240 +   }
 102.241 +
 102.242 +   _SBLIM_RETURNSTATUS(status);
 102.243 +}
 102.244 +
 102.245 +// ----------------------------------------------------------------------------
 102.246 +// GetInstance()
 102.247 +// Return the instance data for the specified instance only.
 102.248 +// ----------------------------------------------------------------------------
 102.249 +static CMPIStatus GetInstance(
 102.250 +		CMPIInstanceMI * self,		/* [in] Handle to this provider (i.e. 'self'). */
 102.251 +		CMPIContext * context,		/* [in] Additional context info, if any. */
 102.252 +		CMPIResult * results,		/* [out] Results of this operation. */
 102.253 +		CMPIObjectPath * reference,	/* [in] Contains the target namespace, classname and object path. */
 102.254 +		const char ** properties)		/* [in] List of desired properties (NULL=all). */
 102.255 +{
 102.256 +   CMPIStatus status = {CMPI_RC_OK, NULL};	/* Return status of CIM operations. */
 102.257 +   _RESOURCES * resources;			/* Handle to the list of system resources. */
 102.258 +   _RESOURCE * resource;			/* Handle to the system resource. */
 102.259 +   char * namespace = CMGetCharPtr(CMGetNameSpace(reference, NULL)); /* Target namespace. */
 102.260 +   int found = 0;				/* Found the target instance? */
 102.261 +
 102.262 +   _SBLIM_ENTER("GetInstance");
 102.263 +   _SBLIM_TRACE(2, ("--- self=\"%s\"", self->ft->miName));
 102.264 +   _SBLIM_TRACE(2, ("--- context=\"%s\"", CMGetCharPtr(CDToString(_BROKER, context, NULL))));
 102.265 +   _SBLIM_TRACE(2, ("--- reference=\"%s\"", CMGetCharPtr(CDToString(_BROKER, reference, NULL))));
 102.266 +   _SBLIM_TRACE(2, ("--- namespace=\"%s\"", namespace));
 102.267 +
 102.268 +   /* Get a handle to the list of system resources. */
 102.269 +   if (!Xen_ComputerSystemConfiguration_getResources(&resources)) {
 102.270 +      _SBLIM_TRACE(1,("--- _getResources() failed"));
 102.271 +      CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_FAILED, "Failed to get list of system resources");
 102.272 +      goto exit;
 102.273 +   }
 102.274 +
 102.275 +   /* Get the target resource. */
 102.276 +   found = Xen_ComputerSystemConfiguration_getResourceForObjectPath(resources, &resource, reference);
 102.277 +   if (!found || (resource == NULL)) {
 102.278 +      _SBLIM_TRACE(1,("--- Target instance not found"));
 102.279 +      CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_NOT_FOUND, "Target instance not found");
 102.280 +      goto exit;
 102.281 +   }
 102.282 +
 102.283 +   /* Create a new CMPIInstance to store this resource. */
 102.284 +   CMPIInstance * instance = _CMNewInstance(_BROKER, namespace, _CLASSNAME, &status);
 102.285 +   if ((status.rc != CMPI_RC_OK) || CMIsNullObject(instance)) {
 102.286 +      _SBLIM_TRACE(1,("--- CMNewInstance() failed - %s", CMGetCharPtr(status.msg)));
 102.287 +      CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERROR, "Cannot create new CMPIInstance");
 102.288 +      goto exit;
 102.289 +   }
 102.290 +
 102.291 +   /* Setup a filter to only return the desired properties. */
 102.292 +   status = CMSetPropertyFilter(instance, properties, _KEYNAMES);
 102.293 +   if (status.rc != CMPI_RC_OK) {
 102.294 +      _SBLIM_TRACE(1, ("--- CMSetPropertyFilter() failed - %s", CMGetCharPtr(status.msg)));
 102.295 +      CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_FAILED, "Cannot set property filter");
 102.296 +      goto exit;
 102.297 +   }
 102.298 +
 102.299 +   /* Set the instance property values from the resource data. */
 102.300 +   if (!Xen_ComputerSystemConfiguration_setInstanceFromResource(resource, instance, _BROKER)) {
 102.301 +      _SBLIM_TRACE(1,("--- _setInstanceFromResource() failed"));
 102.302 +      CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_FAILED, "Failed to set property values from resource data");
 102.303 +      goto exit;
 102.304 +   }
 102.305 +
 102.306 +   /* Free the resource data. */
 102.307 +   if (!Xen_ComputerSystemConfiguration_freeResource(resource)) {
 102.308 +      _SBLIM_TRACE(1,("--- _freeResource() failed"));
 102.309 +      CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_FAILED, "Failed to free resource data");
 102.310 +      goto exit;
 102.311 +   }
 102.312 +
 102.313 +   /* Return the CMPIInstance for this instance. */
 102.314 +   _SBLIM_TRACE(3,("--- instance=\"%s\"", CMGetCharPtr(CDToString(_BROKER, instance, NULL))));
 102.315 +   CMReturnInstance(results, instance);
 102.316 +
 102.317 +   _SBLIM_TRACE(2,("--- instance found"));
 102.318 +   CMReturnDone(results);
 102.319 +
 102.320 +exit:
 102.321 +   /* Free the list of system resources. */
 102.322 +   if (!Xen_ComputerSystemConfiguration_freeResources(resources)) {
 102.323 +      _SBLIM_TRACE(1,("--- _freeResources() failed"));
 102.324 +      CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_FAILED, "Failed to free list of system resources");
 102.325 +   }
 102.326 +
 102.327 +   _SBLIM_RETURNSTATUS(status);
 102.328 +}
 102.329 +
 102.330 +// ----------------------------------------------------------------------------
 102.331 +// SetInstance()
 102.332 +// Save modified instance data for the specified instance.
 102.333 +// ----------------------------------------------------------------------------
 102.334 +static CMPIStatus SetInstance(
 102.335 +		CMPIInstanceMI * self,		/* [in] Handle to this provider (i.e. 'self'). */
 102.336 +		CMPIContext * context,		/* [in] Additional context info, if any. */
 102.337 +		CMPIResult * results,		/* [out] Results of this operation. */
 102.338 +		CMPIObjectPath * reference,	/* [in] Contains the target namespace, classname and object path. */
 102.339 +		CMPIInstance * newinstance)	/* [in] Contains the new instance data. */
 102.340 +{
 102.341 +   CMPIStatus status = {CMPI_RC_OK, NULL};	/* Return status of CIM operations. */
 102.342 +   _RESOURCES * resources;			/* Handle to the list of system resources. */
 102.343 +   _RESOURCE * resource;	       		/* Handle to the system resource. */
 102.344 +   char * namespace = CMGetCharPtr(CMGetNameSpace(reference, NULL)); /* Target namespace. */
 102.345 +   int found = 0;				/* Found the target instance? */
 102.346 +
 102.347 +   _SBLIM_ENTER("SetInstance");
 102.348 +   _SBLIM_TRACE(2, ("--- self=\"%s\"", self->ft->miName));
 102.349 +   _SBLIM_TRACE(2, ("--- context=\"%s\"", CMGetCharPtr(CDToString(_BROKER, context, NULL))));
 102.350 +   _SBLIM_TRACE(2, ("--- reference=\"%s\"", CMGetCharPtr(CDToString(_BROKER, reference, NULL))));
 102.351 +   _SBLIM_TRACE(2, ("--- newinstance=\"%s\"", CMGetCharPtr(CDToString(_BROKER, newinstance, NULL))));
 102.352 +   _SBLIM_TRACE(2, ("--- namespace=\"%s\"", namespace));
 102.353 +
 102.354 +   /* Get a handle to the list of system resources. */
 102.355 +   if (!Xen_ComputerSystemConfiguration_getResources(&resources)) {
 102.356 +      _SBLIM_TRACE(1,("--- _getResources() failed"));
 102.357 +      CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_FAILED, "Failed to get list of system resources");
 102.358 +      goto exit;
 102.359 +   }
 102.360 +
 102.361 +   /* Get the target resource. */
 102.362 +   found = Xen_ComputerSystemConfiguration_getResourceForObjectPath(resources, &resource, reference);
 102.363 +   if (!found || (resource == NULL)) {
 102.364 +      _SBLIM_TRACE(1,("--- Target instance not found"));
 102.365 +      CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_NOT_FOUND, "Target instance not found");
 102.366 +      goto exit;
 102.367 +   }
 102.368 +
 102.369 +   _SBLIM_TRACE(2,("--- instance found", found));
 102.370 +
 102.371 +   /* Update the target resource data with the new instance property values. */
 102.372 +   int rc = Xen_ComputerSystemConfiguration_setResourceFromInstance(resource, newinstance, _BROKER);
 102.373 +
 102.374 +   /* Free the resource data. */
 102.375 +   if (!Xen_ComputerSystemConfiguration_freeResource(resource)) {
 102.376 +      _SBLIM_TRACE(1,("--- _freeResource() failed"));
 102.377 +      CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_FAILED, "Failed to free resource data");
 102.378 +      goto exit;
 102.379 +   }
 102.380 +
 102.381 +   if (rc != 1) {
 102.382 +      if (rc == -1) {
 102.383 +         _SBLIM_TRACE(1,("--- _setResourceFromInstance() unsupported"));
 102.384 +         CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_NOT_SUPPORTED, NULL);
 102.385 +      } else {
 102.386 +         _SBLIM_TRACE(1,("--- _setResourceFromInstance() failed"));
 102.387 +         CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_FAILED, "Failed to set resource data from instance properties");
 102.388 +      }
 102.389 +      goto exit;
 102.390 +   }
 102.391 +
 102.392 +exit:
 102.393 +   /* Free the list of system resources. */
 102.394 +   if (!Xen_ComputerSystemConfiguration_freeResources(resources)) {
 102.395 +      _SBLIM_TRACE(1,("--- _freeResources() failed"));
 102.396 +      CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_FAILED, "Failed to free list of system resources");
 102.397 +   }
 102.398 +
 102.399 +   _SBLIM_RETURNSTATUS(status);
 102.400 +}
 102.401 +
 102.402 +// ----------------------------------------------------------------------------
 102.403 +// CreateInstance()
 102.404 +// Create a new instance from the specified instance data.
 102.405 +// ----------------------------------------------------------------------------
 102.406 +static CMPIStatus CreateInstance(
 102.407 +		CMPIInstanceMI * self,		/* [in] Handle to this provider (i.e. 'self'). */
 102.408 +		CMPIContext * context,		/* [in] Additional context info, if any. */
 102.409 +		CMPIResult * results,		/* [out] Results of this operation. */
 102.410 +		CMPIObjectPath * reference,	/* [in] Contains the target namespace, classname and object path. */
 102.411 +		CMPIInstance * newinstance)	/* [in] Contains the new instance data. */
 102.412 +{
 102.413 +   CMPIStatus status = {CMPI_RC_OK, NULL};	/* Return status of CIM operations. */
 102.414 +   _RESOURCES * resources;			/* Handle to the list of system resources. */
 102.415 +   _RESOURCE * resource;			/* Handle to the system resource. */
 102.416 +   char * namespace = CMGetCharPtr(CMGetNameSpace(reference, NULL)); /* Target namespace. */
 102.417 +   int found = 0;				/* Found the target instance? */
 102.418 +
 102.419 +   _SBLIM_ENTER("CreateInstance");
 102.420 +   _SBLIM_TRACE(2, ("--- self=\"%s\"", self->ft->miName));
 102.421 +   _SBLIM_TRACE(2, ("--- context=\"%s\"", CMGetCharPtr(CDToString(_BROKER, context, NULL))));
 102.422 +   _SBLIM_TRACE(2, ("--- reference=\"%s\"", CMGetCharPtr(CDToString(_BROKER, reference, NULL))));
 102.423 +   _SBLIM_TRACE(2, ("--- newinstance=\"%s\"", CMGetCharPtr(CDToString(_BROKER, newinstance, NULL))));
 102.424 +   _SBLIM_TRACE(2, ("--- namespace=\"%s\"", namespace));
 102.425 +
 102.426 +   /* WORKAROUND FOR PEGASUS BUG?! reference does not contain object path, only namespace & classname. */
 102.427 +   reference = CMGetObjectPath(newinstance, NULL);
 102.428 +
 102.429 +   /* Get a handle to the list of system resources. */
 102.430 +   if (!Xen_ComputerSystemConfiguration_getResources(&resources)) {
 102.431 +      _SBLIM_TRACE(1,("--- _getResources() failed"));
 102.432 +      CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_FAILED, "Failed to get list of system resources");
 102.433 +      goto exit;
 102.434 +   }
 102.435 +
 102.436 +   /* Get the target resource. */
 102.437 +   found = Xen_ComputerSystemConfiguration_getResourceForObjectPath(resources, &resource, reference);
 102.438 +
 102.439 +   /* Free the resource data. */
 102.440 +   if (!Xen_ComputerSystemConfiguration_freeResource(resource)) {
 102.441 +      _SBLIM_TRACE(1,("--- _freeResource() failed"));
 102.442 +      CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_FAILED, "Failed to free resource data");
 102.443 +      goto exit;
 102.444 +   }
 102.445 +
 102.446 +   if (found) {
 102.447 +      _SBLIM_TRACE(1,("--- Target instance already exists"));
 102.448 +      CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_ALREADY_EXISTS, "Target instance already exists");
 102.449 +      goto exit;
 102.450 +   }
 102.451 +
 102.452 +   /* Create a new resource with the new instance property values. */
 102.453 +   int rc = Xen_ComputerSystemConfiguration_createResourceFromInstance(resources, &resource, newinstance, _BROKER);
 102.454 +   if (rc != 1) {
 102.455 +      if (rc == -1) {
 102.456 +         _SBLIM_TRACE(1,("--- _createResourceFromInstance() unsupported"));
 102.457 +         CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_NOT_SUPPORTED, NULL);
 102.458 +      } else {
 102.459 +         _SBLIM_TRACE(1,("--- _createResourceFromInstance() failed"));
 102.460 +         CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_FAILED, "Failed to create resource data from instance properties");
 102.461 +      }
 102.462 +      goto exit;
 102.463 +   }
 102.464 +
 102.465 +   /* Return the object path for the newly created instance. */
 102.466 +   CMPIObjectPath * objectpath = CMGetObjectPath(newinstance, NULL);
 102.467 +   CMSetNameSpace(objectpath, namespace);
 102.468 +   CMReturnObjectPath(results, objectpath);
 102.469 +   CMReturnDone(results);
 102.470 +
 102.471 +exit:
 102.472 +   /* Free the list of system resources. */
 102.473 +   if (!Xen_ComputerSystemConfiguration_freeResources(resources)) {
 102.474 +      _SBLIM_TRACE(1,("--- _freeResources() failed"));
 102.475 +      CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_FAILED, "Failed to free list of system resources");
 102.476 +   }
 102.477 +
 102.478 +   _SBLIM_RETURNSTATUS(status);
 102.479 +}
 102.480 +
 102.481 +// ----------------------------------------------------------------------------
 102.482 +// DeleteInstance()
 102.483 +// Delete or remove the specified instance from the system.
 102.484 +// ----------------------------------------------------------------------------
 102.485 +static CMPIStatus DeleteInstance(
 102.486 +		CMPIInstanceMI * self,		/* [in] Handle to this provider (i.e. 'self'). */
 102.487 +		CMPIContext * context,		/* [in] Additional context info, if any. */
 102.488 +		CMPIResult * results,		/* [out] Results of this operation. */
 102.489 +		CMPIObjectPath * reference)	/* [in] Contains the target namespace, classname and object path. */
 102.490 +{
 102.491 +   CMPIStatus status = {CMPI_RC_OK, NULL};	/* Return status of CIM operations. */
 102.492 +   _RESOURCES * resources;			/* Handle to the list of system resources. */
 102.493 +   _RESOURCE * resource;		/* Handle to the system resource. */
 102.494 +   char * namespace = CMGetCharPtr(CMGetNameSpace(reference, NULL)); /* Target namespace. */
 102.495 +   int found = 0;				/* Found the target instance? */
 102.496 +
 102.497 +   _SBLIM_ENTER("DeleteInstance");
 102.498 +   _SBLIM_TRACE(2, ("--- self=\"%s\"", self->ft->miName));
 102.499 +   _SBLIM_TRACE(2, ("--- context=\"%s\"", CMGetCharPtr(CDToString(_BROKER, context, NULL))));
 102.500 +   _SBLIM_TRACE(2, ("--- reference=\"%s\"", CMGetCharPtr(CDToString(_BROKER, reference, NULL))));
 102.501 +   _SBLIM_TRACE(2, ("--- namespace=\"%s\"", namespace));
 102.502 +
 102.503 +   /* Get a handle to the list of system resources. */
 102.504 +   if (!Xen_ComputerSystemConfiguration_getResources(&resources)) {
 102.505 +      _SBLIM_TRACE(1,("--- _getResources() failed"));
 102.506 +      CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_FAILED, "Failed to get list of system resources");
 102.507 +      goto exit;
 102.508 +   }
 102.509 +
 102.510 +   /* Get the target resource. */
 102.511 +   found = Xen_ComputerSystemConfiguration_getResourceForObjectPath(resources, &resource, reference);
 102.512 +   if (!found || (resource == NULL)) {
 102.513 +      _SBLIM_TRACE(1,("--- Target instance not found"));
 102.514 +      CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_NOT_FOUND, "Target instance not found");
 102.515 +      goto exit;
 102.516 +   }
 102.517 +
 102.518 +   _SBLIM_TRACE(2,("--- instance found", found));
 102.519 +
 102.520 +   /* Delete the target resource. */
 102.521 +   int rc = Xen_ComputerSystemConfiguration_deleteResource(resources, resource);
 102.522 +
 102.523 +   /* Free the resource data. */
 102.524 +   if (!Xen_ComputerSystemConfiguration_freeResource(resource)) {
 102.525 +      _SBLIM_TRACE(1,("--- _freeResource() failed"));
 102.526 +      CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_FAILED, "Failed to free resource data");
 102.527 +      goto exit;
 102.528 +   }
 102.529 +
 102.530 +   if (rc != 1) {
 102.531 +      if (rc == -1) {
 102.532 +         _SBLIM_TRACE(1,("--- __deleteResource() unsupported"));
 102.533 +         CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_NOT_SUPPORTED, NULL);
 102.534 +      } else {
 102.535 +         _SBLIM_TRACE(1,("--- _deleteResource() failed"));
 102.536 +         CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_FAILED, "Failed to delete resource");
 102.537 +      }
 102.538 +      goto exit;
 102.539 +   }
 102.540 +
 102.541 +exit:
 102.542 +   /* Free the list of system resources. */
 102.543 +   if (!Xen_ComputerSystemConfiguration_freeResources(resources)) {
 102.544 +      _SBLIM_TRACE(1,("--- _freeResources() failed"));
 102.545 +      CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_FAILED, "Failed to free list of system resources");
 102.546 +   }
 102.547 +
 102.548 +   _SBLIM_RETURNSTATUS(status);
 102.549 +}
 102.550 +
 102.551 +
 102.552 +// ----------------------------------------------------------------------------
 102.553 +// ExecQuery()
 102.554 +// Return a list of all the instances that satisfy the specified query filter.
 102.555 +// ----------------------------------------------------------------------------
 102.556 +static CMPIStatus ExecQuery(
 102.557 +		CMPIInstanceMI * self,		/* [in] Handle to this provider (i.e. 'self'). */
 102.558 +		CMPIContext * context,		/* [in] Additional context info, if any. */
 102.559 +		CMPIResult * results,		/* [out] Results of this operation. */
 102.560 +		CMPIObjectPath * reference,	/* [in] Contains the target namespace and classname. */
 102.561 +		char * language,		/* [in] Name of the query language. */
 102.562 +		char * query)			/* [in] Text of the query written in the query language. */
 102.563 +{
 102.564 +   CMPIStatus status = {CMPI_RC_OK, NULL};      /* Return status of CIM operations. */
 102.565 +   char * namespace = CMGetCharPtr(CMGetNameSpace(reference, NULL)); /* Target namespace. */
 102.566 +
 102.567 +   _SBLIM_ENTER("ExecQuery");
 102.568 +   _SBLIM_TRACE(2, ("--- self=\"%s\"", self->ft->miName));
 102.569 +   _SBLIM_TRACE(2, ("--- context=\"%s\"", CMGetCharPtr(CDToString(_BROKER, context, NULL))));
 102.570 +   _SBLIM_TRACE(2, ("--- reference=\"%s\"", CMGetCharPtr(CDToString(_BROKER, reference, NULL))));
 102.571 +   _SBLIM_TRACE(2, ("--- language=\"%s\"", language));
 102.572 +   _SBLIM_TRACE(2, ("--- query=\"%s\"", query));
 102.573 +   _SBLIM_TRACE(2, ("--- namespace=\"%s\"", namespace));
 102.574 +
 102.575 +   /* EXECQUERY() IS NOT YET SUPPORTED FOR THIS CLASS */
 102.576 +   CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_NOT_SUPPORTED, NULL);
 102.577 +
 102.578 +   CMReturnDone(results);
 102.579 +
 102.580 +exit:
 102.581 +   _SBLIM_RETURNSTATUS(status);
 102.582 +}
 102.583 +
 102.584 +// ----------------------------------------------------------------------------
 102.585 +// Initialize()
 102.586 +// Perform any necessary initialization immediately after this provider is
 102.587 +// first loaded.
 102.588 +// ----------------------------------------------------------------------------
 102.589 +static void Initialize(
 102.590 +		CMPIInstanceMI * self,		/* [in] Handle to this provider (i.e. 'self'). */
 102.591 +		CMPIContext * context)		/* [in] Additional context info, if any. */
 102.592 +{
 102.593 +   _SBLIM_ENTER("Initialize");
 102.594 +   _SBLIM_TRACE(2, ("--- self=\"%s\"", self->ft->miName));
 102.595 +   _SBLIM_TRACE(2, ("--- context=\"%s\"", CMGetCharPtr(CDToString(_BROKER, context, NULL))));
 102.596 +
 102.597 +   /* Nothing needs to be done to initialize this provider */
 102.598 +
 102.599 +exit:
 102.600 +   _SBLIM_RETURN();
 102.601 +}
 102.602 +
 102.603 +// ============================================================================
 102.604 +// CMPI INSTANCE PROVIDER FUNCTION TABLE SETUP
 102.605 +// ============================================================================
 102.606 +CMInstanceMIStub( , Xen_ComputerSystemConfigurationProvider, _BROKER, Initialize(&mi, ctx));
   103.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   103.2 +++ b/src/Xen_ComputerSystemConfiguration_Resource.c	Wed Mar 22 14:05:14 2006 -0700
   103.3 @@ -0,0 +1,351 @@
   103.4 +// Copyright (C) 2006 IBM Corporation
   103.5 +//
   103.6 +//    This library is free software; you can redistribute it and/or
   103.7 +//    modify it under the terms of the GNU Lesser General Public
   103.8 +//    License as published by the Free Software Foundation; either
   103.9 +//    version 2.1 of the License, or (at your option) any later version.
  103.10 +//
  103.11 +//    This library is distributed in the hope that it will be useful,
  103.12 +//    but WITHOUT ANY WARRANTY; without even the implied warranty of
  103.13 +//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  103.14 +//    Lesser General Public License for more details.
  103.15 +//
  103.16 +//    You should have received a copy of the GNU Lesser General Public
  103.17 +//    License along with this library; if not, write to the Free Software
  103.18 +//    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  103.19 +// ============================================================================
  103.20 +// Authors:       Dr. Gareth S. Bestor, <bestor@us.ibm.com>
  103.21 +//                Tokunbo Adeshiyan, <tokunbo@us.ibm.com>
  103.22 +// Contributors:
  103.23 +// Description:
  103.24 +// ============================================================================
  103.25 +
  103.26 +#include "Xen_ComputerSystemConfiguration_Resource.h"
  103.27 +
  103.28 +/* Include the required CMPI data types, function headers, and macros. */
  103.29 +#include "cmpidt.h"
  103.30 +#include "cmpift.h"
  103.31 +#include "cmpimacs.h"
  103.32 +
  103.33 +/* Include the libxm Xen API. */
  103.34 +#include "xm.h"
  103.35 +
  103.36 +// ----------------------------------------------------------------------------
  103.37 +
  103.38 +/* Get a handle to the list of all system resources for this class. */
  103.39 +int Xen_ComputerSystemConfiguration_getResources( _RESOURCES ** resources )
  103.40 +{
  103.41 +   /* malloc a new handle for the resources list. */
  103.42 +   *resources = (_RESOURCES *)malloc(sizeof(_RESOURCES));
  103.43 +   if (*resources == NULL) return 0;
  103.44 +
  103.45 +   /* Initialize libxm. */
  103.46 +   (*resources)->xen = xm_init();
  103.47 +   if ((*resources)->xen == NULL) {
  103.48 +      free(*resources);
  103.49 +      *resources = NULL;
  103.50 +      return 0;
  103.51 +   }
  103.52 +
  103.53 +   /* Get the list of resources. */
  103.54 +   (*resources)->domainnames = xm_enum_domains((*resources)->xen, &((*resources)->numdomains));
  103.55 +   if ((*resources)->domainnames == NULL) {
  103.56 +      xm_close((*resources)->xen);
  103.57 +      free(*resources);
  103.58 +      *resources = NULL;
  103.59 +      return 0;
  103.60 +   }
  103.61 +
  103.62 +   /* Start iterating from the first resource in the list. */
  103.63 +   (*resources)->currentdomain = 0;
  103.64 +
  103.65 +   return 1;
  103.66 +}
  103.67 +
  103.68 +// ----------------------------------------------------------------------------
  103.69 +
  103.70 +/* Free/deallocate/cleanup the resources list after use. */
  103.71 +int Xen_ComputerSystemConfiguration_freeResources( _RESOURCES * resources )
  103.72 +{
  103.73 +   /* Free any malloc'd memory used to store the list of resources. */
  103.74 +   if (resources != NULL) {
  103.75 +       if (resources->xen != NULL) xm_close(resources->xen);
  103.76 +       if (resources->domainnames != NULL) free(resources->domainnames);
  103.77 +       free(resources);
  103.78 +       resources = NULL;
  103.79 +   }
  103.80 +   
  103.81 +   return 1;
  103.82 +}
  103.83 +
  103.84 +// ----------------------------------------------------------------------------
  103.85 +
  103.86 +/* Iterator to get the next resource from the resources list. */
  103.87 +int Xen_ComputerSystemConfiguration_getNextResource( _RESOURCES * resources, _RESOURCE ** resource )
  103.88 +{
  103.89 +   /* Check input params are valid. */
  103.90 +   if (resources == NULL) return 0;
  103.91 +
  103.92 +   /* Check if reached the end of the list of resources. */
  103.93 +   if (resources->currentdomain == resources->numdomains) return 0;
  103.94 +
  103.95 +   /* Obtain the resource identifier of the next resource. */
  103.96 +   char * id = resources->domainnames[resources->currentdomain];
  103.97 +   if ((id == NULL) || (*id == '\0')) return 0;
  103.98 +
  103.99 +   /* Get all the resource data for the target resource. */
 103.100 +   *resource = xm_get_domain(resources->xen, id);
 103.101 +   if (*resource == NULL) return 0;
 103.102 +
 103.103 +   /* Move to the next resource in the list. */
 103.104 +   resources->currentdomain++;
 103.105 +
 103.106 +   return 1;
 103.107 +}
 103.108 +
 103.109 +// ----------------------------------------------------------------------------
 103.110 +
 103.111 +/* Get the specific resource that matches the CMPI object path. */
 103.112 +int Xen_ComputerSystemConfiguration_getResourceForObjectPath( _RESOURCES * resources, _RESOURCE ** resource, CMPIObjectPath * objectpath )
 103.113 +{
 103.114 +   CMPIStatus status = {CMPI_RC_OK, NULL};	/* Return status of CIM operations. */
 103.115 +
 103.116 +   /* Check input params are valid. */
 103.117 +   if (resources == NULL) return 0;
 103.118 +   if (CMIsNullObject(objectpath)) return 0;
 103.119 +
 103.120 +   /* Obtain the target resource identifier from the CMPIObjectPath key(s). */
 103.121 +   CMPIData iddata = CMGetKey(objectpath, "Name", &status);
 103.122 +   if ((status.rc != CMPI_RC_OK) || CMIsNullValue(iddata)) return 0;
 103.123 +
 103.124 +   /* Extract the id string from the CMPIString. */
 103.125 +   char * id = CMGetCharPtr(iddata.value.string);
 103.126 +   if ((id == NULL) || (*id == '\0')) return 0;
 103.127 +
 103.128 +   /* Get all the resource data for the target resource. */
 103.129 +   *resource = xm_get_domain(resources->xen, id);
 103.130 +   if (*resource == NULL) return 0;
 103.131 +
 103.132 +   return 1;
 103.133 +}
 103.134 +
 103.135 +// ----------------------------------------------------------------------------
 103.136 +
 103.137 +/* Free/deallocate/cleanup the resource after use. */
 103.138 +int Xen_ComputerSystemConfiguration_freeResource( _RESOURCE * resource )
 103.139 +{
 103.140 +   /* Free any malloc'd memory used to store the data for this resource. */
 103.141 +   if (resource != NULL) {
 103.142 +      free(resource);
 103.143 +      resource = NULL;
 103.144 +   }
 103.145 +
 103.146 +   return 1;
 103.147 +}
 103.148 +
 103.149 +// ---------------------------------------------------------------------------- 
 103.150 +
 103.151 +/* Set the property values of a CMPI instance from a specific resource. */
 103.152 +int Xen_ComputerSystemConfiguration_setInstanceFromResource( _RESOURCE * resource, CMPIInstance * instance, CMPIBroker * broker )
 103.153 +{
 103.154 +   int i;
 103.155 +
 103.156 +   if (resource == NULL) return 0;
 103.157 +   if (CMIsNullObject(instance)) return 0;
 103.158 +
 103.159 +   /* Set the CMPIInstance properties from the resource data. */
 103.160 +   CMSetProperty(instance, "CreationClassName",(CMPIValue *)"Xen_ComputerSystemConfiguration", CMPI_chars);
 103.161 +   CMSetProperty(instance, "Name",(CMPIValue *)resource->name, CMPI_chars);
 103.162 +   CMSetProperty(instance, "SystemCreationClassName",(CMPIValue *)"Xen_ComputerSystem", CMPI_chars);
 103.163 +   CMSetProperty(instance, "SystemName",(CMPIValue *)resource->name, CMPI_chars);
 103.164 +
 103.165 +   if (resource->kernel != NULL) CMSetProperty(instance, "Kernel", (CMPIValue *)resource->kernel, CMPI_chars);
 103.166 +   if (resource->ramdisk != NULL) CMSetProperty(instance, "RAMDisk", (CMPIValue *)resource->ramdisk, CMPI_chars);
 103.167 +   CMSetProperty(instance, "Memory", (CMPIValue *)&(resource->memory), CMPI_uint64);
 103.168 +   CMSetProperty(instance, "VCPUs", (CMPIValue *)&(resource->vcpus), CMPI_uint32);
 103.169 +   CMSetProperty(instance, "UUID", (CMPIValue *)resource->uuid, CMPI_chars);
 103.170 +
 103.171 +   /* Setup the NICConfigInfo array. */
 103.172 +   CMSetProperty(instance, "NICs", (CMPIValue *)&resource->n_vif, CMPI_uint32);
 103.173 +   if (resource->n_vif > 0) {
 103.174 +      CMPIArray * nicarray = CMNewArray(broker, resource->n_vif, CMPI_string, NULL);
 103.175 +      for (i=0; i<resource->n_vif; i++) {
 103.176 +         /* Convery the NIC config info into a CMPIString. */
 103.177 +         CMPIString * nicinfostring = CMNewString(broker, resource->vif[i].params, NULL);
 103.178 +         CMSetArrayElementAt(nicarray, i, (CMPIValue *)&nicinfostring, CMPI_string);
 103.179 +      }
 103.180 +      CMSetProperty(instance, "NICConfigInfo", (CMPIValue *)&nicarray, CMPI_stringA);
 103.181 +   }
 103.182 +
 103.183 +   /* Setup the DiskConfigInfo array. */
 103.184 +   CMSetProperty(instance, "Disks", (CMPIValue *)&resource->n_vbd, CMPI_uint32);
 103.185 +   if (resource->n_vbd > 0) {
 103.186 +      /* Create CMPIString array with an entry for each disk. */
 103.187 +      CMPIArray * diskarray = CMNewArray(broker, resource->n_vbd, CMPI_string, NULL);
 103.188 +      for (i=0; i<resource->n_vbd; i++) {
 103.189 +         /* Format the raw disk config info into a CMPIString, of the form: 'uname,dev,mode' */
 103.190 +         char diskinfo[4096];
 103.191 +         sprintf(diskinfo, "%s,%s,%s", resource->vbd[i].uname, resource->vbd[i].dev, resource->vbd[i].mode);
 103.192 +         CMPIString * diskinfostring = CMNewString(broker, diskinfo, NULL);
 103.193 +         CMSetArrayElementAt(diskarray, i, (CMPIValue *)&diskinfostring, CMPI_string);
 103.194 +      }
 103.195 +      CMSetProperty(instance, "DiskConfigInfo", (CMPIValue *)&diskarray, CMPI_stringA);
 103.196 +   }
 103.197 +
 103.198 +   CMSetProperty(instance, "DHCP" , (CMPIValue *)&(resource->dhcp), CMPI_boolean);
 103.199 +   if (resource->netmask != NULL) CMSetProperty(instance, "Netmask" , (CMPIValue *)resource->netmask, CMPI_chars);
 103.200 +   if (resource->gateway != NULL) CMSetProperty(instance, "Gateway" , (CMPIValue *)resource->gateway, CMPI_chars);
 103.201 +   if (resource->hostname != NULL) CMSetProperty(instance, "Hostname" , (CMPIValue *)resource->hostname, CMPI_chars);
 103.202 +   if (resource->cmdline != NULL) CMSetProperty(instance, "KernelOptions" , (CMPIValue *)resource->cmdline, CMPI_chars);
 103.203 +   if (resource->root != NULL) CMSetProperty(instance, "Root" , (CMPIValue *)resource->root, CMPI_chars);
 103.204 +
 103.205 +   return 1;
 103.206 +}
 103.207 +
 103.208 +// ----------------------------------------------------------------------------
 103.209 +
 103.210 +/* Delete the specified resource from the system. */
 103.211 +int Xen_ComputerSystemConfiguration_deleteResource( _RESOURCES * resources, _RESOURCE * resource )
 103.212 +{
 103.213 +   if (resources == NULL) return 0;
 103.214 +   if (resource == NULL) return 0;
 103.215 +
 103.216 +   /* First stop/destroy the running Xen domain, if necessary. */
 103.217 +   if (resource->info != NULL) {
 103.218 +      if (xm_destroy(resources->xen, resource->name) != 0) return 0;
 103.219 +   }
 103.220 +
 103.221 +   /* Remove the Xen domain configuration from the system. */
 103.222 +   if (xm_delete(resources->xen, resource->name) != 0) return 0;
 103.223 +
 103.224 +   return 1;
 103.225 +}
 103.226 +
 103.227 +// ----------------------------------------------------------------------------
 103.228 +
 103.229 +/* Modify the specified resource using the property values of a CMPI instance. */
 103.230 +int Xen_ComputerSystemConfiguration_setResourceFromInstance( _RESOURCE * resource, CMPIInstance * instance, CMPIBroker * broker )
 103.231 +{
 103.232 +   /* Unsupported. */
 103.233 +   return -1;
 103.234 +}
 103.235 +
 103.236 +// ----------------------------------------------------------------------------
 103.237 +
 103.238 +/* Create a new resource using the property values of a CMPI instance. */
 103.239 +int Xen_ComputerSystemConfiguration_createResourceFromInstance( _RESOURCES * resources, _RESOURCE ** resource, CMPIInstance * instance, CMPIBroker * broker )
 103.240 +{
 103.241 +   CMPIStatus status = {CMPI_RC_OK, NULL};	/* Return status of CIM operations. */
 103.242 +   CMPIData propertyvalue;
 103.243 +   int i;
 103.244 +
 103.245 +   /* malloc a new resource to store the domain config data. */
 103.246 +   _RESOURCE * newresource = (_RESOURCE *)calloc(1,sizeof(_RESOURCE));
 103.247 +   if (newresource == NULL) return 0;
 103.248 +
 103.249 +   /* Set the resource values from the CMPIInstance properties. */
 103.250 +   propertyvalue = CMGetProperty(instance, "Name", &status);
 103.251 +   if ((status.rc == CMPI_RC_OK) && !CMIsNullValue(propertyvalue)) {
 103.252 +      newresource->name = CMGetCharPtr(propertyvalue.value.string);
 103.253 +   }
 103.254 +
 103.255 +   propertyvalue = CMGetProperty(instance, "Kernel", &status);
 103.256 +   if ((status.rc == CMPI_RC_OK) && !CMIsNullValue(propertyvalue)) {
 103.257 +      newresource->kernel = CMGetCharPtr(propertyvalue.value.string);
 103.258 +   }
 103.259 +
 103.260 +   propertyvalue = CMGetProperty(instance, "RAMDisk", &status);
 103.261 +   if ((status.rc == CMPI_RC_OK) && !CMIsNullValue(propertyvalue)) {
 103.262 +      newresource->ramdisk = CMGetCharPtr(propertyvalue.value.string);
 103.263 +   }
 103.264 +
 103.265 +   propertyvalue = CMGetProperty(instance, "Memory", &status);
 103.266 +   if ((status.rc == CMPI_RC_OK) && !CMIsNullValue(propertyvalue)) {
 103.267 +      newresource->memory = (memory_t)propertyvalue.value.uint64;
 103.268 +   }
 103.269 +
 103.270 +   propertyvalue = CMGetProperty(instance, "VCPUs", &status);
 103.271 +   if ((status.rc == CMPI_RC_OK) && !CMIsNullValue(propertyvalue)) {
 103.272 +      newresource->vcpus = (int)propertyvalue.value.uint32;
 103.273 +   }
 103.274 +
 103.275 +   propertyvalue = CMGetProperty(instance, "DHCP", &status);
 103.276 +   if ((status.rc == CMPI_RC_OK) && !CMIsNullValue(propertyvalue)) {
 103.277 +      newresource->dhcp = (bool)propertyvalue.value.boolean;
 103.278 +   }
 103.279 +
 103.280 +   propertyvalue = CMGetProperty(instance, "Netmask", &status);
 103.281 +   if ((status.rc == CMPI_RC_OK) && !CMIsNullValue(propertyvalue)) {
 103.282 +      newresource->netmask = CMGetCharPtr(propertyvalue.value.string);
 103.283 +   }
 103.284 +
 103.285 +   propertyvalue = CMGetProperty(instance, "Gateway", &status);
 103.286 +   if ((status.rc == CMPI_RC_OK) && !CMIsNullValue(propertyvalue)) {
 103.287 +      newresource->gateway = CMGetCharPtr(propertyvalue.value.string);
 103.288 +   }
 103.289 +
 103.290 +   propertyvalue = CMGetProperty(instance, "Hostname", &status);
 103.291 +   if ((status.rc == CMPI_RC_OK) && !CMIsNullValue(propertyvalue)) {
 103.292 +      newresource->hostname = CMGetCharPtr(propertyvalue.value.string);
 103.293 +   }
 103.294 +
 103.295 +   propertyvalue = CMGetProperty(instance, "KernelOptions", &status);
 103.296 +   if ((status.rc == CMPI_RC_OK) && !CMIsNullValue(propertyvalue)) {
 103.297 +      newresource->cmdline = CMGetCharPtr(propertyvalue.value.string);
 103.298 +   }
 103.299 +
 103.300 +   propertyvalue = CMGetProperty(instance, "Root", &status);
 103.301 +   if ((status.rc == CMPI_RC_OK) && !CMIsNullValue(propertyvalue)) {
 103.302 +      newresource->root = CMGetCharPtr(propertyvalue.value.string);
 103.303 +   }
 103.304 +
 103.305 +   propertyvalue = CMGetProperty(instance, "NICs", &status);
 103.306 +   if ((status.rc == CMPI_RC_OK) && !CMIsNullValue(propertyvalue)) {
 103.307 +      newresource->n_vif = propertyvalue.value.uint32;
 103.308 +
 103.309 +      /* Create resources for each NICConfigInfo entry. */
 103.310 +      if (newresource->n_vif > 0) {
 103.311 +         propertyvalue = CMGetProperty(instance, "NICConfigInfo", &status);
 103.312 +         if ((status.rc == CMPI_RC_OK) && !CMIsNullValue(propertyvalue)) {
 103.313 +            /* Convert NICConfigInfo to array of xm_config_vif structs. */
 103.314 +            newresource->vif = (struct xm_config_vif *)calloc(newresource->n_vif, sizeof(struct xm_config_vif));
 103.315 +            for (i=0; i<newresource->n_vif; i++) {
 103.316 +               CMPIData stringdata = CMGetArrayElementAt(propertyvalue.value.array, i, NULL);
 103.317 +               newresource->vif[i].params = CMGetCharPtr(stringdata.value.string);
 103.318 +            }      
 103.319 +         } 
 103.320 +      }
 103.321 +   }
 103.322 +
 103.323 +   propertyvalue = CMGetProperty(instance, "Disks", &status);
 103.324 +   if ((status.rc == CMPI_RC_OK) && !CMIsNullValue(propertyvalue)) {
 103.325 +      newresource->n_vbd = propertyvalue.value.uint32;
 103.326 +
 103.327 +      /* Create resources for each DiskConfigInfo entry. */
 103.328 +      if (newresource->n_vbd > 0) {
 103.329 +         propertyvalue = CMGetProperty(instance, "DiskConfigInfo", &status);
 103.330 +         if ((status.rc == CMPI_RC_OK) && !CMIsNullValue(propertyvalue)) {
 103.331 +            /* Convert DiskConfigInfo to array of xm_config_vbd structs. */
 103.332 +            newresource->vbd = (struct xm_config_vbd *)calloc(newresource->n_vbd, sizeof(struct xm_config_vbd));
 103.333 +            for (i=0; i<newresource->n_vbd; i++) {
 103.334 +               CMPIData stringdata = CMGetArrayElementAt(propertyvalue.value.array, i, NULL);
 103.335 +               sscanf(CMGetCharPtr(stringdata.value.string), "%s,%s,%s",
 103.336 +			newresource->vbd[i].uname, newresource->vbd[i].dev, newresource->vbd[i].mode);
 103.337 +            }
 103.338 +         }
 103.339 +      }
 103.340 +   }
 103.341 +
 103.342 +   /* Create a new DomU entry in libxm from the config info. */
 103.343 +   if (xm_set_domain(resources->xen, newresource) != 0) return 0;
 103.344 +
 103.345 +   /* Get the actual registered domain data back for this domain for subsequent processing. */
 103.346 +   *resource = xm_get_domain(resources->xen, newresource->name);
 103.347 +   if (newresource->vif != NULL) free(newresource->vif);
 103.348 +   if (newresource->vbd != NULL) free(newresource->vbd);
 103.349 +   free(newresource);
 103.350 +   if (*resource == NULL) return 0;
 103.351 +   
 103.352 +   return 1;
 103.353 +}
 103.354 +
   104.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   104.2 +++ b/src/Xen_ComputerSystemConfiguration_Resource.h	Wed Mar 22 14:05:14 2006 -0700
   104.3 @@ -0,0 +1,88 @@
   104.4 +// Copyright (C) 2006 IBM Corporation
   104.5 +//
   104.6 +//    This library is free software; you can redistribute it and/or
   104.7 +//    modify it under the terms of the GNU Lesser General Public
   104.8 +//    License as published by the Free Software Foundation; either
   104.9 +//    version 2.1 of the License, or (at your option) any later version.
  104.10 +//
  104.11 +//    This library is distributed in the hope that it will be useful,
  104.12 +//    but WITHOUT ANY WARRANTY; without even the implied warranty of
  104.13 +//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  104.14 +//    Lesser General Public License for more details.
  104.15 +//
  104.16 +//    You should have received a copy of the GNU Lesser General Public
  104.17 +//    License along with this library; if not, write to the Free Software
  104.18 +//    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  104.19 +// ============================================================================
  104.20 +// Authors:       Dr. Gareth S. Bestor, <bestor@us.ibm.com>
  104.21 +//                Tokunbo Adeshiyan, <tokunbo@us.ibm.com>
  104.22 +// Contributors:
  104.23 +// Description:
  104.24 +// ============================================================================
  104.25 +
  104.26 +/* Include the libxm Xen API. */
  104.27 +#include "xm.h"
  104.28 +
  104.29 +/*** CUSTOMIZE FOR EACH PROVIDER ***/
  104.30 +/* DEFINE A HANDLE TO REPRESENT THE 'LIST' OF ALL SYSTEM RESOURCES.
  104.31 +   THE MAIN PROVIDER CODE DOES NOT NEED TO KNOW THE PARTICULARS OF HOW THIS
  104.32 +   LIST IS IMPLEMENTED - IT MAY BE AN ARRAY, LINKED LIST, FILE, ETC.
  104.33 +   THIS HANDLE IS PASSED INTO THE APPROPRIATE RESOURCE ACCESS METHODS WHEN
  104.34 +   ACCESSING/ITERATING/ADDING/REMOVING RESOURCES INSTANCES. */
  104.35 +typedef struct {
  104.36 +   struct xm * xen;
  104.37 +   char ** domainnames;
  104.38 +   unsigned int numdomains;
  104.39 +   unsigned int currentdomain;
  104.40 +} _RESOURCES;
  104.41 +
  104.42 +/*** CUSTOMIZE FOR EACH PROVIDER ***/
  104.43 +/* DEFINE A HANDLE TO BE USED FOR EACH INSTANCE OF A SYSTEM RESOURCE.
  104.44 +   THE MAIN PROVIDER CODE DOES NOT NEED TO KNOW THE PARTICULARS OF HOW EACH
  104.45 +   RESOURCE IS REPRESENTED, BUT TYPICALLY IT IS A STRUCTURE MIRRORING THE
  104.46 +   PROPERTIES IN THE CIM CLASS. THIS HANDLE IS PASSED BETWEEN THE RESOURCE
  104.47 +   ACCESS METHODS WHEN MANIPULATING SPECIFIC RESOURCE INSTANCES. */
  104.48 +typedef struct xm_config _RESOURCE;
  104.49 +
  104.50 +/* NOTHING BELOW THIS LINE SHOULD NEED TO BE CHANGED. */
  104.51 +
  104.52 +/* Include the required CMPI data types. */
  104.53 +#include "cmpidt.h"
  104.54 +
  104.55 +// ----------------------------------------------------------------------------
  104.56 +// Generic resource access methods for CMPI providers.
  104.57 +// Return value:
  104.58 +//	-1 = Unsupported
  104.59 +//	 0 = Failed
  104.60 +//	 1 = OK
  104.61 +// ----------------------------------------------------------------------------
  104.62 +
  104.63 +/* Get a handle to the list of all system resources for this class. */
  104.64 +int Xen_ComputerSystemConfiguration_getResources( _RESOURCES ** resources );
  104.65 +
  104.66 +/* Free/deallocate/cleanup the resources list after use. */
  104.67 +int Xen_ComputerSystemConfiguration_freeResources( _RESOURCES * resources );
  104.68 +
  104.69 +/* Iterator to get the next resource from the resources list. */
  104.70 +int Xen_ComputerSystemConfiguration_getNextResource( _RESOURCES * resources, _RESOURCE ** resource );
  104.71 +
  104.72 +/* Get the specific resource that matches the CMPI object path. */
  104.73 +int Xen_ComputerSystemConfiguration_getResourceForObjectPath( _RESOURCES * resources, _RESOURCE ** resource, CMPIObjectPath * objectpath );
  104.74 +
  104.75 +/* Free/deallocate/cleanup a resource after use. */
  104.76 +int Xen_ComputerSystemConfiguration_freeResource( _RESOURCE * resource );
  104.77 +
  104.78 +/* Set the property values of a CMPI instance from a specific resource. */
  104.79 +int Xen_ComputerSystemConfiguration_setInstanceFromResource( _RESOURCE * resource, CMPIInstance * instance, CMPIBroker * broker );
  104.80 +
  104.81 +// THE FOLLOWING METHODS MAY/NOT BE SUPPORTED BY THE SYSTEM FOR THIS CLASS
  104.82 +
  104.83 +/* Delete the specified resource from the system. */
  104.84 +int Xen_ComputerSystemConfiguration_deleteResource( _RESOURCES * resources, _RESOURCE * resource );
  104.85 +
  104.86 +/* Modify the specified resource using the property values of a CMPI instance. */
  104.87 +int Xen_ComputerSystemConfiguration_setResourceFromInstance( _RESOURCE * resource, CMPIInstance * instance, CMPIBroker * broker );
  104.88 +
  104.89 +/* Create a new resource using the property values of a CMPI instance. */
  104.90 +int Xen_ComputerSystemConfiguration_createResourceFromInstance( _RESOURCES * resources, _RESOURCE ** resource, CMPIInstance * instance, CMPIBroker * broker );
  104.91 +
   105.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   105.2 +++ b/src/Xen_ComputerSystemDisk.c	Wed Mar 22 14:05:14 2006 -0700
   105.3 @@ -0,0 +1,535 @@
   105.4 +// Copyright (C) 2006 IBM Corporation
   105.5 +//
   105.6 +//    This library is free software; you can redistribute it and/or
   105.7 +//    modify it under the terms of the GNU Lesser General Public
   105.8 +//    License as published by the Free Software Foundation; either
   105.9 +//    version 2.1 of the License, or (at your option) any later version.
  105.10 +//
  105.11 +//    This library is distributed in the hope that it will be useful,
  105.12 +//    but WITHOUT ANY WARRANTY; without even the implied warranty of
  105.13 +//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  105.14 +//    Lesser General Public License for more details.
  105.15 +//
  105.16 +//    You should have received a copy of the GNU Lesser General Public
  105.17 +//    License along with this library; if not, write to the Free Software
  105.18 +//    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  105.19 +// ============================================================================
  105.20 +// Authors:       Dr. Gareth S. Bestor, <bestor@us.ibm.com>
  105.21 +// Contributors:
  105.22 +// Description:
  105.23 +// ============================================================================
  105.24 +
  105.25 +/* Include the required CMPI data types, function headers, and macros */
  105.26 +#include "cmpidt.h"
  105.27 +#include "cmpift.h"
  105.28 +#include "cmpimacs.h"
  105.29 +
  105.30 +
  105.31 +// ----------------------------------------------------------------------------
  105.32 +// COMMON GLOBAL VARIABLES
  105.33 +// ----------------------------------------------------------------------------
  105.34 +
  105.35 +/* Handle to the CIM broker. Initialized when the provider lib is loaded. */
  105.36 +static CMPIBroker *_BROKER;
  105.37 +
  105.38 +/* Include utility functions */
  105.39 +#include "cmpiutil.h"
  105.40 +
  105.41 +/* Include _SBLIM_TRACE() logging support */
  105.42 +#include "cmpitrace.h"
  105.43 +
  105.44 +
  105.45 +// ============================================================================
  105.46 +// CMPI ASSOCIATION PROVIDER FUNCTION TABLE
  105.47 +// ============================================================================
  105.48 +
  105.49 +// ----------------------------------------------------------------------------
  105.50 +// Info for the class supported by the association provider
  105.51 +// ----------------------------------------------------------------------------
  105.52 +                                                                                                                                 
  105.53 +/* Name of the left and right hand side classes of this association. */
  105.54 +static char * _ASSOCCLASS = "Xen_ComputerSystemDisk";
  105.55 +static char * _LHSCLASSNAME = "Xen_Disk";
  105.56 +static char * _RHSCLASSNAME = "Xen_ComputerSystem";
  105.57 +static char * _LHSPROPERTYNAME = "PartComponent"; 
  105.58 +static char * _RHSPROPERTYNAME = "GroupComponent";
  105.59 +static char * _LHSKEYNAME = "SystemName";
  105.60 +static char * _RHSKEYNAME = "Name";
  105.61 +
  105.62 +// ----------------------------------------------------------------------------
  105.63 +// AssociationCleanup()
  105.64 +// Perform any necessary cleanup immediately before this provider is unloaded.
  105.65 +// ----------------------------------------------------------------------------
  105.66 +static CMPIStatus AssociationCleanup(
  105.67 +		CMPIAssociationMI * self,	/* [in] Handle to this provider (i.e. 'self'). */
  105.68 +		CMPIContext * context)		/* [in] Additional context info, if any. */
  105.69 +{
  105.70 +   CMPIStatus status = { CMPI_RC_OK, NULL };	/* Return status of CIM operations. */
  105.71 +
  105.72 +   _SBLIM_ENTER("AssociationCleanup");
  105.73 +   _SBLIM_TRACE(2, ("--- self=\"%s\"", self->ft->miName));
  105.74 +   _SBLIM_TRACE(2, ("--- context=\"%s\"", CMGetCharPtr(CDToString(_BROKER, context, NULL))));
  105.75 +
  105.76 +   /* Nothing needs to be done for cleanup. */
  105.77 +
  105.78 +exit:
  105.79 +   _SBLIM_RETURNSTATUS(status);
  105.80 +}
  105.81 +
  105.82 +
  105.83 +// ----------------------------------------------------------------------------
  105.84 +// AssociatorNames()
  105.85 +// ----------------------------------------------------------------------------
  105.86 +static CMPIStatus AssociatorNames(
  105.87 +		CMPIAssociationMI * self,	/* [in] Handle to this provider (i.e. 'self'). */
  105.88 +		CMPIContext * context,		/* [in] Additional context info, if any. */
  105.89 +		CMPIResult * results,		/* [out] Results of this operation. */
  105.90 +		CMPIObjectPath * reference,	/* [in] Contains source namespace, classname and object path. */
  105.91 +		const char * assocClass,
  105.92 +		const char * resultClass,
  105.93 +		const char * role,
  105.94 +		const char * resultRole)
  105.95 +{
  105.96 +   CMPIStatus status = { CMPI_RC_OK, NULL };    /* Return status of CIM operations. */
  105.97 +   char *namespace = CMGetCharPtr(CMGetNameSpace(reference, NULL)); /* Target namespace. */
  105.98 +   char *sourceclass = CMGetCharPtr(CMGetClassName(reference, &status)); /* Class of the source reference object */
  105.99 +   char *targetclass; 				/* Class of the target object(s). */
 105.100 +
 105.101 +   char *sourcekeyname;
 105.102 +   char *targetkeyname;
 105.103 +
 105.104 +   _SBLIM_ENTER("AssociatorNames");
 105.105 +   _SBLIM_TRACE(2, ("--- self=\"%s\"", self->ft->miName));
 105.106 +   _SBLIM_TRACE(2, ("--- context=\"%s\"", CMGetCharPtr(CDToString(_BROKER, context, NULL))));
 105.107 +   _SBLIM_TRACE(2, ("--- reference=\"%s\"", CMGetCharPtr(CDToString(_BROKER, reference, NULL))));
 105.108 +   _SBLIM_TRACE(2, ("--- assocClass=\"%s\"", assocClass));
 105.109 +   _SBLIM_TRACE(2, ("--- resultClass=\"%s\"", resultClass));
 105.110 +   _SBLIM_TRACE(2, ("--- role=\"%s\"", role));
 105.111 +   _SBLIM_TRACE(2, ("--- resultRole=\"%s\"", resultRole));
 105.112 +   _SBLIM_TRACE(2, ("--- namespace=\"%s\"", namespace));
 105.113 +   _SBLIM_TRACE(2, ("--- sourceclass=\"%s\"", sourceclass));
 105.114 +
 105.115 +   /* Check that the requested association class, if any, is supported. */
 105.116 +   if (assocClass != NULL) {
 105.117 +      CMPIObjectPath * assoc = CMNewObjectPath(_BROKER, namespace, _ASSOCCLASS, NULL);
 105.118 +      if (!CMClassPathIsA(_BROKER, assoc, assocClass, NULL)) {
 105.119 +         _SBLIM_TRACE(2, ("--- Unrecognized association class. Ignoring request."));
 105.120 +         goto exit;
 105.121 +      }
 105.122 +   }
 105.123 +
 105.124 +   /* Check that the reference matches the required role, if any. */
 105.125 +   if ((role != NULL) && strcmp(role, sourceclass) != 0) {
 105.126 +      _SBLIM_TRACE(2, ("--- Reference does not match required role. Ignoring request."));
 105.127 +      goto exit;
 105.128 +   }
 105.129 +
 105.130 +   /* Determine the target class from the source class. */
 105.131 +   if (strcmp(sourceclass, _LHSCLASSNAME) == 0) {
 105.132 +      sourcekeyname = _LHSKEYNAME;
 105.133 +      targetclass = _RHSCLASSNAME;
 105.134 +      targetkeyname = _RHSKEYNAME;
 105.135 +   } else if (strcmp(sourceclass, _RHSCLASSNAME) == 0) {
 105.136 +      sourcekeyname = _RHSKEYNAME;
 105.137 +      targetclass = _LHSCLASSNAME;
 105.138 +      targetkeyname = _LHSKEYNAME;
 105.139 +   } else {
 105.140 +      _SBLIM_TRACE(2, ("--- Unrecognized source class. Ignoring request."));
 105.141 +      goto exit;
 105.142 +   }
 105.143 +   _SBLIM_TRACE(2, ("--- targetclass=\"%s\"", targetclass));
 105.144 +
 105.145 +   CMPIData namedata = CMGetKey(reference, sourcekeyname, NULL);
 105.146 +   char * sourcename = CMGetCharPtr(namedata.value.string);
 105.147 +   _SBLIM_TRACE(2, ("--- sourcename=\"%s\"", sourcename));
 105.148 +
 105.149 +   /* Create an object path for the result class. */
 105.150 +   CMPIObjectPath * objectpath = CMNewObjectPath(_BROKER, namespace, targetclass, &status);
 105.151 +   if ((status.rc != CMPI_RC_OK) || CMIsNullObject(objectpath)) {
 105.152 +      _SBLIM_TRACE(1,("--- CMNewObjectPath() failed - %s", CMGetCharPtr(status.msg)));
 105.153 +      CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERROR, "Cannot create new CMPIObjectPath");
 105.154 +      goto exit;
 105.155 +   }
 105.156 +
 105.157 +   /* Get the list of all target class object paths from the CIMOM. */
 105.158 +   CMPIEnumeration * objectpaths = CBEnumInstanceNames(_BROKER, context, objectpath, &status);
 105.159 +   if ((status.rc != CMPI_RC_OK) || CMIsNullObject(objectpaths)) {
 105.160 +      _SBLIM_TRACE(1,("--- CBEnumInstanceNames() failed - %s", CMGetCharPtr(status.msg)));
 105.161 +      CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERROR, "Cannot enumerate target class");
 105.162 +      goto exit;
 105.163 +   }
 105.164 +
 105.165 +   /* Return all object paths that exactly match the target class and resultClass, if specified. */
 105.166 +   while (CMHasNext(objectpaths, NULL)) {
 105.167 +      CMPIData data = CMGetNext(objectpaths, NULL);
 105.168 +      char *class = CMGetCharPtr(CMGetClassName(data.value.ref, NULL));
 105.169 +      if ((strcmp(class,targetclass) == 0) && ((resultClass == NULL) || (strcmp(class,resultClass) == 0))) {
 105.170 +         /* Only return entries whose name matches the reference. */
 105.171 +         namedata = CMGetKey(data.value.ref, targetkeyname, &status);
 105.172 +         char * resultname = CMGetCharPtr(namedata.value.string);
 105.173 +         if (strcmp(sourcename, resultname) == 0) CMReturnObjectPath(results, data.value.ref);
 105.174 +      }
 105.175 +   }
 105.176 +
 105.177 +   CMReturnDone(results);
 105.178 +
 105.179 +exit:
 105.180 +   _SBLIM_RETURNSTATUS(status);
 105.181 +}
 105.182 +
 105.183 +
 105.184 +// ----------------------------------------------------------------------------
 105.185 +// Associators()
 105.186 +// ----------------------------------------------------------------------------
 105.187 +static CMPIStatus Associators(
 105.188 +		CMPIAssociationMI * self,	/* [in] Handle to this provider (i.e. 'self'). */
 105.189 +		CMPIContext * context,		/* [in] Additional context info, if any. */
 105.190 +		CMPIResult * results,		/* [out] Results of this operation. */
 105.191 +		CMPIObjectPath * reference,	/* [in] Contains the source namespace, classname and object path. */
 105.192 +		const char *assocClass,
 105.193 +		const char *resultClass,
 105.194 +		const char *role,
 105.195 +		const char *resultRole,
 105.196 +		char ** properties)		/* [in] List of desired properties (NULL=all). */
 105.197 +{
 105.198 +   CMPIStatus status = { CMPI_RC_OK, NULL };    /* Return status of CIM operations. */
 105.199 +   char *namespace = CMGetCharPtr(CMGetNameSpace(reference, NULL)); /* Target namespace. */
 105.200 +   char *sourceclass = CMGetCharPtr(CMGetClassName(reference, &status)); /* Class of the source reference object */
 105.201 +   char *targetclass;                           /* Class of the target object(s). */
 105.202 +
 105.203 +   char *sourcekeyname;
 105.204 +   char *targetkeyname;
 105.205 +
 105.206 +   _SBLIM_ENTER("Associators");
 105.207 +   _SBLIM_TRACE(2, ("--- self=\"%s\"", self->ft->miName));
 105.208 +   _SBLIM_TRACE(2, ("--- context=\"%s\"", CMGetCharPtr(CDToString(_BROKER, context, NULL))));
 105.209 +   _SBLIM_TRACE(2, ("--- reference=\"%s\"", CMGetCharPtr(CDToString(_BROKER, reference, NULL))));
 105.210 +   _SBLIM_TRACE(2, ("--- assocClass=\"%s\"", assocClass));
 105.211 +   _SBLIM_TRACE(2, ("--- resultClass=\"%s\"", resultClass));
 105.212 +   _SBLIM_TRACE(2, ("--- role=\"%s\"", role));
 105.213 +   _SBLIM_TRACE(2, ("--- resultRole=\"%s\"", resultRole));
 105.214 +   _SBLIM_TRACE(2, ("--- namespace=\"%s\"", namespace));
 105.215 +   _SBLIM_TRACE(2, ("--- sourceclass=\"%s\"", sourceclass));
 105.216 +
 105.217 +   /* Check that the requested association class, if any, is supported. */
 105.218 +   if (assocClass != NULL) {
 105.219 +      CMPIObjectPath * assoc = CMNewObjectPath(_BROKER, namespace, _ASSOCCLASS, NULL);
 105.220 +      if (!CMClassPathIsA(_BROKER, assoc, assocClass, NULL)) {
 105.221 +         _SBLIM_TRACE(2, ("--- Unrecognized association class. Ignoring request."));
 105.222 +         goto exit;
 105.223 +      }
 105.224 +   }
 105.225 +
 105.226 +   /* Check that the reference matches the required role, if any. */
 105.227 +   if ((role != NULL) && strcmp(role, sourceclass) != 0) {
 105.228 +      _SBLIM_TRACE(2, ("--- Reference does not match required role. Ignoring request."));
 105.229 +      goto exit;
 105.230 +   }
 105.231 +   CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_NOT_SUPPORTED, NULL);
 105.232 +
 105.233 +   /* Determine the target class from the source class. */
 105.234 +   if (strcmp(sourceclass, _LHSCLASSNAME) == 0) {
 105.235 +      sourcekeyname = _LHSKEYNAME;
 105.236 +      targetclass = _RHSCLASSNAME;
 105.237 +      targetkeyname = _RHSKEYNAME;
 105.238 +   } else if (strcmp(sourceclass, _RHSCLASSNAME) == 0) {
 105.239 +      sourcekeyname = _RHSKEYNAME;
 105.240 +      targetclass = _LHSCLASSNAME;
 105.241 +      targetkeyname = _LHSKEYNAME;
 105.242 +   } else {
 105.243 +      _SBLIM_TRACE(2, ("--- Unrecognized source class. Ignoring request."));
 105.244 +      goto exit;
 105.245 +   }
 105.246 +   _SBLIM_TRACE(2, ("--- targetclass=\"%s\"", targetclass));
 105.247 +
 105.248 +   CMPIData namedata = CMGetKey(reference, sourcekeyname, NULL);
 105.249 +   char * sourcename = CMGetCharPtr(namedata.value.string);
 105.250 +   _SBLIM_TRACE(2, ("--- sourcename=\"%s\"", sourcename));
 105.251 +
 105.252 +   /* Create an object path for the result class. */
 105.253 +   CMPIObjectPath * objectpath = CMNewObjectPath(_BROKER, namespace, targetclass, &status);
 105.254 +   if ((status.rc != CMPI_RC_OK) || CMIsNullObject(objectpath)) {
 105.255 +      _SBLIM_TRACE(1,("--- CMNewObjectPath() failed - %s", CMGetCharPtr(status.msg)));
 105.256 +      CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERROR, "Cannot create new CMPIObjectPath");
 105.257 +      goto exit;
 105.258 +   }
 105.259 +
 105.260 +   /* Get the list of all target class instances from the CIMOM. */
 105.261 +   CMPIEnumeration * instances = CBEnumInstances(_BROKER, context, objectpath, NULL, &status);
 105.262 +   if ((status.rc != CMPI_RC_OK) || CMIsNullObject(instances)) {
 105.263 +      _SBLIM_TRACE(1,("--- CBEnumInstances() failed - %s", CMGetCharPtr(status.msg)));
 105.264 +      CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERROR, "Cannot enumerate target class");
 105.265 +      goto exit;
 105.266 +   }
 105.267 +
 105.268 +   /* Return all instances that exactly match the target class and resultClass, if specified. */
 105.269 +   while (CMHasNext(instances, NULL)) {
 105.270 +      CMPIData data = CMGetNext(instances, NULL);
 105.271 +      char *class = CMGetCharPtr(CMGetClassName(CMGetObjectPath(data.value.inst,NULL), NULL));
 105.272 +      if ((strcmp(class,targetclass) == 0) && ((resultClass == NULL) || (strcmp(class,resultClass) == 0))) {
 105.273 +         /* Only return entries whose name matches the reference. */
 105.274 +         namedata = CMGetProperty(data.value.inst, targetkeyname, NULL);
 105.275 +         char * resultname = CMGetCharPtr(namedata.value.string);
 105.276 +// BUG - returning data causes crash !?!
 105.277 +_SBLIM_TRACE(2, ("--- data.value.inst=\"%s\"", CMGetCharPtr(CDToString(_BROKER, data.value.inst, NULL))));
 105.278 +//         if (strcmp(sourcename, resultname) == 0) CMReturnInstance(results, data.value.inst);
 105.279 +      }
 105.280 +   }
 105.281 +
 105.282 +   CMReturnDone(results);
 105.283 +
 105.284 +exit:
 105.285 +   _SBLIM_RETURNSTATUS(status);
 105.286 +}
 105.287 +
 105.288 +
 105.289 +// ----------------------------------------------------------------------------
 105.290 +// ReferenceNames()
 105.291 +// ----------------------------------------------------------------------------
 105.292 +static CMPIStatus ReferenceNames(
 105.293 +		CMPIAssociationMI * self,	/* [in] Handle to this provider (i.e. 'self'). */
 105.294 +		CMPIContext * context,		/* [in] Additional context info, if any. */
 105.295 +		CMPIResult * results,		/* [out] Results of this operation. */
 105.296 +		CMPIObjectPath * reference,	/* [in] Contains the source namespace, classname and object path. */
 105.297 +		const char *assocClass, 
 105.298 +		const char *role)
 105.299 +{
 105.300 +   CMPIStatus status = { CMPI_RC_OK, NULL };    /* Return status of CIM operations. */
 105.301 +   char *namespace = CMGetCharPtr(CMGetNameSpace(reference, NULL)); /* Target namespace. */
 105.302 +   char *sourceclass = CMGetCharPtr(CMGetClassName(reference, &status)); /* Class of the source reference object */
 105.303 +   char *targetclass;                           /* Class of the target object(s). */
 105.304 +
 105.305 +   char *sourcekeyname;
 105.306 +   char *targetkeyname;
 105.307 +
 105.308 +   _SBLIM_ENTER("ReferenceNames");
 105.309 +   _SBLIM_TRACE(2, ("--- self=\"%s\"", self->ft->miName));
 105.310 +   _SBLIM_TRACE(2, ("--- context=\"%s\"", CMGetCharPtr(CDToString(_BROKER, context, NULL))));
 105.311 +   _SBLIM_TRACE(2, ("--- reference=\"%s\"", CMGetCharPtr(CDToString(_BROKER, reference, NULL))));
 105.312 +   _SBLIM_TRACE(2, ("--- assocClass=\"%s\"", assocClass));
 105.313 +   _SBLIM_TRACE(2, ("--- role=\"%s\"", role));
 105.314 +   _SBLIM_TRACE(2, ("--- namespace=\"%s\"", namespace));
 105.315 +   _SBLIM_TRACE(2, ("--- sourceclass=\"%s\"", sourceclass));
 105.316 +
 105.317 +   /* Check that the requested association class, if any, is supported. */
 105.318 +   if (assocClass != NULL) {
 105.319 +      CMPIObjectPath * assoc = CMNewObjectPath(_BROKER, namespace, _ASSOCCLASS, NULL);
 105.320 +      if (!CMClassPathIsA(_BROKER, assoc, assocClass, NULL)) {
 105.321 +         _SBLIM_TRACE(2, ("--- Unrecognized association class. Ignoring request."));
 105.322 +         goto exit;
 105.323 +      }
 105.324 +   }
 105.325 +
 105.326 +   /* Check that the reference matches the required role, if any. */
 105.327 +   if ((role != NULL) && strcmp(role, sourceclass) != 0) {
 105.328 +      _SBLIM_TRACE(2, ("--- Reference does not match required role. Ignoring request."));
 105.329 +      goto exit;
 105.330 +   }
 105.331 +
 105.332 +   /* Determine the target class from the source class. */
 105.333 +   if (strcmp(sourceclass, _LHSCLASSNAME) == 0) {
 105.334 +      sourcekeyname = _LHSKEYNAME;
 105.335 +      targetclass = _RHSCLASSNAME;
 105.336 +      targetkeyname = _RHSKEYNAME;
 105.337 +   } else if (strcmp(sourceclass, _RHSCLASSNAME) == 0) {
 105.338 +      sourcekeyname = _RHSKEYNAME;
 105.339 +      targetclass = _LHSCLASSNAME;
 105.340 +      targetkeyname = _LHSKEYNAME;
 105.341 +   } else {
 105.342 +      _SBLIM_TRACE(2, ("--- Unrecognized source class. Ignoring request."));
 105.343 +      goto exit;
 105.344 +   }
 105.345 +   _SBLIM_TRACE(2, ("--- targetclass=\"%s\"", targetclass));
 105.346 +
 105.347 +   CMPIData namedata = CMGetKey(reference, sourcekeyname, NULL);
 105.348 +   char * sourcename = CMGetCharPtr(namedata.value.string);
 105.349 +   _SBLIM_TRACE(2, ("--- sourcename=\"%s\"", sourcename));
 105.350 +
 105.351 +   /* Create an object path for the result class. */
 105.352 +   CMPIObjectPath * objectpath = CMNewObjectPath(_BROKER, namespace, targetclass, &status);
 105.353 +   if ((status.rc != CMPI_RC_OK) || CMIsNullObject(objectpath)) {
 105.354 +      _SBLIM_TRACE(1,("--- CMNewObjectPath() failed - %s", CMGetCharPtr(status.msg)));
 105.355 +      CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERROR, "Cannot create new CMPIObjectPath");
 105.356 +      goto exit;
 105.357 +   }
 105.358 +
 105.359 +   /* Get the list of all target class object paths from the CIMOM. */
 105.360 +   CMPIEnumeration * objectpaths = CBEnumInstanceNames(_BROKER, context, objectpath, &status);
 105.361 +   if ((status.rc != CMPI_RC_OK) || CMIsNullObject(objectpaths)) {
 105.362 +      _SBLIM_TRACE(1,("--- CBEnumInstanceNames() failed - %s", CMGetCharPtr(status.msg)));
 105.363 +      CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERROR, "Cannot enumerate target class");
 105.364 +      goto exit;
 105.365 +   }
 105.366 +
 105.367 +   /* Return all object paths that exactly match the target class and resultClass, if specified. */
 105.368 +   while (CMHasNext(objectpaths, NULL)) {
 105.369 +      CMPIData data = CMGetNext(objectpaths, NULL);
 105.370 +      char *class = CMGetCharPtr(CMGetClassName(data.value.ref, NULL));
 105.371 +      if (strcmp(class,targetclass) == 0) {
 105.372 +
 105.373 +         /* Create an object path for the association. */
 105.374 +         CMPIObjectPath * refobjectpath = CMNewObjectPath(_BROKER, namespace, _ASSOCCLASS, &status);
 105.375 +         if ((status.rc != CMPI_RC_OK) || CMIsNullObject(refobjectpath)) {
 105.376 +            _SBLIM_TRACE(1,("--- CMNewObjectPath() failed - %s", CMGetCharPtr(status.msg)));
 105.377 +            CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERROR, "Cannot create new CMPIObjectPath");
 105.378 +            goto exit;
 105.379 +         }
 105.380 +
 105.381 +         /* Assign the references in the association appropriately. */
 105.382 +         if (strcmp(sourceclass, _RHSCLASSNAME) == 0) {
 105.383 +            CMAddKey(refobjectpath, _RHSPROPERTYNAME, &reference, CMPI_ref);
 105.384 +            CMAddKey(refobjectpath, _LHSPROPERTYNAME, &data.value.ref, CMPI_ref);
 105.385 +         } else {
 105.386 +            CMAddKey(refobjectpath, _RHSPROPERTYNAME, &data.value.ref, CMPI_ref);
 105.387 +            CMAddKey(refobjectpath, _LHSPROPERTYNAME, &reference, CMPI_ref);
 105.388 +         }
 105.389 +
 105.390 +         /* Only return entries whose name matches the reference. */
 105.391 +         namedata = CMGetKey(data.value.ref, targetkeyname, &status);
 105.392 +         char * resultname = CMGetCharPtr(namedata.value.string);
 105.393 +         if (strcmp(sourcename, resultname) == 0) CMReturnObjectPath(results, refobjectpath);
 105.394 +      }
 105.395 +   }
 105.396 +
 105.397 +exit:
 105.398 +   _SBLIM_RETURNSTATUS(status);
 105.399 +}
 105.400 +
 105.401 +
 105.402 +// ----------------------------------------------------------------------------
 105.403 +// References()
 105.404 +// ----------------------------------------------------------------------------
 105.405 +static CMPIStatus References(
 105.406 +		CMPIAssociationMI * self,	/* [in] Handle to this provider (i.e. 'self'). */
 105.407 +		CMPIContext * context,		/* [in] Additional context info, if any. */
 105.408 +		CMPIResult * results,		/* [out] Results of this operation. */
 105.409 +		CMPIObjectPath * reference,	/* [in] Contains the namespace, classname and desired object path. */
 105.410 +		const char *assocClass,
 105.411 +		const char *role,
 105.412 +		char **properties)		/* [in] List of desired properties (NULL=all). */
 105.413 +{
 105.414 +   CMPIStatus status = { CMPI_RC_OK, NULL };    /* Return status of CIM operations. */
 105.415 +   char *namespace = CMGetCharPtr(CMGetNameSpace(reference, NULL)); /* Target namespace. */
 105.416 +   char *sourceclass = CMGetCharPtr(CMGetClassName(reference, &status)); /* Class of the source reference object */
 105.417 +   char *targetclass;                           /* Class of the target object(s). */
 105.418 +
 105.419 +   char *sourcekeyname;
 105.420 +   char *targetkeyname;
 105.421 +
 105.422 +   _SBLIM_ENTER("References");
 105.423 +   _SBLIM_TRACE(2, ("--- self=\"%s\"", self->ft->miName));
 105.424 +   _SBLIM_TRACE(2, ("--- context=\"%s\"", CMGetCharPtr(CDToString(_BROKER, context, NULL))));
 105.425 +   _SBLIM_TRACE(2, ("--- reference=\"%s\"", CMGetCharPtr(CDToString(_BROKER, reference, NULL))));
 105.426 +   _SBLIM_TRACE(2, ("--- assocClass=\"%s\"", assocClass));
 105.427 +   _SBLIM_TRACE(2, ("--- role=\"%s\"", role));
 105.428 +   _SBLIM_TRACE(2, ("--- namespace=\"%s\"", namespace));
 105.429 +   _SBLIM_TRACE(2, ("--- sourceclass=\"%s\"", sourceclass));
 105.430 +
 105.431 +   /* Check that the requested association class, if any, is supported. */
 105.432 +   if (assocClass != NULL) {
 105.433 +      CMPIObjectPath * assoc = CMNewObjectPath(_BROKER, namespace, _ASSOCCLASS, NULL);
 105.434 +      if (!CMClassPathIsA(_BROKER, assoc, assocClass, NULL)) {
 105.435 +         _SBLIM_TRACE(2, ("--- Unrecognized association class. Ignoring request."));
 105.436 +         goto exit;
 105.437 +      }
 105.438 +   }
 105.439 +
 105.440 +   /* Check that the reference matches the required role, if any. */
 105.441 +   if ((role != NULL) && strcmp(role, sourceclass) != 0) {
 105.442 +      _SBLIM_TRACE(2, ("--- Reference does not match required role. Ignoring request."));
 105.443 +      goto exit;
 105.444 +   }
 105.445 +
 105.446 +   /* Determine the target class from the source class. */
 105.447 +   if (strcmp(sourceclass, _LHSCLASSNAME) == 0) {
 105.448 +      sourcekeyname = _LHSKEYNAME;
 105.449 +      targetclass = _RHSCLASSNAME;
 105.450 +      targetkeyname = _RHSKEYNAME;
 105.451 +   } else if (strcmp(sourceclass, _RHSCLASSNAME) == 0) {
 105.452 +      sourcekeyname = _RHSKEYNAME;
 105.453 +      targetclass = _LHSCLASSNAME;
 105.454 +      targetkeyname = _LHSKEYNAME;
 105.455 +   } else {
 105.456 +      _SBLIM_TRACE(2, ("--- Unrecognized source class. Ignoring request."));
 105.457 +      goto exit;
 105.458 +   }
 105.459 +   _SBLIM_TRACE(2, ("--- targetclass=\"%s\"", targetclass));
 105.460 +
 105.461 +   CMPIData namedata = CMGetKey(reference, sourcekeyname, NULL);
 105.462 +   char * sourcename = CMGetCharPtr(namedata.value.string);
 105.463 +   _SBLIM_TRACE(2, ("--- sourcename=\"%s\"", sourcename));
 105.464 +
 105.465 +   /* Create an object path for the result class. */
 105.466 +   CMPIObjectPath * objectpath = CMNewObjectPath(_BROKER, namespace, targetclass, &status);
 105.467 +   if ((status.rc != CMPI_RC_OK) || CMIsNullObject(objectpath)) {
 105.468 +      _SBLIM_TRACE(1,("--- CMNewObjectPath() failed - %s", CMGetCharPtr(status.msg)));
 105.469 +      CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERROR, "Cannot create new CMPIObjectPath");
 105.470 +      goto exit;
 105.471 +   }
 105.472 +
 105.473 +   /* Get the list of all target class object paths from the CIMOM. */
 105.474 +   CMPIEnumeration * objectpaths = CBEnumInstanceNames(_BROKER, context, objectpath, &status);
 105.475 +   if ((status.rc != CMPI_RC_OK) || CMIsNullObject(objectpaths)) {
 105.476 +      _SBLIM_TRACE(1,("--- CBEnumInstanceNames() failed - %s", CMGetCharPtr(status.msg)));
 105.477 +      CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERROR, "Cannot enumerate target class");
 105.478 +      goto exit;
 105.479 +   }
 105.480 +
 105.481 +   /* Return all object paths that exactly match the target class and resultClass, if specified. */
 105.482 +   while (CMHasNext(objectpaths, NULL)) {
 105.483 +      CMPIData data = CMGetNext(objectpaths, NULL);
 105.484 +      char *class = CMGetCharPtr(CMGetClassName(data.value.ref, NULL));
 105.485 +      if (strcmp(class,targetclass) == 0) {
 105.486 +
 105.487 +         /* Create an instance for the association. */
 105.488 +         CMPIInstance * refinstance = _CMNewInstance(_BROKER, namespace, _ASSOCCLASS, &status);
 105.489 +         if ((status.rc != CMPI_RC_OK) || CMIsNullObject(refinstance)) {
 105.490 +            _SBLIM_TRACE(1,("--- CMNewInstance() failed - %s", CMGetCharPtr(status.msg)));
 105.491 +            CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERROR, "Cannot create new CMPIInstance");
 105.492 +            goto exit;
 105.493 +         }
 105.494 +
 105.495 +         /* Assign the references in the association appropriately. */
 105.496 +         if (strcmp(sourceclass, _RHSCLASSNAME) == 0) {
 105.497 +            CMSetProperty(refinstance, _RHSPROPERTYNAME, &reference, CMPI_ref);
 105.498 +            CMSetProperty(refinstance, _LHSPROPERTYNAME, &data.value.ref, CMPI_ref);
 105.499 +         } else {
 105.500 +            CMSetProperty(refinstance, _RHSPROPERTYNAME, &data.value.ref, CMPI_ref);
 105.501 +            CMSetProperty(refinstance, _LHSPROPERTYNAME, &reference, CMPI_ref);
 105.502 +         }
 105.503 +
 105.504 +         /* Only return entries whose name matches the reference. */
 105.505 +         namedata = CMGetKey(data.value.ref, targetkeyname, &status);
 105.506 +         char * resultname = CMGetCharPtr(namedata.value.string);
 105.507 +         if (strcmp(sourcename, resultname) == 0) CMReturnInstance(results, refinstance);
 105.508 +      }
 105.509 +   }
 105.510 +exit:
 105.511 +   _SBLIM_RETURNSTATUS(status);
 105.512 +}
 105.513 +
 105.514 +
 105.515 +// ----------------------------------------------------------------------------
 105.516 +// AssociationInitialize()
 105.517 +// Perform any necessary initialization immediately after this provider is
 105.518 +// first loaded.
 105.519 +// ----------------------------------------------------------------------------
 105.520 +static void AssociationInitialize(
 105.521 +		CMPIAssociationMI * self,	/* [in] Handle to this provider (i.e. 'self'). */
 105.522 +		CMPIContext * context)		/* [in] Additional context info, if any. */
 105.523 +{
 105.524 +   _SBLIM_ENTER("AssociationInitialize");
 105.525 +   _SBLIM_TRACE(2, ("--- self=\"%s\"", self->ft->miName));
 105.526 +   _SBLIM_TRACE(2, ("--- context=\"%s\"", CMGetCharPtr(CDToString(_BROKER, context, NULL))));
 105.527 +
 105.528 +   /* Nothing needs to be done to initialize this provider */
 105.529 +
 105.530 +exit:
 105.531 +   _SBLIM_RETURN();
 105.532 +}
 105.533 +
 105.534 +
 105.535 +// ============================================================================
 105.536 +// CMPI ASSOCIATION PROVIDER FUNCTION TABLE SETUP
 105.537 +// ============================================================================
 105.538 +CMAssociationMIStub( , Xen_ComputerSystemDiskProvider, _BROKER, AssociationInitialize(&mi, ctx));
   106.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   106.2 +++ b/src/Xen_ComputerSystemIndication.c	Wed Mar 22 14:05:14 2006 -0700
   106.3 @@ -0,0 +1,524 @@
   106.4 +// Copyright (C) 2006 IBM Corporation
   106.5 +//
   106.6 +//    This library is free software; you can redistribute it and/or
   106.7 +//    modify it under the terms of the GNU Lesser General Public
   106.8 +//    License as published by the Free Software Foundation; either
   106.9 +//    version 2.1 of the License, or (at your option) any later version.
  106.10 +//
  106.11 +//    This library is distributed in the hope that it will be useful,
  106.12 +//    but WITHOUT ANY WARRANTY; without even the implied warranty of
  106.13 +//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  106.14 +//    Lesser General Public License for more details.
  106.15 +//
  106.16 +//    You should have received a copy of the GNU Lesser General Public
  106.17 +//    License along with this library; if not, write to the Free Software
  106.18 +//    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  106.19 +// ============================================================================
  106.20 +// Authors:       Dr. Gareth S. Bestor, <bestor@us.ibm.com>
  106.21 +// Contributors:
  106.22 +// Description:
  106.23 +// ============================================================================
  106.24 +
  106.25 +/* Include the required CMPI data types, function headers, and macros */
  106.26 +#include "cmpidt.h"
  106.27 +#include "cmpift.h"
  106.28 +#include "cmpimacs.h"
  106.29 +
  106.30 +
  106.31 +// ----------------------------------------------------------------------------
  106.32 +// COMMON GLOBAL VARIABLES
  106.33 +// ----------------------------------------------------------------------------
  106.34 +
  106.35 +/* Handle to the CIM broker. Initialized when the provider lib is loaded. */
  106.36 +static CMPIBroker *_BROKER;
  106.37 +
  106.38 +/* Include utility functions */
  106.39 +#include "cmpiutil.h"
  106.40 +
  106.41 +/* Include _SBLIM_TRACE() logging support */
  106.42 +#include "cmpitrace.h"
  106.43 +
  106.44 +
  106.45 +// ============================================================================
  106.46 +// CMPI INDICATION PROVIDER FUNCTION TABLE
  106.47 +// ============================================================================
  106.48 +
  106.49 +/* Flag indicating if indications are currently enabled */
  106.50 +static int enabled = 0;
  106.51 +
  106.52 +/* Number of active indication filters (i.e. # registered subscriptions) */
  106.53 +static int numActiveFilters = 0;
  106.54 +
  106.55 +/* Number of seconds to wait between polling to generate indications. */
  106.56 +static int pollingInterval = 30;
  106.57 +
  106.58 +/* Handle to the asynchronous indication generator thread */
  106.59 +static CMPI_THREAD_TYPE indicationThreadId = 0;
  106.60 +
  106.61 +static char * _NAMESPACE = "root/cimv2";
  106.62 +static char * _CLASSNAME = "Xen_ComputerSystem";
  106.63 +
  106.64 +static CMPIArray * currentinstances = NULL;
  106.65 +static CMPIArray * previousinstances = NULL;
  106.66 + 
  106.67 +// ----------------------------------------------------------------------------
  106.68 +// _indicationThread()
  106.69 +// Runtime thread to periodically poll to generate indications.
  106.70 +// ----------------------------------------------------------------------------
  106.71 +CMPI_THREAD_RETURN _indicationThread( void * parameters )
  106.72 +{
  106.73 +   CMPIContext * context = (CMPIContext *)parameters; /* Indication thread context */
  106.74 +   CMPIStatus status = {CMPI_RC_OK, NULL};	/* Return status of CIM operations */
  106.75 +   CMPIInstance * indication;			/* CIM instance for each new indication */
  106.76 +   int i,j;
  106.77 +
  106.78 +   _SBLIM_ENTER("_indicationThread");
  106.79 +
  106.80 +   /* Register this thread to the CMPI runtime. */
  106.81 +   CBAttachThread(_BROKER, context);
  106.82 +
  106.83 +   _SBLIM_TRACE(2, ("--- context=\"%s\"", CMGetCharPtr(CDToString(_BROKER, context, NULL))));
  106.84 +
  106.85 +   /* Periodically poll while there is at least one indication subscriber. */
  106.86 +   while (numActiveFilters > 0) {
  106.87 +      _SBLIM_TRACE(3, ("--- Sleeping for %d seconds", pollingInterval));
  106.88 +      sleep(pollingInterval);
  106.89 +
  106.90 +      /* Check if indications are still enabled. */
  106.91 +      if (!enabled) continue;
  106.92 +
  106.93 +      /* Free the previous instances list. */
  106.94 +_SBLIM_TRACE(1,("--- before CMRelease()"));
  106.95 +      if (previousinstances != NULL) CMRelease(previousinstances);
  106.96 +_SBLIM_TRACE(1,("--- after CMRelease()"));
  106.97 +
  106.98 +      /* Move the (old) current instances list to the previous. */
  106.99 +      previousinstances = currentinstances;
 106.100 +
 106.101 +      /* Create an object path for the monitored class. */
 106.102 +      CMPIObjectPath * objectpath = CMNewObjectPath(_BROKER, _NAMESPACE, _CLASSNAME, &status);
 106.103 +      if ((status.rc != CMPI_RC_OK) || CMIsNullObject(objectpath)) {
 106.104 +         _SBLIM_TRACE(1,("--- CMNewObjectPath() failed - %s", CMGetCharPtr(status.msg)));
 106.105 +         goto exit;
 106.106 +      }
 106.107 +
 106.108 +      /* Get the current list of instances of the monitored class. */
 106.109 +      CMPIEnumeration * instances = CBEnumInstances(_BROKER, context, objectpath, NULL, &status);
 106.110 +      if ((status.rc != CMPI_RC_OK) || CMIsNullObject(instances)) {
 106.111 +         _SBLIM_TRACE(1,("--- CBEnumInstanceNames() failed - %s", CMGetCharPtr(status.msg)));
 106.112 +         goto exit;
 106.113 +      }
 106.114 +
 106.115 +      /* Save a copy of the array of instances. */
 106.116 +      currentinstances = CMToArray(instances, &status);
 106.117 +      if ((status.rc != CMPI_RC_OK) || CMIsNullObject(currentinstances)) {
 106.118 +         _SBLIM_TRACE(1,("--- CMToArray() failed - %s", CMGetCharPtr(status.msg)));
 106.119 +         currentinstances = NULL;
 106.120 +         goto exit;
 106.121 +      }
 106.122 +
 106.123 +//_SBLIM_TRACE(4,("before CMClone()"));
 106.124 +//      currentinstances = CMClone(currentinstances, &status);
 106.125 +//_SBLIM_TRACE(4,("after CMClone()"));
 106.126 +      if ((status.rc != CMPI_RC_OK) || CMIsNullObject(currentinstances)) {
 106.127 +         _SBLIM_TRACE(1,("--- CMClone() failed - %s", CMGetCharPtr(status.msg)));
 106.128 +         if (currentinstances != NULL) CMRelease(currentinstances);
 106.129 +         currentinstances = NULL;
 106.130 +         goto exit;
 106.131 +      }
 106.132 +
 106.133 +      /* Go thru the list of current instances and look for changes. */
 106.134 +      if (currentinstances != NULL) {  
 106.135 +         for (i=0; i<CMGetArrayCount(currentinstances,NULL); i++) {
 106.136 +            CMPIData newinstancedata = CMGetArrayElementAt(currentinstances, i, NULL);
 106.137 +            CMPIObjectPath * newobjectpath = CMGetObjectPath(newinstancedata.value.inst, NULL);
 106.138 +            CMPIData oldinstancedata;
 106.139 +
 106.140 +_SBLIM_TRACE(3, ("--- Checking objectpath =\"%s\"", CMGetCharPtr(CDToString(_BROKER, newobjectpath, NULL))));
 106.141 +
 106.142 +            /* Find the matching instance in the previous list, if any. */
 106.143 +            int found = 0;
 106.144 +            if (previousinstances != NULL) {  
 106.145 +               for (j=0; j<CMGetArrayCount(previousinstances, NULL); j++) {
 106.146 +                  oldinstancedata = CMGetArrayElementAt(previousinstances, j, NULL);
 106.147 +                  CMPIObjectPath * oldobjectpath = CMGetObjectPath(oldinstancedata.value.inst, NULL);
 106.148 +                  if (_CMSameObject(oldobjectpath, newobjectpath)) {
 106.149 +                     found = 1;
 106.150 +                     break;
 106.151 +                  }
 106.152 +               }
 106.153 +            }
 106.154 +
 106.155 +            /* InstCreation: If no matching old instance then this is a brand new instance. */
 106.156 +            if (!found) {
 106.157 +               _SBLIM_TRACE(4, ("--- New instance!"));
 106.158 +               indication = _CMNewInstance(_BROKER, _NAMESPACE, "Xen_ComputerSystemCreation", &status);
 106.159 +               if (status.rc != CMPI_RC_OK) goto exit;
 106.160 +
 106.161 +               /* Set the indication properties. */
 106.162 +               CMSetProperty(indication, "SourceInstance",(CMPIValue *)&(newinstancedata.value.inst), CMPI_instance);
 106.163 +            }
 106.164 +
 106.165 +            else {
 106.166 +               /* InstModification: Check if old instance has different property values. */
 106.167 +               CMPIData oldstatusdata = CMGetProperty(oldinstancedata.value.inst,"Status",NULL);
 106.168 +               CMPIData newstatusdata = CMGetProperty(newinstancedata.value.inst,"Status",NULL);
 106.169 +               char * oldstatus = CMGetCharPtr(oldstatusdata.value.string);
 106.170 +               char * newstatus = CMGetCharPtr(newstatusdata.value.string);
 106.171 +
 106.172 +               if (strcmp(oldstatus,newstatus) != 0) {
 106.173 +                  _SBLIM_TRACE(4, ("--- Modified instance! Old status=%s New status=%s", oldstatus, newstatus));
 106.174 +                  indication = _CMNewInstance(_BROKER, _NAMESPACE, "Xen_ComputerSystemModification", &status);
 106.175 +                  if (status.rc != CMPI_RC_OK) goto exit;
 106.176 +
 106.177 +                  /* Set the indication properties. */
 106.178 +                  CMSetProperty(indication, "SourceInstance",(CMPIValue *)&(newinstancedata.value.inst), CMPI_instance);
 106.179 +                  CMSetProperty(indication, "PreviousInstance",(CMPIValue *)&(oldinstancedata.value.inst), CMPI_instance);
 106.180 +               }
 106.181 +               /* No changes so no indication. */ 
 106.182 +               else {
 106.183 +                 continue;
 106.184 +               }
 106.185 +            }
 106.186 +
 106.187 +            /* Deliver the indication to all subscribers. */
 106.188 +            _SBLIM_TRACE(2, ("--- Delivering indication"));
 106.189 +//            _SBLIM_TRACE(3, ("--- indication=\"%s\"", CMGetCharPtr(CDToString(_BROKER, indication, NULL))));
 106.190 +            status = CBDeliverIndication(_BROKER, context, _NAMESPACE, indication);
 106.191 +            if (status.rc != CMPI_RC_OK) {
 106.192 +               _SBLIM_TRACE(1, ("--- Failed to deliver indication"));
 106.193 +               goto exit;
 106.194 +            }
 106.195 +         }
 106.196 +      }
 106.197 +
 106.198 +      /* Check for instances that have been deleted. */
 106.199 +      if (previousinstances != NULL) { 
 106.200 +         _SBLIM_TRACE(3, ("--- Scanning for deleted instances"));
 106.201 +         for (i=0; i<CMGetArrayCount(previousinstances,NULL); i++) {
 106.202 +            CMPIData oldinstancedata = CMGetArrayElementAt(previousinstances, i, NULL);
 106.203 +            CMPIObjectPath * oldobjectpath = CMGetObjectPath(oldinstancedata.value.inst, NULL);
 106.204 +            CMPIData newinstancedata;
 106.205 +
 106.206 +_SBLIM_TRACE(3, ("--- Checking objectpath =\"%s\"", CMGetCharPtr(CDToString(_BROKER, oldobjectpath, NULL))));
 106.207 +
 106.208 +            /* Find the matching instance in the previous list, if any. */
 106.209 +            int found = 0;
 106.210 +            if (currentinstances != NULL) {
 106.211 +               for (j=0; j<CMGetArrayCount(currentinstances, NULL); j++) {
 106.212 +                  newinstancedata = CMGetArrayElementAt(currentinstances, j, NULL);
 106.213 +                  CMPIObjectPath * newobjectpath = CMGetObjectPath(newinstancedata.value.inst, NULL);
 106.214 +                  if (_CMSameObject(oldobjectpath, newobjectpath)) {
 106.215 +                     found = 1;
 106.216 +                     break;
 106.217 +                  }
 106.218 +               }
 106.219 +            }
 106.220 +
 106.221 +            /* InstDeletion: If no matching new instance then the instance was deleted. */
 106.222 +            if (!found) {
 106.223 +               _SBLIM_TRACE(4, ("--- Deleted instance!"));
 106.224 +               indication = _CMNewInstance(_BROKER, _NAMESPACE, "Xen_ComputerSystemDeletion", &status);
 106.225 +               if (status.rc != CMPI_RC_OK) goto exit;
 106.226 +
 106.227 +               /* Set the indication properties. */
 106.228 +               CMSetProperty(indication, "SourceInstance",(CMPIValue *)&(oldinstancedata.value.inst), CMPI_instance);
 106.229 +
 106.230 +               /* Deliver the indication to all subscribers. */
 106.231 +               _SBLIM_TRACE(2, ("--- Delivering indication"));
 106.232 +//               _SBLIM_TRACE(3, ("--- indication=\"%s\"", CMGetCharPtr(CDToString(_BROKER, indication, NULL))));
 106.233 +               status = CBDeliverIndication(_BROKER, context, _NAMESPACE, indication);
 106.234 +               if (status.rc != CMPI_RC_OK) {
 106.235 +                  _SBLIM_TRACE(1, ("--- Failed to deliver indication"));
 106.236 +                  goto exit;
 106.237 +               }
 106.238 +            }
 106.239 +         }
 106.240 +      }
 106.241 +   }
 106.242 +   _SBLIM_TRACE(2, ("--- No more active filters"));
 106.243 +
 106.244 +exit:
 106.245 +   indicationThreadId = 0;
 106.246 +   _SBLIM_RETURN(NULL);
 106.247 +}
 106.248 +
 106.249 +// ----------------------------------------------------------------------------
 106.250 +// IndicationCleanup()
 106.251 +// Perform any necessary cleanup immediately before this provider is unloaded.
 106.252 +// ----------------------------------------------------------------------------
 106.253 +static CMPIStatus IndicationCleanup(
 106.254 +                CMPIInstanceMI * self,          /* [in] Handle to this provider (i.e. 'self'). */
 106.255 +                CMPIContext * context)          /* [in] Additional context info, if any. */
 106.256 +{
 106.257 +   CMPIStatus status = { CMPI_RC_OK, NULL };    /* Return status of CIM operations. */
 106.258 +
 106.259 +   _SBLIM_ENTER("IndicationCleanup");
 106.260 +   _SBLIM_TRACE(2, ("--- self=\"%s\"", self->ft->miName));
 106.261 +   _SBLIM_TRACE(2, ("--- context=\"%s\"", CMGetCharPtr(CDToString(_BROKER, context, NULL))));
 106.262 +
 106.263 +   /* Nothing needs to be done for cleanup. */
 106.264 +
 106.265 +exit:
 106.266 +   _SBLIM_RETURNSTATUS(status);
 106.267 +}
 106.268 +
 106.269 +// ----------------------------------------------------------------------------
 106.270 +// AuthorizeFilter()
 106.271 +// Check whether the requested filter is valid/permitted.
 106.272 +// ----------------------------------------------------------------------------
 106.273 +static CMPIStatus AuthorizeFilter(
 106.274 +		CMPIIndicationMI * self,	/* [in] Handle to this provider (i.e. 'self') */
 106.275 +		CMPIContext * context,		/* [in] Additional context info, if any */
 106.276 +		CMPIResult * results,		/* [out] Results of this operation */
 106.277 +		CMPISelectExp * filter,		/* [in] Indication filter query */
 106.278 +		const char * eventtype,		/* [in] Target indication class(es) of filter. */
 106.279 +		CMPIObjectPath * reference,	/* [in] Namespace and classname of monitored class */
 106.280 +		const char * username )		/* [in] Name of principle requesting the filter */
 106.281 +{
 106.282 +   CMPIStatus status = {CMPI_RC_OK, NULL};	/* Return status of CIM operations */
 106.283 +   CMPIBoolean authorized = CMPI_true;
 106.284 +   char * namespace = CMGetCharPtr(CMGetNameSpace(reference, NULL)); /* Target namespace. */
 106.285 +   char * classname = CMGetCharPtr(CMGetClassName(reference, NULL)); /* Target class. */
 106.286 +
 106.287 +   _SBLIM_ENTER("AuthorizeFilter");
 106.288 +   _SBLIM_TRACE(2, ("--- self=\"%s\"", self->ft->miName));
 106.289 +   _SBLIM_TRACE(2, ("--- context=\"%s\"", CMGetCharPtr(CDToString(_BROKER, context, NULL))));
 106.290 +   _SBLIM_TRACE(2, ("--- filter=\"%s\"", CMGetCharPtr(CMGetSelExpString(filter, NULL))));
 106.291 +   _SBLIM_TRACE(2, ("--- eventtype=\"%s\"", eventtype));
 106.292 +   _SBLIM_TRACE(2, ("--- reference=\"%s\"", CMGetCharPtr(CDToString(_BROKER, reference, NULL))));
 106.293 +   _SBLIM_TRACE(2, ("--- username=\"%s\"", username));
 106.294 +   _SBLIM_TRACE(2, ("--- namespace=\"%s\"", namespace));
 106.295 +   _SBLIM_TRACE(2, ("--- classname=\"%s\"", classname));
 106.296 +
 106.297 +   /* Check that the filter indication class is supported. */
 106.298 +   if ((strcmp(eventtype,"Xen_ComputerSystemCreation") != 0) &&
 106.299 +       (strcmp(eventtype,"Xen_ComputerSystemDeletion") != 0) &&
 106.300 +       (strcmp(eventtype,"Xen_ComputerSystemModification") != 0)) {
 106.301 +      authorized = CMPI_false;
 106.302 +   }
 106.303 +
 106.304 +exit:
 106.305 +   CMReturnData(results, (CMPIValue *)&authorized, CMPI_boolean);
 106.306 +   CMReturnDone(results);
 106.307 +   _SBLIM_RETURNSTATUS(status);
 106.308 +}
 106.309 +
 106.310 +// ----------------------------------------------------------------------------
 106.311 +// MustPoll()
 106.312 +// Specify if the CIMOM should generate indications instead, by polling the
 106.313 +// instance data for any changes.
 106.314 +// ----------------------------------------------------------------------------
 106.315 +static CMPIStatus MustPoll(
 106.316 +                CMPIIndicationMI * self,        /* [in] Handle to this provider (i.e. 'self') */
 106.317 +                CMPIContext * context,          /* [in] Additional context info, if any */
 106.318 +                CMPIResult * results,           /* [out] Results of this operation */
 106.319 +                CMPISelectExp * filter,         /* [in] Indication filter query */
 106.320 +                const char * eventtype,         /* [in] Filter target class(es) */
 106.321 +                CMPIObjectPath * reference )     /* [in] Namespace and classname of monitored class */
 106.322 +{
 106.323 +   CMPIStatus status = {CMPI_RC_OK, NULL};      /* Return status of CIM operations */
 106.324 +   CMPIBoolean poll = CMPI_false;
 106.325 +   char * namespace = CMGetCharPtr(CMGetNameSpace(reference, NULL)); /* Target namespace. */
 106.326 +   char * classname = CMGetCharPtr(CMGetClassName(reference, NULL)); /* Target class. */
 106.327 +
 106.328 +   _SBLIM_ENTER("MustPoll");
 106.329 +   _SBLIM_TRACE(2, ("--- self=\"%s\"", self->ft->miName));
 106.330 +   _SBLIM_TRACE(2, ("--- context=\"%s\"", CMGetCharPtr(CDToString(_BROKER, context, NULL))));
 106.331 +   _SBLIM_TRACE(2, ("--- filter=\"%s\"", CMGetCharPtr(CMGetSelExpString(filter, NULL))));
 106.332 +   _SBLIM_TRACE(2, ("--- eventtype=\"%s\"", eventtype));
 106.333 +   _SBLIM_TRACE(2, ("--- reference=\"%s\"", CMGetCharPtr(CDToString(_BROKER, reference, NULL))));
 106.334 +   _SBLIM_TRACE(2, ("--- namespace=\"%s\"", namespace));
 106.335 +   _SBLIM_TRACE(2, ("--- classname=\"%s\"", classname));
 106.336 +
 106.337 +   /* Polling not required for this indication provider */
 106.338 +
 106.339 +exit:
 106.340 +   CMReturnData(results, (CMPIValue *)&poll, CMPI_boolean);
 106.341 +   CMReturnDone(results);
 106.342 +   _SBLIM_RETURNSTATUS(status);
 106.343 +}
 106.344 +
 106.345 +// ----------------------------------------------------------------------------
 106.346 +// ActivateFilter()
 106.347 +// Add another subscriber and start generating indications.
 106.348 +// ----------------------------------------------------------------------------
 106.349 +static CMPIStatus ActivateFilter(
 106.350 +		CMPIIndicationMI * self,        /* [in] Handle to this provider (i.e. 'self') */
 106.351 +		CMPIContext * context,          /* [in] Additional context info, if any */
 106.352 +		CMPIResult * results,           /* [out] Results of this operation */
 106.353 +		CMPISelectExp * filter,         /* [in] Indication filter query */
 106.354 +		const char * eventtype,         /* [in] Filter target class(es) */
 106.355 +		CMPIObjectPath * reference,     /* [in] Namespace and classname of monitored class */
 106.356 +		CMPIBoolean first )             /* [in] Is this the first filter for this eventtype? */
 106.357 +{
 106.358 +   CMPIStatus status = {CMPI_RC_OK, NULL}; /* Return status of CIM operations */
 106.359 +//   CMPIBoolean activated = CMPI_true;
 106.360 +   char * namespace = CMGetCharPtr(CMGetNameSpace(reference, NULL)); /* Target namespace. */
 106.361 +   char * classname = CMGetCharPtr(CMGetClassName(reference, NULL)); /* Target class. */
 106.362 +
 106.363 +   _SBLIM_ENTER("ActivateFilter");
 106.364 +   _SBLIM_TRACE(2, ("--- self=\"%s\"", self->ft->miName));
 106.365 +   _SBLIM_TRACE(2, ("--- context=\"%s\"", CMGetCharPtr(CDToString(_BROKER, context, NULL))));
 106.366 +   _SBLIM_TRACE(2, ("--- filter=\"%s\"", CMGetCharPtr(CMGetSelExpString(filter, NULL))));
 106.367 +   _SBLIM_TRACE(2, ("--- eventtype=\"%s\"", eventtype));
 106.368 +   _SBLIM_TRACE(2, ("--- reference=\"%s\"", CMGetCharPtr(CDToString(_BROKER, reference, NULL))));
 106.369 +   _SBLIM_TRACE(2, ("--- first=%s", (first)? "TRUE":"FALSE"));
 106.370 +   _SBLIM_TRACE(2, ("--- namespace=\"%s\"", namespace));
 106.371 +   _SBLIM_TRACE(2, ("--- classname=\"%s\"", classname));
 106.372 +
 106.373 +   numActiveFilters++;
 106.374 +   _SBLIM_TRACE(2, ("--- numActiveFilters=%d", numActiveFilters));
 106.375 +
 106.376 +   /* Startup the indication generator if it isn't already running */
 106.377 +   if (indicationThreadId == 0) {
 106.378 +      /* Get the context for the new indication generator thread */
 106.379 +      CMPIContext * indicationContext = CBPrepareAttachThread(_BROKER, context);
 106.380 +      _SBLIM_TRACE(2, ("--- indicationcontext=\"%s\"", CMGetCharPtr(CDToString(_BROKER, indicationContext, NULL))));
 106.381 +
 106.382 +      /* Statup a new non-detached thread to run the indication generator */
 106.383 +      _SBLIM_TRACE(1,("--- Starting up indication generator thread"));
 106.384 +      indicationThreadId = _BROKER->xft->newThread(_indicationThread, indicationContext, 0);
 106.385 +   }
 106.386 +
 106.387 +exit:
 106.388 +//   CMReturnData(results, (CMPIValue *)&activated, CMPI_boolean);
 106.389 +//   CMReturnDone(results);
 106.390 +   _SBLIM_RETURNSTATUS(status);
 106.391 +}
 106.392 +
 106.393 +// ----------------------------------------------------------------------------
 106.394 +// DeActivateFilter()
 106.395 +// Remove a subscriber and if necessary stop generating indications.
 106.396 +// ----------------------------------------------------------------------------
 106.397 +static CMPIStatus DeActivateFilter(
 106.398 +                CMPIIndicationMI * self,        /* [in] Handle to this provider (i.e. 'self') */
 106.399 +                CMPIContext * context,          /* [in] Additional context info, if any */
 106.400 +                CMPIResult * results,           /* [out] Results of this operation */
 106.401 +                CMPISelectExp * filter,         /* [in] Indication filter query */
 106.402 +                const char * eventtype,         /* [in] Filter target class(es) */
 106.403 +                CMPIObjectPath * reference,     /* [in] Namespace and classname of monitored class */
 106.404 +                CMPIBoolean last )              /* [in] Is this the last filter for this eventtype? */
 106.405 +{
 106.406 +   CMPIStatus status = {CMPI_RC_OK, NULL}; /* Return status of CIM operations */
 106.407 +   CMPIContext * indicationContext;
 106.408 +//   CMPIBoolean deactivated = CMPI_true;
 106.409 +   char * namespace = CMGetCharPtr(CMGetNameSpace(reference, NULL)); /* Target namespace. */
 106.410 +   char * classname = CMGetCharPtr(CMGetClassName(reference, NULL)); /* Target class. */
 106.411 +
 106.412 +   _SBLIM_ENTER("DeActivateFilter");
 106.413 +   _SBLIM_TRACE(2, ("--- self=\"%s\"", self->ft->miName));
 106.414 +   _SBLIM_TRACE(2, ("--- context=\"%s\"", CMGetCharPtr(CDToString(_BROKER, context, NULL))));
 106.415 +   _SBLIM_TRACE(2, ("--- filter=\"%s\"", CMGetCharPtr(CMGetSelExpString(filter, NULL))));
 106.416 +   _SBLIM_TRACE(2, ("--- eventtype=\"%s\"", eventtype));
 106.417 +   _SBLIM_TRACE(2, ("--- reference=\"%s\"", CMGetCharPtr(CDToString(_BROKER, reference, NULL))));
 106.418 +   _SBLIM_TRACE(2, ("--- last=%s", (last)? "TRUE":"FALSE"));
 106.419 +   _SBLIM_TRACE(2, ("--- namespace=\"%s\"", namespace));
 106.420 +   _SBLIM_TRACE(2, ("--- classname=\"%s\"", classname));
 106.421 +
 106.422 +   if (numActiveFilters == 0) {
 106.423 +//      deactivated = CMPI_false;
 106.424 +      CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_FAILED, "No active filters");
 106.425 +      goto exit;
 106.426 +   }
 106.427 +
 106.428 +   numActiveFilters--;
 106.429 +   _SBLIM_TRACE(2,("--- numActiveFilters=%d", numActiveFilters));
 106.430 +
 106.431 +   /* If no active filters then shutdown the indication generator thread */
 106.432 +   if ((numActiveFilters == 0) && indicationThreadId != 0) {
 106.433 +      _SBLIM_TRACE(1,("--- Shutting down indication generator thread"));
 106.434 +      _BROKER->xft->cancelThread(indicationThreadId);
 106.435 +      indicationThreadId = 0;
 106.436 +   }
 106.437 +
 106.438 +exit:
 106.439 +//   CMReturnData(results, (CMPIValue *)&deactivated, CMPI_boolean);
 106.440 +//   CMReturnDone(results);
 106.441 +   _SBLIM_RETURNSTATUS(status);
 106.442 +}
 106.443 +
 106.444 +// ----------------------------------------------------------------------------
 106.445 +// EnableIndications()
 106.446 +// ----------------------------------------------------------------------------
 106.447 +static void EnableIndications( CMPIIndicationMI * self )
 106.448 +{
 106.449 +   _SBLIM_ENTER("EnableIndications");
 106.450 +   _SBLIM_TRACE(2, ("--- self=\"%s\"", self->ft->miName));
 106.451 +
 106.452 +   /* Enable indication generation */
 106.453 +   enabled = 1;
 106.454 +
 106.455 +   _SBLIM_RETURN();
 106.456 +}
 106.457 +
 106.458 +// ----------------------------------------------------------------------------
 106.459 +// DisableIndications()
 106.460 +// ----------------------------------------------------------------------------
 106.461 +static void DisableIndications( CMPIIndicationMI * self )
 106.462 +{
 106.463 +   _SBLIM_ENTER("DisableIndications");
 106.464 +   _SBLIM_TRACE(2, ("--- self=\"%s\"", self->ft->miName));
 106.465 +
 106.466 +   /* Disable indication generation */
 106.467 +   enabled = 0;
 106.468 +
 106.469 +   _SBLIM_RETURN();
 106.470 +}
 106.471 +
 106.472 +// ----------------------------------------------------------------------------
 106.473 +// IndicationInitialize()
 106.474 +// Perform any necessary initialization immediately after this provider is
 106.475 +// first loaded.
 106.476 +// ----------------------------------------------------------------------------
 106.477 +static void IndicationInitialize(
 106.478 +                CMPIInstanceMI * self,          /* [in] Handle to this provider (i.e. 'self'). */
 106.479 +                CMPIContext * context)          /* [in] Additional context info, if any. */
 106.480 +{
 106.481 +   CMPIStatus status = {CMPI_RC_OK, NULL}; /* Return status of CIM operations */
 106.482 +
 106.483 +   _SBLIM_ENTER("IndicationInitialize");
 106.484 +   _SBLIM_TRACE(2, ("--- self=\"%s\"", self->ft->miName));
 106.485 +   _SBLIM_TRACE(2, ("--- context=\"%s\"", CMGetCharPtr(CDToString(_BROKER, context, NULL))));
 106.486 +
 106.487 +   /* Create an object path for the monitored class. */
 106.488 +   CMPIObjectPath * objectpath = CMNewObjectPath(_BROKER, _NAMESPACE, _CLASSNAME, &status);
 106.489 +   if ((status.rc != CMPI_RC_OK) || CMIsNullObject(objectpath)) {
 106.490 +      _SBLIM_TRACE(1,("--- CMNewObjectPath() failed - %s", CMGetCharPtr(status.msg)));
 106.491 +      goto exit;
 106.492 +   }
 106.493 +
 106.494 +   /* Get the current list of instances of the monitored class. */
 106.495 +   CMPIEnumeration * instances = CBEnumInstances(_BROKER, context, objectpath, NULL, &status);
 106.496 +   if ((status.rc != CMPI_RC_OK) || CMIsNullObject(instances)) {
 106.497 +      _SBLIM_TRACE(1,("--- CBEnumInstanceNames() failed - %s", CMGetCharPtr(status.msg)));
 106.498 +      goto exit;
 106.499 +   }
 106.500 +
 106.501 +   /* Save a copy of the array of instances. */
 106.502 +   currentinstances = CMToArray(instances, &status);
 106.503 +   if ((status.rc != CMPI_RC_OK) || CMIsNullObject(currentinstances)) {
 106.504 +      _SBLIM_TRACE(1,("--- CMToArray() failed - %s", CMGetCharPtr(status.msg)));
 106.505 +      currentinstances = NULL;
 106.506 +      goto exit;
 106.507 +   }
 106.508 +
 106.509 +_SBLIM_TRACE(4,("before CMClone()"));
 106.510 +   currentinstances = CMClone(currentinstances, &status);
 106.511 +_SBLIM_TRACE(4,("after CMClone()"));
 106.512 +   if ((status.rc != CMPI_RC_OK) || CMIsNullObject(currentinstances)) {
 106.513 +      _SBLIM_TRACE(1,("--- CMClone() failed - %s", CMGetCharPtr(status.msg)));
 106.514 +      if (currentinstances != NULL) CMRelease(currentinstances);
 106.515 +      currentinstances = NULL;
 106.516 +      goto exit;
 106.517 +   }
 106.518 +
 106.519 +exit:
 106.520 +   _SBLIM_RETURN();
 106.521 +}
 106.522 +
 106.523 +// ============================================================================
 106.524 +// CMPI INDICATION PROVIDER FUNCTION TABLE SETUP
 106.525 +// ============================================================================
 106.526 +CMIndicationMIStub( , Xen_ComputerSystemIndicationProvider, _BROKER, IndicationInitialize(&mi, ctx));
 106.527 +
   107.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   107.2 +++ b/src/Xen_ComputerSystemMemory.c	Wed Mar 22 14:05:14 2006 -0700
   107.3 @@ -0,0 +1,535 @@
   107.4 +// Copyright (C) 2006 IBM Corporation
   107.5 +//
   107.6 +//    This library is free software; you can redistribute it and/or
   107.7 +//    modify it under the terms of the GNU Lesser General Public
   107.8 +//    License as published by the Free Software Foundation; either
   107.9 +//    version 2.1 of the License, or (at your option) any later version.
  107.10 +//
  107.11 +//    This library is distributed in the hope that it will be useful,
  107.12 +//    but WITHOUT ANY WARRANTY; without even the implied warranty of
  107.13 +//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  107.14 +//    Lesser General Public License for more details.
  107.15 +//
  107.16 +//    You should have received a copy of the GNU Lesser General Public
  107.17 +//    License along with this library; if not, write to the Free Software
  107.18 +//    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  107.19 +// ============================================================================
  107.20 +// Authors:       Dr. Gareth S. Bestor, <bestor@us.ibm.com>
  107.21 +// Contributors:
  107.22 +// Description:
  107.23 +// ============================================================================
  107.24 +
  107.25 +/* Include the required CMPI data types, function headers, and macros */
  107.26 +#include "cmpidt.h"
  107.27 +#include "cmpift.h"
  107.28 +#include "cmpimacs.h"
  107.29 +
  107.30 +
  107.31 +// ----------------------------------------------------------------------------
  107.32 +// COMMON GLOBAL VARIABLES
  107.33 +// ----------------------------------------------------------------------------
  107.34 +
  107.35 +/* Handle to the CIM broker. Initialized when the provider lib is loaded. */
  107.36 +static CMPIBroker *_BROKER;
  107.37 +
  107.38 +/* Include utility functions */
  107.39 +#include "cmpiutil.h"
  107.40 +
  107.41 +/* Include _SBLIM_TRACE() logging support */
  107.42 +#include "cmpitrace.h"
  107.43 +
  107.44 +
  107.45 +// ============================================================================
  107.46 +// CMPI ASSOCIATION PROVIDER FUNCTION TABLE
  107.47 +// ============================================================================
  107.48 +
  107.49 +// ----------------------------------------------------------------------------
  107.50 +// Info for the class supported by the association provider
  107.51 +// ----------------------------------------------------------------------------
  107.52 +                                                                                                                                 
  107.53 +/* Name of the left and right hand side classes of this association. */
  107.54 +static char * _ASSOCCLASS = "Xen_ComputerSystemMemory";
  107.55 +static char * _LHSCLASSNAME = "Xen_Memory";
  107.56 +static char * _RHSCLASSNAME = "Xen_ComputerSystem";
  107.57 +static char * _LHSPROPERTYNAME = "PartComponent"; 
  107.58 +static char * _RHSPROPERTYNAME = "GroupComponent";
  107.59 +static char * _LHSKEYNAME = "SystemName";
  107.60 +static char * _RHSKEYNAME = "Name";
  107.61 +
  107.62 +// ----------------------------------------------------------------------------
  107.63 +// AssociationCleanup()
  107.64 +// Perform any necessary cleanup immediately before this provider is unloaded.
  107.65 +// ----------------------------------------------------------------------------
  107.66 +static CMPIStatus AssociationCleanup(
  107.67 +		CMPIAssociationMI * self,	/* [in] Handle to this provider (i.e. 'self'). */
  107.68 +		CMPIContext * context)		/* [in] Additional context info, if any. */
  107.69 +{
  107.70 +   CMPIStatus status = { CMPI_RC_OK, NULL };	/* Return status of CIM operations. */
  107.71 +
  107.72 +   _SBLIM_ENTER("AssociationCleanup");
  107.73 +   _SBLIM_TRACE(2, ("--- self=\"%s\"", self->ft->miName));
  107.74 +   _SBLIM_TRACE(2, ("--- context=\"%s\"", CMGetCharPtr(CDToString(_BROKER, context, NULL))));
  107.75 +
  107.76 +   /* Nothing needs to be done for cleanup. */
  107.77 +
  107.78 +exit:
  107.79 +   _SBLIM_RETURNSTATUS(status);
  107.80 +}
  107.81 +
  107.82 +
  107.83 +// ----------------------------------------------------------------------------
  107.84 +// AssociatorNames()
  107.85 +// ----------------------------------------------------------------------------
  107.86 +static CMPIStatus AssociatorNames(
  107.87 +		CMPIAssociationMI * self,	/* [in] Handle to this provider (i.e. 'self'). */
  107.88 +		CMPIContext * context,		/* [in] Additional context info, if any. */
  107.89 +		CMPIResult * results,		/* [out] Results of this operation. */
  107.90 +		CMPIObjectPath * reference,	/* [in] Contains source namespace, classname and object path. */
  107.91 +		const char * assocClass,
  107.92 +		const char * resultClass,
  107.93 +		const char * role,
  107.94 +		const char * resultRole)
  107.95 +{
  107.96 +   CMPIStatus status = { CMPI_RC_OK, NULL };    /* Return status of CIM operations. */
  107.97 +   char *namespace = CMGetCharPtr(CMGetNameSpace(reference, NULL)); /* Target namespace. */
  107.98 +   char *sourceclass = CMGetCharPtr(CMGetClassName(reference, &status)); /* Class of the source reference object */
  107.99 +   char *targetclass; 				/* Class of the target object(s). */
 107.100 +
 107.101 +   char *sourcekeyname;
 107.102 +   char *targetkeyname;
 107.103 +
 107.104 +   _SBLIM_ENTER("AssociatorNames");
 107.105 +   _SBLIM_TRACE(2, ("--- self=\"%s\"", self->ft->miName));
 107.106 +   _SBLIM_TRACE(2, ("--- context=\"%s\"", CMGetCharPtr(CDToString(_BROKER, context, NULL))));
 107.107 +   _SBLIM_TRACE(2, ("--- reference=\"%s\"", CMGetCharPtr(CDToString(_BROKER, reference, NULL))));
 107.108 +   _SBLIM_TRACE(2, ("--- assocClass=\"%s\"", assocClass));
 107.109 +   _SBLIM_TRACE(2, ("--- resultClass=\"%s\"", resultClass));
 107.110 +   _SBLIM_TRACE(2, ("--- role=\"%s\"", role));
 107.111 +   _SBLIM_TRACE(2, ("--- resultRole=\"%s\"", resultRole));
 107.112 +   _SBLIM_TRACE(2, ("--- namespace=\"%s\"", namespace));
 107.113 +   _SBLIM_TRACE(2, ("--- sourceclass=\"%s\"", sourceclass));
 107.114 +
 107.115 +   /* Check that the requested association class, if any, is supported. */
 107.116 +   if (assocClass != NULL) {
 107.117 +      CMPIObjectPath * assoc = CMNewObjectPath(_BROKER, namespace, _ASSOCCLASS, NULL);
 107.118 +      if (!CMClassPathIsA(_BROKER, assoc, assocClass, NULL)) {
 107.119 +         _SBLIM_TRACE(2, ("--- Unrecognized association class. Ignoring request."));
 107.120 +         goto exit;
 107.121 +      }
 107.122 +   }
 107.123 +
 107.124 +   /* Check that the reference matches the required role, if any. */
 107.125 +   if ((role != NULL) && strcmp(role, sourceclass) != 0) {
 107.126 +      _SBLIM_TRACE(2, ("--- Reference does not match required role. Ignoring request."));
 107.127 +      goto exit;
 107.128 +   }
 107.129 +
 107.130 +   /* Determine the target class from the source class. */
 107.131 +   if (strcmp(sourceclass, _LHSCLASSNAME) == 0) {
 107.132 +      sourcekeyname = _LHSKEYNAME;
 107.133 +      targetclass = _RHSCLASSNAME;
 107.134 +      targetkeyname = _RHSKEYNAME;
 107.135 +   } else if (strcmp(sourceclass, _RHSCLASSNAME) == 0) {
 107.136 +      sourcekeyname = _RHSKEYNAME;
 107.137 +      targetclass = _LHSCLASSNAME;
 107.138 +      targetkeyname = _LHSKEYNAME;
 107.139 +   } else {
 107.140 +      _SBLIM_TRACE(2, ("--- Unrecognized source class. Ignoring request."));
 107.141 +      goto exit;
 107.142 +   }
 107.143 +   _SBLIM_TRACE(2, ("--- targetclass=\"%s\"", targetclass));
 107.144 +
 107.145 +   CMPIData namedata = CMGetKey(reference, sourcekeyname, NULL);
 107.146 +   char * sourcename = CMGetCharPtr(namedata.value.string);
 107.147 +   _SBLIM_TRACE(2, ("--- sourcename=\"%s\"", sourcename));
 107.148 +
 107.149 +   /* Create an object path for the result class. */
 107.150 +   CMPIObjectPath * objectpath = CMNewObjectPath(_BROKER, namespace, targetclass, &status);
 107.151 +   if ((status.rc != CMPI_RC_OK) || CMIsNullObject(objectpath)) {
 107.152 +      _SBLIM_TRACE(1,("--- CMNewObjectPath() failed - %s", CMGetCharPtr(status.msg)));
 107.153 +      CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERROR, "Cannot create new CMPIObjectPath");
 107.154 +      goto exit;
 107.155 +   }
 107.156 +
 107.157 +   /* Get the list of all target class object paths from the CIMOM. */
 107.158 +   CMPIEnumeration * objectpaths = CBEnumInstanceNames(_BROKER, context, objectpath, &status);
 107.159 +   if ((status.rc != CMPI_RC_OK) || CMIsNullObject(objectpaths)) {
 107.160 +      _SBLIM_TRACE(1,("--- CBEnumInstanceNames() failed - %s", CMGetCharPtr(status.msg)));
 107.161 +      CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERROR, "Cannot enumerate target class");
 107.162 +      goto exit;
 107.163 +   }
 107.164 +
 107.165 +   /* Return all object paths that exactly match the target class and resultClass, if specified. */
 107.166 +   while (CMHasNext(objectpaths, NULL)) {
 107.167 +      CMPIData data = CMGetNext(objectpaths, NULL);
 107.168 +      char *class = CMGetCharPtr(CMGetClassName(data.value.ref, NULL));
 107.169 +      if ((strcmp(class,targetclass) == 0) && ((resultClass == NULL) || (strcmp(class,resultClass) == 0))) {
 107.170 +         /* Only return entries whose name matches the reference. */
 107.171 +         namedata = CMGetKey(data.value.ref, targetkeyname, &status);
 107.172 +         char * resultname = CMGetCharPtr(namedata.value.string);
 107.173 +         if (strcmp(sourcename, resultname) == 0) CMReturnObjectPath(results, data.value.ref);
 107.174 +      }
 107.175 +   }
 107.176 +
 107.177 +   CMReturnDone(results);
 107.178 +
 107.179 +exit:
 107.180 +   _SBLIM_RETURNSTATUS(status);
 107.181 +}
 107.182 +
 107.183 +
 107.184 +// ----------------------------------------------------------------------------
 107.185 +// Associators()
 107.186 +// ----------------------------------------------------------------------------
 107.187 +static CMPIStatus Associators(
 107.188 +		CMPIAssociationMI * self,	/* [in] Handle to this provider (i.e. 'self'). */
 107.189 +		CMPIContext * context,		/* [in] Additional context info, if any. */
 107.190 +		CMPIResult * results,		/* [out] Results of this operation. */
 107.191 +		CMPIObjectPath * reference,	/* [in] Contains the source namespace, classname and object path. */
 107.192 +		const char *assocClass,
 107.193 +		const char *resultClass,
 107.194 +		const char *role,
 107.195 +		const char *resultRole,
 107.196 +		char ** properties)		/* [in] List of desired properties (NULL=all). */
 107.197 +{
 107.198 +   CMPIStatus status = { CMPI_RC_OK, NULL };    /* Return status of CIM operations. */
 107.199 +   char *namespace = CMGetCharPtr(CMGetNameSpace(reference, NULL)); /* Target namespace. */
 107.200 +   char *sourceclass = CMGetCharPtr(CMGetClassName(reference, &status)); /* Class of the source reference object */
 107.201 +   char *targetclass;                           /* Class of the target object(s). */
 107.202 +
 107.203 +   char *sourcekeyname;
 107.204 +   char *targetkeyname;
 107.205 +
 107.206 +   _SBLIM_ENTER("Associators");
 107.207 +   _SBLIM_TRACE(2, ("--- self=\"%s\"", self->ft->miName));
 107.208 +   _SBLIM_TRACE(2, ("--- context=\"%s\"", CMGetCharPtr(CDToString(_BROKER, context, NULL))));
 107.209 +   _SBLIM_TRACE(2, ("--- reference=\"%s\"", CMGetCharPtr(CDToString(_BROKER, reference, NULL))));
 107.210 +   _SBLIM_TRACE(2, ("--- assocClass=\"%s\"", assocClass));
 107.211 +   _SBLIM_TRACE(2, ("--- resultClass=\"%s\"", resultClass));
 107.212 +   _SBLIM_TRACE(2, ("--- role=\"%s\"", role));
 107.213 +   _SBLIM_TRACE(2, ("--- resultRole=\"%s\"", resultRole));
 107.214 +   _SBLIM_TRACE(2, ("--- namespace=\"%s\"", namespace));
 107.215 +   _SBLIM_TRACE(2, ("--- sourceclass=\"%s\"", sourceclass));
 107.216 +
 107.217 +   /* Check that the requested association class, if any, is supported. */
 107.218 +   if (assocClass != NULL) {
 107.219 +      CMPIObjectPath * assoc = CMNewObjectPath(_BROKER, namespace, _ASSOCCLASS, NULL);
 107.220 +      if (!CMClassPathIsA(_BROKER, assoc, assocClass, NULL)) {
 107.221 +         _SBLIM_TRACE(2, ("--- Unrecognized association class. Ignoring request."));
 107.222 +         goto exit;
 107.223 +      }
 107.224 +   }
 107.225 +
 107.226 +   /* Check that the reference matches the required role, if any. */
 107.227 +   if ((role != NULL) && strcmp(role, sourceclass) != 0) {
 107.228 +      _SBLIM_TRACE(2, ("--- Reference does not match required role. Ignoring request."));
 107.229 +      goto exit;
 107.230 +   }
 107.231 +   CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_NOT_SUPPORTED, NULL);
 107.232 +
 107.233 +   /* Determine the target class from the source class. */
 107.234 +   if (strcmp(sourceclass, _LHSCLASSNAME) == 0) {
 107.235 +      sourcekeyname = _LHSKEYNAME;
 107.236 +      targetclass = _RHSCLASSNAME;
 107.237 +      targetkeyname = _RHSKEYNAME;
 107.238 +   } else if (strcmp(sourceclass, _RHSCLASSNAME) == 0) {
 107.239 +      sourcekeyname = _RHSKEYNAME;
 107.240 +      targetclass = _LHSCLASSNAME;
 107.241 +      targetkeyname = _LHSKEYNAME;
 107.242 +   } else {
 107.243 +      _SBLIM_TRACE(2, ("--- Unrecognized source class. Ignoring request."));
 107.244 +      goto exit;
 107.245 +   }
 107.246 +   _SBLIM_TRACE(2, ("--- targetclass=\"%s\"", targetclass));
 107.247 +
 107.248 +   CMPIData namedata = CMGetKey(reference, sourcekeyname, NULL);
 107.249 +   char * sourcename = CMGetCharPtr(namedata.value.string);
 107.250 +   _SBLIM_TRACE(2, ("--- sourcename=\"%s\"", sourcename));
 107.251 +
 107.252 +   /* Create an object path for the result class. */
 107.253 +   CMPIObjectPath * objectpath = CMNewObjectPath(_BROKER, namespace, targetclass, &status);
 107.254 +   if ((status.rc != CMPI_RC_OK) || CMIsNullObject(objectpath)) {
 107.255 +      _SBLIM_TRACE(1,("--- CMNewObjectPath() failed - %s", CMGetCharPtr(status.msg)));
 107.256 +      CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERROR, "Cannot create new CMPIObjectPath");
 107.257 +      goto exit;
 107.258 +   }
 107.259 +
 107.260 +   /* Get the list of all target class instances from the CIMOM. */
 107.261 +   CMPIEnumeration * instances = CBEnumInstances(_BROKER, context, objectpath, NULL, &status);
 107.262 +   if ((status.rc != CMPI_RC_OK) || CMIsNullObject(instances)) {
 107.263 +      _SBLIM_TRACE(1,("--- CBEnumInstances() failed - %s", CMGetCharPtr(status.msg)));
 107.264 +      CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERROR, "Cannot enumerate target class");
 107.265 +      goto exit;
 107.266 +   }
 107.267 +
 107.268 +   /* Return all instances that exactly match the target class and resultClass, if specified. */
 107.269 +   while (CMHasNext(instances, NULL)) {
 107.270 +      CMPIData data = CMGetNext(instances, NULL);
 107.271 +      char *class = CMGetCharPtr(CMGetClassName(CMGetObjectPath(data.value.inst,NULL), NULL));
 107.272 +      if ((strcmp(class,targetclass) == 0) && ((resultClass == NULL) || (strcmp(class,resultClass) == 0))) {
 107.273 +         /* Only return entries whose name matches the reference. */
 107.274 +         namedata = CMGetProperty(data.value.inst, targetkeyname, NULL);
 107.275 +         char * resultname = CMGetCharPtr(namedata.value.string);
 107.276 +// BUG - returning data causes crash !?!
 107.277 +_SBLIM_TRACE(2, ("--- data.value.inst=\"%s\"", CMGetCharPtr(CDToString(_BROKER, data.value.inst, NULL))));
 107.278 +//         if (strcmp(sourcename, resultname) == 0) CMReturnInstance(results, data.value.inst);
 107.279 +      }
 107.280 +   }
 107.281 +
 107.282 +   CMReturnDone(results);
 107.283 +
 107.284 +exit:
 107.285 +   _SBLIM_RETURNSTATUS(status);
 107.286 +}
 107.287 +
 107.288 +
 107.289 +// ----------------------------------------------------------------------------
 107.290 +// ReferenceNames()
 107.291 +// ----------------------------------------------------------------------------
 107.292 +static CMPIStatus ReferenceNames(
 107.293 +		CMPIAssociationMI * self,	/* [in] Handle to this provider (i.e. 'self'). */
 107.294 +		CMPIContext * context,		/* [in] Additional context info, if any. */
 107.295 +		CMPIResult * results,		/* [out] Results of this operation. */
 107.296 +		CMPIObjectPath * reference,	/* [in] Contains the source namespace, classname and object path. */
 107.297 +		const char *assocClass, 
 107.298 +		const char *role)
 107.299 +{
 107.300 +   CMPIStatus status = { CMPI_RC_OK, NULL };    /* Return status of CIM operations. */
 107.301 +   char *namespace = CMGetCharPtr(CMGetNameSpace(reference, NULL)); /* Target namespace. */
 107.302 +   char *sourceclass = CMGetCharPtr(CMGetClassName(reference, &status)); /* Class of the source reference object */
 107.303 +   char *targetclass;                           /* Class of the target object(s). */
 107.304 +
 107.305 +   char *sourcekeyname;
 107.306 +   char *targetkeyname;
 107.307 +
 107.308 +   _SBLIM_ENTER("ReferenceNames");
 107.309 +   _SBLIM_TRACE(2, ("--- self=\"%s\"", self->ft->miName));
 107.310 +   _SBLIM_TRACE(2, ("--- context=\"%s\"", CMGetCharPtr(CDToString(_BROKER, context, NULL))));
 107.311 +   _SBLIM_TRACE(2, ("--- reference=\"%s\"", CMGetCharPtr(CDToString(_BROKER, reference, NULL))));
 107.312 +   _SBLIM_TRACE(2, ("--- assocClass=\"%s\"", assocClass));
 107.313 +   _SBLIM_TRACE(2, ("--- role=\"%s\"", role));
 107.314 +   _SBLIM_TRACE(2, ("--- namespace=\"%s\"", namespace));
 107.315 +   _SBLIM_TRACE(2, ("--- sourceclass=\"%s\"", sourceclass));
 107.316 +
 107.317 +   /* Check that the requested association class, if any, is supported. */
 107.318 +   if (assocClass != NULL) {
 107.319 +      CMPIObjectPath * assoc = CMNewObjectPath(_BROKER, namespace, _ASSOCCLASS, NULL);
 107.320 +      if (!CMClassPathIsA(_BROKER, assoc, assocClass, NULL)) {
 107.321 +         _SBLIM_TRACE(2, ("--- Unrecognized association class. Ignoring request."));
 107.322 +         goto exit;
 107.323 +      }
 107.324 +   }
 107.325 +
 107.326 +   /* Check that the reference matches the required role, if any. */
 107.327 +   if ((role != NULL) && strcmp(role, sourceclass) != 0) {
 107.328 +      _SBLIM_TRACE(2, ("--- Reference does not match required role. Ignoring request."));
 107.329 +      goto exit;
 107.330 +   }
 107.331 +
 107.332 +   /* Determine the target class from the source class. */
 107.333 +   if (strcmp(sourceclass, _LHSCLASSNAME) == 0) {
 107.334 +      sourcekeyname = _LHSKEYNAME;
 107.335 +      targetclass = _RHSCLASSNAME;
 107.336 +      targetkeyname = _RHSKEYNAME;
 107.337 +   } else if (strcmp(sourceclass, _RHSCLASSNAME) == 0) {
 107.338 +      sourcekeyname = _RHSKEYNAME;
 107.339 +      targetclass = _LHSCLASSNAME;
 107.340 +      targetkeyname = _LHSKEYNAME;
 107.341 +   } else {
 107.342 +      _SBLIM_TRACE(2, ("--- Unrecognized source class. Ignoring request."));
 107.343 +      goto exit;
 107.344 +   }
 107.345 +   _SBLIM_TRACE(2, ("--- targetclass=\"%s\"", targetclass));
 107.346 +
 107.347 +   CMPIData namedata = CMGetKey(reference, sourcekeyname, NULL);
 107.348 +   char * sourcename = CMGetCharPtr(namedata.value.string);
 107.349 +   _SBLIM_TRACE(2, ("--- sourcename=\"%s\"", sourcename));
 107.350 +
 107.351 +   /* Create an object path for the result class. */
 107.352 +   CMPIObjectPath * objectpath = CMNewObjectPath(_BROKER, namespace, targetclass, &status);
 107.353 +   if ((status.rc != CMPI_RC_OK) || CMIsNullObject(objectpath)) {
 107.354 +      _SBLIM_TRACE(1,("--- CMNewObjectPath() failed - %s", CMGetCharPtr(status.msg)));
 107.355 +      CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERROR, "Cannot create new CMPIObjectPath");
 107.356 +      goto exit;
 107.357 +   }
 107.358 +
 107.359 +   /* Get the list of all target class object paths from the CIMOM. */
 107.360 +   CMPIEnumeration * objectpaths = CBEnumInstanceNames(_BROKER, context, objectpath, &status);
 107.361 +   if ((status.rc != CMPI_RC_OK) || CMIsNullObject(objectpaths)) {
 107.362 +      _SBLIM_TRACE(1,("--- CBEnumInstanceNames() failed - %s", CMGetCharPtr(status.msg)));
 107.363 +      CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERROR, "Cannot enumerate target class");
 107.364 +      goto exit;
 107.365 +   }
 107.366 +
 107.367 +   /* Return all object paths that exactly match the target class and resultClass, if specified. */
 107.368 +   while (CMHasNext(objectpaths, NULL)) {
 107.369 +      CMPIData data = CMGetNext(objectpaths, NULL);
 107.370 +      char *class = CMGetCharPtr(CMGetClassName(data.value.ref, NULL));
 107.371 +      if (strcmp(class,targetclass) == 0) {
 107.372 +
 107.373 +         /* Create an object path for the association. */
 107.374 +         CMPIObjectPath * refobjectpath = CMNewObjectPath(_BROKER, namespace, _ASSOCCLASS, &status);
 107.375 +         if ((status.rc != CMPI_RC_OK) || CMIsNullObject(refobjectpath)) {
 107.376 +            _SBLIM_TRACE(1,("--- CMNewObjectPath() failed - %s", CMGetCharPtr(status.msg)));
 107.377 +            CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERROR, "Cannot create new CMPIObjectPath");
 107.378 +            goto exit;
 107.379 +         }
 107.380 +
 107.381 +         /* Assign the references in the association appropriately. */
 107.382 +         if (strcmp(sourceclass, _RHSCLASSNAME) == 0) {
 107.383 +            CMAddKey(refobjectpath, _RHSPROPERTYNAME, &reference, CMPI_ref);
 107.384 +            CMAddKey(refobjectpath, _LHSPROPERTYNAME, &data.value.ref, CMPI_ref);
 107.385 +         } else {
 107.386 +            CMAddKey(refobjectpath, _RHSPROPERTYNAME, &data.value.ref, CMPI_ref);
 107.387 +            CMAddKey(refobjectpath, _LHSPROPERTYNAME, &reference, CMPI_ref);
 107.388 +         }
 107.389 +
 107.390 +         /* Only return entries whose name matches the reference. */
 107.391 +         namedata = CMGetKey(data.value.ref, targetkeyname, &status);
 107.392 +         char * resultname = CMGetCharPtr(namedata.value.string);
 107.393 +         if (strcmp(sourcename, resultname) == 0) CMReturnObjectPath(results, refobjectpath);
 107.394 +      }
 107.395 +   }
 107.396 +
 107.397 +exit:
 107.398 +   _SBLIM_RETURNSTATUS(status);
 107.399 +}
 107.400 +
 107.401 +
 107.402 +// ----------------------------------------------------------------------------
 107.403 +// References()
 107.404 +// ----------------------------------------------------------------------------
 107.405 +static CMPIStatus References(
 107.406 +		CMPIAssociationMI * self,	/* [in] Handle to this provider (i.e. 'self'). */
 107.407 +		CMPIContext * context,		/* [in] Additional context info, if any. */
 107.408 +		CMPIResult * results,		/* [out] Results of this operation. */
 107.409 +		CMPIObjectPath * reference,	/* [in] Contains the namespace, classname and desired object path. */
 107.410 +		const char *assocClass,
 107.411 +		const char *role,
 107.412 +		char **properties)		/* [in] List of desired properties (NULL=all). */
 107.413 +{
 107.414 +   CMPIStatus status = { CMPI_RC_OK, NULL };    /* Return status of CIM operations. */
 107.415 +   char *namespace = CMGetCharPtr(CMGetNameSpace(reference, NULL)); /* Target namespace. */
 107.416 +   char *sourceclass = CMGetCharPtr(CMGetClassName(reference, &status)); /* Class of the source reference object */
 107.417 +   char *targetclass;                           /* Class of the target object(s). */
 107.418 +
 107.419 +   char *sourcekeyname;
 107.420 +   char *targetkeyname;
 107.421 +
 107.422 +   _SBLIM_ENTER("References");
 107.423 +   _SBLIM_TRACE(2, ("--- self=\"%s\"", self->ft->miName));
 107.424 +   _SBLIM_TRACE(2, ("--- context=\"%s\"", CMGetCharPtr(CDToString(_BROKER, context, NULL))));
 107.425 +   _SBLIM_TRACE(2, ("--- reference=\"%s\"", CMGetCharPtr(CDToString(_BROKER, reference, NULL))));
 107.426 +   _SBLIM_TRACE(2, ("--- assocClass=\"%s\"", assocClass));
 107.427 +   _SBLIM_TRACE(2, ("--- role=\"%s\"", role));
 107.428 +   _SBLIM_TRACE(2, ("--- namespace=\"%s\"", namespace));
 107.429 +   _SBLIM_TRACE(2, ("--- sourceclass=\"%s\"", sourceclass));
 107.430 +
 107.431 +   /* Check that the requested association class, if any, is supported. */
 107.432 +   if (assocClass != NULL) {
 107.433 +      CMPIObjectPath * assoc = CMNewObjectPath(_BROKER, namespace, _ASSOCCLASS, NULL);
 107.434 +      if (!CMClassPathIsA(_BROKER, assoc, assocClass, NULL)) {
 107.435 +         _SBLIM_TRACE(2, ("--- Unrecognized association class. Ignoring request."));
 107.436 +         goto exit;
 107.437 +      }
 107.438 +   }
 107.439 +
 107.440 +   /* Check that the reference matches the required role, if any. */
 107.441 +   if ((role != NULL) && strcmp(role, sourceclass) != 0) {
 107.442 +      _SBLIM_TRACE(2, ("--- Reference does not match required role. Ignoring request."));
 107.443 +      goto exit;
 107.444 +   }
 107.445 +
 107.446 +   /* Determine the target class from the source class. */
 107.447 +   if (strcmp(sourceclass, _LHSCLASSNAME) == 0) {
 107.448 +      sourcekeyname = _LHSKEYNAME;
 107.449 +      targetclass = _RHSCLASSNAME;
 107.450 +      targetkeyname = _RHSKEYNAME;
 107.451 +   } else if (strcmp(sourceclass, _RHSCLASSNAME) == 0) {
 107.452 +      sourcekeyname = _RHSKEYNAME;
 107.453 +      targetclass = _LHSCLASSNAME;
 107.454 +      targetkeyname = _LHSKEYNAME;
 107.455 +   } else {
 107.456 +      _SBLIM_TRACE(2, ("--- Unrecognized source class. Ignoring request."));
 107.457 +      goto exit;
 107.458 +   }
 107.459 +   _SBLIM_TRACE(2, ("--- targetclass=\"%s\"", targetclass));
 107.460 +
 107.461 +   CMPIData namedata = CMGetKey(reference, sourcekeyname, NULL);
 107.462 +   char * sourcename = CMGetCharPtr(namedata.value.string);
 107.463 +   _SBLIM_TRACE(2, ("--- sourcename=\"%s\"", sourcename));
 107.464 +
 107.465 +   /* Create an object path for the result class. */
 107.466 +   CMPIObjectPath * objectpath = CMNewObjectPath(_BROKER, namespace, targetclass, &status);
 107.467 +   if ((status.rc != CMPI_RC_OK) || CMIsNullObject(objectpath)) {
 107.468 +      _SBLIM_TRACE(1,("--- CMNewObjectPath() failed - %s", CMGetCharPtr(status.msg)));
 107.469 +      CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERROR, "Cannot create new CMPIObjectPath");
 107.470 +      goto exit;
 107.471 +   }
 107.472 +
 107.473 +   /* Get the list of all target class object paths from the CIMOM. */
 107.474 +   CMPIEnumeration * objectpaths = CBEnumInstanceNames(_BROKER, context, objectpath, &status);
 107.475 +   if ((status.rc != CMPI_RC_OK) || CMIsNullObject(objectpaths)) {
 107.476 +      _SBLIM_TRACE(1,("--- CBEnumInstanceNames() failed - %s", CMGetCharPtr(status.msg)));
 107.477 +      CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERROR, "Cannot enumerate target class");
 107.478 +      goto exit;
 107.479 +   }
 107.480 +
 107.481 +   /* Return all object paths that exactly match the target class and resultClass, if specified. */
 107.482 +   while (CMHasNext(objectpaths, NULL)) {
 107.483 +      CMPIData data = CMGetNext(objectpaths, NULL);
 107.484 +      char *class = CMGetCharPtr(CMGetClassName(data.value.ref, NULL));
 107.485 +      if (strcmp(class,targetclass) == 0) {
 107.486 +
 107.487 +         /* Create an instance for the association. */
 107.488 +         CMPIInstance * refinstance = _CMNewInstance(_BROKER, namespace, _ASSOCCLASS, &status);
 107.489 +         if ((status.rc != CMPI_RC_OK) || CMIsNullObject(refinstance)) {
 107.490 +            _SBLIM_TRACE(1,("--- CMNewInstance() failed - %s", CMGetCharPtr(status.msg)));
 107.491 +            CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERROR, "Cannot create new CMPIInstance");
 107.492 +            goto exit;
 107.493 +         }
 107.494 +
 107.495 +         /* Assign the references in the association appropriately. */
 107.496 +         if (strcmp(sourceclass, _RHSCLASSNAME) == 0) {
 107.497 +            CMSetProperty(refinstance, _RHSPROPERTYNAME, &reference, CMPI_ref);
 107.498 +            CMSetProperty(refinstance, _LHSPROPERTYNAME, &data.value.ref, CMPI_ref);
 107.499 +         } else {
 107.500 +            CMSetProperty(refinstance, _RHSPROPERTYNAME, &data.value.ref, CMPI_ref);
 107.501 +            CMSetProperty(refinstance, _LHSPROPERTYNAME, &reference, CMPI_ref);
 107.502 +         }
 107.503 +
 107.504 +         /* Only return entries whose name matches the reference. */
 107.505 +         namedata = CMGetKey(data.value.ref, targetkeyname, &status);
 107.506 +         char * resultname = CMGetCharPtr(namedata.value.string);
 107.507 +         if (strcmp(sourcename, resultname) == 0) CMReturnInstance(results, refinstance);
 107.508 +      }
 107.509 +   }
 107.510 +exit:
 107.511 +   _SBLIM_RETURNSTATUS(status);
 107.512 +}
 107.513 +
 107.514 +
 107.515 +// ----------------------------------------------------------------------------
 107.516 +// AssociationInitialize()
 107.517 +// Perform any necessary initialization immediately after this provider is
 107.518 +// first loaded.
 107.519 +// ----------------------------------------------------------------------------
 107.520 +static void AssociationInitialize(
 107.521 +		CMPIAssociationMI * self,	/* [in] Handle to this provider (i.e. 'self'). */
 107.522 +		CMPIContext * context)		/* [in] Additional context info, if any. */
 107.523 +{
 107.524 +   _SBLIM_ENTER("AssociationInitialize");
 107.525 +   _SBLIM_TRACE(2, ("--- self=\"%s\"", self->ft->miName));
 107.526 +   _SBLIM_TRACE(2, ("--- context=\"%s\"", CMGetCharPtr(CDToString(_BROKER, context, NULL))));
 107.527 +
 107.528 +   /* Nothing needs to be done to initialize this provider */
 107.529 +
 107.530 +exit:
 107.531 +   _SBLIM_RETURN();
 107.532 +}
 107.533 +
 107.534 +
 107.535 +// ============================================================================
 107.536 +// CMPI ASSOCIATION PROVIDER FUNCTION TABLE SETUP
 107.537 +// ============================================================================
 107.538 +CMAssociationMIStub( , Xen_ComputerSystemMemoryProvider, _BROKER, AssociationInitialize(&mi, ctx));
   108.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   108.2 +++ b/src/Xen_ComputerSystemNetworkPort.c	Wed Mar 22 14:05:14 2006 -0700
   108.3 @@ -0,0 +1,535 @@
   108.4 +// Copyright (C) 2006 IBM Corporation
   108.5 +//
   108.6 +//    This library is free software; you can redistribute it and/or
   108.7 +//    modify it under the terms of the GNU Lesser General Public
   108.8 +//    License as published by the Free Software Foundation; either
   108.9 +//    version 2.1 of the License, or (at your option) any later version.
  108.10 +//
  108.11 +//    This library is distributed in the hope that it will be useful,
  108.12 +//    but WITHOUT ANY WARRANTY; without even the implied warranty of
  108.13 +//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  108.14 +//    Lesser General Public License for more details.
  108.15 +//
  108.16 +//    You should have received a copy of the GNU Lesser General Public
  108.17 +//    License along with this library; if not, write to the Free Software
  108.18 +//    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  108.19 +// ============================================================================
  108.20 +// Authors:       Dr. Gareth S. Bestor, <bestor@us.ibm.com>
  108.21 +// Contributors:
  108.22 +// Description:
  108.23 +// ============================================================================
  108.24 +
  108.25 +/* Include the required CMPI data types, function headers, and macros */
  108.26 +#include "cmpidt.h"
  108.27 +#include "cmpift.h"
  108.28 +#include "cmpimacs.h"
  108.29 +
  108.30 +
  108.31 +// ----------------------------------------------------------------------------
  108.32 +// COMMON GLOBAL VARIABLES
  108.33 +// ----------------------------------------------------------------------------
  108.34 +
  108.35 +/* Handle to the CIM broker. Initialized when the provider lib is loaded. */
  108.36 +static CMPIBroker *_BROKER;
  108.37 +
  108.38 +/* Include utility functions */
  108.39 +#include "cmpiutil.h"
  108.40 +
  108.41 +/* Include _SBLIM_TRACE() logging support */
  108.42 +#include "cmpitrace.h"
  108.43 +
  108.44 +
  108.45 +// ============================================================================
  108.46 +// CMPI ASSOCIATION PROVIDER FUNCTION TABLE
  108.47 +// ============================================================================
  108.48 +
  108.49 +// ----------------------------------------------------------------------------
  108.50 +// Info for the class supported by the association provider
  108.51 +// ----------------------------------------------------------------------------
  108.52 +                                                                                                                                 
  108.53 +/* Name of the left and right hand side classes of this association. */
  108.54 +static char * _ASSOCCLASS = "Xen_ComputerSystemNetworkPort";
  108.55 +static char * _LHSCLASSNAME = "Xen_NetworkPort";
  108.56 +static char * _RHSCLASSNAME = "Xen_ComputerSystem";
  108.57 +static char * _LHSPROPERTYNAME = "PartComponent"; 
  108.58 +static char * _RHSPROPERTYNAME = "GroupComponent";
  108.59 +static char * _LHSKEYNAME = "SystemName";
  108.60 +static char * _RHSKEYNAME = "Name";
  108.61 +
  108.62 +// ----------------------------------------------------------------------------
  108.63 +// AssociationCleanup()
  108.64 +// Perform any necessary cleanup immediately before this provider is unloaded.
  108.65 +// ----------------------------------------------------------------------------
  108.66 +static CMPIStatus AssociationCleanup(
  108.67 +		CMPIAssociationMI * self,	/* [in] Handle to this provider (i.e. 'self'). */
  108.68 +		CMPIContext * context)		/* [in] Additional context info, if any. */
  108.69 +{
  108.70 +   CMPIStatus status = { CMPI_RC_OK, NULL };	/* Return status of CIM operations. */
  108.71 +
  108.72 +   _SBLIM_ENTER("AssociationCleanup");
  108.73 +   _SBLIM_TRACE(2, ("--- self=\"%s\"", self->ft->miName));
  108.74 +   _SBLIM_TRACE(2, ("--- context=\"%s\"", CMGetCharPtr(CDToString(_BROKER, context, NULL))));
  108.75 +
  108.76 +   /* Nothing needs to be done for cleanup. */
  108.77 +
  108.78 +exit:
  108.79 +   _SBLIM_RETURNSTATUS(status);
  108.80 +}
  108.81 +
  108.82 +
  108.83 +// ----------------------------------------------------------------------------
  108.84 +// AssociatorNames()
  108.85 +// ----------------------------------------------------------------------------
  108.86 +static CMPIStatus AssociatorNames(
  108.87 +		CMPIAssociationMI * self,	/* [in] Handle to this provider (i.e. 'self'). */
  108.88 +		CMPIContext * context,		/* [in] Additional context info, if any. */
  108.89 +		CMPIResult * results,		/* [out] Results of this operation. */
  108.90 +		CMPIObjectPath * reference,	/* [in] Contains source namespace, classname and object path. */
  108.91 +		const char * assocClass,
  108.92 +		const char * resultClass,
  108.93 +		const char * role,
  108.94 +		const char * resultRole)
  108.95 +{
  108.96 +   CMPIStatus status = { CMPI_RC_OK, NULL };    /* Return status of CIM operations. */
  108.97 +   char *namespace = CMGetCharPtr(CMGetNameSpace(reference, NULL)); /* Target namespace. */
  108.98 +   char *sourceclass = CMGetCharPtr(CMGetClassName(reference, &status)); /* Class of the source reference object */
  108.99 +   char *targetclass; 				/* Class of the target object(s). */
 108.100 +
 108.101 +   char *sourcekeyname;
 108.102 +   char *targetkeyname;
 108.103 +
 108.104 +   _SBLIM_ENTER("AssociatorNames");
 108.105 +   _SBLIM_TRACE(2, ("--- self=\"%s\"", self->ft->miName));
 108.106 +   _SBLIM_TRACE(2, ("--- context=\"%s\"", CMGetCharPtr(CDToString(_BROKER, context, NULL))));
 108.107 +   _SBLIM_TRACE(2, ("--- reference=\"%s\"", CMGetCharPtr(CDToString(_BROKER, reference, NULL))));
 108.108 +   _SBLIM_TRACE(2, ("--- assocClass=\"%s\"", assocClass));
 108.109 +   _SBLIM_TRACE(2, ("--- resultClass=\"%s\"", resultClass));
 108.110 +   _SBLIM_TRACE(2, ("--- role=\"%s\"", role));
 108.111 +   _SBLIM_TRACE(2, ("--- resultRole=\"%s\"", resultRole));
 108.112 +   _SBLIM_TRACE(2, ("--- namespace=\"%s\"", namespace));
 108.113 +   _SBLIM_TRACE(2, ("--- sourceclass=\"%s\"", sourceclass));
 108.114 +
 108.115 +   /* Check that the requested association class, if any, is supported. */
 108.116 +   if (assocClass != NULL) {
 108.117 +      CMPIObjectPath * assoc = CMNewObjectPath(_BROKER, namespace, _ASSOCCLASS, NULL);
 108.118 +      if (!CMClassPathIsA(_BROKER, assoc, assocClass, NULL)) {
 108.119 +         _SBLIM_TRACE(2, ("--- Unrecognized association class. Ignoring request."));
 108.120 +         goto exit;
 108.121 +      }
 108.122 +   }
 108.123 +
 108.124 +   /* Check that the reference matches the required role, if any. */
 108.125 +   if ((role != NULL) && strcmp(role, sourceclass) != 0) {
 108.126 +      _SBLIM_TRACE(2, ("--- Reference does not match required role. Ignoring request."));
 108.127 +      goto exit;
 108.128 +   }
 108.129 +
 108.130 +   /* Determine the target class from the source class. */
 108.131 +   if (strcmp(sourceclass, _LHSCLASSNAME) == 0) {
 108.132 +      sourcekeyname = _LHSKEYNAME;
 108.133 +      targetclass = _RHSCLASSNAME;
 108.134 +      targetkeyname = _RHSKEYNAME;
 108.135 +   } else if (strcmp(sourceclass, _RHSCLASSNAME) == 0) {
 108.136 +      sourcekeyname = _RHSKEYNAME;
 108.137 +      targetclass = _LHSCLASSNAME;
 108.138 +      targetkeyname = _LHSKEYNAME;
 108.139 +   } else {
 108.140 +      _SBLIM_TRACE(2, ("--- Unrecognized source class. Ignoring request."));
 108.141 +      goto exit;
 108.142 +   }
 108.143 +   _SBLIM_TRACE(2, ("--- targetclass=\"%s\"", targetclass));
 108.144 +
 108.145 +   CMPIData namedata = CMGetKey(reference, sourcekeyname, NULL);
 108.146 +   char * sourcename = CMGetCharPtr(namedata.value.string);
 108.147 +   _SBLIM_TRACE(2, ("--- sourcename=\"%s\"", sourcename));
 108.148 +
 108.149 +   /* Create an object path for the result class. */
 108.150 +   CMPIObjectPath * objectpath = CMNewObjectPath(_BROKER, namespace, targetclass, &status);
 108.151 +   if ((status.rc != CMPI_RC_OK) || CMIsNullObject(objectpath)) {
 108.152 +      _SBLIM_TRACE(1,("--- CMNewObjectPath() failed - %s", CMGetCharPtr(status.msg)));
 108.153 +      CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERROR, "Cannot create new CMPIObjectPath");
 108.154 +      goto exit;
 108.155 +   }
 108.156 +
 108.157 +   /* Get the list of all target class object paths from the CIMOM. */
 108.158 +   CMPIEnumeration * objectpaths = CBEnumInstanceNames(_BROKER, context, objectpath, &status);
 108.159 +   if ((status.rc != CMPI_RC_OK) || CMIsNullObject(objectpaths)) {
 108.160 +      _SBLIM_TRACE(1,("--- CBEnumInstanceNames() failed - %s", CMGetCharPtr(status.msg)));
 108.161 +      CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERROR, "Cannot enumerate target class");
 108.162 +      goto exit;
 108.163 +   }
 108.164 +
 108.165 +   /* Return all object paths that exactly match the target class and resultClass, if specified. */
 108.166 +   while (CMHasNext(objectpaths, NULL)) {
 108.167 +      CMPIData data = CMGetNext(objectpaths, NULL);
 108.168 +      char *class = CMGetCharPtr(CMGetClassName(data.value.ref, NULL));
 108.169 +      if ((strcmp