From e5829735c26ac62534b9ece76151853f83aa4ac5 Mon Sep 17 00:00:00 2001 From: Quentin Smith Date: Sun, 2 Jan 2011 02:44:46 -0500 Subject: [PATCH] Workaround for http://bugzilla.xensource.com/bugzilla/show_bug.cgi?id=1275 --- debian/changelog | 10 ++++++++++ vif-invirtroute | 34 +++++++++++++++++++++------------- 2 files changed, 31 insertions(+), 13 deletions(-) diff --git a/debian/changelog b/debian/changelog index 57ee1b5..0f11f33 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,13 @@ +invirt-xen-config (0.0.34) unstable; urgency=low + + * The kernel fails to issue a udev event when a paravirtualized guest + shuts down (see + http://bugzilla.xensource.com/bugzilla/show_bug.cgi?id=1275). So, we + must design our configuration so that it does need any tearing + down. We do this by not creating a bridge for paravirtualized guests. + + -- Quentin Smith Sun, 02 Jan 2011 02:44:27 -0500 + invirt-xen-config (0.0.33) unstable; urgency=low * If we don't turn off offloading for the vif interface, the guest diff --git a/vif-invirtroute b/vif-invirtroute index e5497b3..e8b5eb8 100755 --- a/vif-invirtroute +++ b/vif-invirtroute @@ -29,31 +29,39 @@ dir=$(dirname "$0") . "$dir/vif-common.sh" main_ip=$(dom0_ip) + dev=${dev:-${vif}} +intfname=${dev} -brname=dom${vif#vif} +if [ ${dev} != ${vif} ]; then + # This is an HVM and it has two interfaces, so we'll set up a bridge. + brname=dom${vif#vif} + intfname=${brname} +fi case "$command" in online) - create_bridge ${brname} - setup_bridge_port ${dev} - add_to_bridge ${brname} ${dev} - if [ "$dev" != "$vif" ]; then + if [ $brname ]; then + create_bridge ${brname} + setup_bridge_port ${dev} setup_bridge_port ${vif} + add_to_bridge ${brname} ${dev} add_to_bridge ${brname} ${vif} fi - ifconfig ${brname} ${main_ip} netmask 255.255.255.255 up - echo 1 >/proc/sys/net/ipv4/conf/${brname}/proxy_arp - echo 1 >/proc/sys/net/ipv4/conf/${brname}/rp_filter + ifconfig ${intfname} ${main_ip} netmask 255.255.255.255 up + echo 1 >/proc/sys/net/ipv4/conf/${intfname}/proxy_arp + echo 1 >/proc/sys/net/ipv4/conf/${intfname}/rp_filter xenstore-write "$XENBUS_PATH/feature-gso-tcpv4" 0 ethtool -K ${vif} tx off ipcmd='add' cmdprefix='' ;; offline) - do_without_error brctl delif ${brname} ${vif} - do_without_error brctl delif ${brname} ${dev} - do_without_error ifconfig ${brname} down + if [ $brname ]; then + do_without_error brctl delif ${brname} ${vif} + do_without_error brctl delif ${brname} ${dev} + do_without_error ifconfig ${brname} down + fi ipcmd='del' cmdprefix='do_without_error' ;; @@ -65,7 +73,7 @@ if [ ${vif_type} != "ioemu" -o x${qemu_online} = xyes ] ; then # If we've been given a list of IP addresses, then add routes from dom0 to # the guest using those addresses. for addr in ${ip} ; do - ${cmdprefix} ip route ${ipcmd} ${addr} dev ${brname} src ${main_ip} + ${cmdprefix} ip route ${ipcmd} ${addr} dev ${intfname} src ${main_ip} if [ "$ipcmd" == "del" ]; then do_without_error ip route del ${addr} dev ${dev} src ${main_ip} fi @@ -78,7 +86,7 @@ if [ ${vif_type} != "ioemu" -o x${qemu_online} = xyes ] ; then fi fi -if [ "$command" == "offline" ] +if [[ "$command" == "offline" && -n "$brname" ]] then do_without_error brctl delbr ${brname} fi -- 1.7.9.5