[ovs-dev] [PATCH 4/4] ovn-controller: Adding new files for exposing chassis information to OVN Southbound DB.

Sugesh Chandran sugesh.chandran at intel.com
Mon Aug 24 12:47:13 UTC 2015


From: sugeshch <sugesh.chandran at intel.com>

This patch introduces two new files for exposing the chassis sysinfo to the CMS.
The new context named 'sysinfo_ctx' is also proposed in this patch to keep
track of the chassis information. The Controller on a chassis uses the functions
in this patch for populating the host information in OVN Southbound DB.

Signed-off-by: Sugesh Chandran <sugesh.chandran at intel.com>
---
 ovn/controller/automake.mk      |  2 ++
 ovn/controller/ovn-controller.h |  4 +++-
 ovn/controller/pn_sysinfo.c     | 46 +++++++++++++++++++++++++++++++++++++++++
 ovn/controller/pn_sysinfo.h     | 35 +++++++++++++++++++++++++++++++
 4 files changed, 86 insertions(+), 1 deletion(-)
 create mode 100644 ovn/controller/pn_sysinfo.c
 create mode 100644 ovn/controller/pn_sysinfo.h

diff --git a/ovn/controller/automake.mk b/ovn/controller/automake.mk
index 9c91420..317a4b8 100644
--- a/ovn/controller/automake.mk
+++ b/ovn/controller/automake.mk
@@ -8,6 +8,8 @@ ovn_controller_ovn_controller_SOURCES = \
 	ovn/controller/encaps.h \
 	ovn/controller/lflow.c \
 	ovn/controller/lflow.h \
+	ovn/controller/pn_sysinfo.c \
+	ovn/controller/pn_sysinfo.h \
 	ovn/controller/ofctrl.c \
 	ovn/controller/ofctrl.h \
 	ovn/controller/ovn-controller.c \
diff --git a/ovn/controller/ovn-controller.h b/ovn/controller/ovn-controller.h
index be89b5f..069eaf8 100644
--- a/ovn/controller/ovn-controller.h
+++ b/ovn/controller/ovn-controller.h
@@ -18,12 +18,14 @@
 #define OVN_CONTROLLER_H 1
 
 #include "ovn/lib/ovn-sb-idl.h"
+#include "pn_sysinfo.h"
 
 struct controller_ctx {
     struct ovsdb_idl *ovnsb_idl;
     struct ovsdb_idl_txn *ovnsb_idl_txn;
-
     struct ovsdb_idl *ovs_idl;
+    struct sysinfo_ctx *sysinfo; /* system info of this chassis */
+
     struct ovsdb_idl_txn *ovs_idl_txn;
 };
 
diff --git a/ovn/controller/pn_sysinfo.c b/ovn/controller/pn_sysinfo.c
new file mode 100644
index 0000000..6677f98
--- /dev/null
+++ b/ovn/controller/pn_sysinfo.c
@@ -0,0 +1,46 @@
+/* Copyright (c) 2015 Intel Corp.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#include <config.h>
+#include "pn_sysinfo.h"
+
+/*
+ * Function to populate the Sys_Info table in OVN Southbound DB. OVN controller
+ * call this function every-time when it started on a chassis. Any changes to
+ * the OVN specific external_id fields in Open_vSwitch table also call this
+ * function to update the Southbound DB.
+ */
+void sysinfo_init(struct controller_ctx *ctx)
+{
+
+}
+
+/*
+ * Function to destroy sysinfo entry for this chassis in OVN Southbound DB
+ * Sys_Info table. This function should called by ovn-controller to remove the
+ * sysinfo entry.
+ */
+void sysinfo_destroy(struct controller_ctx *ctx)
+{
+
+}
+
+/*
+ *Function to destroy sysinfo entry for a specific host in OVN Southbound DB
+ *Sys_Info table.
+ */
+void sysinfo_destroy_by_hostname(char *hostname)
+{
+
+}
diff --git a/ovn/controller/pn_sysinfo.h b/ovn/controller/pn_sysinfo.h
new file mode 100644
index 0000000..7312ebc
--- /dev/null
+++ b/ovn/controller/pn_sysinfo.h
@@ -0,0 +1,35 @@
+/* Copyright (c) 2015 Intel Corp.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef OVN_PN_SYSINFO_H
+#define OVN_PN_SYSINFO_H    1
+
+#include <limits.h>
+
+struct controller_ctx;
+
+struct sysinfo_ctx {
+    /* sysinfo context for storing chassis capability information */
+    char hostname[HOST_NAME_MAX]; /* hostname of the chassis */
+    const char *chassis; /* UUID for this chassis */
+    const struct ovsrec_bridge *br_int; /* integration bridge of this chassis */
+    const char *port_types; /* List of supported port types in this chassis */
+};
+
+void sysinfo_init(struct controller_ctx *);
+void sysinfo_destroy(struct controller_ctx *);
+void sysinfo_destroy_by_hostname(char *hostname);
+
+#endif /* ovn/pn_sysinfo.h*/
-- 
2.1.4




More information about the dev mailing list