mirror of
https://github.com/samba-team/samba.git
synced 2025-02-26 21:57:41 +03:00
no longer wait at startup for services to become available, instead
set the node initially unhealthy and let the status monitoring bring the node online. This fixes a problem with winbindd, where it refused to start because secrets.tdb was not populated but we could not populate ctdbd, because the net command would not run while ctdbd was still doing startup and thus frozen (This used to be ctdb commit 3a001b793dd76fb96addf1e2ccb74da326fbcfbc)
This commit is contained in:
parent
4178cb98a1
commit
b87ddd9148
@ -30,10 +30,6 @@ case $cmd in
|
|||||||
# create the state directory for samba
|
# create the state directory for samba
|
||||||
/bin/mkdir -p $CTDB_BASE/state/samba
|
/bin/mkdir -p $CTDB_BASE/state/samba
|
||||||
|
|
||||||
# wait for all shared directories to become available
|
|
||||||
smb_dirs=`testparm -s 2> /dev/null | egrep '^\s*path = ' | cut -d= -f2`
|
|
||||||
ctdb_wait_directories "Samba" $smb_dirs
|
|
||||||
|
|
||||||
# make sure samba is not already started
|
# make sure samba is not already started
|
||||||
service smb stop > /dev/null 2>&1
|
service smb stop > /dev/null 2>&1
|
||||||
service winbind stop > /dev/null 2>&1
|
service winbind stop > /dev/null 2>&1
|
||||||
@ -48,13 +44,6 @@ case $cmd in
|
|||||||
# anything else
|
# anything else
|
||||||
service winbind start
|
service winbind start
|
||||||
nice service smb start
|
nice service smb start
|
||||||
|
|
||||||
# wait for the Samba tcp ports to become available
|
|
||||||
smb_ports=`testparm -s --parameter-name="smb ports" 2> /dev/null`
|
|
||||||
ctdb_wait_tcp_ports "Samba" $smb_ports
|
|
||||||
|
|
||||||
# wait for winbind to be ready
|
|
||||||
ctdb_wait_command "winbind" "wbinfo -p"
|
|
||||||
;;
|
;;
|
||||||
|
|
||||||
takeip)
|
takeip)
|
||||||
|
@ -17,12 +17,6 @@ case $cmd in
|
|||||||
/bin/mkdir -p $CTDB_BASE/state/nfs
|
/bin/mkdir -p $CTDB_BASE/state/nfs
|
||||||
/bin/mkdir -p $CTDB_BASE/state/statd/ip
|
/bin/mkdir -p $CTDB_BASE/state/statd/ip
|
||||||
/bin/mkdir -p $STATD_SHARED_DIRECTORY
|
/bin/mkdir -p $STATD_SHARED_DIRECTORY
|
||||||
ctdb_wait_directories "nfslock" "$STATD_SHARED_DIRECTORY"
|
|
||||||
|
|
||||||
|
|
||||||
# wait for all nfs exported directories to become available
|
|
||||||
nfs_dirs=`grep -v '^#' < /etc/exports | cut -d' ' -f1`
|
|
||||||
ctdb_wait_directories "NFS" $nfs_dirs
|
|
||||||
|
|
||||||
# make sure nfs is stopped before we start it, or it may get a bind error
|
# make sure nfs is stopped before we start it, or it may get a bind error
|
||||||
service nfs stop > /dev/null 2>&1
|
service nfs stop > /dev/null 2>&1
|
||||||
|
@ -61,6 +61,12 @@ static void flag_change_handler(struct ctdb_context *ctdb, uint64_t srvid,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void print_exit_message(void)
|
||||||
|
{
|
||||||
|
DEBUG(0,("CTDB daemon shutting down\n"));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* called when the "startup" event script has finished */
|
/* called when the "startup" event script has finished */
|
||||||
static void ctdb_start_transport(struct ctdb_context *ctdb, int status, void *p)
|
static void ctdb_start_transport(struct ctdb_context *ctdb, int status, void *p)
|
||||||
{
|
{
|
||||||
@ -81,6 +87,9 @@ static void ctdb_start_transport(struct ctdb_context *ctdb, int status, void *p)
|
|||||||
exit(11);
|
exit(11);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Make sure we log something when the daemon terminates */
|
||||||
|
atexit(print_exit_message);
|
||||||
|
|
||||||
/* a handler for when nodes are disabled/enabled */
|
/* a handler for when nodes are disabled/enabled */
|
||||||
ctdb_register_message_handler(ctdb, ctdb, CTDB_SRVID_NODE_FLAGS_CHANGED,
|
ctdb_register_message_handler(ctdb, ctdb, CTDB_SRVID_NODE_FLAGS_CHANGED,
|
||||||
flag_change_handler, NULL);
|
flag_change_handler, NULL);
|
||||||
@ -566,11 +575,6 @@ static int unlink_destructor(const char *name)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void print_exit_message(void)
|
|
||||||
{
|
|
||||||
DEBUG(0,("CTDB daemon shutting down\n"));
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
start the protocol going as a daemon
|
start the protocol going as a daemon
|
||||||
*/
|
*/
|
||||||
@ -594,9 +598,6 @@ int ctdb_start_daemon(struct ctdb_context *ctdb, bool do_fork)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Make sure we log something when the daemon terminates */
|
|
||||||
atexit(print_exit_message);
|
|
||||||
|
|
||||||
tdb_reopen_all(False);
|
tdb_reopen_all(False);
|
||||||
|
|
||||||
if (do_fork) {
|
if (do_fork) {
|
||||||
|
@ -119,8 +119,8 @@ static int ctdb_add_node(struct ctdb_context *ctdb, char *nstr)
|
|||||||
/* this assumes that the nodes are kept in sorted order, and no gaps */
|
/* this assumes that the nodes are kept in sorted order, and no gaps */
|
||||||
node->pnn = ctdb->num_nodes;
|
node->pnn = ctdb->num_nodes;
|
||||||
|
|
||||||
/* nodes start out disconnected */
|
/* nodes start out disconnected and unhealthy */
|
||||||
node->flags |= NODE_FLAGS_DISCONNECTED;
|
node->flags |= NODE_FLAGS_DISCONNECTED | NODE_FLAGS_UNHEALTHY;
|
||||||
|
|
||||||
if (ctdb->address.address &&
|
if (ctdb->address.address &&
|
||||||
ctdb_same_address(&ctdb->address, &node->address)) {
|
ctdb_same_address(&ctdb->address, &node->address)) {
|
||||||
|
@ -50,7 +50,7 @@ static void test_store_records(struct ctdb_context *ctdb, struct event_context *
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("Current value: %*.*s\n", data.dsize, data.dsize, data.dptr);
|
printf("Current value: %*.*s\n", (int)data.dsize, (int)data.dsize, data.dptr);
|
||||||
|
|
||||||
if (data.dsize != 0) {
|
if (data.dsize != 0) {
|
||||||
if (sscanf((char *)data.dptr, "Node %u Count %u", &node, &count) != 2) {
|
if (sscanf((char *)data.dptr, "Node %u Count %u", &node, &count) != 2) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user