[ClusterLabs] Determine a resource's current host in the CIB

Reid Wahl nwahl at redhat.com
Thu Sep 24 03:19:27 EDT 2020


**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>`)

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/



-- 
Regards,

Reid Wahl, RHCA
Software Maintenance Engineer, Red Hat
CEE - Platform Support Delivery - ClusterHA



More information about the Users mailing list