3 # Copyright (c) 2016 Open Platform for NFV Project, Inc. and its contributors
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
9 # http://www.apache.org/licenses/LICENSE-2.0
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
17 # This script is patching /usr/lib/python2.7/dist-packages/nova/network/linux_net.py
18 # More specifically it's adding '1' as recognized exit code
19 # it's WA and will work just when _setr_device_mtu will not change dramatically
21 # step1) get ROW for patching
22 FILE="/usr/lib/python2.7/dist-packages/nova/network/linux_net.py"
24 ROW=`grep -n "def _set_device_mtu(dev, mtu=None):" $FILE | cut -d ":" -f 1`
26 # step2) use sed for patching it
28 sed -i.bck "$((ROW+8))s/check_exit_code=\[0, 2, 254\]/check_exit_code=\[0, 1, 2, 254\]/" $FILE
33 echo "WARNING: linux_net.py not patched, please check if it's really needed"
35 echo "SUCCESS: linux_net.py patched"