mirror of
https://github.com/samba-team/samba.git
synced 2025-02-04 17:47:26 +03:00
ctdb-tools: Drop "ctdb rebalanceip"
This is undocumented and is not needed. It was a workaround for trying to ensure public IP addresses are properly rebalanced after running "ctdb addip" on multiple nodes. "ctdb reloadips" is a better solution. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
This commit is contained in:
parent
21ec67e2e9
commit
aaa57fbcb3
@ -1741,7 +1741,7 @@ Server id 0:14765 exists
|
|||||||
|
|
||||||
<!-- UNDOCUMENTED: showban stats disablemonitor enablemonitor
|
<!-- UNDOCUMENTED: showban stats disablemonitor enablemonitor
|
||||||
isnotrecmaster addtickle deltickle regsrvid unregsrvid chksrvid
|
isnotrecmaster addtickle deltickle regsrvid unregsrvid chksrvid
|
||||||
getsrvids rebalanceip setdbprio getdbprio msglisten msgsend
|
getsrvids setdbprio getdbprio msglisten msgsend
|
||||||
tfetch tstore readkey writekey
|
tfetch tstore readkey writekey
|
||||||
checktcpport getdbseqnum ipiface
|
checktcpport getdbseqnum ipiface
|
||||||
-->
|
-->
|
||||||
|
@ -908,7 +908,7 @@ int32_t ctdb_control_release_ip(struct ctdb_context *ctdb,
|
|||||||
talloc_free(vnn->takeover_ctx);
|
talloc_free(vnn->takeover_ctx);
|
||||||
vnn->takeover_ctx = NULL;
|
vnn->takeover_ctx = NULL;
|
||||||
|
|
||||||
/* Some ctdb tool commands (e.g. moveip, rebalanceip) send
|
/* Some ctdb tool commands (e.g. moveip) send
|
||||||
* lazy multicast to drop an IP from any node that isn't the
|
* lazy multicast to drop an IP from any node that isn't the
|
||||||
* intended new node. The following causes makes ctdbd ignore
|
* intended new node. The following causes makes ctdbd ignore
|
||||||
* a release for any address it doesn't host.
|
* a release for any address it doesn't host.
|
||||||
|
@ -1848,82 +1848,6 @@ done:
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int rebalance_ip(struct ctdb_context *ctdb, ctdb_sock_addr *addr)
|
|
||||||
{
|
|
||||||
struct ctdb_public_ip ip;
|
|
||||||
int ret;
|
|
||||||
uint32_t *nodes;
|
|
||||||
uint32_t disable_time;
|
|
||||||
TDB_DATA data;
|
|
||||||
struct ctdb_node_map_old *nodemap=NULL;
|
|
||||||
TALLOC_CTX *tmp_ctx = talloc_new(ctdb);
|
|
||||||
|
|
||||||
disable_time = 30;
|
|
||||||
data.dptr = (uint8_t*)&disable_time;
|
|
||||||
data.dsize = sizeof(disable_time);
|
|
||||||
ret = ctdb_client_send_message(ctdb, CTDB_BROADCAST_CONNECTED, CTDB_SRVID_DISABLE_IP_CHECK, data);
|
|
||||||
if (ret != 0) {
|
|
||||||
DEBUG(DEBUG_ERR,("Failed to send message to disable ipcheck\n"));
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
ip.pnn = -1;
|
|
||||||
ip.addr = *addr;
|
|
||||||
|
|
||||||
data.dptr = (uint8_t *)&ip;
|
|
||||||
data.dsize = sizeof(ip);
|
|
||||||
|
|
||||||
ret = ctdb_ctrl_getnodemap(ctdb, TIMELIMIT(), options.pnn, tmp_ctx, &nodemap);
|
|
||||||
if (ret != 0) {
|
|
||||||
DEBUG(DEBUG_ERR, ("Unable to get nodemap from node %u\n", options.pnn));
|
|
||||||
talloc_free(tmp_ctx);
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
nodes = list_of_active_nodes(ctdb, nodemap, tmp_ctx, true);
|
|
||||||
ret = ctdb_client_async_control(ctdb, CTDB_CONTROL_RELEASE_IP,
|
|
||||||
nodes, 0,
|
|
||||||
LONGTIMELIMIT(),
|
|
||||||
false, data,
|
|
||||||
NULL, NULL,
|
|
||||||
NULL);
|
|
||||||
if (ret != 0) {
|
|
||||||
DEBUG(DEBUG_ERR,("Failed to release IP on nodes\n"));
|
|
||||||
talloc_free(tmp_ctx);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
talloc_free(tmp_ctx);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
release an ip form all nodes and have it re-assigned by recd
|
|
||||||
*/
|
|
||||||
static int control_rebalanceip(struct ctdb_context *ctdb, int argc, const char **argv)
|
|
||||||
{
|
|
||||||
ctdb_sock_addr addr;
|
|
||||||
|
|
||||||
assert_single_node_only();
|
|
||||||
|
|
||||||
if (argc < 1) {
|
|
||||||
usage();
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (parse_ip(argv[0], NULL, 0, &addr) == 0) {
|
|
||||||
DEBUG(DEBUG_ERR,("Wrongly formed ip address '%s'\n", argv[0]));
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (rebalance_ip(ctdb, &addr) != 0) {
|
|
||||||
DEBUG(DEBUG_ERR,("Error when trying to reassign ip\n"));
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int getips_store_callback(void *param, void *data)
|
static int getips_store_callback(void *param, void *data)
|
||||||
{
|
{
|
||||||
struct ctdb_public_ip *node_ip = (struct ctdb_public_ip *)data;
|
struct ctdb_public_ip *node_ip = (struct ctdb_public_ip *)data;
|
||||||
@ -6365,7 +6289,6 @@ static const struct {
|
|||||||
{ "listnodes", control_listnodes, false, true, "list all nodes in the cluster"},
|
{ "listnodes", control_listnodes, false, true, "list all nodes in the cluster"},
|
||||||
{ "reloadnodes", control_reload_nodes_file, false, false, "reload the nodes file and restart the transport on all nodes"},
|
{ "reloadnodes", control_reload_nodes_file, false, false, "reload the nodes file and restart the transport on all nodes"},
|
||||||
{ "moveip", control_moveip, false, false, "move/failover an ip address to another node", "<ip> <node>"},
|
{ "moveip", control_moveip, false, false, "move/failover an ip address to another node", "<ip> <node>"},
|
||||||
{ "rebalanceip", control_rebalanceip, false, false, "release an ip from the node and let recd rebalance it", "<ip>"},
|
|
||||||
{ "addip", control_addip, true, false, "add a ip address to a node", "<ip/mask> <iface>"},
|
{ "addip", control_addip, true, false, "add a ip address to a node", "<ip/mask> <iface>"},
|
||||||
{ "delip", control_delip, false, false, "delete an ip address from a node", "<ip>"},
|
{ "delip", control_delip, false, false, "delete an ip address from a node", "<ip>"},
|
||||||
{ "eventscript", control_eventscript, true, false, "run the eventscript with the given parameters on a node", "<arguments>"},
|
{ "eventscript", control_eventscript, true, false, "run the eventscript with the given parameters on a node", "<arguments>"},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user