diff options
author | Radek Novacek <rnovacek@redhat.com> | 2013-10-30 15:51:12 +0100 |
---|---|---|
committer | Radek Novacek <rnovacek@redhat.com> | 2013-10-31 08:53:46 +0100 |
commit | 49394a84fe1235b692fc32d903bf3486e41f76b4 (patch) | |
tree | e702181ad69ea995e48ce103f1f3e2b90fa97597 /src/hardware/LMI_ProcessorSystemDeviceProvider.c | |
parent | 793843369a4445f8602ef176b41c828730cb4404 (diff) | |
download | openlmi-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_ProcessorSystemDeviceProvider.c')
-rw-r--r-- | src/hardware/LMI_ProcessorSystemDeviceProvider.c | 20 |
1 files changed, 5 insertions, 15 deletions
diff --git a/src/hardware/LMI_ProcessorSystemDeviceProvider.c b/src/hardware/LMI_ProcessorSystemDeviceProvider.c index 2b5112a..21a2ec4 100644 --- a/src/hardware/LMI_ProcessorSystemDeviceProvider.c +++ b/src/hardware/LMI_ProcessorSystemDeviceProvider.c @@ -26,9 +26,9 @@ static const CMPIBroker* _cb; -static void LMI_ProcessorSystemDeviceInitialize() +static void LMI_ProcessorSystemDeviceInitialize(const CMPIContext *ctx) { - lmi_init(provider_name, _cb, provider_config_defaults); + lmi_init(provider_name, _cb, ctx, provider_config_defaults); } static CMPIStatus LMI_ProcessorSystemDeviceCleanup( @@ -57,10 +57,7 @@ static CMPIStatus LMI_ProcessorSystemDeviceEnumInstances( const char** properties) { LMI_ProcessorSystemDevice lmi_cpu_sys_device; - CIM_ComputerSystemRef cim_cs; LMI_ProcessorRef lmi_cpu; - CMPIObjectPath *o; - CMPIStatus st; const char *ns = KNameSpace(cop); unsigned i; DmiProcessor *dmi_cpus = NULL; @@ -70,13 +67,6 @@ static CMPIStatus LMI_ProcessorSystemDeviceEnumInstances( goto done; } - 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()); - for (i = 0; i < dmi_cpus_nb; i++) { LMI_ProcessorSystemDevice_Init(&lmi_cpu_sys_device, _cb, ns); @@ -89,7 +79,7 @@ static CMPIStatus LMI_ProcessorSystemDeviceEnumInstances( LMI_ProcessorRef_Set_DeviceID(&lmi_cpu, dmi_cpus[i].id); LMI_ProcessorSystemDevice_SetObjectPath_GroupComponent( - &lmi_cpu_sys_device, o); + &lmi_cpu_sys_device, lmi_get_computer_system()); LMI_ProcessorSystemDevice_Set_PartComponent(&lmi_cpu_sys_device, &lmi_cpu); @@ -254,13 +244,13 @@ CMInstanceMIStub( LMI_ProcessorSystemDevice, LMI_ProcessorSystemDevice, _cb, - LMI_ProcessorSystemDeviceInitialize()) + LMI_ProcessorSystemDeviceInitialize(ctx)) CMAssociationMIStub( LMI_ProcessorSystemDevice, LMI_ProcessorSystemDevice, _cb, - LMI_ProcessorSystemDeviceInitialize()) + LMI_ProcessorSystemDeviceInitialize(ctx)) KONKRET_REGISTRATION( "root/cimv2", |