aboutsummaryrefslogtreecommitdiff
path: root/docker
diff options
context:
space:
mode:
authorNuman Siddique <nusiddiq@redhat.com>2019-10-22 18:04:26 +0530
committerNuman Siddique <nusiddiq@redhat.com>2019-10-24 14:57:27 +0530
commitd1a07584ed116c3e046dc0b77370b70374a5c947 (patch)
tree6a3850a415ce38a81b5f65453cdfef891e461243 /docker
parente239169e13319ca51437604f152bb61d82ab81e9 (diff)
downloadkolla-d1a07584ed116c3e046dc0b77370b70374a5c947.tar.gz
kolla-d1a07584ed116c3e046dc0b77370b70374a5c947.zip
ovn: Create the ovn dbs only if the schema file exists
OVN has been split out from openvswitch and it's code is here [1]. With the split we have changed the ovn runtime/data dirs to /etc/ovn and /usr/share/ovn respectively. If a user uses latest OVN (when used after the split from openvswitch), then the extend_start.sh of ovn-nb-db-server and ovn-sb-db-server will fail because the OVN schema files will be in different location (new location is /usr/share/ovn/ovn-nb.ovschema and /usr/share/ovn/ovn-sb.ovschema) The old location is - /usr/share/openvswitch/ovn-nb.ovschema and /usr/share/openvswitch/ovn-sb.ovschema This patch checks for the presence of the schema files in the old location before accessing them. For latest OVN, it is advisable to use the "ovn-ctl" script to start and stop OVN ovsdb-servers. ovn-citl script takes care of creating the dbs and updating the dbs if the schema is updated. [1] - https://github.com/ovn-org/ovn https://github.com/openvswitch/ovs/commit/f3e24610ea18eb873dc860f1710432e9aacd27fd Change-Id: If2bab2fac5be28ae7e1cd02de13a2de94fe17bac Closes-bug: 1849633 Signed-off-by: Numan Siddique <nusiddiq@redhat.com>
Diffstat (limited to 'docker')
-rw-r--r--docker/ovn/ovn-nb-db-server/extend_start.sh17
-rw-r--r--docker/ovn/ovn-sb-db-server/extend_start.sh17
2 files changed, 30 insertions, 4 deletions
diff --git a/docker/ovn/ovn-nb-db-server/extend_start.sh b/docker/ovn/ovn-nb-db-server/extend_start.sh
index dffc85c1f..dfaa0f12a 100644
--- a/docker/ovn/ovn-nb-db-server/extend_start.sh
+++ b/docker/ovn/ovn-nb-db-server/extend_start.sh
@@ -1,6 +1,19 @@
#!/bin/bash
mkdir -p "/run/openvswitch"
-if [[ ! -e "/var/lib/openvswitch/ovnnb.db" ]]; then
- ovsdb-tool create "/var/lib/openvswitch/ovnnb.db" "/usr/share/openvswitch/ovn-nb.ovsschema"
+
+# Check for the presence of schema file in the old
+# location before accessing it.
+# Note: If latest OVN is used (post split from openvswitch),
+# then the new location for the schema file
+# is - /usr/share/ovn/ovn-nb.ovsschema.
+# It is advisable to use the ovn-ctl script to start
+# ovn NB db server. ovn-ctl takes care of creating the
+# db file from the schema file if the db file is not
+# present. ovn-ctl also takes care of updating the db file
+# if the schema file is updated.
+if [[ -e "/usr/share/openvswitch/ovn-nb.ovsschema" ]]; then
+ if [[ ! -e "/var/lib/openvswitch/ovnnb.db" ]]; then
+ ovsdb-tool create "/var/lib/openvswitch/ovnnb.db" "/usr/share/openvswitch/ovn-nb.ovsschema"
+ fi
fi
diff --git a/docker/ovn/ovn-sb-db-server/extend_start.sh b/docker/ovn/ovn-sb-db-server/extend_start.sh
index 688e37a0e..782a49c37 100644
--- a/docker/ovn/ovn-sb-db-server/extend_start.sh
+++ b/docker/ovn/ovn-sb-db-server/extend_start.sh
@@ -1,6 +1,19 @@
#!/bin/bash
mkdir -p "/run/openvswitch"
-if [[ ! -e "/var/lib/openvswitch/ovnsb.db" ]]; then
- ovsdb-tool create "/var/lib/openvswitch/ovnsb.db" "/usr/share/openvswitch/ovn-sb.ovsschema"
+
+# Check for the presence of schema file in the old
+# location before accessing it.
+# Note: If latest OVN is used (post split from openvswitch),
+# then the new location for the schema file
+# is - /usr/share/ovn/ovn-sb.ovsschema.
+# It is advisable to use the ovn-ctl script to start
+# ovn SB db server. ovn-ctl takes care of creating the
+# db file from the schema file if the db file is not
+# present. ovn-ctl also takes care of updating the db file
+# if the schema file is updated.
+if [[ -e "/usr/share/openvswitch/ovn-sb.ovsschema" ]]; then
+ if [[ ! -e "/var/lib/openvswitch/ovnsb.db" ]]; then
+ ovsdb-tool create "/var/lib/openvswitch/ovnsb.db" "/usr/share/openvswitch/ovn-sb.ovsschema"
+ fi
fi