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
*/