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/realmd | |
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/realmd')
-rw-r--r-- | src/realmd/LMI_HostedRealmdServiceProvider.c | 19 | ||||
-rw-r--r-- | src/realmd/LMI_RealmdServiceProvider.c | 8 | ||||
-rw-r--r-- | src/realmd/rdcp_util.h | 9 |
3 files changed, 9 insertions, 27 deletions
diff --git a/src/realmd/LMI_HostedRealmdServiceProvider.c b/src/realmd/LMI_HostedRealmdServiceProvider.c index 1c06368..37d93fc 100644 --- a/src/realmd/LMI_HostedRealmdServiceProvider.c +++ b/src/realmd/LMI_HostedRealmdServiceProvider.c @@ -6,9 +6,9 @@ static const CMPIBroker* _cb; -static void LMI_HostedRealmdServiceInitialize() +static void LMI_HostedRealmdServiceInitialize(const CMPIContext *ctx) { - lmi_init(provider_name, _cb, provider_config_defaults); + lmi_init(provider_name, _cb, ctx, provider_config_defaults); } static CMPIStatus LMI_HostedRealmdServiceCleanup( @@ -37,28 +37,19 @@ static CMPIStatus LMI_HostedRealmdServiceEnumInstances( const char** properties) { CMPIStatus status; - CIM_ComputerSystemRef computer_sys_ref; LMI_RealmdServiceRef realmd_service_ref; LMI_HostedRealmdService hosted_realmd_service; - CMPIObjectPath *computer_sys_op = NULL; const char *name_space = KNameSpace(cop); const char *host_name = get_system_name(); CMSetStatus(&status, CMPI_RC_OK); - LMI_InitComputerSystemKeys(CIM_ComputerSystemRef, &computer_sys_ref, - name_space, host_name); - LMI_InitRealmdServiceKeys(LMI_RealmdServiceRef, &realmd_service_ref, name_space, host_name); - computer_sys_op = LMI_RealmdServiceRef_ToObjectPath(&realmd_service_ref, &status); - computer_sys_op->ft->setClassName(computer_sys_op, - get_system_creation_class_name()); - LMI_HostedRealmdService_Init(&hosted_realmd_service, _cb, name_space); LMI_HostedRealmdService_SetObjectPath_Antecedent(&hosted_realmd_service, - computer_sys_op); + lmi_get_computer_system()); LMI_HostedRealmdService_Set_Dependent(&hosted_realmd_service, &realmd_service_ref); @@ -219,13 +210,13 @@ CMInstanceMIStub( LMI_HostedRealmdService, LMI_HostedRealmdService, _cb, - LMI_HostedRealmdServiceInitialize()) + LMI_HostedRealmdServiceInitialize(ctx)) CMAssociationMIStub( LMI_HostedRealmdService, LMI_HostedRealmdService, _cb, - LMI_HostedRealmdServiceInitialize()) + LMI_HostedRealmdServiceInitialize(ctx)) KONKRET_REGISTRATION( "root/cimv2", diff --git a/src/realmd/LMI_RealmdServiceProvider.c b/src/realmd/LMI_RealmdServiceProvider.c index 8ecd381..448fe49 100644 --- a/src/realmd/LMI_RealmdServiceProvider.c +++ b/src/realmd/LMI_RealmdServiceProvider.c @@ -61,9 +61,9 @@ get_joined_domain(GVariant *provider_props) -static void LMI_RealmdServiceInitialize() +static void LMI_RealmdServiceInitialize(const CMPIContext *ctx) { - lmi_init(provider_name, _cb, provider_config_defaults); + lmi_init(provider_name, _cb, ctx, provider_config_defaults); } static CMPIStatus LMI_RealmdServiceCleanup( @@ -179,7 +179,7 @@ CMInstanceMIStub( LMI_RealmdService, LMI_RealmdService, _cb, - LMI_RealmdServiceInitialize()) + LMI_RealmdServiceInitialize(ctx)) static CMPIStatus LMI_RealmdServiceMethodCleanup( CMPIMethodMI* mi, @@ -206,7 +206,7 @@ CMMethodMIStub( LMI_RealmdService, LMI_RealmdService, _cb, - LMI_RealmdServiceInitialize()) + LMI_RealmdServiceInitialize(ctx)) KUint32 LMI_RealmdService_RequestStateChange( const CMPIBroker* cb, diff --git a/src/realmd/rdcp_util.h b/src/realmd/rdcp_util.h index 5ed0e28..be5d2bb 100644 --- a/src/realmd/rdcp_util.h +++ b/src/realmd/rdcp_util.h @@ -83,15 +83,6 @@ KINLINE unsigned char *octetstring_parse(unsigned char *octetstring, CMPIUint32 \ } - -#define LMI_InitComputerSystemKeys(klass, obj, name_space, host_name) \ -{ \ - klass##_Init(obj, _cb, name_space); \ - klass##_Set_Name(obj, host_name); \ - klass##_Set_CreationClassName(obj, \ - get_system_creation_class_name()); \ -} - void print_properties (GVariant *properties, gchar *format, ...) __attribute__ ((format (printf, 2, 3))); |