mirror of
https://github.com/CumulusNetworks/ifupdown2.git
synced 2024-05-06 15:54:50 +00:00
Ticket: CM-10437 Reviewed By: CCR-4480 Testing Done: Created a bond and made sure it's lacp_rate could be set fast or slow wioth or without specifying the mode. The current code assumes that for a bond to be in 802.3ad mode the "bond-mode" parameter has to be specified in the list of bond attributes being set. Only then will ifupdown2 allow the lacp_rate and lacp_bypass attributes to be set. But since we have changed the default mode to be 802.3ad, the mode attribute no longer needs to be specified for a bond to be in 802.3ad mode. So, instead of doing a check for the configuration attributes to determine the mode, the linkinfo cache is checked. And the cache is refreshed, just in case the mode attribute has been specified and just previously been set. The order in which the attributes are set is fixed for bonds, and the mode is always set prior to the lacp_rate and lacp_bypass attributes. Also, while testing this I noticed another assumption about the default value of an attribute: min_links. A warning is displayed when min_links is not specified or set to 0, and the mode is set to 802.3ad. Well, now that the default for min_links is 1 it doesn't have to be specified, even if the mode is set to 802.3ad. So ifupdown2 checks the current state of min_links if it is not specified as one of the attibutes. If it is 0, either by being specified as an attribute or not being specified but having that value, and the mode is set to 802.3ad, a warning is displayed. And there was this other little problem where if a bond already existed in the linkcache it wouldn't be refreshed, even if the refresh=True parameter was specified in the _bond_linkinfo_fill function.