mirror of
https://github.com/samba-team/samba.git
synced 2024-12-22 13:34:15 +03:00
when adding an ip, try manually adding and takingover the ip instead of triggering a full recovery to do the same thing
(This used to be ctdb commit 4d5d22e64270cfb31be6acd71f4f97ec43df5b2c)
This commit is contained in:
parent
79eef7f2b5
commit
b046f5e3aa
@ -2021,7 +2021,7 @@ int32_t ctdb_control_send_gratious_arp(struct ctdb_context *ctdb, TDB_DATA indat
|
||||
int32_t ctdb_control_add_public_address(struct ctdb_context *ctdb, TDB_DATA indata)
|
||||
{
|
||||
struct ctdb_control_ip_iface *pub = (struct ctdb_control_ip_iface *)indata.dptr;
|
||||
|
||||
int ret;
|
||||
|
||||
/* verify the size of indata */
|
||||
if (indata.dsize < offsetof(struct ctdb_control_ip_iface, iface)) {
|
||||
@ -2039,7 +2039,14 @@ int32_t ctdb_control_add_public_address(struct ctdb_context *ctdb, TDB_DATA inda
|
||||
return -1;
|
||||
}
|
||||
|
||||
return ctdb_add_public_address(ctdb, &pub->addr, pub->mask, &pub->iface[0]);
|
||||
ret = ctdb_add_public_address(ctdb, &pub->addr, pub->mask, &pub->iface[0]);
|
||||
|
||||
if (ret != 0) {
|
||||
DEBUG(DEBUG_ERR,(__location__ " Failed to add public address\n"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1092,6 +1092,15 @@ static int control_addip(struct ctdb_context *ctdb, int argc, const char **argv)
|
||||
}
|
||||
|
||||
|
||||
/* check if some other node is already serving this ip, if not,
|
||||
* we will claim it
|
||||
*/
|
||||
for (i=0;i<ips->num;i++) {
|
||||
if (ctdb_same_ip(&addr, &ips->ips[i].addr)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
len = offsetof(struct ctdb_control_ip_iface, iface) + strlen(argv[1]) + 1;
|
||||
pub = talloc_size(tmp_ctx, len);
|
||||
CTDB_NO_MEMORY(ctdb, pub);
|
||||
@ -1108,22 +1117,21 @@ static int control_addip(struct ctdb_context *ctdb, int argc, const char **argv)
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
/* check if some other node is already serving this ip, if not,
|
||||
* we will claim it
|
||||
*/
|
||||
for (i=0;i<ips->num;i++) {
|
||||
if (ctdb_same_ip(&addr, &ips->ips[i].addr)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
/* no one has this ip so we claim it */
|
||||
if (i == ips->num) {
|
||||
ret = control_send_release(ctdb, options.pnn, &addr);
|
||||
} else {
|
||||
ret = control_send_release(ctdb, ips->ips[i].pnn, &addr);
|
||||
struct ctdb_public_ip ip;
|
||||
|
||||
ip.pnn = options.pnn;
|
||||
ip.addr = addr;
|
||||
|
||||
ret = ctdb_ctrl_takeover_ip(ctdb, TIMELIMIT(), options.pnn, &ip);
|
||||
if (ret != 0) {
|
||||
DEBUG(DEBUG_ERR,("Failed to take over IP on node %d\n", options.pnn));
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (ret != 0) {
|
||||
DEBUG(DEBUG_ERR, ("Failed to send 'change ip' to all nodes\n"));
|
||||
return -1;
|
||||
|
Loading…
Reference in New Issue
Block a user