Hi Lars, On Wed, Nov 21, 2012 at 04:43:08PM +0100, Lars Marowsky-Bree wrote: > On 2012-11-21T16:33:18, Dejan Muhamedagic <de...@suse.de> wrote: > > > Hi, > > > > This is little something which could help while debugging > > resource agents. Setting the environment variable __OCF_TRACE_RA > > would cause the resource agent run to be traced (as in set -x). > > PS4 is set accordingly (that's a bash feature, don't know if > > other shells support it). ocf-tester got an option (-X) to turn > > the feature on. The agent itself can also turn on/off tracing > > via ocf_start_trace/ocf_stop_trace. > > > > Do you find anything amiss? > > I *really* like this. > > But I'd like a different way to turn it on - a standard one that is > available via the CIB configuration, without modifying the script.
I don't really want that the script gets modified either. The above instructions are for people developing a new RA. > What would you think of OCF_RESKEY_RA_TRACE ? A meta attribute perhaps? That wouldn't cause a resource restart. > Our include script could > enable that; it's unlikely that the problem occurs prior to that. > > - never (default): Does nothing > - always: Always trace, write to $(which path?)/raname.rscid.$timestamp bash has a way to send trace to a separate FD, but that feature is available with version >=4.x. Otherwise, it could be messy to separate the trace from the other stderr output. Of course, one could just redirect stderr in this case. I suppose that that would work too. > - on-error: always trace, but delete on successful exit Good idea. > hb_report/history explorer could gather this too. Right. > (And yes I know this introduces a fake parameter that doesn't really > exist. But it'd be so helpful.) > > Sorry. Maybe I'm getting carried away ;-) Good points. I didn't really think much (yet) about how to further facilitate the feature, just had a vague idea that somehow lrmd should set the environment variable. Perhaps we could do something like this: # crm resource trace <rsc_id> [<action>] [<when-to-trace>] This would set the appropriate meta attribute for the resource which would trickle down to the RA. ocf-shellfuncs would then do whatever's necessary to setup the trace. The file management could get tricky though, as we don't have a single point of exit (and trap is already used elsewhere). Cheers, Dejan > > Regards, > Lars > > -- > Architect Storage/HA > SUSE LINUX Products GmbH, GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer, > HRB 21284 (AG Nürnberg) > "Experience is the name everyone gives to their mistakes." -- Oscar Wilde > > _______________________________________________________ > Linux-HA-Dev: Linux-HA-Dev@lists.linux-ha.org > http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev > Home Page: http://linux-ha.org/ _______________________________________________________ Linux-HA-Dev: Linux-HA-Dev@lists.linux-ha.org http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev Home Page: http://linux-ha.org/