[ClusterLabs] Antw: [EXT] Re: Determine a resource's current host in the CIB
Ulrich Windl
Ulrich.Windl at rz.uni-regensburg.de
Tue Sep 29 09:02:00 EDT 2020
>>> Digimer <lists at alteeve.ca> schrieb am 24.09.2020 um 17:17 in Nachricht
<6dd863d8-e749-bf22-e270-0b52db4996c7 at alteeve.ca>:
> On 2020-09-24 3:19 a.m., Reid Wahl wrote:
>> **Directly via the CIB**, I don't see a more obvious way than looking
>> for the most recent (perhaps by last-rc-change) successful
>> (rc-code="0" or rc-code="8") monitor operation. That might be
>> error-prone. I haven't looked into exactly how crm_simulate parses
>> resource status from the CIB XML yet. Others on the list might know.
>>
>> Is there a particular reason why you need to parse the status directly
>> from the CIB, as opposed to using other tools? Does your use case
>> allow you to use crm_simulate with the cib.xml as input? (e.g.,
>> `crm_simulate --xml-file=<cibfile>`)
>
> I'm writing a parser for our next HA platform, and XML is a lot more
> machine-parsable that output meant for human consumption. Also, adding a
> layer between the data and the processor seems like an avoidable failure
> point (ie: what if crm_mon output changes format and breaks the regex
> used to pull data).
>
> Programs like crm_mon and pcs have a way of determining what is running
> where, and that's fundamentally what I am trying to do as well.
Hi!
Personally I think the XML in thge CIB is quite a mess, but tools hide that
mess successfully from the user.
For the task you want to do I think there is no simple XPath query to provide
the result you need.
Probably youll have to sort the status section by last-run time, filtered by
the resource name you are interested in and the rc-code being successful. The
the last entry matching most likely describes what you are looking for.
(This is just my guess)
Regards,
Ulrich
>
> digimer
>
>> On Wed, Sep 23, 2020 at 11:04 PM Digimer <lists at alteeve.ca> wrote:
>>>
>>> Hi all,
>>>
>>> I'm trying to parse the CIB to determine which node a given resource
>>> (VM) is currently running on. I notice that the 'monitor' shows in both
>>> node's status element (from when it last ran when the node previously
>>> hosted the resource).
>>>
>>> https://pastebin.com/6RCMWdgq
>>>
>>> Specifically, I see under node 1 (the active host when the CIB was read):
>>>
>>> <lrm_rsc_op id="srv07-el6_monitor_60000"
>>> operation_key="srv07-el6_monitor_60000" operation="monitor"
>>> crm-debug-origin="do_update_resource" crm_feature_set="3.3.0"
>>> transition-key="23:85:0:829209fd-35f2-4626-a9cd-f8a50a62871e"
>>> transition-magic="0:0;23:85:0:829209fd-35f2-4626-a9cd-f8a50a62871e"
>>> exit-reason="" on_node="mk-a02n01" call-id="76" rc-code="0"
>>> op-status="0" interval="60000" last-rc-change="1600925201"
>>> exec-time="541" queue-time="0"
>>> op-digest="65d0f0c9227f2593835f5de6c9cb9d0e"/>
>>>
>>> And under node 2 (hosted the server in the past):
>>>
>>> <lrm_rsc_op id="srv07-el6_monitor_60000"
>>> operation_key="srv07-el6_monitor_60000" operation="monitor"
>>> crm-debug-origin="do_update_resource" crm_feature_set="3.3.0"
>>> transition-key="23:83:0:829209fd-35f2-4626-a9cd-f8a50a62871e"
>>> transition-magic="0:0;23:83:0:829209fd-35f2-4626-a9cd-f8a50a62871e"
>>> exit-reason="" on_node="mk-a02n02" call-id="61" rc-code="0"
>>> op-status="0" interval="60000" last-rc-change="1600925173"
>>> exec-time="539" queue-time="0"
>>> op-digest="65d0f0c9227f2593835f5de6c9cb9d0e"/>
>>>
>>> I don't see any specific entry in the CIB saying "resource X is
>>> currently hosted on node Y", so I assume I should infer which node is
>>> the current host? If so, should I look at which node's 'exec-time' is
>>> higher, or which node has the higher 'call-id'?
>>>
>>> Or am I missing a more obvious way to tell what resource is running on
>>> which node?
>>>
>>> --
>>> Digimer
>>> Papers and Projects: https://alteeve.com/w/
>>> "I am, somehow, less interested in the weight and convolutions of
>>> Einstein’s brain than in the near certainty that people of equal talent
>>> have lived and died in cotton fields and sweatshops." - Stephen Jay Gould
>>> _______________________________________________
>>> Manage your subscription:
>>> https://lists.clusterlabs.org/mailman/listinfo/users
>>>
>>> ClusterLabs home: https://www.clusterlabs.org/
>>
>>
>>
>
>
> --
> Digimer
> Papers and Projects: https://alteeve.com/w/
> "I am, somehow, less interested in the weight and convolutions of
> Einstein’s brain than in the near certainty that people of equal talent
> have lived and died in cotton fields and sweatshops." - Stephen Jay Gould
> _______________________________________________
> Manage your subscription:
> https://lists.clusterlabs.org/mailman/listinfo/users
>
> ClusterLabs home: https://www.clusterlabs.org/
More information about the Users
mailing list