}
static void print_nodemap(TALLOC_CTX *mem_ctx, struct ctdb_context *ctdb,
- struct ctdb_node_map *nodemap, uint32_t mypnn)
+ struct ctdb_node_map *nodemap, uint32_t mypnn,
+ bool print_header)
{
struct ctdb_node_and_flags *node;
int num_deleted_nodes = 0;
}
}
- if (num_deleted_nodes == 0) {
- printf("Number of nodes:%d\n", nodemap->num);
- } else {
- printf("Number of nodes:%d (including %d deleted nodes)\n",
- nodemap->num, num_deleted_nodes);
+ if (print_header) {
+ if (num_deleted_nodes == 0) {
+ printf("Number of nodes:%d\n", nodemap->num);
+ } else {
+ printf("Number of nodes:%d "
+ "(including %d deleted nodes)\n",
+ nodemap->num, num_deleted_nodes);
+ }
}
for (i=0; i<nodemap->num; i++) {
{
int i;
- print_nodemap(mem_ctx, ctdb, nodemap, mypnn);
+ print_nodemap(mem_ctx, ctdb, nodemap, mypnn, true);
if (vnnmap->generation == INVALID_GENERATION) {
printf("Generation:INVALID\n");
const char *nodestring = NULL;
struct ctdb_node_map *nodemap;
int ret, i;
+ bool print_hdr = false;
if (argc > 1) {
usage("nodestatus");
if (argc == 1) {
nodestring = argv[0];
+ if (strcmp(nodestring, "all") == 0) {
+ print_hdr = true;
+ }
}
if (! parse_nodestring(mem_ctx, ctdb, nodestring, &nodemap)) {
if (options.machinereadable) {
print_nodemap_machine(mem_ctx, ctdb, nodemap, ctdb->cmd_pnn);
} else {
- print_nodemap(mem_ctx, ctdb, nodemap, ctdb->cmd_pnn);
+ print_nodemap(mem_ctx, ctdb, nodemap, ctdb->cmd_pnn, print_hdr);
}
ret = 0;