Received: from eggs.gnu.org ([2001:4830:134:3::10]:47618) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WG4Qp-0006LO-Ob for qemu-devel@nongnu.org; Wed, 19 Feb 2014 05:31:17 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WG4Qj-0005V0-Oh for qemu-devel@nongnu.org; Wed, 19 Feb 2014 05:31:11 -0500 Received: from indium.canonical.com ([91.189.90.7]:48199) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WG4Qj-0005Ur-H9 for qemu-devel@nongnu.org; Wed, 19 Feb 2014 05:31:05 -0500 Received: from loganberry.canonical.com ([91.189.90.37]) by indium.canonical.com with esmtp (Exim 4.76 #1 (Debian)) id 1WG4Qj-0006Ug-0Q for ; Wed, 19 Feb 2014 10:31:05 +0000 Received: from loganberry.canonical.com (localhost [127.0.0.1]) by loganberry.canonical.com (Postfix) with ESMTP id 01BA72E8005 for ; Wed, 19 Feb 2014 10:31:05 +0000 (UTC) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Date: Wed, 19 Feb 2014 10:23:56 -0000 From: Tim Rohde Sender: bounces@canonical.com References: <20131216170051.8689.69478.malonedeb@gac.canonical.com> Message-Id: <20140219102357.1931.19885.malone@gac.canonical.com> Errors-To: bounces@canonical.com Subject: [Qemu-devel] [Bug 1261450] Re: libvirtd reload and hooks problem routed-net Reply-To: Bug 1261450 <1261450@bugs.launchpad.net> List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Hi, we have a workaround for that. We=C2=B4ve add sleep ${RANDOM:0:1}.${RANDOM:-1:1} between the IP Tables rules. The Problem is, that IP tables cannot execute twice or more times simultaneously. Cheers Tim -- = You received this bug notification because you are a member of qemu- devel-ml, which is subscribed to QEMU. https://bugs.launchpad.net/bugs/1261450 Title: libvirtd reload and hooks problem routed-net Status in QEMU: New Bug description: if we do a reload of libvirt, some iptables rules, which are created thro= ugh /etc/libvirt/hooks/qemu are not working anymore. Every time a other (one or two,thee) vm is affected. = = our qemu file: #!/bin/bash = do_net() { local status=3D$2 local ip=3D$3 local in=3D$4 local out=3D$5 if [[ ! $status || ! $ip || ! $in || ! $out ]]; then echo "Not all parameters were passed!" exit 1 fi if [ "$status" =3D "stopped" -o "$status" =3D "reconnect" ]; then ip route del $ip via 191.255.255.1 dev $out ip neigh del proxy $ip dev $in iptables -D FORWARD -i $in -o $out -s 0.0.0.0/0 -d $ip/32= -j ACCEPT iptables -D FORWARD -i $out -o $in -s $ip/32 -d 0.0.0.0/0= -j ACCEPT fi if [ "$status" =3D "start" -o "$status" =3D "reconnect" ]; then ip route add $ip via 191.255.255.1 dev $out ip neigh add proxy $ip dev $in iptables -I FORWARD 4 -i $in -o $out -s 0.0.0.0/0 -d $ip/= 32 -j ACCEPT iptables -I FORWARD 4 -i $out -o $in -s $ip/32 -d 0.0.0.0= /0 -j ACCEPT fi } CONF=3D//etc/libvirt/hooks/vms/* for file in $CONF do guest_ipaddr=3D"" guest_name=3D"" type=3D"" destination=3D"0.0.0.0/0" while read line; do eval $line done < $file guest_ipaddrnet=3D$guest_ipaddr"/32" for dest in ${destination} do if [ "${1}" =3D "${guest_name}" ]; then echo "SRC-IP=3D"$guest_ipaddr " " $guest_ipaddrne= t " VM=3D"$guest_name " Dest=3D"$dest if [ "${2}" =3D "stopped" ]; then ip route del $guest_ipaddr via 19= 1.255.255.1 dev virbr1 ip neigh del proxy $guest_ipaddr d= ev bond0 iptables -D FORWARD -i bond0 -o virbr1 -s = $dest -d $guest_ipaddrnet -j ACCEPT iptables -D FORWARD -i virbr1 -o bond0 -s = $guest_ipaddrnet -d $dest -j ACCEPT fi if [ "${2}" =3D "start" ]; then ip route add $guest_ipaddr via 191.255.2= 55.1 dev virbr1 ip neigh add proxy $guest_ipaddr dev bon= d0 iptables -I FORWARD 4 -i bond0 -o virbr1= -s $dest -d $guest_ipaddrnet -j ACCEPT iptables -I FORWARD 4 -i virbr1 -o bond0= -s $guest_ipaddrnet -d $dest -j ACCEPT fi if [ "${2}" =3D "reconnect" ]; then ip route del $guest_ipaddr via 191= .255.255.1 dev virbr1 ip neigh del proxy $guest_ipaddr d= ev bond0 iptables -D FORWARD -i bond0 -o virbr1 -s = $dest -d $guest_ipaddrnet -j ACCEPT iptables -D FORWARD -i virbr1 -o bond0 -s = $guest_ipaddrnet -d $dest -j ACCEPT sleep 1 ip route add $guest_ipaddr via 191.255.2= 55.1 dev virbr1 ip neigh add proxy $guest_ipaddr dev bon= d0 iptables -I FORWARD 4 -i bond0 -o virbr1 -= s $dest -d $guest_ipaddrnet -j ACCEPT iptables -I FORWARD 4 -i virbr1 -o bond0 -= s $guest_ipaddrnet -d $dest -j ACCEPT fi fi done done To manage notifications about this bug go to: https://bugs.launchpad.net/qemu/+bug/1261450/+subscriptions