licenses: Add license headers
[ovsnfv.git] / fuel-plugin-ovsnfv / deployment_scripts / puppet / modules / ovsdpdk / files / kvm-wrapper.sh
1 #!/usr/bin/env bash
2
3 # Copyright (c) 2016 Open Platform for NFV Project, Inc. and its contributors
4 #
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
8 #
9 #        http://www.apache.org/licenses/LICENSE-2.0
10 #
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.
16
17 VIRTIO_OPTIONS="csum=off,gso=off,guest_tso4=off,guest_tso6=off,guest_ecn=off"
18 VHOST_FORCE="vhostforce"
19 SHARE="share=on"
20 add_mem=False
21 i=0
22 while [ $# -gt 0 ]; do
23      case "$1" in
24
25      -device)
26         args[i]="$1"
27         (( i++ ))
28         shift
29         if [[ $1 =~ "vhost-user" ]]
30         then
31                 args[i]=${1},${VHOST_FORCE}
32                 (( i++))
33                 shift
34
35         fi
36         ;;
37     -object)
38         args[i]="$1"
39         (( i++ ))
40         shift
41         if [[ $1 =~ "memory-backend-file" ]]
42         then
43                 args[i]=${1},${SHARE}
44                 (( i++))
45                 shift
46
47         fi
48         ;;
49
50      *)
51          args[i]="$1"
52          (( i++ ))
53          shift ;;
54      esac
55 done
56 echo "qemu ${args[@]}"  > /tmp/qemu.orig
57 if [ -e /usr/local/bin/qemu-system-x86_64 ]; then
58     exec /usr/local/bin/qemu-system-x86_64  "${args[@]}"
59 elif [ -e /usr/libexec/qemu-kvm.orig ]; then
60     exec /usr/libexec/qemu-kvm.orig  "${args[@]}"
61 fi