diff mbox

[ovs-dev,1/4] ovn: Add schema versions and checksum to schema files.

Message ID 1443737396-2585-1-git-send-email-gshetty@nicira.com
State Accepted
Headers show

Commit Message

Gurucharan Shetty Oct. 1, 2015, 10:09 p.m. UTC
Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
---
 ovn/.gitignore       |  1 +
 ovn/automake.mk      | 28 ++++++++++++++++++++++++++++
 ovn/ovn-nb.ovsschema |  2 ++
 ovn/ovn-sb.ovsschema |  2 ++
 4 files changed, 33 insertions(+)

Comments

Ben Pfaff Oct. 2, 2015, 1:22 p.m. UTC | #1
On Thu, Oct 01, 2015 at 03:09:53PM -0700, Gurucharan Shetty wrote:
> Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>

Maybe we should put a little script for this in build-aux, since this is
several lines of cut-and-paste.

Acked-by: Ben Pfaff <blp@nicira.com>
Gurucharan Shetty Oct. 2, 2015, 4:08 p.m. UTC | #2
On Fri, Oct 2, 2015 at 6:22 AM, Ben Pfaff <blp@nicira.com> wrote:
> On Thu, Oct 01, 2015 at 03:09:53PM -0700, Gurucharan Shetty wrote:
>> Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
>
> Maybe we should put a little script for this in build-aux, since this is
> several lines of cut-and-paste.

I applied this patch and sent a new one to consolidate the checksum check.
>
> Acked-by: Ben Pfaff <blp@nicira.com>
diff mbox

Patch

diff --git a/ovn/.gitignore b/ovn/.gitignore
index 5b3bc55..d971938 100644
--- a/ovn/.gitignore
+++ b/ovn/.gitignore
@@ -5,3 +5,4 @@ 
 /ovn-sb.5
 /ovn-sb.gv
 /ovn-sb.pic
+/*.ovsschema.stamp
diff --git a/ovn/automake.mk b/ovn/automake.mk
index 33bbd05..4b6a836 100644
--- a/ovn/automake.mk
+++ b/ovn/automake.mk
@@ -75,6 +75,34 @@  EXTRA_DIST += \
 	ovn/CONTAINERS.OpenStack.md \
 	ovn/OVN-GW-HA.md
 
+# Version checking for ovn-nb.ovsschema.
+ALL_LOCAL += ovn/ovn-nb.ovsschema.stamp
+ovn/ovn-nb.ovsschema.stamp: ovn/ovn-nb.ovsschema
+	@sum=`sed '/cksum/d' $? | cksum`; \
+	expected=`sed -n 's/.*"cksum": "\(.*\)".*/\1/p' $?`; \
+	if test "X$$sum" = "X$$expected"; then \
+		touch $@; \
+	else \
+		ln=`sed -n '/"cksum":/=' $?`; \
+		echo >&2 "$?:$$ln: The checksum \"$$sum\" was calculated from the schema file and does not match cksum field in the schema file - you should probably update the version number and the checksum in the schema file with the value listed here."; \
+		exit 1; \
+	fi
+CLEANFILES += ovn/ovn-nb.ovsschema.stamp
+
+# Version checking for ovn-sb.ovsschema.
+ALL_LOCAL += ovn/ovn-sb.ovsschema.stamp
+ovn/ovn-sb.ovsschema.stamp: ovn/ovn-sb.ovsschema
+	@sum=`sed '/cksum/d' $? | cksum`; \
+	expected=`sed -n 's/.*"cksum": "\(.*\)".*/\1/p' $?`; \
+	if test "X$$sum" = "X$$expected"; then \
+		touch $@; \
+	else \
+		ln=`sed -n '/"cksum":/=' $?`; \
+		echo >&2 "$?:$$ln: The checksum \"$$sum\" was calculated from the schema file and does not match cksum field in the schema file - you should probably update the version number and the checksum in the schema file with the value listed here."; \
+		exit 1; \
+	fi
+CLEANFILES += ovn/ovn-sb.ovsschema.stamp
+
 include ovn/controller/automake.mk
 include ovn/controller-vtep/automake.mk
 include ovn/lib/automake.mk
diff --git a/ovn/ovn-nb.ovsschema b/ovn/ovn-nb.ovsschema
index 566617b..780fe33 100644
--- a/ovn/ovn-nb.ovsschema
+++ b/ovn/ovn-nb.ovsschema
@@ -1,5 +1,7 @@ 
 {
     "name": "OVN_Northbound",
+    "version": "1.0.0",
+    "cksum": "3052542625 4535",
     "tables": {
         "Logical_Switch": {
             "columns": {
diff --git a/ovn/ovn-sb.ovsschema b/ovn/ovn-sb.ovsschema
index 7f857ed..264a217 100644
--- a/ovn/ovn-sb.ovsschema
+++ b/ovn/ovn-sb.ovsschema
@@ -1,5 +1,7 @@ 
 {
     "name": "OVN_Southbound",
+    "version": "1.0.0",
+    "cksum": "4202564645 5078",
     "tables": {
         "Chassis": {
             "columns": {