merge with tridge
authorRonnie Sahlberg <sahlberg@ronnie>
Sat, 28 Apr 2007 13:11:23 +0000 (23:11 +1000)
committerRonnie Sahlberg <sahlberg@ronnie>
Sat, 28 Apr 2007 13:11:23 +0000 (23:11 +1000)
fix the logic in ctdb_connected to print CONNECTED if the node is
connected and UNAVAILABLE when the node is dead  instead of the opposite

1  2 
common/ctdb_client.c
tools/ctdb_control.c

Simple merge
index 6057a186f3db3fba32c0447e7451ef2940f0cd2a,c3ad212f97b1794ef7776851196e10fbf99ad50d..3a8bb777e901b9cca858cda0259cac49b1dbaa6e
@@@ -156,71 -154,6 +156,74 @@@ static int control_getvnnmap(struct ctd
        return 0;
  }
  
-               printf("vnn:%d %s\n", nodemap->nodes[i].vnn, nodemap->nodes[i].flags&NODE_FLAGS_CONNECTED?"UNAVAILABLE":"CONNECTED");
 +/*
 +  display a list of the databases on a remote ctdb
 + */
 +static int control_getdbmap(struct ctdb_context *ctdb, int argc, const char **argv)
 +{
 +      uint32_t vnn;
 +      int i, ret;
 +      struct ctdb_dbid_map *dbmap;
 +
 +      if (argc < 1) {
 +              usage();
 +      }
 +
 +      vnn = strtoul(argv[0], NULL, 0);
 +
 +      dbmap = talloc_zero(ctdb, struct ctdb_dbid_map);
 +      ret = ctdb_getdbmap(ctdb, vnn, dbmap);
 +      if (ret != 0) {
 +              printf("Unable to get dbids from node %u\n", vnn);
 +              talloc_free(dbmap);
 +              return ret;
 +      }
 +
 +      printf("Number of databases:%d\n", dbmap->num);
 +      for(i=0;i<dbmap->num;i++){
 +              const char *path;
 +
 +              ctdb_getdbpath(ctdb, dbmap->dbids[i], dbmap, &path);
 +              printf("dbid:0x%08x path:%s\n", dbmap->dbids[i], path);
 +      }
 +      talloc_free(dbmap);
 +      return 0;
 +}
 +
 +/*
 +  display a list nodes known to a remote ctdb
 + */
 +static int control_getnodemap(struct ctdb_context *ctdb, int argc, const char **argv)
 +{
 +      uint32_t vnn;
 +      int i, ret;
 +      struct ctdb_node_map *nodemap;
 +
 +      if (argc < 1) {
 +              usage();
 +      }
 +
 +      vnn = strtoul(argv[0], NULL, 0);
 +
 +      nodemap = talloc_zero(ctdb, struct ctdb_node_map);
 +      ret = ctdb_getnodemap(ctdb, vnn, nodemap);
 +      if (ret != 0) {
 +              printf("Unable to get nodemap from node %u\n", vnn);
 +              talloc_free(nodemap);
 +              return ret;
 +      }
 +
 +      printf("Number of nodes:%d\n", nodemap->num);
 +      for(i=0;i<nodemap->num;i++){
++              printf("vnn:%d %s\n", nodemap->nodes[i].vnn,
++                      nodemap->nodes[i].vnn==vnn?"THIS NODE": 
++                      nodemap->nodes[i].flags&NODE_FLAGS_CONNECTED?
++                              "CONNECTED":"UNAVAILABLE");
 +      }
 +      talloc_free(nodemap);
 +      return 0;
 +}
 +
  /*
    set remote ctdb vnn map
   */