Revision 329f0df8

b/kvm-ifup-custom
1
#!/bin/bash
2

  
3
# This is an example of a Ganeti kvm ifup script that configures network
4
# interfaces based on the initial deployment of the Okeanos project
5

  
6
source /etc/default/snf-network
7
source /usr/lib/snf-network/common.sh
8

  
9
GANETI_INSTANCE_NAME=$INSTANCE
10
get_info
11

  
12
try clear_routed_setup_ipv4
13
try clear_routed_setup_ipv6
14
try clear_routed_setup_firewall
15
try clear_ebtables
16
try clear_nfdhcpd
17

  
18
if [ "$MODE" = "routed" ]; then
19
  TABLE=$LINK
20
  ip link set $INTERFACE addr $TAP_CONSTANT_MAC up
21
  INDEV=$INTERFACE
22
elif [ "$MODE" = "bridged" ]; then
23
  ip link set $INTERFACE up
24
  brctl addif $BRIDGE $INTERFACE
25
  INDEV=$BRIDGE
26
fi
27

  
28
for tag in $NETWORK_TAGS; do
29
  case $tag in
30
  $IP_LESS_ROUTED_TAG)
31
    try routed_setup_ipv4
32
    try routed_setup_ipv6
33
    try routed_setup_firewall
34
    try send_garp
35
  ;;
36
  $NFDHCPD_TAG)
37
    try setup_nfdhcpd
38
  ;;
39
  $MAC_FILTERED_TAG)
40
    try init_ebtables
41
    try setup_ebtables
42
  ;;
43
  $MASQ_TAG)
44
    try setup_masq
45
  ;;
46
  esac
47
done
48

  
49
if [ -x "$IFUP_EXTRA_SCRIPT" ]; then
50
  exec $IFUP_EXTRA_SCRIPT "$@"
51
fi
52

  
53
exit 0
/dev/null
1
#!/bin/bash
2

  
3
# This is an example of a Ganeti kvm ifup script that configures network
4
# interfaces based on the initial deployment of the Okeanos project
5

  
6
source /etc/default/snf-network
7
source /usr/lib/snf-network/common.sh
8

  
9
GANETI_INSTANCE_NAME=$INSTANCE
10
get_info
11

  
12
try clear_routed_setup_ipv4
13
try clear_routed_setup_ipv6
14
try clear_routed_setup_firewall
15
try clear_ebtables
16
try clear_nfdhcpd
17

  
18
if [ "$MODE" = "routed" ]; then
19
  TABLE=$LINK
20
  ip link set $INTERFACE addr $TAP_CONSTANT_MAC up
21
  INDEV=$INTERFACE
22
elif [ "$MODE" = "bridged" ]; then
23
  ip link set $INTERFACE up
24
  brctl addif $BRIDGE $INTERFACE
25
  INDEV=$BRIDGE
26
fi
27

  
28
for tag in $NETWORK_TAGS; do
29
  case $tag in
30
  $IP_LESS_ROUTED_TAG)
31
    try routed_setup_ipv4
32
    try routed_setup_ipv6
33
    try routed_setup_firewall
34
    try send_garp
35
  ;;
36
  $NFDHCPD_TAG)
37
    try setup_nfdhcpd
38
  ;;
39
  $MAC_FILTERED_TAG)
40
    try init_ebtables
41
    try setup_ebtables
42
  ;;
43
  $MASQ_TAG)
44
    try setup_masq
45
  ;;
46
  esac
47
done
48

  
49
if [ -x "$IFUP_EXTRA_SCRIPT" ]; then
50
  exec $IFUP_EXTRA_SCRIPT "$@"
51
fi
52

  
53
exit 0

Also available in: Unified diff