X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=system%2Ftemplate-qemu%2Fqemu-bridge-init;fp=system%2Ftemplate-qemu%2Fqemu-bridge-init;h=ff4198c57cba031b98dc8e0e3fea1bfb8b12cf7b;hb=34bdffb5c9b5022156dc64dec44be4647bf805a0;hp=e390bfeeeeba1c3811e3536b38a91ec170b0e65c;hpb=c0136b4f5c23a808b6ea98164d0469bb739ecbc6;p=tests.git diff --git a/system/template-qemu/qemu-bridge-init b/system/template-qemu/qemu-bridge-init index e390bfe..ff4198c 100755 --- a/system/template-qemu/qemu-bridge-init +++ b/system/template-qemu/qemu-bridge-init @@ -1,7 +1,7 @@ #!/bin/bash # Thierry Parmentelat -# Copyright (C) 2010 INRIA +# Copyright (C) 2010 INRIA # # Establishment of a runtime environment for a # virtual machine under QEMU, This script allows the host box @@ -31,7 +31,7 @@ for line in file("/proc/net/dev"): print ifname EOF } - + function discover_interface () { for ifname in $(gather_interfaces); do ip link show $ifname | grep -qi 'state UP' && { echo $ifname; return; } @@ -80,7 +80,7 @@ function start () { #Getting host IP/masklen address=$(/sbin/ip address show $INTERFACE_LAN | grep -v inet6 | grep inet | head --lines=1 | awk '{print $2;}') [ -z "$address" ] && { echo "ERROR: Could not determine IP address for $INTERFACE_LAN" ; exit 1 ; } - + broadcast=$(/sbin/ip address show $INTERFACE_LAN | grep -v inet6 | grep inet | head --lines=1 | awk '{print $4;}') [ -z "$broadcast" ] && echo "WARNING: Could not determine broadcast address for $INTERFACE_LAN" @@ -120,7 +120,7 @@ function start () { ip address add $address broadcast $broadcast dev $INTERFACE_BRIDGE # turn on bridge interface ip link set dev $INTERFACE_BRIDGE up - ip address del $address dev $INTERFACE_LAN + ip address del $address dev $INTERFACE_LAN sleep 1 #Reconfigure the routing table @@ -133,7 +133,7 @@ function start () { echo "========== $COMMAND: exiting start - end" } -#Adding a new interface to the bridge: this is used by qemu-ifup +#Adding a new interface to the bridge: this is used by qemu-ifup function add () { [[ -z "$@" ]] && { echo "Usage: $COMMAND add ifname" ; exit 1 ; } @@ -170,7 +170,7 @@ function add () { echo "Installed iptables" iptables-save - + echo "========== $COMMAND: exiting add - end" } @@ -190,8 +190,7 @@ function stop () { brctl delif $INTERFACE_BRIDGE $INTERFACE_LAN ip address del $address dev $INTERFACE_BRIDGE brctl delbr $INTERFACE_BRIDGE - /sbin/service network restart - /sbin/service iptables restart + systemctl NetworkManager restart } function main () {