Bug 754216
| Summary: | Pacemaker should provide equivalent of clustat -x (cluster and services status in xml) | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Product: | Red Hat Enterprise Linux 6 | Reporter: | Jaroslav Kortus <jkortus> | ||||||
| Component: | pacemaker | Assignee: | David Vossel <dvossel> | ||||||
| Status: | CLOSED ERRATA | QA Contact: | Cluster QE <mspqa-list> | ||||||
| Severity: | medium | Docs Contact: | |||||||
| Priority: | high | ||||||||
| Version: | 6.3 | CC: | abeekhof, cluster-maint, djansa, dvossel, fdinitto, syeghiay | ||||||
| Target Milestone: | rc | Keywords: | TechPreview | ||||||
| Target Release: | --- | ||||||||
| Hardware: | Unspecified | ||||||||
| OS: | Unspecified | ||||||||
| Whiteboard: | |||||||||
| Fixed In Version: | pacemaker-1.1.7-2.el6 | Doc Type: | Technology Preview | ||||||
| Doc Text: |
Do not document, internal change for other tools.
|
Story Points: | --- | ||||||
| Clone Of: | |||||||||
| : | 816875 (view as bug list) | Environment: | |||||||
| Last Closed: | 2012-06-20 13:48:40 UTC | Type: | --- | ||||||
| Regression: | --- | Mount Type: | --- | ||||||
| Documentation: | --- | CRM: | |||||||
| Verified Versions: | Category: | --- | |||||||
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |||||||
| Cloudforms Team: | --- | Target Upstream Version: | |||||||
| Embargoed: | |||||||||
| Bug Depends On: | |||||||||
| Bug Blocks: | 756082, 816875 | ||||||||
| Attachments: |
|
||||||||
|
Description
Jaroslav Kortus
2011-11-15 18:04:20 UTC
cibadmin -Q exposes the list of cluster resources and the actions that have been performed on them. the state/location of individual resources can be queries using crm_resource --locate (for scripts you'll probably want --quiet too). Not sure that there is a need for a new tool here. Hmm, I thought the cibadmin -Q also had states. It does. But determining the state of the service is much harder compared to clustat -x. It appears crm_mon is the most logical equivalent to 'clustat', but the output is not uniformly parseable even in HTML form.
It also appears fairly trivial to add a print_xml_status() which is uniformly parseable...:
<?xml version="1.0"?>
<crm_mon version="1.0">
<nodes>
<node name="rhel6-1" nodeid="1" state="1" dc="1" standby_onfail="0" standby="0"/>
<node name="rhel6-2" nodeid="2" state="1" dc="0" standby_onfail="0" standby="0"/>
</nodes>
<resources>
[until you get here, where each resource type (clone, group, native, etc.) have their own print functions which would need to be augmented individually in order to present parseable output.]
</resources>
</crm_mon>
So, some work is necessary here, but it looks fairly simple, though I haven't discussed with Andrew. Obviously, there are not "services" in the same way rgmanager has them - so you would probably see:
<resources>
<group ... >
<resource ... >
</group>
<resource ... />
<clone ... />
</resources>
Created attachment 559075 [details]
Sample xml of crm --as-xml output.
I've attached some sample output of the crm_mon --as-xml option I have been working on.
Jaroslav, I believe this should address your needs. Looking good. I think we want to include the node's uuid when listing where the resource is active. We also need a better name for multi_state_slave_master, lets change it to just "multi_state". Created attachment 559155 [details]
Sample 2 with Andrew's suggestions
I uploaded a new sample xml with Andrew's suggestions.
the attached xml looks very promising, I really like it :). Thanks guys. I've also changed the component back to pacemaker as I think the change to 389-ds-base was not intentional.
Technical note added. If any revisions are required, please edit the "Technical Notes" field
accordingly. All revisions will be proofread by the Engineering Content Services team.
New Contents:
Do not document, internal change for other tools.
A related patch has been committed upstream: https://github.com/beekhof/pacemaker/commit/ca5f8a9 is there any reason why --as-xml has a mandatory filename parameter? My idea was to have it like clustat -x which goes to stdout (and then enables us to filter that via gxpp for example). Can you please change it to print to stdout? Funnily enough we just spoke about this in the team meeting and reached the same conclusion: https://github.com/beekhof/pacemaker/commit/9c928be A related patch has been committed upstream: https://github.com/beekhof/pacemaker/commit/9c928be great :)
just a small remark from the patch:
+ {"as-xml", 0, 0, 'X', "Write cluster status to the named xml file"},
should not this be changed as well, when it's not writing to a file any more?
That was changed as well in the next commit. https://github.com/beekhof/pacemaker/commit/dfa526bb3dc0f99917447e9c330fda557fa014ad BZ bot apparently didn't change the status after the errata update, setting to ON_QA manually thanks for such a quick fix :).
For today I'll have another question. Would it be possible to show all resources and their states in the output?
I'd like to see the same tree no matter what the state of the cluster is. For every configured resource there should be an entry saying what it's state is.
I came to this by loosing quorum in the cluster, then the reported <resources> section includes only the STONITH agent:
<resources>
<resource id="virt-fencing" resource_agent="stonith:fence_xvm" role="Started" active="true" orphaned="false" managed="true" failed="false" failure_ignored="false" nodes_running_on="1" >
<node name="node01" id="node01" />
</resource>
</resources>
while in full operation it says:
<resources>
<resource id="virt-fencing" resource_agent="stonith:fence_xvm" role="Started" active="true" orphaned="false" managed="true" failed="false" failure_ignored="false" nodes_running_on="1" >
<node name="node01" id="node01" />
</resource>
<group id="group01" number_resources="2" >
<resource id="webserver" resource_agent="ocf::heartbeat:apache" role="Started" active="true" orphaned="false" managed="true" failed="false" failure_ignored="false" nodes_running_on="1" >
<node name="node03" id="node03" />
</resource>
<resource id="ClusterIP" resource_agent="ocf::heartbeat:IPaddr2" role="Started" active="true" orphaned="false" managed="true" failed="false" failure_ignored="false" nodes_running_on="1" >
<node name="node03" id="node03" />
</resource>
</group>
</resources>
Traditionally we skip stopped resources but it makes sense in this situation. David, can you handle this amendment please? Does the --inactive option not already accomplish this? Example: crm_mon --as-xml --inactive My understanding is the --inactive option adds the stopped resources to the xml output, which seems to be what you need. It appears to work as I would expect it to for a test scenario I have running on my box. Totally forgot about that option, thanks David. Jaraslav... all good now? $ crm_mon -1 --as-xml --inactive the output looks as expected, thank you, guys :) two remarks: 1. without -1 options it looks just "stuck", maybe it should be implied by --as-xml 2. I'd prefer --only-active option and have --inactive as default (like clustat -x in cman) pacemaker-1.1.7-5.el6.x86_64 For item 1, no problem. I'll make the -1 option implied when --as-xml is used. As for item 2, that would be changing the default behavior of the tool that has been established for almost a decade. This isn't something we can change at this point. (In reply to comment #34) > For item 1, no problem. I'll make the -1 option implied when --as-xml is used. > A related patch has been committed upstream. https://github.com/ClusterLabs/pacemaker/commit/13df1b4c23e89b024801973d82e43f6d959f6df4 Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. http://rhn.redhat.com/errata/RHBA-2012-0846.html |