diff options
| author | Zuul <zuul@review.opendev.org> | 2019-11-14 20:29:21 +0000 |
|---|---|---|
| committer | Gerrit Code Review <review@openstack.org> | 2019-11-14 20:29:21 +0000 |
| commit | 4ffff0c1830941b865f357ef9d66540b9c110964 (patch) | |
| tree | 6ab21ae88eada995a749c3e160fbbb4515caf067 | |
| parent | 60d67956687f25a8c1f4f6d1327f4bb2637f8dc3 (diff) | |
| parent | b8c8fa15edcf5336a1121155cdc880a35ccf161f (diff) | |
| download | kolla-4ffff0c1830941b865f357ef9d66540b9c110964.tar.gz kolla-4ffff0c1830941b865f357ef9d66540b9c110964.zip | |
Merge "Use ovn-ctl script to start OVN ovsdb-servers"
| -rw-r--r-- | docker/ovn/ovn-base/Dockerfile.j2 | 3 | ||||
| -rw-r--r-- | docker/ovn/ovn-base/extend_start.sh | 2 | ||||
| -rw-r--r-- | docker/ovn/ovn-nb-db-server/Dockerfile.j2 | 4 | ||||
| -rw-r--r-- | docker/ovn/ovn-nb-db-server/extend_start.sh | 19 | ||||
| -rwxr-xr-x | docker/ovn/ovn-nb-db-server/start_nb_db_server.sh | 31 | ||||
| -rw-r--r-- | docker/ovn/ovn-sb-db-server/Dockerfile.j2 | 4 | ||||
| -rw-r--r-- | docker/ovn/ovn-sb-db-server/extend_start.sh | 19 | ||||
| -rwxr-xr-x | docker/ovn/ovn-sb-db-server/start_sb_db_server.sh | 32 |
8 files changed, 52 insertions, 62 deletions
diff --git a/docker/ovn/ovn-base/Dockerfile.j2 b/docker/ovn/ovn-base/Dockerfile.j2 index be4f15718..d0c837873 100644 --- a/docker/ovn/ovn-base/Dockerfile.j2 +++ b/docker/ovn/ovn-base/Dockerfile.j2 @@ -26,7 +26,6 @@ LABEL maintainer="{{ maintainer }}" name="{{ image_name }}" build-date="{{ build COPY extend_start.sh /usr/local/bin/kolla_extend_start -RUN touch /usr/local/bin/kolla_ovn_extend_start \ - && chmod 755 /usr/local/bin/kolla_extend_start /usr/local/bin/kolla_ovn_extend_start +RUN chmod 755 /usr/local/bin/kolla_extend_start {% block ovn_base_footer %}{% endblock %} diff --git a/docker/ovn/ovn-base/extend_start.sh b/docker/ovn/ovn-base/extend_start.sh index 089c8f6ae..573a953d8 100644 --- a/docker/ovn/ovn-base/extend_start.sh +++ b/docker/ovn/ovn-base/extend_start.sh @@ -6,5 +6,3 @@ fi if [[ $(stat -c %a /var/log/kolla/openvswitch) != "755" ]]; then chmod 755 /var/log/kolla/openvswitch fi - -. /usr/local/bin/kolla_ovn_extend_start diff --git a/docker/ovn/ovn-nb-db-server/Dockerfile.j2 b/docker/ovn/ovn-nb-db-server/Dockerfile.j2 index 75671f924..ac5be8886 100644 --- a/docker/ovn/ovn-nb-db-server/Dockerfile.j2 +++ b/docker/ovn/ovn-nb-db-server/Dockerfile.j2 @@ -18,10 +18,8 @@ LABEL maintainer="{{ maintainer }}" name="{{ image_name }}" build-date="{{ build {% endif %} {{ macros.install_packages(ovn_nb_db_server_packages | customizable("packages")) }} -COPY extend_start.sh /usr/local/bin/kolla_ovn_extend_start COPY start_nb_db_server.sh /usr/local/bin/start-nb-db-server -RUN chmod 755 /usr/local/bin/kolla_ovn_extend_start \ - /usr/local/bin/start-nb-db-server +RUN chmod 755 /usr/local/bin/start-nb-db-server {% block ovn_nb_db_server_footer %}{% endblock %} {% block footer %}{% endblock %} diff --git a/docker/ovn/ovn-nb-db-server/extend_start.sh b/docker/ovn/ovn-nb-db-server/extend_start.sh deleted file mode 100644 index dfaa0f12a..000000000 --- a/docker/ovn/ovn-nb-db-server/extend_start.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/bash - -mkdir -p "/run/openvswitch" - -# 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-nb-db-server/start_nb_db_server.sh b/docker/ovn/ovn-nb-db-server/start_nb_db_server.sh index 5c5767d1c..d08dd2890 100755 --- a/docker/ovn/ovn-nb-db-server/start_nb_db_server.sh +++ b/docker/ovn/ovn-nb-db-server/start_nb_db_server.sh @@ -1,11 +1,28 @@ #!/bin/bash -ovsdb_ip=$1 -ovnnb_port=$2 -if [ -e $ovnnb_port ]; then - ovnnb_port=6641 +# All the option passed to this script will be +# passed to the ovn-ctl script. Please see the options +# supported by ovn-ctl script - +# https://github.com/ovn-org/ovn/blob/master/utilities/ovn-ctl +args=$@ + +# Use ovn-ctl script to start ovn NB db server as it +# takes care of creating the db file from the schema +# file if the db file is not present. It also takes care +# of updating the db file if the schema file is updated. + +# Check for the presence of ovn-ctl script in two locations. +# If latest OVN is used (post split from openvswitch), +# then the new location for the ovn-ctl script is +# is - /usr/share/ovn/scripts/ovn-ctl. Otherwise it is +# /usr/share/openvswitch/scripts/ovn-ctl. + +if [[ -f "/usr/share/openvswitch/scripts/ovn-ctl" ]]; then + set /usr/share/openvswitch/scripts/ovn-ctl --no-monitor +elif [[ -f "/usr/share/ovn/scripts/ovn-ctl" ]]; then + set /usr/share/ovn/scripts/ovn-ctl --no-monitor +else + exit 1 fi -/usr/sbin/ovsdb-server /var/lib/openvswitch/ovnnb.db -vconsole:emer -vsyslog:err -vfile:info \ ---remote=punix:/run/openvswitch/ovnnb_db.sock --remote=ptcp:$ovnnb_port:$ovsdb_ip \ ---unixctl=/run/openvswitch/ovnnb_db.ctl --log-file=/var/log/kolla/openvswitch/ovsdb-server-nb.log +$@ $args run_nb_ovsdb diff --git a/docker/ovn/ovn-sb-db-server/Dockerfile.j2 b/docker/ovn/ovn-sb-db-server/Dockerfile.j2 index 91adba8bd..2ebae7267 100644 --- a/docker/ovn/ovn-sb-db-server/Dockerfile.j2 +++ b/docker/ovn/ovn-sb-db-server/Dockerfile.j2 @@ -18,10 +18,8 @@ LABEL maintainer="{{ maintainer }}" name="{{ image_name }}" build-date="{{ build {% endif %} {{ macros.install_packages(ovn_sb_db_server_packages | customizable("packages")) }} -COPY extend_start.sh /usr/local/bin/kolla_ovn_extend_start COPY start_sb_db_server.sh /usr/local/bin/start-sb-db-server -RUN chmod 755 /usr/local/bin/kolla_ovn_extend_start \ - /usr/local/bin/start-sb-db-server +RUN chmod 755 /usr/local/bin/start-sb-db-server {% block ovn_sb_db_server_footer %}{% endblock %} {% block footer %}{% endblock %} diff --git a/docker/ovn/ovn-sb-db-server/extend_start.sh b/docker/ovn/ovn-sb-db-server/extend_start.sh deleted file mode 100644 index 782a49c37..000000000 --- a/docker/ovn/ovn-sb-db-server/extend_start.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/bash - -mkdir -p "/run/openvswitch" - -# 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 diff --git a/docker/ovn/ovn-sb-db-server/start_sb_db_server.sh b/docker/ovn/ovn-sb-db-server/start_sb_db_server.sh index 2f9cda77a..ef39b8d25 100755 --- a/docker/ovn/ovn-sb-db-server/start_sb_db_server.sh +++ b/docker/ovn/ovn-sb-db-server/start_sb_db_server.sh @@ -1,11 +1,29 @@ #!/bin/bash -ovnsb_db_ip=$1 -ovnsb_port=$2 -if [ -e $ovnsb_port ]; then - ovnsb_port=6642 +# All the option passed to this script will be +# passed to the ovn-ctl script. Please see the options +# supported by ovn-ctl script - +# https://github.com/ovn-org/ovn/blob/master/utilities/ovn-ctl +args=$@ + +# Use ovn-ctl script to start ovn SB db server as it +# takes care of creating the db file from the schema +# file if the db file is not present. It also takes care +# of updating the db file if the schema file is updated. + +# Check for the presence of ovn-ctl script in two locations. +# If latest OVN is used (post split from openvswitch), +# then the new location for the ovn-ctl script is +# is - /usr/share/ovn/scripts/ovn-ctl. Otherwise it is +# /usr/share/openvswitch/scripts/ovn-ctl. + + +if [[ -f "/usr/share/openvswitch/scripts/ovn-ctl" ]]; then + set /usr/share/openvswitch/scripts/ovn-ctl --no-monitor +elif [[ -f "/usr/share/ovn/scripts/ovn-ctl" ]]; then + set /usr/share/ovn/scripts/ovn-ctl --no-monitor +else + exit 1 fi -/usr/sbin/ovsdb-server /var/lib/openvswitch/ovnsb.db -vconsole:emer -vsyslog:err -vfile:info \ ---remote=punix:/run/openvswitch/ovnsb_db.sock --remote=ptcp:$ovnsb_port:$ovnsb_db_ip \ ---unixctl=/run/openvswitch/ovnsb_db.ctl --log-file=/var/log/kolla/openvswitch/ovsdb-server-sb.log +$@ $args run_sb_ovsdb |
