Skip to content

Commit 8297d72

Browse files
committed
add some debug
Signed-off-by: clyi <clyi@alauda.io>
1 parent 3a0e1ec commit 8297d72

File tree

2 files changed

+186
-1
lines changed

2 files changed

+186
-1
lines changed

dist/images/Dockerfile.base

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ ADD patches/e4e6ea9c5f4ba080b719924e470daa8094ff38a7.patch $SRC_DIR
6363
ADD patches/e7d3ba53cdcbc524bb29c54ddb07b83cc4258ed7.patch $SRC_DIR
6464
ADD patches/9286e1fd578fdb8f565a0f4aa9066b538295e1ac.patch $SRC_DIR
6565
ADD patches/737d9f932edada5a91f315b5f382daada8dee952.patch $SRC_DIR
66+
ADD patches/debug_clyi.patch $SRC_DIR
6667

6768
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
6869
--mount=type=cache,target=/var/lib/apt,sharing=locked \
@@ -125,7 +126,9 @@ RUN cd /usr/src/ && git clone -b branch-25.03 --depth=1 https://github.com/ovn-o
125126
# northd: skip arp/nd request for lrp addresses from localnet ports
126127
git apply $SRC_DIR/477695a010affe56efdd66b60510fa612f8704c1.patch && \
127128
# add skip conntrack ipcidrs support
128-
git apply $SRC_DIR/737d9f932edada5a91f315b5f382daada8dee952.patch
129+
git apply $SRC_DIR/737d9f932edada5a91f315b5f382daada8dee952.patch && \
130+
# add debug patch
131+
git apply $SRC_DIR/debug_clyi.patch
129132

130133
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
131134
--mount=type=cache,target=/var/lib/apt,sharing=locked \
Lines changed: 182 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,182 @@
1+
--- a/controller/binding.c
2+
+++ b/controller/binding.c
3+
@@ -2160,6 +2160,14 @@
4+
} else {
5+
lbinding->multiple_bindings = true;
6+
static struct vlog_rate_limit rl =
7+
VLOG_RATE_LIMIT_INIT(1, 5);
8+
+ VLOG_INFO("CLYI BINDING: Multiple bindings for LSP %s: old=[%s] new=[%s]",
9+
+ iface_id, lbinding->iface->name, iface_rec->name);
10+
+ VLOG_INFO("CLYI BINDING: Old iface ofport=%lld, new iface ofport=%lld",
11+
+ lbinding->iface->n_ofport ? *lbinding->iface->ofport : 0,
12+
+ iface_rec->n_ofport ? *iface_rec->ofport : 0);
13+
+ VLOG_INFO("CLYI BINDING: LSP %s status - installed=%s",
14+
+ iface_id,
15+
+ (lbinding->iface && smap_get_bool(&lbinding->iface->external_ids, "ovn-installed", false)) ? "true" : "false");
16+
VLOG_WARN_RL(
17+
&rl,
18+
"Invalid configuration: iface-id is configured on "
19+
@@ -2931,6 +2939,15 @@
20+
/* If multiple bindings to the same port, remove the "old" binding.
21+
* This ensures that change tracking is correct.
22+
*/
23+
if (lbinding->multiple_bindings) {
24+
+ VLOG_INFO("CLYI BINDING: Removing related lport for %s due to multiple bindings",
25+
+ pb->logical_port);
26+
+ VLOG_INFO("CLYI BINDING: LSP %s - current_chassis=%s, target_chassis=%s, up=%s",
27+
+ pb->logical_port,
28+
+ pb->chassis ? pb->chassis->name : "none",
29+
+ b_ctx_in->chassis_rec ? b_ctx_in->chassis_rec->name : "unknown",
30+
+ (pb->n_up && pb->up[0]) ? "true" : "false");
31+
+ VLOG_INFO("CLYI BINDING: LSP %s addresses=%s",
32+
+ pb->logical_port,
33+
+ pb->n_mac ? pb->mac[0] : "none");
34+
remove_related_lport(pb, b_ctx_out);
35+
}
36+
enum en_lport_type lport_type = get_lport_type(pb);
37+
@@ -2940,6 +2957,12 @@
38+
if (lport_type == LP_VIF &&
39+
!consider_vif_lport(pb, b_ctx_in, b_ctx_out, lbinding)) {
40+
+ VLOG_INFO("CLYI BINDING: VIF consideration FAILED for %s - type=%d, chassis=%s",
41+
+ pb->logical_port, lport_type,
42+
+ pb->chassis ? pb->chassis->name : "none");
43+
+ VLOG_INFO("CLYI BINDING: VIF failure - iface=%s, ofport=%lld, installed=%s",
44+
+ lbinding && lbinding->iface ? lbinding->iface->name : "no_iface",
45+
+ (lbinding && lbinding->iface && lbinding->iface->n_ofport) ? *lbinding->iface->n_ofport : 0,
46+
+ (lbinding && lbinding->iface && smap_get_bool(&lbinding->iface->external_ids, "ovn-installed", false)) ? "true" : "false");
47+
return false;
48+
}
49+
+ VLOG_INFO("CLYI BINDING: VIF consideration SUCCESS for %s", pb->logical_port);
50+
+
51+
+ VLOG_INFO("CLYI BINDING: Final status for %s - pb_chassis=%s, iface_installed=%s",
52+
+ pb->logical_port,
53+
+ pb->chassis ? pb->chassis->name : "none",
54+
+ (lbinding && lbinding->iface && smap_get_bool(&lbinding->iface->external_ids, "ovn-installed", false)) ? "true" : "false");
55+
56+
--- a/controller/lport.c
57+
+++ b/controller/lport.c
58+
@@ -76,6 +76,9 @@
59+
lport_pb_is_chassis_resident(const struct sbrec_chassis *chassis,
60+
const struct sbrec_port_binding *pb)
61+
{
62+
+ VLOG_INFO("CLYI LPORT: lport_pb_is_chassis_resident called - port=%s, type=%s",
63+
+ pb ? pb->logical_port : "NULL", pb ? pb->type : "NULL");
64+
+
65+
if (!pb || !pb->chassis) {
66+
+ VLOG_INFO("CLYI LPORT: returning false - no pb(%p) or chassis(%p)", pb, pb ? pb->chassis : NULL);
67+
return false;
68+
}
69+
70+
@@ -83,6 +86,13 @@
71+
* when the underlying BFD state changes are only detected by some of the
72+
* chassis in the associated HA_Chassis_Group. */
73+
bool result = pb->chassis == chassis;
74+
+ VLOG_INFO("CLYI LPORT: %s (type=%s) - pb_chassis=%s vs target_chassis=%s -> result=%s",
75+
+ pb->logical_port, pb->type,
76+
+ pb->chassis ? pb->chassis->name : "NULL",
77+
+ chassis ? chassis->name : "NULL",
78+
+ result ? "true" : "false");
79+
+
80+
return result;
81+
}
82+
83+
@@ -95,6 +105,8 @@
84+
lport_is_chassis_resident(struct ovsdb_idl_index *sbrec_port_binding_by_name,
85+
const struct sbrec_chassis *chassis,
86+
const char *port_name)
87+
{
88+
+ VLOG_INFO("CLYI LPORT: lport_is_chassis_resident called for port=%s", port_name);
89+
+
90+
const struct sbrec_port_binding *pb
91+
= lport_lookup_by_name(sbrec_port_binding_by_name, port_name);
92+
return lport_pb_is_chassis_resident(chassis, pb);
93+
@@ -115,6 +127,8 @@
94+
lport_is_local(struct ovsdb_idl_index *sbrec_port_binding_by_name,
95+
const struct sbrec_chassis *chassis,
96+
const char *port_name)
97+
{
98+
+ VLOG_INFO("CLYI LPORT: lport_is_local called for port=%s", port_name);
99+
+
100+
const struct sbrec_port_binding *pb = lport_lookup_by_name(
101+
sbrec_port_binding_by_name, port_name);
102+
103+
@@ -124,6 +138,9 @@
104+
if (lport_pb_is_chassis_resident(chassis, pb)) {
105+
+ VLOG_INFO("CLYI LPORT: %s - direct check result=true", port_name);
106+
return true;
107+
}
108+
+ VLOG_INFO("CLYI LPORT: %s - direct check result=false, checking cr_port", port_name);
109+
110+
const struct sbrec_port_binding *cr_pb =
111+
lport_get_cr_port(sbrec_port_binding_by_name, pb, NULL);
112+
@@ -131,6 +148,10 @@
113+
+ VLOG_INFO("CLYI LPORT: %s - cr_port=%s",
114+
+ port_name,
115+
+ cr_pb ? cr_pb->logical_port : "NULL");
116+
+
117+
return lport_pb_is_chassis_resident(chassis, cr_pb);
118+
}
119+
120+
--- a/controller/pinctrl.c
121+
+++ b/controller/pinctrl.c
122+
@@ -1473,6 +1473,8 @@
123+
char *redirect_name = xasprintf("cr-%s", pb->logical_port);
124+
bool resident = lport_is_chassis_resident(sbrec_port_binding_by_name,
125+
chassis, redirect_name);
126+
+ VLOG_INFO("CLYI PCTRL: IPv6 prefixd - %s -> %s resident=%s (pb_type=%s, pb_chassis=%s)",
127+
+ pb->logical_port, redirect_name, resident ? "true" : "false", pb->type, pb->chassis ? pb->chassis->name : "none");
128+
free(redirect_name);
129+
if ((strcmp(pb->type, "l3gateway") || pb->chassis != chassis) &&
130+
!resident) {
131+
+ VLOG_INFO("CLYI PCTRL: IPv6 prefixd - SKIPPING %s due to resident check", pb->logical_port);
132+
continue;
133+
}
134+
135+
@@ -8403,6 +8405,8 @@
136+
char *redirect_name = xasprintf("cr-%s", pb->logical_port);
137+
bool resident = lport_is_chassis_resident(sbrec_port_binding_by_name,
138+
chassis, redirect_name);
139+
+ VLOG_INFO("CLYI PCTRL: BFD monitor - %s -> %s resident=%s (pb_type=%s, pb_chassis=%s)",
140+
+ pb->logical_port, redirect_name, resident ? "true" : "false", pb->type, pb->chassis ? pb->chassis->name : "none");
141+
free(redirect_name);
142+
if ((strcmp(pb->type, "l3gateway") || pb->chassis != chassis) &&
143+
!resident) {
144+
+ VLOG_INFO("CLYI PCTRL: BFD monitor - SKIPPING %s due to resident check", pb->logical_port);
145+
continue;
146+
}
147+
148+
--- a/controller/physical.c
149+
+++ b/controller/physical.c
150+
@@ -873,6 +873,8 @@
151+
char *cr_peer_name = xasprintf("cr-%s", rport_binding->logical_port);
152+
if (lport_is_chassis_resident(ctx->sbrec_port_binding_by_name,
153+
ctx->chassis, cr_peer_name)) {
154+
+ VLOG_INFO("CLYI PHYSICAL: %s chassisredirect %s is resident - skipping MAC replace",
155+
+ localnet_port->logical_port, cr_peer_name);
156+
/* If a router port's chassisredirect port is
157+
* resident on this chassis, then we need not do mac replace. */
158+
free(cr_peer_name);
159+
continue;
160+
}
161+
+ VLOG_INFO("CLYI PHYSICAL: %s chassisredirect %s NOT resident - adding MAC replace flow",
162+
+ localnet_port->logical_port, cr_peer_name);
163+
free(cr_peer_name);
164+
165+
--- a/controller/if-status.c
166+
+++ b/controller/if-status.c
167+
@@ -XXX,6 +XXX,8 @@
168+
bool
169+
if_status_is_port_claimed(struct if_status_mgr *if_mgr, const char *port_name)
170+
{
171+
+ VLOG_INFO("CLYI IFSTATUS: checking if port %s is claimed", port_name);
172+
+
173+
struct if_status_entry *entry = shash_find_data(&if_mgr->port_status,
174+
port_name);
175+
if (!entry) {
176+
+ VLOG_INFO("CLYI IFSTATUS: port %s not found in status manager", port_name);
177+
return false;
178+
}
179+
180+
+ VLOG_INFO("CLYI IFSTATUS: port %s claimed=%s", port_name, entry->claimed ? "true" : "false");
181+
return entry->claimed;
182+
}

0 commit comments

Comments
 (0)