Ensure we don't pass empty addresses to lsp_set_addresses

If we somehow have an empty set of addresses, lsp_set_addresses
will fail. This instead calls db_clear() on the addresses field if
we are trying to set it to empty.

Closes-bug: #1860560

Change-Id: Ied92eb85b74e63a7317d50970b5131fb49e3e4b0
This commit is contained in:
Terry Wilson 2020-01-21 16:12:45 -06:00
parent e15d1003f8
commit c6a5b284b5
1 changed files with 7 additions and 2 deletions

View File

@ -435,8 +435,13 @@ class DBInconsistenciesPeriodics(object):
elif not type_ and ovn_const.UNKNOWN_ADDR in addresses:
addresses.remove(ovn_const.UNKNOWN_ADDR)
self._nb_idl.lsp_set_addresses(
port.name, addresses=addresses).execute(check_error=True)
if addresses:
self._nb_idl.lsp_set_addresses(
port.name, addresses=addresses).execute(check_error=True)
else:
self._nb_idl.db_clear(
'Logical_Switch_Port', port.name,
'addresses').execute(check_error=True)
raise periodics.NeverAgain()