mirror of
https://github.com/samba-team/samba.git
synced 2024-12-22 13:34:15 +03:00
merged the db_dir changes from volker. Changed them slightly,
to make the --dbdir option available to all ctdb tools, not just the daemon (This used to be ctdb commit add63b0ae11d8727163bb6f0c94a617d9b88ef28)
This commit is contained in:
commit
36816ee12a
@ -31,11 +31,13 @@ static struct {
|
||||
const char *transport;
|
||||
const char *myaddress;
|
||||
int self_connect;
|
||||
const char *db_dir;
|
||||
} ctdb_cmdline = {
|
||||
.nlist = NULL,
|
||||
.transport = "tcp",
|
||||
.myaddress = NULL,
|
||||
.self_connect = 0,
|
||||
.db_dir = "."
|
||||
};
|
||||
|
||||
|
||||
@ -45,6 +47,7 @@ struct poptOption popt_ctdb_cmdline[] = {
|
||||
{ "transport", 0, POPT_ARG_STRING, &ctdb_cmdline.transport, 0, "protocol transport", NULL },
|
||||
{ "self-connect", 0, POPT_ARG_NONE, &ctdb_cmdline.self_connect, 0, "enable self connect", "boolean" },
|
||||
{ "debug", 'd', POPT_ARG_INT, &LogLevel, 0, "debug level"},
|
||||
{ "dbdir", 0, POPT_ARG_STRING, &ctdb_cmdline.db_dir, 0, "directory for the tdb files", NULL },
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
@ -93,5 +96,11 @@ struct ctdb_context *ctdb_cmdline_init(struct event_context *ev)
|
||||
exit(1);
|
||||
}
|
||||
|
||||
ret = ctdb_set_tdb_dir(ctdb, ctdb_cmdline.db_dir);
|
||||
if (ret == -1) {
|
||||
printf("ctdb_set_tdb_dir failed - %s\n", ctdb_errstr(ctdb));
|
||||
exit(1);
|
||||
}
|
||||
|
||||
return ctdb;
|
||||
}
|
||||
|
@ -73,6 +73,18 @@ void ctdb_set_max_lacount(struct ctdb_context *ctdb, unsigned count)
|
||||
ctdb->max_lacount = count;
|
||||
}
|
||||
|
||||
/*
|
||||
set the directory for the local databases
|
||||
*/
|
||||
int ctdb_set_tdb_dir(struct ctdb_context *ctdb, const char *dir)
|
||||
{
|
||||
ctdb->db_directory = talloc_strdup(ctdb, dir);
|
||||
if (ctdb->db_directory == NULL) {
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
add a node to the list of active nodes
|
||||
*/
|
||||
|
@ -84,7 +84,7 @@ struct ctdb_db_context *ctdb_attach(struct ctdb_context *ctdb, const char *name,
|
||||
|
||||
/* add the node id to the database name, so when we run on loopback
|
||||
we don't conflict in the local filesystem */
|
||||
name = talloc_asprintf(ctdb_db, "%s.%u", name, ctdb_get_vnn(ctdb));
|
||||
name = talloc_asprintf(ctdb_db, "%s/%s", ctdb->db_directory, name);
|
||||
|
||||
/* when we have a separate daemon this will need to be a real
|
||||
file, not a TDB_INTERNAL, so the parent can access it to
|
||||
|
@ -71,6 +71,11 @@ struct ctdb_context *ctdb_init(struct event_context *ev);
|
||||
*/
|
||||
int ctdb_set_transport(struct ctdb_context *ctdb, const char *transport);
|
||||
|
||||
/*
|
||||
set the directory for the local databases
|
||||
*/
|
||||
int ctdb_set_tdb_dir(struct ctdb_context *ctdb, const char *dir);
|
||||
|
||||
/*
|
||||
set some flags
|
||||
*/
|
||||
|
@ -119,6 +119,7 @@ struct ctdb_context {
|
||||
struct event_context *ev;
|
||||
struct ctdb_address address;
|
||||
const char *name;
|
||||
const char *db_directory;
|
||||
uint32_t vnn; /* our own vnn */
|
||||
uint32_t num_nodes;
|
||||
uint32_t num_connected;
|
||||
@ -460,4 +461,6 @@ struct ctdb_call_state *ctdb_daemon_call_send_remote(struct ctdb_db_context *ctd
|
||||
struct ctdb_call *call,
|
||||
struct ctdb_ltdb_header *header);
|
||||
|
||||
void ctdb_request_finished(struct ctdb_context *ctdb, struct ctdb_req_header *hdr);
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user