mirror of
https://github.com/CumulusNetworks/ifupdown2.git
synced 2024-05-06 15:54:50 +00:00
addons: vrf: fix check in vrf map initialization when no running vrfs present
Ticket: CM-10178 Review: trivial Testing: tested with failing testcase in the CM This patch fixes a check in vrf map initialization code which did not account for running vrfs correctly. This caused the case where there were no running vrfs but stale map file to fail. Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com> addons,ifupdown,sbin: adding ifquery --with-defaults option Ticket: CM-7840 Reviewed By: Roopa Prabhu Testing Done: yes, by installing ifupdown .deb file onto dell-s3000-02 This patch adds a new argument '--with-defaults' to 'ifquery' when 'ifquery --with-defaults' is executed, running states of all interface attributes are compared against respective configured attributes from /etc/network/interfaces file, if configured. Otherwise, compared against default attributes from policy file Signed-off-by: Nikhil <nikhil@cumulusnetworks.com>
This commit is contained in:
@@ -123,7 +123,7 @@ class ethtool(moduleBase,utilsBase):
|
||||
def _pre_down(self, ifaceobj):
|
||||
pass #self._post_up(ifaceobj,operation="_pre_down")
|
||||
|
||||
def _query_check(self, ifaceobj, ifaceobjcurr):
|
||||
def _query_check(self, ifaceobj, ifaceobjcurr, withdefaults):
|
||||
"""
|
||||
_query_check() needs to compare the configured (or running)
|
||||
attribute with the running attribute.
|
||||
@@ -133,11 +133,13 @@ class ethtool(moduleBase,utilsBase):
|
||||
This is because a reboot will lose their running attribute
|
||||
(the default will get set).
|
||||
"""
|
||||
# Add default attributes if --with-defaults is set
|
||||
for attr in ['speed', 'duplex', 'autoneg']:
|
||||
configured = ifaceobj.get_attr_value_first('link-%s'%attr)
|
||||
# if there is nothing configured, do not check
|
||||
if not configured:
|
||||
continue
|
||||
if not withdefaults:
|
||||
continue
|
||||
default = policymanager.policymanager_api.get_iface_default(
|
||||
module_name='ethtool',
|
||||
ifname=ifaceobj.name,
|
||||
@@ -266,6 +268,7 @@ class ethtool(moduleBase,utilsBase):
|
||||
self._init_command_handlers()
|
||||
|
||||
if operation == 'query-checkcurr':
|
||||
op_handler(self, ifaceobj, query_ifaceobj)
|
||||
op_handler(self, ifaceobj, query_ifaceobj,
|
||||
extra_args['withdefaults'] if 'withdefaults' in extra_args else False)
|
||||
else:
|
||||
op_handler(self, ifaceobj)
|
||||
|
Reference in New Issue
Block a user