Let the caller do the cleanup, as needed.
Signed-off-by: Ihar Hrachyshka <[email protected]>
---
northd/northd.c | 23 +++++++++++++----------
1 file changed, 13 insertions(+), 10 deletions(-)
diff --git a/northd/northd.c b/northd/northd.c
index f2406890c..ace663d54 100644
--- a/northd/northd.c
+++ b/northd/northd.c
@@ -4292,7 +4292,7 @@ ovn_port_find_in_datapath(struct ovn_datapath *od,
static bool
ls_port_init(struct ovn_port *op, struct ovsdb_idl_txn *ovnsb_txn,
- struct hmap *ls_ports, struct ovn_datapath *od,
+ struct ovn_datapath *od,
const struct sbrec_port_binding *sb,
const struct sbrec_mirror_table *sbrec_mirror_table,
const struct sbrec_chassis_table *sbrec_chassis_table,
@@ -4320,11 +4320,6 @@ ls_port_init(struct ovn_port *op, struct ovsdb_idl_txn
*ovnsb_txn,
}
/* Assign new tunnel ids where needed. */
if (!ovn_port_allocate_key(sbrec_chassis_table, op)) {
- if (op->sb) {
- sbrec_port_binding_delete(op->sb);
- }
- ovs_list_remove(&op->list);
- ovn_port_destroy(ls_ports, op);
return false;
}
ovn_port_update_sbrec(ovnsb_txn, sbrec_chassis_by_name,
@@ -4345,9 +4340,13 @@ ls_port_create(struct ovsdb_idl_txn *ovnsb_txn, struct
hmap *ls_ports,
struct ovn_port *op = ovn_port_create(ls_ports, key, nbsp, NULL,
NULL);
hmap_insert(&od->ports, &op->dp_node, hmap_node_hash(&op->key_node));
- if (!ls_port_init(op, ovnsb_txn, ls_ports, od, sb,
+ if (!ls_port_init(op, ovnsb_txn, od, sb,
sbrec_mirror_table, sbrec_chassis_table,
sbrec_chassis_by_name, sbrec_chassis_by_hostname)) {
+ if (op->sb) {
+ sbrec_port_binding_delete(op->sb);
+ }
+ ovs_list_remove(&op->list);
ovn_port_destroy(ls_ports, op);
return NULL;
}
@@ -4357,7 +4356,6 @@ ls_port_create(struct ovsdb_idl_txn *ovnsb_txn, struct
hmap *ls_ports,
static bool
ls_port_reinit(struct ovn_port *op, struct ovsdb_idl_txn *ovnsb_txn,
- struct hmap *ls_ports,
const struct nbrec_logical_switch_port *nbsp,
const struct nbrec_logical_router_port *nbrp,
struct ovn_datapath *od,
@@ -4371,7 +4369,7 @@ ls_port_reinit(struct ovn_port *op, struct ovsdb_idl_txn
*ovnsb_txn,
op->sb = sb;
ovn_port_set_nb(op, nbsp, nbrp);
op->l3dgw_port = op->cr_port = NULL;
- return ls_port_init(op, ovnsb_txn, ls_ports, od, sb,
+ return ls_port_init(op, ovnsb_txn, od, sb,
sbrec_mirror_table, sbrec_chassis_table,
sbrec_chassis_by_name, sbrec_chassis_by_hostname);
}
@@ -4546,12 +4544,17 @@ ls_handle_lsp_changes(struct ovsdb_idl_txn
*ovnsb_idl_txn,
op->visited = true;
continue;
}
- if (!ls_port_reinit(op, ovnsb_idl_txn, &nd->ls_ports,
+ if (!ls_port_reinit(op, ovnsb_idl_txn,
new_nbsp, NULL,
od, sb, ni->sbrec_mirror_table,
ni->sbrec_chassis_table,
ni->sbrec_chassis_by_name,
ni->sbrec_chassis_by_hostname)) {
+ if (op->sb) {
+ sbrec_port_binding_delete(op->sb);
+ }
+ ovs_list_remove(&op->list);
+ ovn_port_destroy(&nd->ls_ports, op);
goto fail;
}
add_op_to_northd_tracked_ports(&trk_lsps->updated, op);
--
2.41.0
_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev