Andrew Beekhof 写道:
> On 10/22/07, dxj_600 <[EMAIL PROTECTED]> wrote:
>   
>> Hi,
>>
>> I use heartbeat-2.1.2, consider the following configurations:
>> <cib>
>> <configuration>
>> <crm_config> .... </crm_config>
>> <nodes>
>>   <node uname="node0" id="node0"/>
>> </nodes>
>> <resources>
>>   <primative id="rsc_xxx" class="ocf" type="Stateful" provider="heartbeat" 
>> is_managed="true">
>>   </primative>
>> </resources>
>> <constraints>
>>   <rsc_location id="location_xxx" rsc="rsc_xxx">
>>     <rule id="location_xxx_rule" score="-infinity"/>
>>   </rsc_location>
>> </constraints>
>> </configuration>
>> </cib>
>>
>> I want to code a program which can start/stop a resource, and I want the 
>> function to be synchronous.
>>   static BOOL cib_updated=FALSE;
>>   void on_cib_diff()
>>   {
>>     cib_updated=TRUE;
>>   }
>>   int start_xxx()
>>   {
>>      cib_t *cib=cib_new();
>>      cib->cmds->signon();
>>      cib_conn->cmds->add_notify_callback(cib, T_CIB_DIFF_NOTIFY, 
>> on_cib_diff);
>>
>>      code with effect: cibadmin -D -o constraints -X '<rsc_location 
>> id="location_xxx"/>'
>>      while(cib_updated==FALSE) sleep(1);
>>      /* Now, cib has been updated, and will trigger the pengine/tengine to 
>> start the resource
>>         MY QUESTION IS:
>>         WHEN and HOW can i determine that the resource xxx has been started 
>> successfully???????
>>      */
>>
>>      cib->cmds->signoff();
>>      cib=NULL;
>>   }
>>     
>
> your program should connect to the cib and subscribe to change
> notifications (the TE does this, look there for how).
>
> once you make your update, look for an lrm_rsc_op for (your resource +
> action=start + rc=0)
>
> once you see that, then you know it has started
>  
Well, when i find the result of lrm_rsc_op, how can i know that it's the result 
of my function call, or the result of a early function call, or the result of 
somebody else????
And, how about use the function cluster_status() provided in file 
lib/crm/pengine/status.c?
which will extract resource's role as one of {unkown, stopped, started, slave, 
master}
thanks
>   
> _______________________________________________
> Linux-HA mailing list
> [email protected]
> http://lists.linux-ha.org/mailman/listinfo/linux-ha
> See also: http://linux-ha.org/ReportingProblems
>
>
_______________________________________________
Linux-HA mailing list
[email protected]
http://lists.linux-ha.org/mailman/listinfo/linux-ha
See also: http://linux-ha.org/ReportingProblems

Reply via email to