Ensure interface exists before adding OVS port

Otherwise fail.

Change-Id: Ia84d146e568071a84a7d0e06fcd88e64427904b8
Closes-Bug: #1700745
Signed-off-by: Pavel Glushchak <pglushchak@virtuozzo.com>
This commit is contained in:
Pavel Glushchak 2017-06-27 13:55:51 +03:00 committed by Pavel Gluschak (scsnow)
parent f10a2496a0
commit 4489bf24d8

View File

@ -3,8 +3,14 @@
bridge=$1
port=$2
ovs-vsctl br-exists $bridge; rc=$?
if [[ $rc == 2 ]]; then
ip link show $port
if [[ $? -ne 0 ]]; then
# fail when device doesn't exist
exit 1
fi
ovs-vsctl br-exists $bridge
if [[ $? -eq 2 ]]; then
changed=changed
ovs-vsctl --no-wait add-br $bridge
fi