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/account/LMI_OwningGroupProvider.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/account/LMI_OwningGroupProvider.c')
-rw-r--r-- | src/account/LMI_OwningGroupProvider.c | 25 |
1 files changed, 6 insertions, 19 deletions
diff --git a/src/account/LMI_OwningGroupProvider.c b/src/account/LMI_OwningGroupProvider.c index a7506f8..12ea99a 100644 --- a/src/account/LMI_OwningGroupProvider.c +++ b/src/account/LMI_OwningGroupProvider.c @@ -33,9 +33,9 @@ static const CMPIBroker* _cb; -static void LMI_OwningGroupInitialize() +static void LMI_OwningGroupInitialize(const CMPIContext *ctx) { - lmi_init(provider_name, _cb, provider_config_defaults); + lmi_init(provider_name, _cb, ctx, provider_config_defaults); } static CMPIStatus LMI_OwningGroupCleanup( @@ -63,13 +63,9 @@ static CMPIStatus LMI_OwningGroupEnumInstances( const CMPIObjectPath* cop, const char** properties) { - CIM_ComputerSystemRef lcsref; LMI_GroupRef lgref; LMI_OwningGroup log; - CMPIObjectPath *computerSystemOP = NULL; - CMPIStatus rc; - struct lu_context *luc = NULL; struct lu_error *error = NULL; GPtrArray *groups = NULL; @@ -77,16 +73,6 @@ static CMPIStatus LMI_OwningGroupEnumInstances( size_t i; const char *nameSpace = KNameSpace(cop); - const char *hostname = get_system_name(); - - CIM_ComputerSystemRef_Init(&lcsref, _cb, nameSpace); - CIM_ComputerSystemRef_Set_Name(&lcsref, hostname); - CIM_ComputerSystemRef_Set_CreationClassName(&lcsref, - get_system_creation_class_name()); - - computerSystemOP = CIM_ComputerSystemRef_ToObjectPath(&lcsref, &rc); - computerSystemOP->ft->setClassName(computerSystemOP, - get_system_creation_class_name()); luc = lu_start(NULL, lu_group, NULL, NULL, lu_prompt_console_quiet, NULL, &error); if (!luc) @@ -104,7 +90,8 @@ static CMPIStatus LMI_OwningGroupEnumInstances( LMI_GroupRef_Set_CreationClassName(&lgref, LMI_Group_ClassName); LMI_OwningGroup_Init(&log, _cb, nameSpace); - LMI_OwningGroup_SetObjectPath_OwningElement(&log, computerSystemOP); + LMI_OwningGroup_SetObjectPath_OwningElement(&log, + lmi_get_computer_system()); LMI_OwningGroup_Set_OwnedElement(&log, &lgref); KReturnInstance(cr, log); @@ -273,13 +260,13 @@ CMInstanceMIStub( LMI_OwningGroup, LMI_OwningGroup, _cb, - LMI_OwningGroupInitialize()) + LMI_OwningGroupInitialize(ctx)) CMAssociationMIStub( LMI_OwningGroup, LMI_OwningGroup, _cb, - LMI_OwningGroupInitialize()) + LMI_OwningGroupInitialize(ctx)) KONKRET_REGISTRATION( "root/cimv2", |