Merge "[OVN] Skip ports with VNIC type direct and no port binding"

This commit is contained in:
Zuul 2023-02-15 14:51:59 +00:00 committed by Gerrit Code Review
commit 30f0150535
2 changed files with 8 additions and 2 deletions

View File

@ -938,7 +938,11 @@ class DBInconsistenciesPeriodics(SchemaAwarePeriodicsBase):
n_context.get_admin_context(), portbindings.VNIC_DIRECT)
with self._nb_idl.transaction(check_error=True) as txn:
for pb in port_bindings:
profile = jsonutils.loads(pb.profile)
try:
profile = jsonutils.loads(pb.profile)
except ValueError:
continue
capabilities = profile.get(ovn_const.PORT_CAP_PARAM, [])
external_ids = {
ovn_const.OVN_PORT_VNIC_TYPE_KEY: portbindings.VNIC_DIRECT,

View File

@ -841,7 +841,8 @@ class TestDBInconsistenciesPeriodics(testlib_api.SqlTestCaseLight,
profile = {'capabilities': ['switchdev']}
pb1 = mock.Mock(profile=jsonutils.dumps(profile), port_id='port1')
pb2 = mock.Mock(profile=jsonutils.dumps(profile), port_id='port2')
mock_get_pb.return_value = [pb1, pb2]
pb3 = mock.Mock(profile='', port_id='port3')
mock_get_pb.return_value = [pb1, pb2, pb3]
self.assertRaises(
periodics.NeverAgain,
@ -854,3 +855,4 @@ class TestDBInconsistenciesPeriodics(testlib_api.SqlTestCaseLight,
mock.call(lport_name='port2', if_exists=True,
external_ids=external_ids)]
nb_idl.set_lswitch_port.assert_has_calls(expected_calls)
self.assertEqual(2, nb_idl.set_lswitch_port.call_count)