Merge "Use ovn-ctl script to start OVN ovsdb-servers" into stable/train

This commit is contained in:
Zuul 2019-12-03 15:00:03 +00:00 committed by Gerrit Code Review
commit 6d595d44a7
8 changed files with 52 additions and 62 deletions

View File

@ -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 %}

View File

@ -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

View File

@ -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 %}

View File

@ -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

View File

@ -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

View File

@ -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 %}

View File

@ -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

View File

@ -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