[Ocfs2-tools-devel] [PATCH 13/25] o2cb: Add ops list-clusters, list-cluster, list-nodes and list-heartbeats

Sunil Mushran sunil.mushran at oracle.com
Sun Jun 27 11:20:28 PDT 2010


On 06/23/2010 07:58 PM, Joel Becker wrote:
> On Wed, Jun 23, 2010 at 11:44:23AM -0700, Sunil Mushran wrote:
>    
>> +	if (oneline) {
>> +		verbosef(VL_OUT, "heartbeat:\n");
>> +		format = "  %s\n";
>>      
> 	This is two lines, not one.  If you're concerned about how
> list-cluster would work, your way:
>
> ------------------------------------------------
> heartbeat:
>    aaaaaaaaaaaaaaaaaaaaaaaaaa
>    bbbbbbbbbbbbbbbbbbbbbbbbbb
> node:
>    1, node1, 10.0.0.1:7777
>    2, node2, 10.0.0.2:7777
> ------------------------------------------------
>
> is a lot harder to parse than just prefixing the lines:
>
> ------------------------------------------------
> heartbeat: aaaaaaaaaaaaaaaaaaaaaaaaaa
> heartbeat: bbbbbbbbbbbbbbbbbbbbbbbbbb
> node: 1, node1, 10.0.0.1:7777
> node: 2, node2, 10.0.0.2:7777
> ------------------------------------------------
>
> In fact, we don't allow spaces, lose the commas:
>
> ------------------------------------------------
> heartbeat: aaaaaaaaaaaaaaaaaaaaaaaaaa
> heartbeat: bbbbbbbbbbbbbbbbbbbbbbbbbb
> node: 1 node1 10.0.0.1:7777
> node: 2 node2 10.0.0.2:7777
> ------------------------------------------------
>
> 	Now awk(1) loves parsing our onelines.
>    

Looks much better. I also added the clustername at the end.
Now both oneline and full, output the data in the same order.



More information about the Ocfs2-tools-devel mailing list