diff options
author | Radek Novacek <rnovacek@redhat.com> | 2013-12-17 14:08:05 +0100 |
---|---|---|
committer | Radek Novacek <rnovacek@redhat.com> | 2013-12-17 14:59:51 +0100 |
commit | afec462a470d58486820155e44e5ce625fddbe2f (patch) | |
tree | 27dcb8f938cc6ee3f993c15ecc58f63814b9ccb4 /src/power | |
parent | 64c621e8ea63b29bbd77be5172f95a01d691ee3f (diff) | |
download | openlmi-providers-afec462a470d58486820155e44e5ce625fddbe2f.tar.gz openlmi-providers-afec462a470d58486820155e44e5ce625fddbe2f.tar.xz openlmi-providers-afec462a470d58486820155e44e5ce625fddbe2f.zip |
power: Always init provider when starting
Power provider didn't call power_ref to init itself when enumerating some
"static" objects like LMI_HostedPowerManagementService. But it has to be
called because of obtaining hostname from ComputerSystem instance.
Diffstat (limited to 'src/power')
-rw-r--r-- | src/power/LMI_ElementCapabilitiesProvider.c | 19 | ||||
-rw-r--r-- | src/power/LMI_HostedPowerManagementServiceProvider.c | 20 |
2 files changed, 33 insertions, 6 deletions
diff --git a/src/power/LMI_ElementCapabilitiesProvider.c b/src/power/LMI_ElementCapabilitiesProvider.c index 9369511..da0f03f 100644 --- a/src/power/LMI_ElementCapabilitiesProvider.c +++ b/src/power/LMI_ElementCapabilitiesProvider.c @@ -21,11 +21,20 @@ #include <konkret/konkret.h> #include "LMI_ElementCapabilities.h" #include "globals.h" +#include "power.h" static const CMPIBroker* _cb; -static void LMI_ElementCapabilitiesInitialize(const CMPIContext *ctx) +static void LMI_ElementCapabilitiesInitialize(CMPIInstanceMI *mi, + const CMPIContext *ctx) { + mi->hdl = power_ref(_cb, ctx); +} + +static void LMI_ElementCapabilitiesAssociationInitialize(CMPIAssociationMI *mi, + const CMPIContext *ctx) +{ + mi->hdl = power_ref(_cb, ctx); } static CMPIStatus LMI_ElementCapabilitiesCleanup( @@ -33,6 +42,8 @@ static CMPIStatus LMI_ElementCapabilitiesCleanup( const CMPIContext* cc, CMPIBoolean term) { + power_unref(mi->hdl); + mi->hdl = NULL; CMReturn(CMPI_RC_OK); } @@ -134,6 +145,8 @@ static CMPIStatus LMI_ElementCapabilitiesAssociationCleanup( const CMPIContext* cc, CMPIBoolean term) { + power_unref(mi->hdl); + mi->hdl = NULL; CMReturn(CMPI_RC_OK); } @@ -229,13 +242,13 @@ CMInstanceMIStub( LMI_ElementCapabilities, LMI_ElementCapabilities, _cb, - LMI_ElementCapabilitiesInitialize(ctx)) + LMI_ElementCapabilitiesInitialize(&mi, ctx)) CMAssociationMIStub( LMI_ElementCapabilities, LMI_ElementCapabilities, _cb, - LMI_ElementCapabilitiesInitialize(ctx)) + LMI_ElementCapabilitiesAssociationInitialize(&mi, ctx)) KONKRET_REGISTRATION( "root/cimv2", diff --git a/src/power/LMI_HostedPowerManagementServiceProvider.c b/src/power/LMI_HostedPowerManagementServiceProvider.c index b41021b..2345c59 100644 --- a/src/power/LMI_HostedPowerManagementServiceProvider.c +++ b/src/power/LMI_HostedPowerManagementServiceProvider.c @@ -23,18 +23,30 @@ #include "LMI_HostedPowerManagementService.h" #include "globals.h" +#include "power.h" static const CMPIBroker* _cb; -static void LMI_HostedPowerManagementServiceInitialize(const CMPIContext *ctx) +static void LMI_HostedPowerManagementServiceInitialize(CMPIInstanceMI *mi, + const CMPIContext *ctx) { + mi->hdl = power_ref(_cb, ctx); } +static void LMI_HostedPowerManagementServiceAssociationInitialize( + CMPIAssociationMI *mi, const CMPIContext *ctx) +{ + mi->hdl = power_ref(_cb, ctx); +} + + static CMPIStatus LMI_HostedPowerManagementServiceCleanup( CMPIInstanceMI* mi, const CMPIContext* cc, CMPIBoolean term) { + power_unref(mi->hdl); + mi->hdl = NULL; CMReturn(CMPI_RC_OK); } @@ -131,6 +143,8 @@ static CMPIStatus LMI_HostedPowerManagementServiceAssociationCleanup( const CMPIContext* cc, CMPIBoolean term) { + power_unref(mi->hdl); + mi->hdl = NULL; CMReturn(CMPI_RC_OK); } @@ -226,13 +240,13 @@ CMInstanceMIStub( LMI_HostedPowerManagementService, LMI_HostedPowerManagementService, _cb, - LMI_HostedPowerManagementServiceInitialize(ctx)) + LMI_HostedPowerManagementServiceInitialize(&mi, ctx)) CMAssociationMIStub( LMI_HostedPowerManagementService, LMI_HostedPowerManagementService, _cb, - LMI_HostedPowerManagementServiceInitialize(ctx)) + LMI_HostedPowerManagementServiceAssociationInitialize(&mi, ctx)) KONKRET_REGISTRATION( "root/cimv2", |