[OVN] Do not fail to when deleting PG if it's already gone
Trivial-ish patch that sets if_exists=True to the pg_del() command when deleting the port group. Change-Id: I7c10c8fc2c11329c58fc43b9d611b0aeea2b2ed5 Signed-off-by: Lucas Alvares Gomes <lucasagomes@gmail.com>
This commit is contained in:
parent
d189d83bd7
commit
4216e43f96
|
@ -2018,7 +2018,7 @@ class OVNClient(object):
|
|||
def delete_security_group(self, context, security_group_id):
|
||||
with self._nb_idl.transaction(check_error=True) as txn:
|
||||
name = utils.ovn_port_group_name(security_group_id)
|
||||
txn.add(self._nb_idl.pg_del(name=name))
|
||||
txn.add(self._nb_idl.pg_del(name=name, if_exists=True))
|
||||
db_rev.delete_revision(context, security_group_id,
|
||||
ovn_const.TYPE_SECURITY_GROUPS)
|
||||
|
||||
|
|
|
@ -177,7 +177,7 @@ class TestOVNMechanismDriver(test_plugin.Ml2PluginV2TestCase):
|
|||
pg_name = ovn_utils.ovn_port_group_name(self.fake_sg['id'])
|
||||
|
||||
self.nb_ovn.pg_del.assert_called_once_with(
|
||||
name=pg_name)
|
||||
if_exists=True, name=pg_name)
|
||||
|
||||
mock_del_rev.assert_called_once_with(
|
||||
mock.ANY, self.fake_sg['id'], ovn_const.TYPE_SECURITY_GROUPS)
|
||||
|
@ -2844,7 +2844,7 @@ class TestOVNMechanismDriverSecurityGroup(
|
|||
|
||||
expected_pg_name = ovn_utils.ovn_port_group_name(sg['id'])
|
||||
expected_pg_del_calls = [
|
||||
mock.call(name=expected_pg_name),
|
||||
mock.call(if_exists=True, name=expected_pg_name),
|
||||
]
|
||||
self.mech_driver._nb_ovn.pg_del.assert_has_calls(
|
||||
expected_pg_del_calls)
|
||||
|
|
Loading…
Reference in New Issue