mirror of
https://github.com/samba-team/samba.git
synced 2025-01-10 01:18:15 +03:00
clean shutdown in ctdb - release all our IPs
(This used to be ctdb commit 2f196cb6a86eb85205d7de1c4cadd4e1e701c06f)
This commit is contained in:
parent
1455d7d7ad
commit
edcaa0d6a0
@ -250,7 +250,10 @@ static int32_t ctdb_control_dispatch(struct ctdb_context *ctdb,
|
||||
return ctdb->monitoring_mode;
|
||||
|
||||
case CTDB_CONTROL_SHUTDOWN:
|
||||
exit(10);
|
||||
ctdb_release_all_ips(ctdb);
|
||||
ctdb_event_script(ctdb, "shutdown");
|
||||
DEBUG(0,("shutting down\n"));
|
||||
exit(0);
|
||||
|
||||
case CTDB_CONTROL_MAX_RSN:
|
||||
CHECK_CONTROL_DATA_SIZE(sizeof(uint32_t));
|
||||
|
@ -946,5 +946,6 @@ int32_t ctdb_control_startup(struct ctdb_context *ctdb, uint32_t vnn);
|
||||
|
||||
void ctdb_takeover_client_destructor_hook(struct ctdb_client *client);
|
||||
int ctdb_event_script(struct ctdb_context *ctdb, const char *fmt, ...);
|
||||
void ctdb_release_all_ips(struct ctdb_context *ctdb);
|
||||
|
||||
#endif
|
||||
|
@ -526,3 +526,26 @@ void ctdb_takeover_client_destructor_hook(struct ctdb_client *client)
|
||||
talloc_free(tcp);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
release all IPs on shutdown
|
||||
*/
|
||||
void ctdb_release_all_ips(struct ctdb_context *ctdb)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (!ctdb->takeover.enabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (i=0;i<ctdb->num_nodes;i++) {
|
||||
struct ctdb_node *node = ctdb->nodes[i];
|
||||
if (ctdb_sys_have_ip(node->public_address)) {
|
||||
ctdb_event_script(ctdb, "releaseip %s %s %u",
|
||||
ctdb->takeover.interface,
|
||||
node->public_address,
|
||||
node->public_netmask_bits);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -30,6 +30,7 @@ case $cmd in
|
||||
;;
|
||||
|
||||
recovered)
|
||||
shutdown)
|
||||
# restart any services as necessary, like NFS
|
||||
exit 0
|
||||
;;
|
||||
|
Loading…
Reference in New Issue
Block a user