* [PATCH] hotplug: vif: fail if a duplicate vifname is used
@ 2012-07-10 17:36 Ian Campbell
2012-07-17 15:58 ` Ian Jackson
0 siblings, 1 reply; 4+ messages in thread
From: Ian Campbell @ 2012-07-10 17:36 UTC (permalink / raw)
To: xen-devel; +Cc: 658305-submitter, ian.jackson, 658305
# HG changeset patch
# User Ian Campbell <ian.campbell@citrix.com>
# Date 1341941699 -3600
# Node ID efb7fee3573b68e895de0341dd67df83cb68acc6
# Parent ca5c306052791edf6d96da3f80aecd750b86a5e4
hotplug: vif: fail if a duplicate vifname is used.
This is based on a patch from Hans van Kranenburg in
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=658305. Quoting that bug report:
When configurating a duplicate custom vifname for interfaces in the Xen
dom0 that are added to a bridge (which is obviously a configuration error),
the hotplug scripts fail silently to rename the new vifX.0 to
the custom vifname, if it's already existing.
The result of this, is that the domU will start normally, but no network
traffic between domU and the dom0 bridge is possible, because the vifX.0
never gets added to the bridge.
Worse... when doing xm shutdown on the newly created domU, while
investigating the issue, the interface of another running domU gets shut
down, and remains hanging around in a DOWN state, because it cannot be
removed (the other unrelated domU is still running, but succesfully made
unavailable on the network!).
When starting the new domU again, the interface of the other domU will
be added to the bridge again, and while looking at the output of brctl
show, tcpdump and ping, which make no sense, because everything will
seem to be right, nagios will notify you of another host being down. :|
Note that libxl doesn't actually check the hotplug status yet, this changes
with Rogers hotplug script changes. xend correctly picks the failure up.
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
diff -r ca5c30605279 -r efb7fee3573b tools/hotplug/Linux/vif-common.sh
--- a/tools/hotplug/Linux/vif-common.sh Tue Jul 10 15:06:13 2012 +0100
+++ b/tools/hotplug/Linux/vif-common.sh Tue Jul 10 18:34:59 2012 +0100
@@ -65,6 +65,20 @@ case "$command" in
;;
esac
+rename_vif() {
+ local dev=$1
+ local vifname=$2
+
+ # if a custom vifname was chosen and a link with that desired name
+ # already exists, then stop, before messing up whatever is using
+ # that interface (e.g. another running domU) because it's likely a
+ # configuration error
+ if ip link show "$vifname" >&/dev/null
+ then
+ fatal "Cannot rename interface $dev. An interface with name $vifname already exists."
+ fi
+ do_or_die ip link set "$dev" name "$vifname"
+}
if [ "$type_if" = vif ]; then
# Check presence of compulsory args.
@@ -74,9 +88,9 @@ if [ "$type_if" = vif ]; then
vifname=$(xenstore_read_default "$XENBUS_PATH/vifname" "")
if [ "$vifname" ]
then
- if [ "$command" == "online" ] && ! ip link show "$vifname" >&/dev/null
+ if [ "$command" == "online" ]
then
- do_or_die ip link set "$dev" name "$vifname"
+ rename_vif "$dev" "$vifname"
fi
dev="$vifname"
fi
@@ -96,9 +110,9 @@ elif [ "$type_if" = tap ]; then
if [ "$vifname" ]
then
vifname="${vifname}-emu"
- if [ "$command" == "add" ] && ! ip link show "$vifname" >&/dev/null
+ if [ "$command" == "add" ]
then
- do_or_die ip link set "$dev" name "$vifname"
+ rename_vif "$dev" "$vifname"
fi
dev="$vifname"
fi
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] hotplug: vif: fail if a duplicate vifname is used
2012-07-10 17:36 [PATCH] hotplug: vif: fail if a duplicate vifname is used Ian Campbell
@ 2012-07-17 15:58 ` Ian Jackson
2012-07-17 16:00 ` Ian Campbell
2012-07-23 12:21 ` Ian Campbell
0 siblings, 2 replies; 4+ messages in thread
From: Ian Jackson @ 2012-07-17 15:58 UTC (permalink / raw)
To: Ian Campbell; +Cc: 658305-submitter, 658305, xen-devel
Ian Campbell writes ("[PATCH] hotplug: vif: fail if a duplicate vifname is used"):
> hotplug: vif: fail if a duplicate vifname is used.
Do we know if anyone has tested this against upstream xen-unstable.hg ?
But:
> Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Ian.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] hotplug: vif: fail if a duplicate vifname is used
2012-07-17 15:58 ` Ian Jackson
@ 2012-07-17 16:00 ` Ian Campbell
2012-07-23 12:21 ` Ian Campbell
1 sibling, 0 replies; 4+ messages in thread
From: Ian Campbell @ 2012-07-17 16:00 UTC (permalink / raw)
To: Ian Jackson; +Cc: 658305-submitter, 658305, xen-devel
On Tue, 2012-07-17 at 16:58 +0100, Ian Jackson wrote:
> Ian Campbell writes ("[PATCH] hotplug: vif: fail if a duplicate vifname is used"):
> > hotplug: vif: fail if a duplicate vifname is used.
>
> Do we know if anyone has tested this against upstream xen-unstable.hg ?
Yes, I tested it with both xend and xl just before I submitted it.
>
> But:
>
> > Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
>
> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
>
> Ian.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] hotplug: vif: fail if a duplicate vifname is used
2012-07-17 15:58 ` Ian Jackson
2012-07-17 16:00 ` Ian Campbell
@ 2012-07-23 12:21 ` Ian Campbell
1 sibling, 0 replies; 4+ messages in thread
From: Ian Campbell @ 2012-07-23 12:21 UTC (permalink / raw)
To: Ian Jackson; +Cc: 658305-submitter, 658305, xen-devel
On Tue, 2012-07-17 at 16:58 +0100, Ian Jackson wrote:
> Ian Campbell writes ("[PATCH] hotplug: vif: fail if a duplicate vifname is used"):
> > hotplug: vif: fail if a duplicate vifname is used.
>
> Do we know if anyone has tested this against upstream xen-unstable.hg ?
>
> But:
>
> > Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
>
> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Thanks, Applied.
>
> Ian.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2012-07-23 12:21 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-07-10 17:36 [PATCH] hotplug: vif: fail if a duplicate vifname is used Ian Campbell
2012-07-17 15:58 ` Ian Jackson
2012-07-17 16:00 ` Ian Campbell
2012-07-23 12:21 ` Ian Campbell
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.