Commit Graph
24 Commits
Author SHA1 Message Date
kfraser@localhost.localdomain 06809a93ad [NET] Remove netloop from network bridge init scripts.
The scripts are partly based on work by Daniel P. Berrange.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2007-06-04 11:01:46 +01:00
kfraser@localhost.localdomain a8d5290171 Improve hotplug script error reporting via xenstore.
Use this to detect and report up-front in vif-bridge script whether
the bridge device exists or not.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2007-02-07 16:22:55 +00:00
Alastair Tse b2bfd9596f Switch hotplug scripts to use /bin/bash rather than /bin/sh.
Hotplug scripts include certain bash-isms that are not supported under
some distros' default shell (eg. Ubuntu 6.10's use of dash)

Signed-off-by: Alastair Tse <atse@xensource.com>
2007-01-04 14:25:58 +00:00
Ewan Mellor ed5bb56602 Replace uses of [ ... == ... ] with the POSIX-legal single-equals. Tidy up
external-device-migrate script in its handling of parameters.

Patch from Roland Illig <roland.illig@gmx.de>.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
2006-11-08 13:22:08 +00:00
kaf24@firebug.cl.cam.ac.uk ac85f84b53 [TOOLS] Clean up the network setup scripts. Create some
setup functions and use them everywhere.
Signed-off-by: Gerd Hoffmann <kraxel@suse.de>
2006-06-17 08:40:50 +01:00
emellor@leeni.uk.xensource.com c9392b836d Use new do_without_error function to squelch the errors when closing down an
interface.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
2005-12-09 10:50:49 +00:00
emellor@leeni.uk.xensource.com 2832dba652 Replace grep >&/dev/null with grep -q.
Signed-off-by: Ewan Mellor <ewan@xensource.com>
2005-11-29 14:56:16 +00:00
emellor@leeni.uk.xensource.com 7522af5c6a Only write a success node when coming online, not going offline. Delete the
interface from the bridge when going offline -- the comment stating that
interfaces are auto-removed does not seem to be true, at least some of the
time.  Log failure of brctl delif and ifconfig down only at debug level, as
this script may be called more than once, depending upon the hotplug
configuration.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
2005-11-25 17:12:12 +00:00
emellor@leeni.uk.xensource.com 92b5e81264 Don't treat the failure of ifconfig vifX.Y down as a fatal error. This hasn't
emerged as a problem in the field, AFAIK, but it seems that distro scripts
could have brought the device down already by this point (Debian stable's
net.agent does ifdown vifX.Y, and it wouldn't surprise me if someone decided
to do ifconfig vifX.Y down if this failed, for example).

Logging but ignoring the failure seems sensible.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
2005-11-23 19:16:54 +00:00
dykman@us.ibm.com 35e6103a68 1) "brctl show" has no parameters.
2) Add a -n flag to iptables -L to skip DNS lookups
2005-11-20 15:37:08 +01:00
emellor@leeni.uk.xensource.com 8d43373af6 Have the vif scripts expect the offline event, not the remove event. With
the remove event, the script environment variable has disappeared, so we must
hook on the offline event instead.  This fix was put into xen-backend.rules,
but not the vif scripts, so they were out of sync, and the interfaces were not
being properly closed down.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
2005-11-15 15:56:47 +01:00
emellor@leeni.uk.xensource.com c0efb8dc85 Rename the commands inside the hotplug scripts to match those used by hotplug
and udev.  Pass all commands through from xen-backend.agent or
xen-backend.rules rather than second-guessing the individual scripts.  This
should make it easier to tear down devices cleanly, especially the dangling
vifs we are seeing at the moment.

Cope with a missing type node inside the block script, as we don't want to
resurrect a removed node by writing a hotplug error message.

Log failure of iptables command.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
2005-11-11 18:01:44 +01:00
emellor@leeni.uk.xensource.com cb3d870a1a From Murillo Fernandes Bernardes <mfb@br.ibm.com>:
The problem is: There is no mechanism to detect block device setup failure

Network devices have the same problem, and are fixed with this too.

I handling this problem in the way suggested by aliguori:
- hotplug scripts write a "hotplug-status" node on store
- Xend DevController.createDevice() check verify this node and return success
or throw an exception on failure.
- If no changes in "hotplug-status" node after DEVICE_CREATE_TIMEOUT seconds
Xend throw an exception showing the problem with hotplug scripts.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
2005-10-31 17:10:57 +01:00
emellor@leeni.uk.xensource.com af374bc7d2 Added xen-script-common.sh, for functions common to all scripts, not just the
hotplug ones.  Added evalVariables and findCommand functions to that, which we
use to clarify the handling of variables being passed in as command line
variables.

Make vif-bridge able to find the bridge for itself if only one bridge is in
use.  This means that it is not necessary to specify a bridge in many
configurations.  Allow the bridge to be specified on the command line, meaning
that a default may be provided in the xend-config.sxp if desired.

Added xenstore_read_default to xen-hotplug-common.sh, which reads from the
store but uses a given default if the path in the store is not present.  This
is used by vif-bridge to allow the store details (i.e. those given to xm create)
to override the default value given in the xend-config.sxp.

Remove vif-bridge setting -- the value can be specified on the vif-script
command line if necessary.

Added examples for network-nat/vif-nat.

Added lots of big comments.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
2005-10-30 13:33:17 +01:00
emellor@leeni.uk.xensource.com e5edf96441 Break common network code in xen-network-common.sh, and common vif hotplugging
code into vif-common.sh.

Fix the antispoofing in network-bridge to allow forwarding from physical
device to bridge, and vif0.0 to eth0.

Change the interface between netback driver and vif hotplugging scripts.  The
mac address and bridge details are read from the store directly by the script,
so that the kernel driver does not need to get involved.

Remove an awful lot of cruft from vif-bridge.  Move the iptables handling into
vif-common.sh, and fix it so that the new vif can get past the antispoofing
entries.  Merge vif-nat and vif-route into this structure too.

Use ip instead of ifconfig to get necessary details.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
2005-10-21 12:06:17 +01:00
emellor@leeni.uk.xensource.com a77149f8e4 New network-bridge script and associated gubbins.
This is Kurt Garloff's reworked network-bridge script:

* we got rid of ifconfig
* it works for netdev != eth0
* arp on and off are symmetric as are ifdown and ifup
* ifup will be passed the ifcfg config file name if needed
  (the ifup may otherwise figure that the veth0 hardware is
   NOT the same as the original ${netdev} and not use the same
   config -- this happens on SUSE. Charles Coffing tracked this
   one down.)

Plus Kurt's avoid-dash patch:

the network setup scripts on SUSE have trouble with the bridge
name xen-br0; they don't expect the '-'.
Arguably this should be fixed.
But I assume there's more scripts out there which may not like it,
so I suggest the following patch to rename xen-br0 to xenbr0.

Plus Charles Duffy's patch to support multiple bridges:

The attached patch allows the network-bridge script to be used to
generate multiple bridges corresponding to different physical
interfaces. It adds a new parameter, "vifnum", used to refer both to
the loopback interface to be used and to set defaults regarding the
physical interface and bridge name.

Thus, if one wishes to start xenbr0 on eth0 and xenbr1 on eth1, one
need only call:

network-bridge start ## vifnum is 0 by default
network-bridge start vifnum=1

...well, that and set loopback.nloopbacks=2 in the Dom0 kernel
parameters.

Plus renaming of virtnum to vifnum in Charles' patch, as requested by Ian Pratt.

Plus a fix to DevController to allocate vif IDs starting from 0 (i.e. vif2.0
is now domain 2's first vif, as opposed to vif2.1 in the recent past).

Plus tidying up inside network-bridge using some helper variables.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
2005-10-19 16:24:54 +01:00
emellor@leeni.uk.xensource.com c8a1f1c7fc Some trivial changes for the tool scripts:
- make xen-hotplug-common.sh (un)set locales.
 - use xen-hotplug-common.sh in vif-bridge.

From Gerd Knorr <kraxel@suse.de>.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
2005-10-19 13:34:44 +01:00
kaf24@firebug.cl.cam.ac.uk 6f455ecab6 The hotplug agent sets the path now, but that's not as practical to do
with udev rules.  So instead, make sure that the path is set in the vif
scripts themselves.

Signed-off-by: Jeremy Katz <katzj@redhat.com>
2005-10-07 13:11:41 +01:00
cl349@firebug.cl.cam.ac.uk e9626ce65f Fix vif scripts for domains with more than one ip.
As reported in bug 218 by christian@prehl.de.
Signed-off-by: Christian Limpach <Christian.Limpach@cl.cam.ac.uk>
2005-09-07 17:26:27 +00:00
kaf24@firebug.cl.cam.ac.uk 2a17786484 1. Remove workaround patch
2. Update scripts/vif-bridge to not call 'brctl delif'

When a domU is shutdown/destroyed and the netif is destroyed, the
notify_call_chain triggered from unregister_netdevice() will trigger the
bridge event handler and which will call the proper code to remove the
device from the bridge.

I can't see any reason why brtcl delif should be called when taking out
a domain if the call chain will delete the interface from the bridge
when the vif is destroyed automatically.

Signed-off-by: Ryan Harper <ryanh@us.ibm.com>
2005-08-25 15:51:30 +00:00
cl349@firebug.cl.cam.ac.uk b93e7f7e8b bitkeeper revision 1.1426.1.1 (4289cc8cPUM98bLJs4TV93NHY9LOKg)
Many files:
  Make interface to network/block scripts consistent:
  - output on stdout is returned to the script caller
  - output on stderr is logged at the error level, messages with a '-' prefix
    are logged at the debug level and messages with a '*' prefix are logged
    at the info level.
Signed-off-by: Christian Limpach <Christian.Limpach@cl.cam.ac.uk>
2005-05-17 10:50:52 +00:00
kaf24@scramble.cl.cam.ac.uk b52f7b088b bitkeeper revision 1.1159.170.78 (41d829e8lHqACg7gEEHdWaU-Jb1YdQ)
Network driver fixes.
2005-01-02 17:05:44 +00:00
mjw@wray-m-3.hpl.hp.com a23e4c0121 bitkeeper revision 1.1159.1.164 (41503abcmVn6L0phzf-BOxlxa3zgxw)
Add support for reconfiguring an existing device,
including support for changing the bridge of a vif.
Treat bridge "null" as meaning no bridge.
2004-09-21 14:29:16 +00:00
mjw@wray-m-3.hpl.hp.com 67e0d840e7 bitkeeper revision 1.1053.1.1 (40ee75a9YghVZFFolzFjyJngpxAbKg)
Move to new model of network and vif control using shell scripts.
2004-07-09 10:38:33 +00:00