----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: http://reviewboard-openlmi.rhcloud.com/r/351/ -----------------------------------------------------------
Review request for OpenLMI Developers.
Repository: openlmi-providers
Description -------
Indication manager
Signed-off-by: Roman Rakus rrakus@redhat.com
Diffs -----
CMakeLists.txt f25850e1640f52aed9f18c3bd343d41f7f5f21a4 src/CMakeLists.txt 0cd11d911fb2cf8c26376790c2c9f86cc30d8358 src/indmanager/CMakeLists.txt PRE-CREATION src/indmanager/ind_manager.h PRE-CREATION src/indmanager/ind_manager.c PRE-CREATION src/indmanager/openlmiindmanager.pc.in PRE-CREATION
Diff: http://reviewboard-openlmi.rhcloud.com/r/351/diff/
Testing -------
Thanks,
Roman Rakus
----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: http://reviewboard-openlmi.rhcloud.com/r/351/ -----------------------------------------------------------
(Updated May 14, 2013, 2:43 p.m.)
Review request for OpenLMI Developers.
Repository: openlmi-providers
Description -------
Indication manager
Signed-off-by: Roman Rakus rrakus@redhat.com
Diffs -----
CMakeLists.txt f25850e1640f52aed9f18c3bd343d41f7f5f21a4 src/CMakeLists.txt 0cd11d911fb2cf8c26376790c2c9f86cc30d8358 src/indmanager/CMakeLists.txt PRE-CREATION src/indmanager/ind_manager.h PRE-CREATION src/indmanager/ind_manager.c PRE-CREATION src/indmanager/openlmiindmanager.pc.in PRE-CREATION
Diff: http://reviewboard-openlmi.rhcloud.com/r/351/diff/
Testing (updated) -------
For testing purposes I used the following provider: #include <konkret/konkret.h> #include "LMI_AccountInstCreationIndication.h"
#include "ind_manager.h" #include <stdbool.h>
static const CMPIBroker* _cb = NULL;
static IMManager *im = NULL; IMError im_err = IM_ERR_OK;
static bool filter_checker(const CMPISelectExp *filter) { //TODO - true checking return true; }
// TODO - remove ! #include <unistd.h> static bool spawner(void *data) { //TODO - true checking return true; }
// TODO - remove ! #include <unistd.h> static bool spawner(void *data) { //TODO - inotify sleep(10); return true; }
static void LMI_AccountInstCreationIndicationInitialize() { // startup indication manager im = im_create_manager(NULL, filter_checker, true, spawner, IM_IND_CREATION, (CMPIBroker *)_cb, &im_err); }
static CMPIStatus LMI_AccountInstCreationIndicationIndicationCleanup( CMPIIndicationMI* mi, const CMPIContext* cc, CMPIBoolean term) { // destroy indication manager im_destroy_manager(im, cc, &im_err); CMReturn(CMPI_RC_OK); }
static CMPIStatus LMI_AccountInstCreationIndicationAuthorizeFilter( CMPIIndicationMI* mi, const CMPIContext* cc, const CMPISelectExp* se, const char* ns, const CMPIObjectPath* op, const char* user) { // verify filter im_verify_filter(im, se, cc, &im_err); CMReturn(CMPI_RC_OK); }
static CMPIStatus LMI_AccountInstCreationIndicationMustPoll( CMPIIndicationMI* mi, const CMPIContext* cc, const CMPISelectExp* se, const char* ns, const CMPIObjectPath* op) { // yes, this is not supported :( CMReturn(CMPI_RC_ERR_NOT_SUPPORTED); }
static CMPIStatus LMI_AccountInstCreationIndicationActivateFilter( CMPIIndicationMI* mi, const CMPIContext* cc, const CMPISelectExp* se, const char* ns, const CMPIObjectPath* op, CMPIBoolean firstActivation) { // verify filter and add it via indication manager im_verify_filter(im, se, cc, &im_err); im_add_filter(im, (CMPISelectExp*)se, cc, &im_err); CMReturn(CMPI_RC_OK); }
static CMPIStatus LMI_AccountInstCreationIndicationDeActivateFilter( CMPIIndicationMI* mi, const CMPIContext* cc, const CMPISelectExp* se, const char* ns, const CMPIObjectPath* op, CMPIBoolean lastActivation) { // remove filter from indication manager im_remove_filter(im, se, cc, &im_err); CMReturn(CMPI_RC_OK); }
static CMPIStatus LMI_AccountInstCreationIndicationEnableIndications( CMPIIndicationMI* mi, const CMPIContext* cc) { // start indications im_start_ind(im, cc, &im_err); CMReturn(CMPI_RC_OK); }
static CMPIStatus LMI_AccountInstCreationIndicationDisableIndications( CMPIIndicationMI* mi, const CMPIContext* cc) { // stop indications im_stop_ind(im, cc, &im_err); CMReturn(CMPI_RC_OK); }
CMIndicationMIStub( LMI_AccountInstCreationIndication, LMI_AccountInstCreationIndication, _cb, LMI_AccountInstCreationIndicationInitialize())
KONKRET_REGISTRATION( "root/cimv2", "LMI_AccountInstCreationIndication", "LMI_AccountInstCreationIndication", "indication")
Thanks,
Roman Rakus
----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: http://reviewboard-openlmi.rhcloud.com/r/351/#review411 -----------------------------------------------------------
src/indmanager/ind_manager.h http://reviewboard-openlmi.rhcloud.com/r/351/#comment248
I would appreciate some text what these callbacks should do, i.e. what an user of ind. manager is supposed to implement. The demo in "Testing Done" doesn't really help.
src/indmanager/ind_manager.h http://reviewboard-openlmi.rhcloud.com/r/351/#comment249
Please rename those to clearly indicate which one is which.
src/indmanager/ind_manager.c http://reviewboard-openlmi.rhcloud.com/r/351/#comment250
Minor speedup: you can use snprintf return value and you don't need to count strlen.
src/indmanager/ind_manager.c http://reviewboard-openlmi.rhcloud.com/r/351/#comment252
CMPIValue is *union*, you can't directly compare any its member before knowing its type. You probably want:
if (type & CMPI_ARRAY) { if (!v1->array && !v2->array) { return true; } if (!v1->array || !v2->array) { return false; } }
src/indmanager/ind_manager.c http://reviewboard-openlmi.rhcloud.com/r/351/#comment253
If I am reading right, for c=2 this will compare items at indexes 0 and -1 -> error.
src/indmanager/ind_manager.c http://reviewboard-openlmi.rhcloud.com/r/351/#comment256
probably CMGetPropertyCount(i2, NULL);
src/indmanager/ind_manager.c http://reviewboard-openlmi.rhcloud.com/r/351/#comment258
Please check malloc() result.
src/indmanager/ind_manager.c http://reviewboard-openlmi.rhcloud.com/r/351/#comment259
Either the comment or the function is wrong, it actually compares namespace and class name.
src/indmanager/ind_manager.c http://reviewboard-openlmi.rhcloud.com/r/351/#comment260
Missing check for malloc return value.
src/indmanager/ind_manager.c http://reviewboard-openlmi.rhcloud.com/r/351/#comment261
shouldn't you check CMToArray and CMClone return value?
src/indmanager/ind_manager.c http://reviewboard-openlmi.rhcloud.com/r/351/#comment262
CMSetProperty has CMPIValue* as the third argument, not CMPIInstance **.
This applies to all CMSetProperty calls below.
src/indmanager/ind_manager.c http://reviewboard-openlmi.rhcloud.com/r/351/#comment264
This is really clumsy detection of SELECT * FROM... What if there are more whitespaces between SELECT and FROM? Or is the CQL expression guaranteed to be in some canonical state? What about strtok_r()?
src/indmanager/ind_manager.c http://reviewboard-openlmi.rhcloud.com/r/351/#comment263
Missing malloc check
src/indmanager/ind_manager.c http://reviewboard-openlmi.rhcloud.com/r/351/#comment265
missing check for NULL?
src/indmanager/ind_manager.c http://reviewboard-openlmi.rhcloud.com/r/351/#comment267
I am afraid most of CMGet* function calls in this thread will leak memory as they do not run in context of any CIM operation (which would free it upon completion). Double check with valgrind!
src/indmanager/ind_manager.c http://reviewboard-openlmi.rhcloud.com/r/351/#comment266
You should probably lock the mutex before updating 'running', but bool update should be atomic anyway, so I won't create an issue for it.
Overall, lot of functions defined in the patch return bool, but the return value is never checked. At least something meaningful should be logged.
In addition, the log messages in the patch should be actually helpful, we will get them from people as the only information what went wrong in our providers.
- Jan Safranek
On May 14, 2013, 4:43 p.m., Roman Rakus wrote:
This is an automatically generated e-mail. To reply, visit: http://reviewboard-openlmi.rhcloud.com/r/351/
(Updated May 14, 2013, 4:43 p.m.)
Review request for OpenLMI Developers.
Repository: openlmi-providers
Description
Indication manager
Signed-off-by: Roman Rakus rrakus@redhat.com
Diffs
CMakeLists.txt f25850e1640f52aed9f18c3bd343d41f7f5f21a4 src/CMakeLists.txt 0cd11d911fb2cf8c26376790c2c9f86cc30d8358 src/indmanager/CMakeLists.txt PRE-CREATION src/indmanager/ind_manager.h PRE-CREATION src/indmanager/ind_manager.c PRE-CREATION src/indmanager/openlmiindmanager.pc.in PRE-CREATION
Diff: http://reviewboard-openlmi.rhcloud.com/r/351/diff/
Testing
For testing purposes I used the following provider: #include <konkret/konkret.h> #include "LMI_AccountInstCreationIndication.h"
#include "ind_manager.h" #include <stdbool.h>
static const CMPIBroker* _cb = NULL;
static IMManager *im = NULL; IMError im_err = IM_ERR_OK;
static bool filter_checker(const CMPISelectExp *filter) { //TODO - true checking return true; }
// TODO - remove ! #include <unistd.h> static bool spawner(void *data) { //TODO - true checking return true; }
// TODO - remove ! #include <unistd.h> static bool spawner(void *data) { //TODO - inotify sleep(10); return true; }
static void LMI_AccountInstCreationIndicationInitialize() { // startup indication manager im = im_create_manager(NULL, filter_checker, true, spawner, IM_IND_CREATION, (CMPIBroker *)_cb, &im_err); }
static CMPIStatus LMI_AccountInstCreationIndicationIndicationCleanup( CMPIIndicationMI* mi, const CMPIContext* cc, CMPIBoolean term) { // destroy indication manager im_destroy_manager(im, cc, &im_err); CMReturn(CMPI_RC_OK); }
static CMPIStatus LMI_AccountInstCreationIndicationAuthorizeFilter( CMPIIndicationMI* mi, const CMPIContext* cc, const CMPISelectExp* se, const char* ns, const CMPIObjectPath* op, const char* user) { // verify filter im_verify_filter(im, se, cc, &im_err); CMReturn(CMPI_RC_OK); }
static CMPIStatus LMI_AccountInstCreationIndicationMustPoll( CMPIIndicationMI* mi, const CMPIContext* cc, const CMPISelectExp* se, const char* ns, const CMPIObjectPath* op) { // yes, this is not supported :( CMReturn(CMPI_RC_ERR_NOT_SUPPORTED); }
static CMPIStatus LMI_AccountInstCreationIndicationActivateFilter( CMPIIndicationMI* mi, const CMPIContext* cc, const CMPISelectExp* se, const char* ns, const CMPIObjectPath* op, CMPIBoolean firstActivation) { // verify filter and add it via indication manager im_verify_filter(im, se, cc, &im_err); im_add_filter(im, (CMPISelectExp*)se, cc, &im_err); CMReturn(CMPI_RC_OK); }
static CMPIStatus LMI_AccountInstCreationIndicationDeActivateFilter( CMPIIndicationMI* mi, const CMPIContext* cc, const CMPISelectExp* se, const char* ns, const CMPIObjectPath* op, CMPIBoolean lastActivation) { // remove filter from indication manager im_remove_filter(im, se, cc, &im_err); CMReturn(CMPI_RC_OK); }
static CMPIStatus LMI_AccountInstCreationIndicationEnableIndications( CMPIIndicationMI* mi, const CMPIContext* cc) { // start indications im_start_ind(im, cc, &im_err); CMReturn(CMPI_RC_OK); }
static CMPIStatus LMI_AccountInstCreationIndicationDisableIndications( CMPIIndicationMI* mi, const CMPIContext* cc) { // stop indications im_stop_ind(im, cc, &im_err); CMReturn(CMPI_RC_OK); }
CMIndicationMIStub( LMI_AccountInstCreationIndication, LMI_AccountInstCreationIndication, _cb, LMI_AccountInstCreationIndicationInitialize())
KONKRET_REGISTRATION( "root/cimv2", "LMI_AccountInstCreationIndication", "LMI_AccountInstCreationIndication", "indication")
Thanks,
Roman Rakus
On May 15, 2013, 4:36 p.m., Jan Safranek wrote:
src/indmanager/ind_manager.c, lines 100-105 http://reviewboard-openlmi.rhcloud.com/r/351/diff/1/?file=2242#file2242line100
CMPIValue is *union*, you can't directly compare any its member before knowing its type. You probably want: if (type & CMPI_ARRAY) { if (!v1->array && !v2->array) { return true; } if (!v1->array || !v2->array) { return false; } }
Hmm... I think this is supposed to be check if pointers aren't NULL. It will be incorrect if members will be some kind of integer with 0 value. Created macro from it and used on right places.
On May 15, 2013, 4:36 p.m., Jan Safranek wrote:
src/indmanager/ind_manager.c, line 44 http://reviewboard-openlmi.rhcloud.com/r/351/diff/1/?file=2242#file2242line44
Minor speedup: you can use snprintf return value and you don't need to count strlen.
...and return value of vsnprintf(). Will look later.
On May 15, 2013, 4:36 p.m., Jan Safranek wrote:
src/indmanager/ind_manager.c, lines 111-117 http://reviewboard-openlmi.rhcloud.com/r/351/diff/1/?file=2242#file2242line111
If I am reading right, for c=2 this will compare items at indexes 0 and -1 -> error.
Rewritten into for loop.
On May 15, 2013, 4:36 p.m., Jan Safranek wrote:
src/indmanager/ind_manager.c, line 432 http://reviewboard-openlmi.rhcloud.com/r/351/diff/1/?file=2242#file2242line432
shouldn't you check CMToArray and CMClone return value?
Actually there many missing checks like this. I will rather do it in separate review.
On May 15, 2013, 4:36 p.m., Jan Safranek wrote:
src/indmanager/ind_manager.c, line 502 http://reviewboard-openlmi.rhcloud.com/r/351/diff/1/?file=2242#file2242line502
CMSetProperty has CMPIValue* as the third argument, not CMPIInstance **. This applies to all CMSetProperty calls below.
Don't ask me why, but it works this way.
On May 15, 2013, 4:36 p.m., Jan Safranek wrote:
src/indmanager/ind_manager.c, lines 554-557 http://reviewboard-openlmi.rhcloud.com/r/351/diff/1/?file=2242#file2242line554
This is really clumsy detection of SELECT * FROM... What if there are more whitespaces between SELECT and FROM? Or is the CQL expression guaranteed to be in some canonical state? What about strtok_r()?
Converted to strtok_r().
On May 15, 2013, 4:36 p.m., Jan Safranek wrote:
src/indmanager/ind_manager.c, line 558 http://reviewboard-openlmi.rhcloud.com/r/351/diff/1/?file=2242#file2242line558
Missing malloc check
Converted to strtok_r()
On May 15, 2013, 4:36 p.m., Jan Safranek wrote:
src/indmanager/ind_manager.c, line 574 http://reviewboard-openlmi.rhcloud.com/r/351/diff/1/?file=2242#file2242line574
missing check for NULL?
You mean check for returned value? I will add the check in the next review, where I will add checks for every cmpi calls.
On May 15, 2013, 4:36 p.m., Jan Safranek wrote:
src/indmanager/ind_manager.c, lines 621-622 http://reviewboard-openlmi.rhcloud.com/r/351/diff/1/?file=2242#file2242line621
I am afraid most of CMGet* function calls in this thread will leak memory as they do not run in context of any CIM operation (which would free it upon completion). Double check with valgrind!
I thought that CBAttachThread() will take care of it. But will check it.
- Roman
----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: http://reviewboard-openlmi.rhcloud.com/r/351/#review411 -----------------------------------------------------------
On May 14, 2013, 2:43 p.m., Roman Rakus wrote:
This is an automatically generated e-mail. To reply, visit: http://reviewboard-openlmi.rhcloud.com/r/351/
(Updated May 14, 2013, 2:43 p.m.)
Review request for OpenLMI Developers.
Repository: openlmi-providers
Description
Indication manager
Signed-off-by: Roman Rakus rrakus@redhat.com
Diffs
CMakeLists.txt f25850e1640f52aed9f18c3bd343d41f7f5f21a4 src/CMakeLists.txt 0cd11d911fb2cf8c26376790c2c9f86cc30d8358 src/indmanager/CMakeLists.txt PRE-CREATION src/indmanager/ind_manager.h PRE-CREATION src/indmanager/ind_manager.c PRE-CREATION src/indmanager/openlmiindmanager.pc.in PRE-CREATION
Diff: http://reviewboard-openlmi.rhcloud.com/r/351/diff/
Testing
For testing purposes I used the following provider: #include <konkret/konkret.h> #include "LMI_AccountInstCreationIndication.h"
#include "ind_manager.h" #include <stdbool.h>
static const CMPIBroker* _cb = NULL;
static IMManager *im = NULL; IMError im_err = IM_ERR_OK;
static bool filter_checker(const CMPISelectExp *filter) { //TODO - true checking return true; }
// TODO - remove ! #include <unistd.h> static bool spawner(void *data) { //TODO - true checking return true; }
// TODO - remove ! #include <unistd.h> static bool spawner(void *data) { //TODO - inotify sleep(10); return true; }
static void LMI_AccountInstCreationIndicationInitialize() { // startup indication manager im = im_create_manager(NULL, filter_checker, true, spawner, IM_IND_CREATION, (CMPIBroker *)_cb, &im_err); }
static CMPIStatus LMI_AccountInstCreationIndicationIndicationCleanup( CMPIIndicationMI* mi, const CMPIContext* cc, CMPIBoolean term) { // destroy indication manager im_destroy_manager(im, cc, &im_err); CMReturn(CMPI_RC_OK); }
static CMPIStatus LMI_AccountInstCreationIndicationAuthorizeFilter( CMPIIndicationMI* mi, const CMPIContext* cc, const CMPISelectExp* se, const char* ns, const CMPIObjectPath* op, const char* user) { // verify filter im_verify_filter(im, se, cc, &im_err); CMReturn(CMPI_RC_OK); }
static CMPIStatus LMI_AccountInstCreationIndicationMustPoll( CMPIIndicationMI* mi, const CMPIContext* cc, const CMPISelectExp* se, const char* ns, const CMPIObjectPath* op) { // yes, this is not supported :( CMReturn(CMPI_RC_ERR_NOT_SUPPORTED); }
static CMPIStatus LMI_AccountInstCreationIndicationActivateFilter( CMPIIndicationMI* mi, const CMPIContext* cc, const CMPISelectExp* se, const char* ns, const CMPIObjectPath* op, CMPIBoolean firstActivation) { // verify filter and add it via indication manager im_verify_filter(im, se, cc, &im_err); im_add_filter(im, (CMPISelectExp*)se, cc, &im_err); CMReturn(CMPI_RC_OK); }
static CMPIStatus LMI_AccountInstCreationIndicationDeActivateFilter( CMPIIndicationMI* mi, const CMPIContext* cc, const CMPISelectExp* se, const char* ns, const CMPIObjectPath* op, CMPIBoolean lastActivation) { // remove filter from indication manager im_remove_filter(im, se, cc, &im_err); CMReturn(CMPI_RC_OK); }
static CMPIStatus LMI_AccountInstCreationIndicationEnableIndications( CMPIIndicationMI* mi, const CMPIContext* cc) { // start indications im_start_ind(im, cc, &im_err); CMReturn(CMPI_RC_OK); }
static CMPIStatus LMI_AccountInstCreationIndicationDisableIndications( CMPIIndicationMI* mi, const CMPIContext* cc) { // stop indications im_stop_ind(im, cc, &im_err); CMReturn(CMPI_RC_OK); }
CMIndicationMIStub( LMI_AccountInstCreationIndication, LMI_AccountInstCreationIndication, _cb, LMI_AccountInstCreationIndicationInitialize())
KONKRET_REGISTRATION( "root/cimv2", "LMI_AccountInstCreationIndication", "LMI_AccountInstCreationIndication", "indication")
Thanks,
Roman Rakus
On May 15, 2013, 6:36 p.m., Jan Safranek wrote:
src/indmanager/ind_manager.c, lines 621-622 http://reviewboard-openlmi.rhcloud.com/r/351/diff/1/?file=2242#file2242line621
I am afraid most of CMGet* function calls in this thread will leak memory as they do not run in context of any CIM operation (which would free it upon completion). Double check with valgrind!
Roman Rakus wrote: I thought that CBAttachThread() will take care of it. But will check it.
CBAttachThread ensures that CMGet* won't fail. It won't de-allocate the copies returned from it. At least that's what I found in Pegasus implementation of CMPI.
On May 15, 2013, 6:36 p.m., Jan Safranek wrote:
src/indmanager/ind_manager.c, line 502 http://reviewboard-openlmi.rhcloud.com/r/351/diff/1/?file=2242#file2242line502
CMSetProperty has CMPIValue* as the third argument, not CMPIInstance **. This applies to all CMSetProperty calls below.
Roman Rakus wrote: Don't ask me why, but it works this way.
'Working' does not mean 'correct'. It works just accidentally because CMPIValue is union, having CMPIInstance* as member.
- Jan
----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: http://reviewboard-openlmi.rhcloud.com/r/351/#review411 -----------------------------------------------------------
On May 16, 2013, 1:59 p.m., Roman Rakus wrote:
This is an automatically generated e-mail. To reply, visit: http://reviewboard-openlmi.rhcloud.com/r/351/
(Updated May 16, 2013, 1:59 p.m.)
Review request for OpenLMI Developers.
Repository: openlmi-providers
Description
Indication manager
Signed-off-by: Roman Rakus rrakus@redhat.com
Diffs
CMakeLists.txt f25850e1640f52aed9f18c3bd343d41f7f5f21a4 src/CMakeLists.txt 9f714d080d8541c368dedc235996e7a790930fff src/indmanager/CMakeLists.txt PRE-CREATION src/indmanager/ind_manager.h PRE-CREATION src/indmanager/ind_manager.c PRE-CREATION src/indmanager/openlmiindmanager.pc.in PRE-CREATION
Diff: http://reviewboard-openlmi.rhcloud.com/r/351/diff/
Testing
For testing purposes I used the following provider: #include <konkret/konkret.h> #include "LMI_AccountInstCreationIndication.h"
#include "ind_manager.h" #include <stdbool.h>
static const CMPIBroker* _cb = NULL;
static IMManager *im = NULL; IMError im_err = IM_ERR_OK;
static bool filter_checker(const CMPISelectExp *filter) { //TODO - true checking return true; }
// TODO - remove ! #include <unistd.h> static bool spawner(void *data) { //TODO - true checking return true; }
// TODO - remove ! #include <unistd.h> static bool spawner(void *data) { //TODO - inotify sleep(10); return true; }
static void LMI_AccountInstCreationIndicationInitialize() { // startup indication manager im = im_create_manager(NULL, filter_checker, true, spawner, IM_IND_CREATION, (CMPIBroker *)_cb, &im_err); }
static CMPIStatus LMI_AccountInstCreationIndicationIndicationCleanup( CMPIIndicationMI* mi, const CMPIContext* cc, CMPIBoolean term) { // destroy indication manager im_destroy_manager(im, cc, &im_err); CMReturn(CMPI_RC_OK); }
static CMPIStatus LMI_AccountInstCreationIndicationAuthorizeFilter( CMPIIndicationMI* mi, const CMPIContext* cc, const CMPISelectExp* se, const char* ns, const CMPIObjectPath* op, const char* user) { // verify filter im_verify_filter(im, se, cc, &im_err); CMReturn(CMPI_RC_OK); }
static CMPIStatus LMI_AccountInstCreationIndicationMustPoll( CMPIIndicationMI* mi, const CMPIContext* cc, const CMPISelectExp* se, const char* ns, const CMPIObjectPath* op) { // yes, this is not supported :( CMReturn(CMPI_RC_ERR_NOT_SUPPORTED); }
static CMPIStatus LMI_AccountInstCreationIndicationActivateFilter( CMPIIndicationMI* mi, const CMPIContext* cc, const CMPISelectExp* se, const char* ns, const CMPIObjectPath* op, CMPIBoolean firstActivation) { // verify filter and add it via indication manager im_verify_filter(im, se, cc, &im_err); im_add_filter(im, (CMPISelectExp*)se, cc, &im_err); CMReturn(CMPI_RC_OK); }
static CMPIStatus LMI_AccountInstCreationIndicationDeActivateFilter( CMPIIndicationMI* mi, const CMPIContext* cc, const CMPISelectExp* se, const char* ns, const CMPIObjectPath* op, CMPIBoolean lastActivation) { // remove filter from indication manager im_remove_filter(im, se, cc, &im_err); CMReturn(CMPI_RC_OK); }
static CMPIStatus LMI_AccountInstCreationIndicationEnableIndications( CMPIIndicationMI* mi, const CMPIContext* cc) { // start indications im_start_ind(im, cc, &im_err); CMReturn(CMPI_RC_OK); }
static CMPIStatus LMI_AccountInstCreationIndicationDisableIndications( CMPIIndicationMI* mi, const CMPIContext* cc) { // stop indications im_stop_ind(im, cc, &im_err); CMReturn(CMPI_RC_OK); }
CMIndicationMIStub( LMI_AccountInstCreationIndication, LMI_AccountInstCreationIndication, _cb, LMI_AccountInstCreationIndicationInitialize())
KONKRET_REGISTRATION( "root/cimv2", "LMI_AccountInstCreationIndication", "LMI_AccountInstCreationIndication", "indication")
Thanks,
Roman Rakus
----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: http://reviewboard-openlmi.rhcloud.com/r/351/ -----------------------------------------------------------
(Updated May 16, 2013, 11:59 a.m.)
Review request for OpenLMI Developers.
Repository: openlmi-providers
Description -------
Indication manager
Signed-off-by: Roman Rakus rrakus@redhat.com
Diffs (updated) -----
CMakeLists.txt f25850e1640f52aed9f18c3bd343d41f7f5f21a4 src/CMakeLists.txt 9f714d080d8541c368dedc235996e7a790930fff src/indmanager/CMakeLists.txt PRE-CREATION src/indmanager/ind_manager.h PRE-CREATION src/indmanager/ind_manager.c PRE-CREATION src/indmanager/openlmiindmanager.pc.in PRE-CREATION
Diff: http://reviewboard-openlmi.rhcloud.com/r/351/diff/
Testing -------
For testing purposes I used the following provider: #include <konkret/konkret.h> #include "LMI_AccountInstCreationIndication.h"
#include "ind_manager.h" #include <stdbool.h>
static const CMPIBroker* _cb = NULL;
static IMManager *im = NULL; IMError im_err = IM_ERR_OK;
static bool filter_checker(const CMPISelectExp *filter) { //TODO - true checking return true; }
// TODO - remove ! #include <unistd.h> static bool spawner(void *data) { //TODO - true checking return true; }
// TODO - remove ! #include <unistd.h> static bool spawner(void *data) { //TODO - inotify sleep(10); return true; }
static void LMI_AccountInstCreationIndicationInitialize() { // startup indication manager im = im_create_manager(NULL, filter_checker, true, spawner, IM_IND_CREATION, (CMPIBroker *)_cb, &im_err); }
static CMPIStatus LMI_AccountInstCreationIndicationIndicationCleanup( CMPIIndicationMI* mi, const CMPIContext* cc, CMPIBoolean term) { // destroy indication manager im_destroy_manager(im, cc, &im_err); CMReturn(CMPI_RC_OK); }
static CMPIStatus LMI_AccountInstCreationIndicationAuthorizeFilter( CMPIIndicationMI* mi, const CMPIContext* cc, const CMPISelectExp* se, const char* ns, const CMPIObjectPath* op, const char* user) { // verify filter im_verify_filter(im, se, cc, &im_err); CMReturn(CMPI_RC_OK); }
static CMPIStatus LMI_AccountInstCreationIndicationMustPoll( CMPIIndicationMI* mi, const CMPIContext* cc, const CMPISelectExp* se, const char* ns, const CMPIObjectPath* op) { // yes, this is not supported :( CMReturn(CMPI_RC_ERR_NOT_SUPPORTED); }
static CMPIStatus LMI_AccountInstCreationIndicationActivateFilter( CMPIIndicationMI* mi, const CMPIContext* cc, const CMPISelectExp* se, const char* ns, const CMPIObjectPath* op, CMPIBoolean firstActivation) { // verify filter and add it via indication manager im_verify_filter(im, se, cc, &im_err); im_add_filter(im, (CMPISelectExp*)se, cc, &im_err); CMReturn(CMPI_RC_OK); }
static CMPIStatus LMI_AccountInstCreationIndicationDeActivateFilter( CMPIIndicationMI* mi, const CMPIContext* cc, const CMPISelectExp* se, const char* ns, const CMPIObjectPath* op, CMPIBoolean lastActivation) { // remove filter from indication manager im_remove_filter(im, se, cc, &im_err); CMReturn(CMPI_RC_OK); }
static CMPIStatus LMI_AccountInstCreationIndicationEnableIndications( CMPIIndicationMI* mi, const CMPIContext* cc) { // start indications im_start_ind(im, cc, &im_err); CMReturn(CMPI_RC_OK); }
static CMPIStatus LMI_AccountInstCreationIndicationDisableIndications( CMPIIndicationMI* mi, const CMPIContext* cc) { // stop indications im_stop_ind(im, cc, &im_err); CMReturn(CMPI_RC_OK); }
CMIndicationMIStub( LMI_AccountInstCreationIndication, LMI_AccountInstCreationIndication, _cb, LMI_AccountInstCreationIndicationInitialize())
KONKRET_REGISTRATION( "root/cimv2", "LMI_AccountInstCreationIndication", "LMI_AccountInstCreationIndication", "indication")
Thanks,
Roman Rakus
----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: http://reviewboard-openlmi.rhcloud.com/r/351/#review439 -----------------------------------------------------------
src/indmanager/ind_manager.h http://reviewboard-openlmi.rhcloud.com/r/351/#comment285
I see now, the function does not actually spawn anything, it just waits for an event. The name confused me a bit. I leave it to you judgement if you rename it or not.
Anyway, I'd appreciate some more introduction, like:
- the ind. manager works in two modes (polling/with IMInstGather callback)
- the ind. manager can serve watch multiple classes simultaneously, but they must share the callbacks (?)
- some real-life example would be nice.
This does not need to be documented in the code, it can be in README or Usage.txt.
- Jan Safranek
On May 16, 2013, 1:59 p.m., Roman Rakus wrote:
This is an automatically generated e-mail. To reply, visit: http://reviewboard-openlmi.rhcloud.com/r/351/
(Updated May 16, 2013, 1:59 p.m.)
Review request for OpenLMI Developers.
Repository: openlmi-providers
Description
Indication manager
Signed-off-by: Roman Rakus rrakus@redhat.com
Diffs
CMakeLists.txt f25850e1640f52aed9f18c3bd343d41f7f5f21a4 src/CMakeLists.txt 9f714d080d8541c368dedc235996e7a790930fff src/indmanager/CMakeLists.txt PRE-CREATION src/indmanager/ind_manager.h PRE-CREATION src/indmanager/ind_manager.c PRE-CREATION src/indmanager/openlmiindmanager.pc.in PRE-CREATION
Diff: http://reviewboard-openlmi.rhcloud.com/r/351/diff/
Testing
For testing purposes I used the following provider: #include <konkret/konkret.h> #include "LMI_AccountInstCreationIndication.h"
#include "ind_manager.h" #include <stdbool.h>
static const CMPIBroker* _cb = NULL;
static IMManager *im = NULL; IMError im_err = IM_ERR_OK;
static bool filter_checker(const CMPISelectExp *filter) { //TODO - true checking return true; }
// TODO - remove ! #include <unistd.h> static bool spawner(void *data) { //TODO - true checking return true; }
// TODO - remove ! #include <unistd.h> static bool spawner(void *data) { //TODO - inotify sleep(10); return true; }
static void LMI_AccountInstCreationIndicationInitialize() { // startup indication manager im = im_create_manager(NULL, filter_checker, true, spawner, IM_IND_CREATION, (CMPIBroker *)_cb, &im_err); }
static CMPIStatus LMI_AccountInstCreationIndicationIndicationCleanup( CMPIIndicationMI* mi, const CMPIContext* cc, CMPIBoolean term) { // destroy indication manager im_destroy_manager(im, cc, &im_err); CMReturn(CMPI_RC_OK); }
static CMPIStatus LMI_AccountInstCreationIndicationAuthorizeFilter( CMPIIndicationMI* mi, const CMPIContext* cc, const CMPISelectExp* se, const char* ns, const CMPIObjectPath* op, const char* user) { // verify filter im_verify_filter(im, se, cc, &im_err); CMReturn(CMPI_RC_OK); }
static CMPIStatus LMI_AccountInstCreationIndicationMustPoll( CMPIIndicationMI* mi, const CMPIContext* cc, const CMPISelectExp* se, const char* ns, const CMPIObjectPath* op) { // yes, this is not supported :( CMReturn(CMPI_RC_ERR_NOT_SUPPORTED); }
static CMPIStatus LMI_AccountInstCreationIndicationActivateFilter( CMPIIndicationMI* mi, const CMPIContext* cc, const CMPISelectExp* se, const char* ns, const CMPIObjectPath* op, CMPIBoolean firstActivation) { // verify filter and add it via indication manager im_verify_filter(im, se, cc, &im_err); im_add_filter(im, (CMPISelectExp*)se, cc, &im_err); CMReturn(CMPI_RC_OK); }
static CMPIStatus LMI_AccountInstCreationIndicationDeActivateFilter( CMPIIndicationMI* mi, const CMPIContext* cc, const CMPISelectExp* se, const char* ns, const CMPIObjectPath* op, CMPIBoolean lastActivation) { // remove filter from indication manager im_remove_filter(im, se, cc, &im_err); CMReturn(CMPI_RC_OK); }
static CMPIStatus LMI_AccountInstCreationIndicationEnableIndications( CMPIIndicationMI* mi, const CMPIContext* cc) { // start indications im_start_ind(im, cc, &im_err); CMReturn(CMPI_RC_OK); }
static CMPIStatus LMI_AccountInstCreationIndicationDisableIndications( CMPIIndicationMI* mi, const CMPIContext* cc) { // stop indications im_stop_ind(im, cc, &im_err); CMReturn(CMPI_RC_OK); }
CMIndicationMIStub( LMI_AccountInstCreationIndication, LMI_AccountInstCreationIndication, _cb, LMI_AccountInstCreationIndicationInitialize())
KONKRET_REGISTRATION( "root/cimv2", "LMI_AccountInstCreationIndication", "LMI_AccountInstCreationIndication", "indication")
Thanks,
Roman Rakus
On May 17, 2013, 7:30 a.m., Jan Safranek wrote:
src/indmanager/ind_manager.h, lines 60-63 http://reviewboard-openlmi.rhcloud.com/r/351/diff/2/?file=2297#file2297line60
I see now, the function does not actually spawn anything, it just waits for an event. The name confused me a bit. I leave it to you judgement if you rename it or not. Anyway, I'd appreciate some more introduction, like: - the ind. manager works in two modes (polling/with IMInstGather callback) - the ind. manager can serve watch multiple classes simultaneously, but they must share the callbacks (?) - some real-life example would be nice. This does not need to be documented in the code, it can be in README or Usage.txt.
It would be good to rename it, but I'm out of any idea how to name it. Watcher? README is definetely missing. But I also like comments in the header files.
Regarding the question mark - yes, only 1 callback. I want to keep it as simple as possible (for using). It is supposed that you will have more indications providers doing basic things. I will also add it to documentation.
- Roman
----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: http://reviewboard-openlmi.rhcloud.com/r/351/#review439 -----------------------------------------------------------
On May 16, 2013, 11:59 a.m., Roman Rakus wrote:
This is an automatically generated e-mail. To reply, visit: http://reviewboard-openlmi.rhcloud.com/r/351/
(Updated May 16, 2013, 11:59 a.m.)
Review request for OpenLMI Developers.
Repository: openlmi-providers
Description
Indication manager
Signed-off-by: Roman Rakus rrakus@redhat.com
Diffs
CMakeLists.txt f25850e1640f52aed9f18c3bd343d41f7f5f21a4 src/CMakeLists.txt 9f714d080d8541c368dedc235996e7a790930fff src/indmanager/CMakeLists.txt PRE-CREATION src/indmanager/ind_manager.h PRE-CREATION src/indmanager/ind_manager.c PRE-CREATION src/indmanager/openlmiindmanager.pc.in PRE-CREATION
Diff: http://reviewboard-openlmi.rhcloud.com/r/351/diff/
Testing
For testing purposes I used the following provider: #include <konkret/konkret.h> #include "LMI_AccountInstCreationIndication.h"
#include "ind_manager.h" #include <stdbool.h>
static const CMPIBroker* _cb = NULL;
static IMManager *im = NULL; IMError im_err = IM_ERR_OK;
static bool filter_checker(const CMPISelectExp *filter) { //TODO - true checking return true; }
// TODO - remove ! #include <unistd.h> static bool spawner(void *data) { //TODO - true checking return true; }
// TODO - remove ! #include <unistd.h> static bool spawner(void *data) { //TODO - inotify sleep(10); return true; }
static void LMI_AccountInstCreationIndicationInitialize() { // startup indication manager im = im_create_manager(NULL, filter_checker, true, spawner, IM_IND_CREATION, (CMPIBroker *)_cb, &im_err); }
static CMPIStatus LMI_AccountInstCreationIndicationIndicationCleanup( CMPIIndicationMI* mi, const CMPIContext* cc, CMPIBoolean term) { // destroy indication manager im_destroy_manager(im, cc, &im_err); CMReturn(CMPI_RC_OK); }
static CMPIStatus LMI_AccountInstCreationIndicationAuthorizeFilter( CMPIIndicationMI* mi, const CMPIContext* cc, const CMPISelectExp* se, const char* ns, const CMPIObjectPath* op, const char* user) { // verify filter im_verify_filter(im, se, cc, &im_err); CMReturn(CMPI_RC_OK); }
static CMPIStatus LMI_AccountInstCreationIndicationMustPoll( CMPIIndicationMI* mi, const CMPIContext* cc, const CMPISelectExp* se, const char* ns, const CMPIObjectPath* op) { // yes, this is not supported :( CMReturn(CMPI_RC_ERR_NOT_SUPPORTED); }
static CMPIStatus LMI_AccountInstCreationIndicationActivateFilter( CMPIIndicationMI* mi, const CMPIContext* cc, const CMPISelectExp* se, const char* ns, const CMPIObjectPath* op, CMPIBoolean firstActivation) { // verify filter and add it via indication manager im_verify_filter(im, se, cc, &im_err); im_add_filter(im, (CMPISelectExp*)se, cc, &im_err); CMReturn(CMPI_RC_OK); }
static CMPIStatus LMI_AccountInstCreationIndicationDeActivateFilter( CMPIIndicationMI* mi, const CMPIContext* cc, const CMPISelectExp* se, const char* ns, const CMPIObjectPath* op, CMPIBoolean lastActivation) { // remove filter from indication manager im_remove_filter(im, se, cc, &im_err); CMReturn(CMPI_RC_OK); }
static CMPIStatus LMI_AccountInstCreationIndicationEnableIndications( CMPIIndicationMI* mi, const CMPIContext* cc) { // start indications im_start_ind(im, cc, &im_err); CMReturn(CMPI_RC_OK); }
static CMPIStatus LMI_AccountInstCreationIndicationDisableIndications( CMPIIndicationMI* mi, const CMPIContext* cc) { // stop indications im_stop_ind(im, cc, &im_err); CMReturn(CMPI_RC_OK); }
CMIndicationMIStub( LMI_AccountInstCreationIndication, LMI_AccountInstCreationIndication, _cb, LMI_AccountInstCreationIndicationInitialize())
KONKRET_REGISTRATION( "root/cimv2", "LMI_AccountInstCreationIndication", "LMI_AccountInstCreationIndication", "indication")
Thanks,
Roman Rakus
----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: http://reviewboard-openlmi.rhcloud.com/r/351/#review490 -----------------------------------------------------------
src/indmanager/ind_manager.c http://reviewboard-openlmi.rhcloud.com/r/351/#comment299
Typo 'compape'
- Jan Safranek
On May 16, 2013, 1:59 p.m., Roman Rakus wrote:
This is an automatically generated e-mail. To reply, visit: http://reviewboard-openlmi.rhcloud.com/r/351/
(Updated May 16, 2013, 1:59 p.m.)
Review request for OpenLMI Developers.
Repository: openlmi-providers
Description
Indication manager
Signed-off-by: Roman Rakus rrakus@redhat.com
Diffs
CMakeLists.txt f25850e1640f52aed9f18c3bd343d41f7f5f21a4 src/CMakeLists.txt 9f714d080d8541c368dedc235996e7a790930fff src/indmanager/CMakeLists.txt PRE-CREATION src/indmanager/ind_manager.h PRE-CREATION src/indmanager/ind_manager.c PRE-CREATION src/indmanager/openlmiindmanager.pc.in PRE-CREATION
Diff: http://reviewboard-openlmi.rhcloud.com/r/351/diff/
Testing
For testing purposes I used the following provider: #include <konkret/konkret.h> #include "LMI_AccountInstCreationIndication.h"
#include "ind_manager.h" #include <stdbool.h>
static const CMPIBroker* _cb = NULL;
static IMManager *im = NULL; IMError im_err = IM_ERR_OK;
static bool filter_checker(const CMPISelectExp *filter) { //TODO - true checking return true; }
// TODO - remove ! #include <unistd.h> static bool spawner(void *data) { //TODO - true checking return true; }
// TODO - remove ! #include <unistd.h> static bool spawner(void *data) { //TODO - inotify sleep(10); return true; }
static void LMI_AccountInstCreationIndicationInitialize() { // startup indication manager im = im_create_manager(NULL, filter_checker, true, spawner, IM_IND_CREATION, (CMPIBroker *)_cb, &im_err); }
static CMPIStatus LMI_AccountInstCreationIndicationIndicationCleanup( CMPIIndicationMI* mi, const CMPIContext* cc, CMPIBoolean term) { // destroy indication manager im_destroy_manager(im, cc, &im_err); CMReturn(CMPI_RC_OK); }
static CMPIStatus LMI_AccountInstCreationIndicationAuthorizeFilter( CMPIIndicationMI* mi, const CMPIContext* cc, const CMPISelectExp* se, const char* ns, const CMPIObjectPath* op, const char* user) { // verify filter im_verify_filter(im, se, cc, &im_err); CMReturn(CMPI_RC_OK); }
static CMPIStatus LMI_AccountInstCreationIndicationMustPoll( CMPIIndicationMI* mi, const CMPIContext* cc, const CMPISelectExp* se, const char* ns, const CMPIObjectPath* op) { // yes, this is not supported :( CMReturn(CMPI_RC_ERR_NOT_SUPPORTED); }
static CMPIStatus LMI_AccountInstCreationIndicationActivateFilter( CMPIIndicationMI* mi, const CMPIContext* cc, const CMPISelectExp* se, const char* ns, const CMPIObjectPath* op, CMPIBoolean firstActivation) { // verify filter and add it via indication manager im_verify_filter(im, se, cc, &im_err); im_add_filter(im, (CMPISelectExp*)se, cc, &im_err); CMReturn(CMPI_RC_OK); }
static CMPIStatus LMI_AccountInstCreationIndicationDeActivateFilter( CMPIIndicationMI* mi, const CMPIContext* cc, const CMPISelectExp* se, const char* ns, const CMPIObjectPath* op, CMPIBoolean lastActivation) { // remove filter from indication manager im_remove_filter(im, se, cc, &im_err); CMReturn(CMPI_RC_OK); }
static CMPIStatus LMI_AccountInstCreationIndicationEnableIndications( CMPIIndicationMI* mi, const CMPIContext* cc) { // start indications im_start_ind(im, cc, &im_err); CMReturn(CMPI_RC_OK); }
static CMPIStatus LMI_AccountInstCreationIndicationDisableIndications( CMPIIndicationMI* mi, const CMPIContext* cc) { // stop indications im_stop_ind(im, cc, &im_err); CMReturn(CMPI_RC_OK); }
CMIndicationMIStub( LMI_AccountInstCreationIndication, LMI_AccountInstCreationIndication, _cb, LMI_AccountInstCreationIndicationInitialize())
KONKRET_REGISTRATION( "root/cimv2", "LMI_AccountInstCreationIndication", "LMI_AccountInstCreationIndication", "indication")
Thanks,
Roman Rakus
----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: http://reviewboard-openlmi.rhcloud.com/r/351/#review491 -----------------------------------------------------------
Ship it!
Ok, so let's ship it, but add README somewhere appropriate (src/indmanager?) and install it (README.indmanager in -devel package?)
- Jan Safranek
On May 16, 2013, 1:59 p.m., Roman Rakus wrote:
This is an automatically generated e-mail. To reply, visit: http://reviewboard-openlmi.rhcloud.com/r/351/
(Updated May 16, 2013, 1:59 p.m.)
Review request for OpenLMI Developers.
Repository: openlmi-providers
Description
Indication manager
Signed-off-by: Roman Rakus rrakus@redhat.com
Diffs
CMakeLists.txt f25850e1640f52aed9f18c3bd343d41f7f5f21a4 src/CMakeLists.txt 9f714d080d8541c368dedc235996e7a790930fff src/indmanager/CMakeLists.txt PRE-CREATION src/indmanager/ind_manager.h PRE-CREATION src/indmanager/ind_manager.c PRE-CREATION src/indmanager/openlmiindmanager.pc.in PRE-CREATION
Diff: http://reviewboard-openlmi.rhcloud.com/r/351/diff/
Testing
For testing purposes I used the following provider: #include <konkret/konkret.h> #include "LMI_AccountInstCreationIndication.h"
#include "ind_manager.h" #include <stdbool.h>
static const CMPIBroker* _cb = NULL;
static IMManager *im = NULL; IMError im_err = IM_ERR_OK;
static bool filter_checker(const CMPISelectExp *filter) { //TODO - true checking return true; }
// TODO - remove ! #include <unistd.h> static bool spawner(void *data) { //TODO - true checking return true; }
// TODO - remove ! #include <unistd.h> static bool spawner(void *data) { //TODO - inotify sleep(10); return true; }
static void LMI_AccountInstCreationIndicationInitialize() { // startup indication manager im = im_create_manager(NULL, filter_checker, true, spawner, IM_IND_CREATION, (CMPIBroker *)_cb, &im_err); }
static CMPIStatus LMI_AccountInstCreationIndicationIndicationCleanup( CMPIIndicationMI* mi, const CMPIContext* cc, CMPIBoolean term) { // destroy indication manager im_destroy_manager(im, cc, &im_err); CMReturn(CMPI_RC_OK); }
static CMPIStatus LMI_AccountInstCreationIndicationAuthorizeFilter( CMPIIndicationMI* mi, const CMPIContext* cc, const CMPISelectExp* se, const char* ns, const CMPIObjectPath* op, const char* user) { // verify filter im_verify_filter(im, se, cc, &im_err); CMReturn(CMPI_RC_OK); }
static CMPIStatus LMI_AccountInstCreationIndicationMustPoll( CMPIIndicationMI* mi, const CMPIContext* cc, const CMPISelectExp* se, const char* ns, const CMPIObjectPath* op) { // yes, this is not supported :( CMReturn(CMPI_RC_ERR_NOT_SUPPORTED); }
static CMPIStatus LMI_AccountInstCreationIndicationActivateFilter( CMPIIndicationMI* mi, const CMPIContext* cc, const CMPISelectExp* se, const char* ns, const CMPIObjectPath* op, CMPIBoolean firstActivation) { // verify filter and add it via indication manager im_verify_filter(im, se, cc, &im_err); im_add_filter(im, (CMPISelectExp*)se, cc, &im_err); CMReturn(CMPI_RC_OK); }
static CMPIStatus LMI_AccountInstCreationIndicationDeActivateFilter( CMPIIndicationMI* mi, const CMPIContext* cc, const CMPISelectExp* se, const char* ns, const CMPIObjectPath* op, CMPIBoolean lastActivation) { // remove filter from indication manager im_remove_filter(im, se, cc, &im_err); CMReturn(CMPI_RC_OK); }
static CMPIStatus LMI_AccountInstCreationIndicationEnableIndications( CMPIIndicationMI* mi, const CMPIContext* cc) { // start indications im_start_ind(im, cc, &im_err); CMReturn(CMPI_RC_OK); }
static CMPIStatus LMI_AccountInstCreationIndicationDisableIndications( CMPIIndicationMI* mi, const CMPIContext* cc) { // stop indications im_stop_ind(im, cc, &im_err); CMReturn(CMPI_RC_OK); }
CMIndicationMIStub( LMI_AccountInstCreationIndication, LMI_AccountInstCreationIndication, _cb, LMI_AccountInstCreationIndicationInitialize())
KONKRET_REGISTRATION( "root/cimv2", "LMI_AccountInstCreationIndication", "LMI_AccountInstCreationIndication", "indication")
Thanks,
Roman Rakus
----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: http://reviewboard-openlmi.rhcloud.com/r/351/ -----------------------------------------------------------
(Updated May 27, 2013, 11:11 a.m.)
Review request for OpenLMI Developers.
Repository: openlmi-providers
Description -------
Indication manager
Signed-off-by: Roman Rakus rrakus@redhat.com
Diffs (updated) -----
CMakeLists.txt f25850e1640f52aed9f18c3bd343d41f7f5f21a4 src/CMakeLists.txt 9f714d080d8541c368dedc235996e7a790930fff src/indmanager/CMakeLists.txt PRE-CREATION src/indmanager/README PRE-CREATION src/indmanager/ind_manager.h PRE-CREATION src/indmanager/ind_manager.c PRE-CREATION src/indmanager/openlmiindmanager.pc.in PRE-CREATION
Diff: http://reviewboard-openlmi.rhcloud.com/r/351/diff/
Testing -------
For testing purposes I used the following provider: #include <konkret/konkret.h> #include "LMI_AccountInstCreationIndication.h"
#include "ind_manager.h" #include <stdbool.h>
static const CMPIBroker* _cb = NULL;
static IMManager *im = NULL; IMError im_err = IM_ERR_OK;
static bool filter_checker(const CMPISelectExp *filter) { //TODO - true checking return true; }
// TODO - remove ! #include <unistd.h> static bool spawner(void *data) { //TODO - true checking return true; }
// TODO - remove ! #include <unistd.h> static bool spawner(void *data) { //TODO - inotify sleep(10); return true; }
static void LMI_AccountInstCreationIndicationInitialize() { // startup indication manager im = im_create_manager(NULL, filter_checker, true, spawner, IM_IND_CREATION, (CMPIBroker *)_cb, &im_err); }
static CMPIStatus LMI_AccountInstCreationIndicationIndicationCleanup( CMPIIndicationMI* mi, const CMPIContext* cc, CMPIBoolean term) { // destroy indication manager im_destroy_manager(im, cc, &im_err); CMReturn(CMPI_RC_OK); }
static CMPIStatus LMI_AccountInstCreationIndicationAuthorizeFilter( CMPIIndicationMI* mi, const CMPIContext* cc, const CMPISelectExp* se, const char* ns, const CMPIObjectPath* op, const char* user) { // verify filter im_verify_filter(im, se, cc, &im_err); CMReturn(CMPI_RC_OK); }
static CMPIStatus LMI_AccountInstCreationIndicationMustPoll( CMPIIndicationMI* mi, const CMPIContext* cc, const CMPISelectExp* se, const char* ns, const CMPIObjectPath* op) { // yes, this is not supported :( CMReturn(CMPI_RC_ERR_NOT_SUPPORTED); }
static CMPIStatus LMI_AccountInstCreationIndicationActivateFilter( CMPIIndicationMI* mi, const CMPIContext* cc, const CMPISelectExp* se, const char* ns, const CMPIObjectPath* op, CMPIBoolean firstActivation) { // verify filter and add it via indication manager im_verify_filter(im, se, cc, &im_err); im_add_filter(im, (CMPISelectExp*)se, cc, &im_err); CMReturn(CMPI_RC_OK); }
static CMPIStatus LMI_AccountInstCreationIndicationDeActivateFilter( CMPIIndicationMI* mi, const CMPIContext* cc, const CMPISelectExp* se, const char* ns, const CMPIObjectPath* op, CMPIBoolean lastActivation) { // remove filter from indication manager im_remove_filter(im, se, cc, &im_err); CMReturn(CMPI_RC_OK); }
static CMPIStatus LMI_AccountInstCreationIndicationEnableIndications( CMPIIndicationMI* mi, const CMPIContext* cc) { // start indications im_start_ind(im, cc, &im_err); CMReturn(CMPI_RC_OK); }
static CMPIStatus LMI_AccountInstCreationIndicationDisableIndications( CMPIIndicationMI* mi, const CMPIContext* cc) { // stop indications im_stop_ind(im, cc, &im_err); CMReturn(CMPI_RC_OK); }
CMIndicationMIStub( LMI_AccountInstCreationIndication, LMI_AccountInstCreationIndication, _cb, LMI_AccountInstCreationIndicationInitialize())
KONKRET_REGISTRATION( "root/cimv2", "LMI_AccountInstCreationIndication", "LMI_AccountInstCreationIndication", "indication")
Thanks,
Roman Rakus
----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: http://reviewboard-openlmi.rhcloud.com/r/351/#review492 -----------------------------------------------------------
Ship it!
src/indmanager/README http://reviewboard-openlmi.rhcloud.com/r/351/#comment300
I would emphasize that the callback *should* be blocking (otherwise there is busy loop).
- Jan Safranek
On May 27, 2013, 1:11 p.m., Roman Rakus wrote:
This is an automatically generated e-mail. To reply, visit: http://reviewboard-openlmi.rhcloud.com/r/351/
(Updated May 27, 2013, 1:11 p.m.)
Review request for OpenLMI Developers.
Repository: openlmi-providers
Description
Indication manager
Signed-off-by: Roman Rakus rrakus@redhat.com
Diffs
CMakeLists.txt f25850e1640f52aed9f18c3bd343d41f7f5f21a4 src/CMakeLists.txt 9f714d080d8541c368dedc235996e7a790930fff src/indmanager/CMakeLists.txt PRE-CREATION src/indmanager/README PRE-CREATION src/indmanager/ind_manager.h PRE-CREATION src/indmanager/ind_manager.c PRE-CREATION src/indmanager/openlmiindmanager.pc.in PRE-CREATION
Diff: http://reviewboard-openlmi.rhcloud.com/r/351/diff/
Testing
For testing purposes I used the following provider: #include <konkret/konkret.h> #include "LMI_AccountInstCreationIndication.h"
#include "ind_manager.h" #include <stdbool.h>
static const CMPIBroker* _cb = NULL;
static IMManager *im = NULL; IMError im_err = IM_ERR_OK;
static bool filter_checker(const CMPISelectExp *filter) { //TODO - true checking return true; }
// TODO - remove ! #include <unistd.h> static bool spawner(void *data) { //TODO - true checking return true; }
// TODO - remove ! #include <unistd.h> static bool spawner(void *data) { //TODO - inotify sleep(10); return true; }
static void LMI_AccountInstCreationIndicationInitialize() { // startup indication manager im = im_create_manager(NULL, filter_checker, true, spawner, IM_IND_CREATION, (CMPIBroker *)_cb, &im_err); }
static CMPIStatus LMI_AccountInstCreationIndicationIndicationCleanup( CMPIIndicationMI* mi, const CMPIContext* cc, CMPIBoolean term) { // destroy indication manager im_destroy_manager(im, cc, &im_err); CMReturn(CMPI_RC_OK); }
static CMPIStatus LMI_AccountInstCreationIndicationAuthorizeFilter( CMPIIndicationMI* mi, const CMPIContext* cc, const CMPISelectExp* se, const char* ns, const CMPIObjectPath* op, const char* user) { // verify filter im_verify_filter(im, se, cc, &im_err); CMReturn(CMPI_RC_OK); }
static CMPIStatus LMI_AccountInstCreationIndicationMustPoll( CMPIIndicationMI* mi, const CMPIContext* cc, const CMPISelectExp* se, const char* ns, const CMPIObjectPath* op) { // yes, this is not supported :( CMReturn(CMPI_RC_ERR_NOT_SUPPORTED); }
static CMPIStatus LMI_AccountInstCreationIndicationActivateFilter( CMPIIndicationMI* mi, const CMPIContext* cc, const CMPISelectExp* se, const char* ns, const CMPIObjectPath* op, CMPIBoolean firstActivation) { // verify filter and add it via indication manager im_verify_filter(im, se, cc, &im_err); im_add_filter(im, (CMPISelectExp*)se, cc, &im_err); CMReturn(CMPI_RC_OK); }
static CMPIStatus LMI_AccountInstCreationIndicationDeActivateFilter( CMPIIndicationMI* mi, const CMPIContext* cc, const CMPISelectExp* se, const char* ns, const CMPIObjectPath* op, CMPIBoolean lastActivation) { // remove filter from indication manager im_remove_filter(im, se, cc, &im_err); CMReturn(CMPI_RC_OK); }
static CMPIStatus LMI_AccountInstCreationIndicationEnableIndications( CMPIIndicationMI* mi, const CMPIContext* cc) { // start indications im_start_ind(im, cc, &im_err); CMReturn(CMPI_RC_OK); }
static CMPIStatus LMI_AccountInstCreationIndicationDisableIndications( CMPIIndicationMI* mi, const CMPIContext* cc) { // stop indications im_stop_ind(im, cc, &im_err); CMReturn(CMPI_RC_OK); }
CMIndicationMIStub( LMI_AccountInstCreationIndication, LMI_AccountInstCreationIndication, _cb, LMI_AccountInstCreationIndicationInitialize())
KONKRET_REGISTRATION( "root/cimv2", "LMI_AccountInstCreationIndication", "LMI_AccountInstCreationIndication", "indication")
Thanks,
Roman Rakus
----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: http://reviewboard-openlmi.rhcloud.com/r/351/ -----------------------------------------------------------
(Updated May 27, 2013, 12:49 p.m.)
Status ------
This change has been marked as submitted.
Review request for OpenLMI Developers.
Repository: openlmi-providers
Description -------
Indication manager
Signed-off-by: Roman Rakus rrakus@redhat.com
Diffs -----
CMakeLists.txt f25850e1640f52aed9f18c3bd343d41f7f5f21a4 src/CMakeLists.txt 9f714d080d8541c368dedc235996e7a790930fff src/indmanager/CMakeLists.txt PRE-CREATION src/indmanager/README PRE-CREATION src/indmanager/ind_manager.h PRE-CREATION src/indmanager/ind_manager.c PRE-CREATION src/indmanager/openlmiindmanager.pc.in PRE-CREATION
Diff: http://reviewboard-openlmi.rhcloud.com/r/351/diff/
Testing -------
For testing purposes I used the following provider: #include <konkret/konkret.h> #include "LMI_AccountInstCreationIndication.h"
#include "ind_manager.h" #include <stdbool.h>
static const CMPIBroker* _cb = NULL;
static IMManager *im = NULL; IMError im_err = IM_ERR_OK;
static bool filter_checker(const CMPISelectExp *filter) { //TODO - true checking return true; }
// TODO - remove ! #include <unistd.h> static bool spawner(void *data) { //TODO - true checking return true; }
// TODO - remove ! #include <unistd.h> static bool spawner(void *data) { //TODO - inotify sleep(10); return true; }
static void LMI_AccountInstCreationIndicationInitialize() { // startup indication manager im = im_create_manager(NULL, filter_checker, true, spawner, IM_IND_CREATION, (CMPIBroker *)_cb, &im_err); }
static CMPIStatus LMI_AccountInstCreationIndicationIndicationCleanup( CMPIIndicationMI* mi, const CMPIContext* cc, CMPIBoolean term) { // destroy indication manager im_destroy_manager(im, cc, &im_err); CMReturn(CMPI_RC_OK); }
static CMPIStatus LMI_AccountInstCreationIndicationAuthorizeFilter( CMPIIndicationMI* mi, const CMPIContext* cc, const CMPISelectExp* se, const char* ns, const CMPIObjectPath* op, const char* user) { // verify filter im_verify_filter(im, se, cc, &im_err); CMReturn(CMPI_RC_OK); }
static CMPIStatus LMI_AccountInstCreationIndicationMustPoll( CMPIIndicationMI* mi, const CMPIContext* cc, const CMPISelectExp* se, const char* ns, const CMPIObjectPath* op) { // yes, this is not supported :( CMReturn(CMPI_RC_ERR_NOT_SUPPORTED); }
static CMPIStatus LMI_AccountInstCreationIndicationActivateFilter( CMPIIndicationMI* mi, const CMPIContext* cc, const CMPISelectExp* se, const char* ns, const CMPIObjectPath* op, CMPIBoolean firstActivation) { // verify filter and add it via indication manager im_verify_filter(im, se, cc, &im_err); im_add_filter(im, (CMPISelectExp*)se, cc, &im_err); CMReturn(CMPI_RC_OK); }
static CMPIStatus LMI_AccountInstCreationIndicationDeActivateFilter( CMPIIndicationMI* mi, const CMPIContext* cc, const CMPISelectExp* se, const char* ns, const CMPIObjectPath* op, CMPIBoolean lastActivation) { // remove filter from indication manager im_remove_filter(im, se, cc, &im_err); CMReturn(CMPI_RC_OK); }
static CMPIStatus LMI_AccountInstCreationIndicationEnableIndications( CMPIIndicationMI* mi, const CMPIContext* cc) { // start indications im_start_ind(im, cc, &im_err); CMReturn(CMPI_RC_OK); }
static CMPIStatus LMI_AccountInstCreationIndicationDisableIndications( CMPIIndicationMI* mi, const CMPIContext* cc) { // stop indications im_stop_ind(im, cc, &im_err); CMReturn(CMPI_RC_OK); }
CMIndicationMIStub( LMI_AccountInstCreationIndication, LMI_AccountInstCreationIndication, _cb, LMI_AccountInstCreationIndicationInitialize())
KONKRET_REGISTRATION( "root/cimv2", "LMI_AccountInstCreationIndication", "LMI_AccountInstCreationIndication", "indication")
Thanks,
Roman Rakus
openlmi-devel@lists.fedorahosted.org