[patch libteam] Log more detailed error messages from get_ifinfo_list() and retry if nl_recvmsgs() returns NLE_DUMP_INTR Signed-off-by: Chris Card <ctcard@hotmail.com>
by Chris Card
---
libteam/ifinfo.c | 57 +++++++++++++++++++++++++++++++++++++++-----------------
1 file changed, 40 insertions(+), 17 deletions(-)
diff --git a/libteam/ifinfo.c b/libteam/ifinfo.c
index 47b342c..9754ffa 100644
--- a/libteam/ifinfo.c
+++ b/libteam/ifinfo.c
@@ -367,23 +367,46 @@ int get_ifinfo_list(struct team_handle *th)
};
int ret;
- ret = nl_send_simple(th->nl_cli.sock, RTM_GETLINK, NLM_F_DUMP,
- &rt_hdr, sizeof(rt_hdr));
- if (ret < 0)
- return -nl2syserr(ret);
- orig_cb = nl_socket_get_cb(th->nl_cli.sock);
- cb = nl_cb_clone(orig_cb);
- nl_cb_put(orig_cb);
- if (!cb)
- return -ENOMEM;
-
- nl_cb_set(cb, NL_CB_VALID, NL_CB_CUSTOM, valid_handler, th);
-
- ret = nl_recvmsgs(th->nl_cli.sock, cb);
- nl_cb_put(cb);
- if (ret < 0)
- return -nl2syserr(ret);
- return check_call_change_handlers(th, TEAM_IFINFO_CHANGE);
+ int retry = 1;
+ while (retry)
+ {
+ retry = 0;
+ ret = nl_send_simple(th->nl_cli.sock, RTM_GETLINK, NLM_F_DUMP,
+ &rt_hdr, sizeof(rt_hdr));
+ if (ret < 0)
+ {
+ err(th, "get_ifinfo_list: nl_send_simple failed: ret = %d", ret);
+ return -nl2syserr(ret);
+ }
+ orig_cb = nl_socket_get_cb(th->nl_cli.sock);
+ cb = nl_cb_clone(orig_cb);
+ nl_cb_put(orig_cb);
+ if (!cb)
+ {
+ err(th, "get_ifinfo_list: nl_cb_clone failed");
+ return -ENOMEM;
+ }
+
+ nl_cb_set(cb, NL_CB_VALID, NL_CB_CUSTOM, valid_handler, th);
+
+ ret = nl_recvmsgs(th->nl_cli.sock, cb);
+ nl_cb_put(cb);
+ if (ret < 0)
+ {
+ err(th, "get_ifinfo_list: nl_recvmsgs failed: ret = %d", ret);
+ if (ret != -NLE_DUMP_INTR)
+ {
+ return -nl2syserr(ret);
+ }
+ retry = 1;
+ }
+ }
+ ret = check_call_change_handlers(th, TEAM_IFINFO_CHANGE);
+ if (ret < 0)
+ {
+ err(th, "get_ifinfo_list: check_call_change_handers failed: ret = %d", ret);
+ }
+ return ret;
}
int ifinfo_list_init(struct team_handle *th)
--
1.8.3.1
7 years, 10 months
[PATCH] Fix remove and add a member port from one team to another.
by Samudrala, Sridhar
The following scenario where a member port is removed from team1
and added to team2
teamd -d -c '{"device": "team1", "ports": {"p4p1": {}}}'
teamd -d -t team2
ip link set p4p1 nomaster
ip link set p4p1 master team2
fails with this error
teamd_team2[17226]: p4p1: Port original hardware address has different length (0) than team device has (6).
This patch fixes this issue by initializing orig_hw_addr/len of a port
after it is removed from another team so that the correct address is
available when it is added to the new team.
It doesn't fix the case where the member port is directly moved to
a new team without removing it from the original team.
teamd -d -c '{"device": "team1", "ports": {"p4p1": {}}}'
teamd -d -t team2
ip link set p4p1 master team2
In this scenario teamd gets a notification only after the port is added
to the new team.
It is not clear how to address this scenario OR if we should block
adding a member port to a team if it is already a member of another team.
Signed-off-by: Sridhar Samudrala <sridhar.samudrala(a)intel.com>
---
libteam/ifinfo.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/libteam/ifinfo.c b/libteam/ifinfo.c
index 47b342c..632f5f1 100644
--- a/libteam/ifinfo.c
+++ b/libteam/ifinfo.c
@@ -116,6 +116,11 @@ static void update_hwaddr(struct team_ifinfo *ifinfo, struct rtnl_link *link)
memcpy(ifinfo->orig_hwaddr, hwaddr, hwaddr_len);
set_changed(ifinfo, CHANGED_HWADDR);
}
+
+ if (!ifinfo->master_ifindex && !ifinfo->orig_hwaddr_len) {
+ ifinfo->orig_hwaddr_len = hwaddr_len;
+ memcpy(ifinfo->orig_hwaddr, hwaddr, hwaddr_len);
+ }
}
static void update_ifname(struct team_ifinfo *ifinfo, struct rtnl_link *link)
--
2.1.0
7 years, 10 months
[Patch][Manpage][teamd.conf] The agg_select_policy is named port_config not port_options
by Peter Schmitt
Hi,
by looking at the sourcecode, I found out that there is a bug in the man
page of teamd.conf.
The agg_select_policy option for the lacp runner recognizes the option
port_config and not, as
stated in the man page, port_options.
--- libteam-1.22/man/teamd.conf.5 2015-10-05 15:37:26.000000000 +0200
+++ libteam-1.22.patched/man/teamd.conf.5 2015-11-05
09:22:07.981631626 +0100
@@ -256,7 +256,7 @@ Select aggregator with highest total ban
.BR "count "\(em
Select aggregator with highest number of ports.
.PP
-.BR "port_options "\(em
+.BR "port_config "\(em
Aggregator with highest priority according to per-port options
.BR "prio " and
.BR "sticky "
Best regards,
Peter
7 years, 10 months
teamdctl port config update changes not adopted
by Peter Schmitt
Hi,
I am currently testing libteam, especially I am testing the activebackup
runner and I have found that my changes done with
teamdctl <device> port config update <port> '{<config>}'
are not adopted by the devices. I am setting up a teamdevice without
ports configured:
{
"device": "bond0",
"link_watch": {
"name": "ethtool"
},
"runner": {
"name": "activebackup",
"hwaddr_policy" : "same_all"
}
}
and start teamd afterwards:
teamd -d -o -N -f /var/run/teamd/bond0.config -g -t bond0
I add two ports to this device:
teamdctl bond0 port add eth1
teamdctl bond0 port add eth2
and set the config for these
teamdctl bond0 port config update eth1 '{"prio":1000, "sticky":true}'
teamdctl bond0 port config update eth2 '{"prio":10, "sticky":false}'
so that eth1 should be the preferred slave.
Now I see the following lines in the logs:
teamd_bond0[6614] eth1: Using sticky "0".
If I set the ethX devices to down and up with 'ip link', I see the
following in the logs:
teamd_bond0[6614] Found best port: "eth1" (ifindex "8", prio "0").
[...]
teamd_bond0[6614] eth2: ethtool-link went up.
teamd_bond0[6614] Current active port: "eth1" (ifindex "8", prio "0").
So it seems that the values that were configured with the "port config
update" were not adopted.
The active-backup failover does behave exactly like this. If I set eth1
to down and than up again with
ip link set dev eth1 down | up
eth2 stays the active slave.
Teamdctl however shows my configuration:
> teamdctl bond0 port config dump eth1
{
"prio": 1000,
"sticky": true
}
and
> teamdctl bond0 port config dump eth2
{
"prio": 10,
"sticky": false
}
I also noticed that I can rename the configs to "prioasdasda" for
example and teamdctl does not complain
and it shows the options as they were typed.
When I start the teamd with the interfaces and options configured in the
config file, the active-backup switches work as expected.
However when I change the priorities using teamdctl, these new settings
are not reflected in the system. All the devices still have
their initial configuration.
Do I miss something here? What do I need to do to let the new
configuration be adopted?
I am using kernel 3.18. If you need any further information or want me
to try something out, I can reproduce this anytime.
Thank you in advance,
Peter
7 years, 10 months