Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DHCP relay]: Wait for VLAN interface to come up before starting DHCP relay #399

Merged
merged 1 commit into from
Mar 16, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions dockers/docker-dhcp-relay/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@ RUN rm -rf /debs

COPY ["isc-dhcp-relay.j2", "/usr/share/sonic/templates/"]
COPY ["config.sh", "/usr/bin/"]
COPY ["start.sh", "/usr/bin/"]

ENTRYPOINT /usr/bin/config.sh \
&& service rsyslog start \
&& service isc-dhcp-relay start \
ENTRYPOINT /usr/bin/config.sh \
&& service rsyslog start \
&& /usr/bin/start.sh \
&& /bin/bash
12 changes: 12 additions & 0 deletions dockers/docker-dhcp-relay/start.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash

VLAN_IFACE_NAME=`sonic-cfggen -m /etc/sonic/minigraph.xml -v "minigraph_vlan_interfaces[0]['name']"`

# Wait for the VLAN to come up (i.e., 'ip link show' returns 0)
until ip link show $VLAN_IFACE_NAME > /dev/null 2>&1; do
sleep 1
done

# Start the DHCP relay
service isc-dhcp-relay start

2 changes: 1 addition & 1 deletion files/build_templates/dhcp_relay.service.j2
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[Unit]
Description=DHCP relay container
Requires=docker.service
After=docker.service
After=interfaces-config.service

[Service]
User={{ sonicadmin_user }}
Expand Down