[OVN] Fix check_for_ha_chassis_group_address maintenance task

Add a default value to the max() built-in method while looking for the
highest priority chassis in the HA Chassis Group and to avoid the
following error:

2020-03-20 10:05:35.160 27 ERROR futurist.periodics   File
"/usr/lib/python3.6/site-packages/futurist/periodics.py", line 293, in
run
2020-03-20 10:05:35.160 27 ERROR futurist.periodics     work()
2020-03-20 10:05:35.160 27 ERROR futurist.periodics   File
"/usr/lib/python3.6/site-packages/futurist/periodics.py", line 67, in
__call__
2020-03-20 10:05:35.160 27 ERROR futurist.periodics     return
self.callback(*self.args, **self.kwargs)
2020-03-20 10:05:35.160 27 ERROR futurist.periodics   File
"/usr/lib/python3.6/site-packages/futurist/periodics.py", line 181, in
decorator
2020-03-20 10:05:35.160 27 ERROR futurist.periodics     return f(*args,
**kwargs)
2020-03-20 10:05:35.160 27 ERROR futurist.periodics   File
"/usr/lib/python3.6/site-packages/neutron/plugins/ml2/drivers/ovn/mech_driver/ovsdb/maintenance.py",
line 576, in check_for_ha_chassis_group_address
2020-03-20 10:05:35.160 27 ERROR futurist.periodics     high_prio_ch =
max(default_ch_grp.ha_chassis, key=lambda x: x.priority)
2020-03-20 10:05:35.160 27 ERROR futurist.periodics ValueError: max()
arg is an empty sequence

Change-Id: Ifeb1ed8a4eac1d2c34a2d1d306a41708d80b4110
Signed-off-by: Lucas Alvares Gomes <lucasagomes@gmail.com>
This commit is contained in:
Lucas Alvares Gomes 2020-03-20 11:16:43 +00:00
parent c87164a630
commit f9d6076aec
1 changed files with 2 additions and 1 deletions

View File

@ -573,7 +573,8 @@ class DBInconsistenciesPeriodics(SchemaAwarePeriodicsBase):
# NOTE(lucasagomes): Find the existing chassis with the highest
# priority and keep it as being the highest to avoid moving
# things around
high_prio_ch = max(default_ch_grp.ha_chassis, key=lambda x: x.priority)
high_prio_ch = max(default_ch_grp.ha_chassis, key=lambda x: x.priority,
default=None)
all_ch = self._sb_idl.get_all_chassis()
gw_ch = self._sb_idl.get_gateway_chassis_from_cms_options()