integ/filesystem/drbd/drbd-tools/centos/patches/0004-drbdadm-ipaddr-change.patch
Scott Little 18f91ec6be Relocate drbd-tools to stx-integ/filesystem/drbd/drbd-tools
Move content from stx-gplv2 into stx-integ

Packages will be relocated to

stx-integ:
    base/
        bash
        cgcs-users
        cluster-resource-agents
        dpkg
        haproxy
        libfdt
        netpbm
        rpm

    database/
        mariadb

    filesystem/
        iscsi-initiator-utils

    filesystem/drbd/
        drbd-tools

    kernel/kernel-modules/
        drbd
        integrity
        intel-e1000e
        intel-i40e
        intel-i40evf
        intel-ixgbe
        intel-ixgbevf
        qat17
        tpmdd

    ldap/
        ldapscripts

    networking/
        iptables
        net-tools

Change-Id: Ibf3a0fc29dc2e6a0eeb02c98ff053bdb0443a9f0
Story: 2002801
Task: 22687
Signed-off-by: Scott Little <scott.little@windriver.com>
2018-08-01 15:31:55 -04:00

133 lines
5.7 KiB
Diff

Index: git/user/drbdadm_adjust.c
===================================================================
--- git.orig/user/drbdadm_adjust.c
+++ git/user/drbdadm_adjust.c
@@ -157,6 +157,7 @@ static int opts_equal(struct context_def
static int addr_equal(struct d_resource* conf, struct d_resource* running)
{
int equal;
+ char *peer_addr, *peer_af, *peer_port;
if (conf->peer == NULL && running->peer == NULL) return 1;
if (running->peer == NULL) return 0;
@@ -165,16 +166,29 @@ static int addr_equal(struct d_resource*
!strcmp(conf->me->port, running->me->port) &&
!strcmp(conf->me->address_family, running->me->address_family);
- if(conf->me->proxy)
- equal = equal &&
- !strcmp(conf->me->proxy->inside_addr, running->peer->address) &&
- !strcmp(conf->me->proxy->inside_port, running->peer->port) &&
- !strcmp(conf->me->proxy->inside_af, running->peer->address_family);
- else
- equal = equal && conf->peer &&
- !strcmp(conf->peer->address, running->peer->address) &&
- !strcmp(conf->peer->port, running->peer->port) &&
- !strcmp(conf->peer->address_family, running->peer->address_family);
+ if(conf->me->proxy) {
+ peer_addr = conf->me->proxy->inside_addr;
+ peer_port = conf->me->proxy->inside_port;
+ peer_af = conf->me->proxy->inside_af;
+ } else {
+ peer_addr = conf->peer->address;
+ peer_port = conf->peer->port;
+ peer_af = conf->peer->address_family;
+ }
+
+ equal = equal && conf->peer &&
+ !strcmp(peer_addr, running->peer->address) &&
+ !strcmp(peer_port, running->peer->port) &&
+ !strcmp(peer_af, running->peer->address_family);
+
+ if (verbose > 2)
+ fprintf(stderr, "Network addresses differ:\n"
+ "\trunning: %s:%s:%s -- %s:%s:%s\n"
+ "\t config: %s:%s:%s -- %s:%s:%s\n",
+ running->me->address_family, running->me->address, running->me->port,
+ running->peer->address_family, running->peer->address, running->peer->port,
+ conf->me->address_family, conf->me->address, conf->me->port,
+ peer_af, peer_addr, peer_port);
return equal;
}
@@ -690,8 +704,7 @@ int adm_adjust(struct cfg_ctx *ctx)
if (ctx->res->me->proxy && can_do_proxy)
do_connect |= proxy_reconf(ctx, running);
- if (do_connect && running)
- do_disconnect = running->net_options != NULL;
+ do_disconnect = do_connect && running && (running->peer || running->net_options);
if (do_res_options)
schedule_deferred_cmd(adm_set_default_res_options, ctx, "resource-options", CFG_RESOURCE);
@@ -716,8 +729,12 @@ int adm_adjust(struct cfg_ctx *ctx)
}
if (do_connect) {
- if (do_disconnect && ctx->res->peer)
- schedule_deferred_cmd(adm_disconnect, ctx, "disconnect", CFG_NET_PREREQ);
+ /* "disconnect" specifying the end-point addresses currently in-use,
+ * before "connect"ing with the addresses currently in-config-file. */
+ if (do_disconnect) {
+ struct cfg_ctx tmp_ctx = { .res = running, .vol = vol, };
+ schedule_deferred_cmd(adm_disconnect, &tmp_ctx, "disconnect", CFG_NET_PREREQ);
+ }
schedule_deferred_cmd(adm_connect, ctx, "connect", CFG_NET);
do_net_options = 0;
}
Index: git/user/legacy/drbdadm_adjust.c
===================================================================
--- git.orig/user/legacy/drbdadm_adjust.c
+++ git/user/legacy/drbdadm_adjust.c
@@ -133,6 +133,7 @@ static int opts_equal(struct d_option* c
static int addr_equal(struct d_resource* conf, struct d_resource* running)
{
int equal;
+ char *peer_addr, *peer_af, *peer_port;
if (conf->peer == NULL && running->peer == NULL) return 1;
if (running->peer == NULL) return 0;
@@ -141,18 +142,31 @@ static int addr_equal(struct d_resource*
!strcmp(conf->me->port, running->me->port) &&
!strcmp(conf->me->address_family, running->me->address_family);
- if(conf->me->proxy)
- equal = equal &&
- !strcmp(conf->me->proxy->inside_addr, running->peer->address) &&
- !strcmp(conf->me->proxy->inside_port, running->peer->port) &&
- !strcmp(conf->me->proxy->inside_af, running->peer->address_family);
- else
- equal = equal && conf->peer &&
- !strcmp(conf->peer->address, running->peer->address) &&
- !strcmp(conf->peer->port, running->peer->port) &&
- !strcmp(conf->peer->address_family, running->peer->address_family);
+ if(conf->me->proxy) {
+ peer_addr = conf->me->proxy->inside_addr;
+ peer_port = conf->me->proxy->inside_port;
+ peer_af = conf->me->proxy->inside_af;
+ } else {
+ peer_addr = conf->peer->address;
+ peer_port = conf->peer->port;
+ peer_af = conf->peer->address_family;
+ }
+
+ equal = equal && conf->peer &&
+ !strcmp(peer_addr, running->peer->address) &&
+ !strcmp(peer_port, running->peer->port) &&
+ !strcmp(peer_af, running->peer->address_family);
+
+ if (verbose > 2)
+ fprintf(stderr, "Network addresses differ:\n"
+ "\trunning: %s:%s:%s -- %s:%s:%s\n"
+ "\t config: %s:%s:%s -- %s:%s:%s\n",
+ running->me->address_family, running->me->address, running->me->port,
+ running->peer->address_family, running->peer->address, running->peer->port,
+ conf->me->address_family, conf->me->address, conf->me->port,
+ peer_af, peer_addr, peer_port);
- return equal;
+ return equal;
}
static int proto_equal(struct d_resource* conf, struct d_resource* running)