vswitchd: Make the MAC entry aging time configurable.
[sliver-openvswitch.git] / xenserver / etc_init.d_openvswitch-xapi-update
1 #!/bin/bash
2 #
3 # openvswitch-xapi-update
4 #
5 # chkconfig: 2345 95 01
6 # description: Update Open vSwitch configuration from XAPI database at boot
7
8 # Copyright (C) 2009, 2010 Nicira Networks, Inc.
9 #
10 # Licensed under the Apache License, Version 2.0 (the "License");
11 # you may not use this file except in compliance with the License.
12 # You may obtain a copy of the License at:
13 #
14 #     http://www.apache.org/licenses/LICENSE-2.0
15 #
16 # Unless required by applicable law or agreed to in writing, software
17 # distributed under the License is distributed on an "AS IS" BASIS,
18 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19 # See the License for the specific language governing permissions and
20 # limitations under the License.
21 ### BEGIN INIT INFO
22 # Provides:      openvswitch-xapi-update
23 # Required-Start: $network $remote_fs
24 # Required-Stop: $network
25 # Default-Start:  3 5
26 # Default-Stop:
27 # Short-Description:    openvswitch-xapi-update
28 # Description:          reconfigures Open vSwitch based on XAPI configuration
29 ### END INIT INFO
30
31 . /etc/init.d/functions
32
33 function do_host_call {
34     xe host-call-plugin host-uuid="$INSTALLATION_UUID" plugin="openvswitch-cfg-update" fn="update" >/dev/null
35 }
36
37 function start {
38     if [ ! -f /etc/xensource-inventory ]; then
39         printf "openvswitch-xapi-update ERROR: XenSource inventory not present in /etc/xensource-inventory\n"
40         exit 1
41     fi
42     source /etc/xensource-inventory
43     action "Updating configuration" do_host_call
44 }
45
46 case "$1" in
47     start)
48         start
49         ;;
50     stop)
51         # Nothing to do here.
52         ;;
53     restart)
54         start
55         ;;
56     help)
57         printf "openvswitch-xapi-update [start|stop|restart]\n"
58         ;;
59     *)
60         printf "Unknown command: $1\n"
61         exit 1
62         ;;
63 esac