summaryrefslogtreecommitdiffstats
path: root/src/hardware/LMI_MemorySystemDeviceProvider.c
diff options
context:
space:
mode:
authorRadek Novacek <rnovacek@redhat.com>2013-10-30 15:51:12 +0100
committerRadek Novacek <rnovacek@redhat.com>2013-10-31 08:53:46 +0100
commit49394a84fe1235b692fc32d903bf3486e41f76b4 (patch)
treee702181ad69ea995e48ce103f1f3e2b90fa97597 /src/hardware/LMI_MemorySystemDeviceProvider.c
parent793843369a4445f8602ef176b41c828730cb4404 (diff)
downloadopenlmi-providers-49394a84fe1235b692fc32d903bf3486e41f76b4.tar.gz
openlmi-providers-49394a84fe1235b692fc32d903bf3486e41f76b4.tar.xz
openlmi-providers-49394a84fe1235b692fc32d903bf3486e41f76b4.zip
Add lmi_get_computer_system function and fix lmi_get_system_name
PG_ComputerSystem has different method how to get hostname than our providers. In order to create the associations to this class we need to enumerate it. The downside is that all providers must supply CMPIContext to the lmi_init function. New function lmi_get_computer_system returns CMPIObjectPath to the configured CIM_ComputerSystem subclass instance. This object should be used in all references with ComputerSystem. Function lmi_get_system_name has been altered to return same value as ComputerSystem "Name" property.
Diffstat (limited to 'src/hardware/LMI_MemorySystemDeviceProvider.c')
-rw-r--r--src/hardware/LMI_MemorySystemDeviceProvider.c20
1 files changed, 5 insertions, 15 deletions
diff --git a/src/hardware/LMI_MemorySystemDeviceProvider.c b/src/hardware/LMI_MemorySystemDeviceProvider.c
index 9b25535..a9d5522 100644
--- a/src/hardware/LMI_MemorySystemDeviceProvider.c
+++ b/src/hardware/LMI_MemorySystemDeviceProvider.c
@@ -25,9 +25,9 @@
static const CMPIBroker* _cb;
-static void LMI_MemorySystemDeviceInitialize()
+static void LMI_MemorySystemDeviceInitialize(const CMPIContext *ctx)
{
- lmi_init(provider_name, _cb, provider_config_defaults);
+ lmi_init(provider_name, _cb, ctx, provider_config_defaults);
}
static CMPIStatus LMI_MemorySystemDeviceCleanup(
@@ -56,19 +56,9 @@ static CMPIStatus LMI_MemorySystemDeviceEnumInstances(
const char** properties)
{
LMI_MemorySystemDevice lmi_mem_sys_device;
- CIM_ComputerSystemRef cim_cs;
LMI_MemoryRef lmi_mem;
- CMPIObjectPath *o;
- CMPIStatus st;
const char *ns = KNameSpace(cop);
- CIM_ComputerSystemRef_Init(&cim_cs, _cb, ns);
- CIM_ComputerSystemRef_Set_Name(&cim_cs, get_system_name());
- CIM_ComputerSystemRef_Set_CreationClassName(&cim_cs,
- get_system_creation_class_name());
- o = CIM_ComputerSystemRef_ToObjectPath(&cim_cs, &st);
- CMSetClassName(o, get_system_creation_class_name());
-
LMI_MemorySystemDevice_Init(&lmi_mem_sys_device, _cb, ns);
LMI_MemoryRef_Init(&lmi_mem, _cb, ns);
@@ -79,7 +69,7 @@ static CMPIStatus LMI_MemorySystemDeviceEnumInstances(
LMI_MemoryRef_Set_DeviceID(&lmi_mem, "0");
LMI_MemorySystemDevice_SetObjectPath_GroupComponent(
- &lmi_mem_sys_device, o);
+ &lmi_mem_sys_device, lmi_get_computer_system());
LMI_MemorySystemDevice_Set_PartComponent(&lmi_mem_sys_device,
&lmi_mem);
@@ -240,13 +230,13 @@ CMInstanceMIStub(
LMI_MemorySystemDevice,
LMI_MemorySystemDevice,
_cb,
- LMI_MemorySystemDeviceInitialize())
+ LMI_MemorySystemDeviceInitialize(ctx))
CMAssociationMIStub(
LMI_MemorySystemDevice,
LMI_MemorySystemDevice,
_cb,
- LMI_MemorySystemDeviceInitialize())
+ LMI_MemorySystemDeviceInitialize(ctx))
KONKRET_REGISTRATION(
"root/cimv2",