Lionel Tricon <[EMAIL PROTECTED]> wrote on 06/11/2007 03:55:33 AM:

> Renier Morales a écrit :
> > The problem may be that the session is not subscribed to receive
> > events, when the resource failed event is reported. By the time you
> > run hpievents, the event already came and went.
> >
> > If you put your code in get_event like I've already suggested, it
> > should work.
> > You can also try running hpievents blocking for events (hpievents -h
> > for more info) while running hpitree to get your code to generate the
> > event.
> >
> > You can also look at the domain event log (with hpiel) to see if the
> > event got logged there. Events get logged in the domain event log if
> > they are of high enough severity (MINOR by default). This severity
> > threshold can be changed in openhpi.conf.
> >
> > Saludos,
> 
> In fact, after a glance into the get_event() function, it appears that
> the function do nothing except return that no events are to be processed 
:

The function's purpose is to give the plugin a chance to generate events. 
In the simulator's case, it doesn't generate any events except for the 
ones created during discovery.
The reason I told you to put your code (e.g. switch case generating failed 
resource event) in get_event was to make it easier for you to see it as 
you would only have had to run hpievents to do that.

> 
> /*
>  * Return values:
>  * 1 - events to be processed.
>  * SA_OK - No events to be processed.
>  * SA_ERR_HPI_INVALID_PARAMS - @hnd is NULL.
>  */
> SaErrorT sim_get_event(void *hnd)
> {
>         /*struct oh_handler_state *state = hnd;
>         struct oh_event *e = NULL;*/
>         if (!hnd) return SA_ERR_HPI_INVALID_PARAMS;
> 
>         /*
>         e = g_async_queue_try_pop(state->eventq_async);
>         if (e) {
>                 trace("retrieving sim event from async q");
>                 *event = *e;
>                 g_free(e);
> 
>                 return 1;
>         } else {
>                 trace("no more events for sim instance");
>                 return 0;
>         }*/
>         return SA_OK;
> }
> 
> 
> I tried to modify this function like below but now it's hanging on the
> g_async_queue_try_pop call :
> 
> SaErrorT sim_get_event(void *hnd, struct oh_event *event, struct timeval
> *timeout )
> {
>         struct oh_handler_state *state = hnd;
>         struct oh_event *e = NULL;
> 
>         if (!hnd) return SA_ERR_HPI_INVALID_PARAMS;
> 
>         e = g_async_queue_try_pop(state->eventq);
> 
>         if (e) {
>                 trace("retrieving sim event from async q");
>                 *event = *e;
>                 g_free(e);
> 
>                 return 1;
>         } else {
>                 trace("no more events for sim instance");
>                 return 0;
>         }
>         return SA_OK;
> }
> 
> 
> But, even if i understand better why it was not working, i do not
> understand now why it's hanging. Any thought ?

The code you modified had been commented out because eventq is not 
supposed to be used that way anymore.

Did you try running both hpievents and hpitree in the way I said before? 
or tried running hpiel?

> 
> Thanks,
> Lionel Tricon
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Openhpi-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openhpi-devel

Reply via email to