diff mbox series

[ovs-dev,v2,1/7] controller: Add debug/dump-related-ports unixctl.

Message ID 20240723155444.2530187-2-xsimonar@redhat.com
State Accepted
Delegated to: Numan Siddique
Headers show
Series pmtud and related ports. | expand

Checks

Context Check Description
ovsrobot/apply-robot success apply and check: success
ovsrobot/github-robot-_Build_and_Test success github build: passed
ovsrobot/github-robot-_ovn-kubernetes success github build: passed

Commit Message

Xavier Simonart July 23, 2024, 3:54 p.m. UTC
Signed-off-by: Xavier Simonart <xsimonar@redhat.com>
---
 controller/binding.c        | 12 ++++++++++++
 controller/binding.h        |  3 +++
 controller/ovn-controller.c | 15 +++++++++++++++
 3 files changed, 30 insertions(+)

Comments

Numan Siddique July 30, 2024, 8:34 p.m. UTC | #1
On Tue, Jul 23, 2024 at 11:55 AM Xavier Simonart <xsimonar@redhat.com> wrote:
>
> Signed-off-by: Xavier Simonart <xsimonar@redhat.com>


> ---
>  controller/binding.c        | 12 ++++++++++++
>  controller/binding.h        |  3 +++
>  controller/ovn-controller.c | 15 +++++++++++++++
>  3 files changed, 30 insertions(+)
>
> diff --git a/controller/binding.c b/controller/binding.c
> index b7e7f4874..97f4545a4 100644
> --- a/controller/binding.c
> +++ b/controller/binding.c
> @@ -1037,6 +1037,18 @@ local_binding_set_down(struct shash *local_bindings, const char *pb_name,
>      }
>  }
>
> +void
> +binding_dump_related_lports(struct related_lports *related_lports,
> +                            struct ds *out_data)
> +{
> +    const char *name;
> +    if (sset_count(&related_lports->lport_names)) {
> +        SSET_FOR_EACH (name, &related_lports->lport_names) {
> +            ds_put_format(out_data, "%s\n", name);
> +        }
> +    }
> +}

Thanks.

I applied this patch with the below changes

diff --git a/controller/binding.c b/controller/binding.c
index 97f4545a40..5d1650fe1e 100644
--- a/controller/binding.c
+++ b/controller/binding.c
@@ -1042,10 +1042,8 @@ binding_dump_related_lports(struct
related_lports *related_lports,
                             struct ds *out_data)
 {
     const char *name;
-    if (sset_count(&related_lports->lport_names)) {
-        SSET_FOR_EACH (name, &related_lports->lport_names) {
-            ds_put_format(out_data, "%s\n", name);
-        }
+    SSET_FOR_EACH (name, &related_lports->lport_names) {
+        ds_put_format(out_data, "%s\n", name);
     }
 }



Numan

> +
>  void
>  binding_dump_local_bindings(struct local_binding_data *lbinding_data,
>                              struct ds *out_data)
> diff --git a/controller/binding.h b/controller/binding.h
> index 75e7a2679..f44f95833 100644
> --- a/controller/binding.h
> +++ b/controller/binding.h
> @@ -202,6 +202,9 @@ void binding_tracked_dp_destroy(struct hmap *tracked_datapaths);
>
>  void binding_dump_local_bindings(struct local_binding_data *, struct ds *);
>
> +void binding_dump_related_lports(struct related_lports *related_lports,
> +                                 struct ds *);
> +
>  bool is_additional_chassis(const struct sbrec_port_binding *pb,
>                             const struct sbrec_chassis *chassis_rec);
>
> diff --git a/controller/ovn-controller.c b/controller/ovn-controller.c
> index d6d001b1a..a4714739e 100644
> --- a/controller/ovn-controller.c
> +++ b/controller/ovn-controller.c
> @@ -99,6 +99,7 @@ static unixctl_cb_func debug_pause_execution;
>  static unixctl_cb_func debug_resume_execution;
>  static unixctl_cb_func debug_status_execution;
>  static unixctl_cb_func debug_dump_local_bindings;
> +static unixctl_cb_func debug_dump_related_lports;
>  static unixctl_cb_func debug_dump_local_template_vars;
>  static unixctl_cb_func debug_dump_lflow_conj_ids;
>  static unixctl_cb_func lflow_cache_flush_cmd;
> @@ -5310,6 +5311,10 @@ main(int argc, char *argv[])
>                               debug_dump_local_bindings,
>                               &runtime_data->lbinding_data);
>
> +    unixctl_command_register("debug/dump-related-ports", "", 0, 0,
> +                             debug_dump_related_lports,
> +                             &runtime_data->related_lports);
> +
>      unixctl_command_register("debug/dump-lflow-conj-ids", "", 0, 0,
>                               debug_dump_lflow_conj_ids,
>                               &lflow_output_data->conj_ids);
> @@ -6220,6 +6225,16 @@ debug_dump_local_bindings(struct unixctl_conn *conn, int argc OVS_UNUSED,
>      ds_destroy(&binding_data);
>  }
>
> +static void
> +debug_dump_related_lports(struct unixctl_conn *conn, int argc OVS_UNUSED,
> +                          const char *argv[] OVS_UNUSED, void *related_lports)
> +{
> +    struct ds data = DS_EMPTY_INITIALIZER;
> +    binding_dump_related_lports(related_lports, &data);
> +    unixctl_command_reply(conn, ds_cstr(&data));
> +    ds_destroy(&data);
> +}
> +
>  static void
>  debug_dump_lflow_conj_ids(struct unixctl_conn *conn, int argc OVS_UNUSED,
>                            const char *argv[] OVS_UNUSED, void *conj_ids)
> --
> 2.31.1
>
> _______________________________________________
> dev mailing list
> dev@openvswitch.org
> https://mail.openvswitch.org/mailman/listinfo/ovs-dev
>
diff mbox series

Patch

diff --git a/controller/binding.c b/controller/binding.c
index b7e7f4874..97f4545a4 100644
--- a/controller/binding.c
+++ b/controller/binding.c
@@ -1037,6 +1037,18 @@  local_binding_set_down(struct shash *local_bindings, const char *pb_name,
     }
 }
 
+void
+binding_dump_related_lports(struct related_lports *related_lports,
+                            struct ds *out_data)
+{
+    const char *name;
+    if (sset_count(&related_lports->lport_names)) {
+        SSET_FOR_EACH (name, &related_lports->lport_names) {
+            ds_put_format(out_data, "%s\n", name);
+        }
+    }
+}
+
 void
 binding_dump_local_bindings(struct local_binding_data *lbinding_data,
                             struct ds *out_data)
diff --git a/controller/binding.h b/controller/binding.h
index 75e7a2679..f44f95833 100644
--- a/controller/binding.h
+++ b/controller/binding.h
@@ -202,6 +202,9 @@  void binding_tracked_dp_destroy(struct hmap *tracked_datapaths);
 
 void binding_dump_local_bindings(struct local_binding_data *, struct ds *);
 
+void binding_dump_related_lports(struct related_lports *related_lports,
+                                 struct ds *);
+
 bool is_additional_chassis(const struct sbrec_port_binding *pb,
                            const struct sbrec_chassis *chassis_rec);
 
diff --git a/controller/ovn-controller.c b/controller/ovn-controller.c
index d6d001b1a..a4714739e 100644
--- a/controller/ovn-controller.c
+++ b/controller/ovn-controller.c
@@ -99,6 +99,7 @@  static unixctl_cb_func debug_pause_execution;
 static unixctl_cb_func debug_resume_execution;
 static unixctl_cb_func debug_status_execution;
 static unixctl_cb_func debug_dump_local_bindings;
+static unixctl_cb_func debug_dump_related_lports;
 static unixctl_cb_func debug_dump_local_template_vars;
 static unixctl_cb_func debug_dump_lflow_conj_ids;
 static unixctl_cb_func lflow_cache_flush_cmd;
@@ -5310,6 +5311,10 @@  main(int argc, char *argv[])
                              debug_dump_local_bindings,
                              &runtime_data->lbinding_data);
 
+    unixctl_command_register("debug/dump-related-ports", "", 0, 0,
+                             debug_dump_related_lports,
+                             &runtime_data->related_lports);
+
     unixctl_command_register("debug/dump-lflow-conj-ids", "", 0, 0,
                              debug_dump_lflow_conj_ids,
                              &lflow_output_data->conj_ids);
@@ -6220,6 +6225,16 @@  debug_dump_local_bindings(struct unixctl_conn *conn, int argc OVS_UNUSED,
     ds_destroy(&binding_data);
 }
 
+static void
+debug_dump_related_lports(struct unixctl_conn *conn, int argc OVS_UNUSED,
+                          const char *argv[] OVS_UNUSED, void *related_lports)
+{
+    struct ds data = DS_EMPTY_INITIALIZER;
+    binding_dump_related_lports(related_lports, &data);
+    unixctl_command_reply(conn, ds_cstr(&data));
+    ds_destroy(&data);
+}
+
 static void
 debug_dump_lflow_conj_ids(struct unixctl_conn *conn, int argc OVS_UNUSED,
                           const char *argv[] OVS_UNUSED, void *conj_ids)