Commit Graph
442 Commits
Author SHA1 Message Date
emellor@leeni.uk.xensource.com 0c63b57930 Tidy and comment use of canonicalise_mode, et al.
Signed-off-by: Ewan Mellor <ewan@xensource.com>
2005-11-29 15:01:47 +00:00
emellor@leeni.uk.xensource.com 5c9e232d3d Merged. 2005-11-29 15:00:27 +00:00
emellor@leeni.uk.xensource.com 1f2b7910d7 Support facilities for the new DHCP support.
Signed-off-by: Ewan Mellor <ewan@xensource.com>
2005-11-29 14:57:33 +00:00
emellor@leeni.uk.xensource.com feea83809d Added trap for ERR, to get better response from the scripts when they are really
broken, and add do_or_die command.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
2005-11-29 14:56:54 +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 5941ac94f2 Added DHCP server support, configured by a dhcp=yes parameter. This will write
the appropriate entries into dom0's DHCP server configuration file, allowing
that server to provide info for the guest when it starts.

If an IP address is not configured for vif-nat, invent one using the domain
ID and vif ID.

Fix the vif-nat script.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
2005-11-29 14:55:48 +00:00
rread@ubuntu.eng.hq.xensource.com b8ae09f01c The device sharing check races when more than one file backed vbd is
configured. Both of the files pick the same free loop device in the for
loop, and then one fails to losetup.  This patch will now retry if
losetup fails until it succeeds or no more devices are available.

Signed-off-by: Robert Read <robert@xensource.com>
2005-11-28 15:34:00 -07:00
emellor@leeni.uk.xensource.com dad18c78cb Change uses of \s within sed regexps -- some versions of sed do not support this
escape.

Allow the vif-nat and vif-route scripts to have netdev specified, rather than
hard-coding eth0.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
2005-11-28 11:05:07 +00:00
emellor@leeni.uk.xensource.com 9e1ac75bfa Added device-sharing checks for loopback-mounted files. The existing
check_sharing functions have been rejigged slightly so that the file-specific
stuff can share the code therein.  This separates the actual test from the
generation of the error message, and introduces the canonicalise_mode function.

This also restores the broken teardown functionality for file: devices -- the
writing of XENBUS_PATH/node had been removed, but this is required for file
device teardown.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
2005-11-27 00:56:34 +00:00
emellor@leeni.uk.xensource.com 963d9e8fdf Write the error message and the hotplug-status=busy in the same transaction, to
ensure that the message is picked up.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
2005-11-26 23:59:09 +00:00
emellor@leeni.uk.xensource.com d966085083 Check when using physical devices that the device is not already in use. Using
a device from two guests, or from dom 0 and a guest, can destroy the filesystem,
and this check prevents that.  This should ensure that the xm tests
11_block_attach_shared_dom0 and 12_block_attach_shared_domU should pass.
Closes bug #331.

Devices may be shared only if all uses are read-only.  If anyone has read-write
access to a device, then no sharing is allowed.

The mode in the config file may now have an exclamation mark appended, to
indicate that devices may be shared (i.e. that this new check should be
bypassed).  This supports some network block devices, but is clearly dangerous
and should only be used when you know what you are doing.

The mode specified in the config file is now written explicitly to the store,
To implement this, the blkback driver has been changed to create two entries
in /sys describing each device in use.  This means that we can determine which
devices are in use without crawling through the store.

The physical-device node has been changed to give the major and minor of the
device, separated by a colon.  This means that we do not need to pack these
numbers into one, removing the restriction to 8 bit minors that we had in place
before.

The mode specified in the config file is now written explicitly to the store,
rather than using the presence or absence of a read-only node.  This supports
the write-sharing override above.

If the device is in use, a new hotplug status of "busy" is written to the
store, and a message is written to a new hotplug-error node.  Xend uses these
things for diagnosis.

The block scripts do not need to handle online or offline events, so this
support has been removed.  These scripts can be called twice, depending upon
the hotplug config, so they now identify the second run and do not attempt to
set up the device again.

The device directories in the store are cleaned out before new details are
written there.  This prevents stale information from messing up block device
hotplugging.  This will be one cause of "blkback: changing physical device
not supported" messages.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
2005-11-25 20:58:07 +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 4494161ec1 Only write a success node when coming online, not going offline.
Signed-off-by: Ewan Mellor <ewan@xensource.com>
2005-11-25 17:09:49 +00:00
emellor@leeni.uk.xensource.com 88eca2a60d Don't issue the iptables diagnostic when removing entries. Depending upon your
hotplug config, the offline event may come through to this script twice, and
the iptables -D will fail the second time.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
2005-11-25 17:08:22 +00:00
emellor@leeni.uk.xensource.com 892f3730ae Match rename of parameters to match the corresponding hotplug events. This
took place some time ago, so presumably not many people are using this scripts!

Signed-off-by: Ewan Mellor <ewan@xensource.com>
2005-11-25 17:07:19 +00:00
kaf24@firebug.cl.cam.ac.uk b588d4451a Update vtpm driver following the recent changes to the
xenbus driver and its semantics.

Signed-off-by: Stefan Berger <stefanb@us.ibm.com>
2005-11-25 09:14:01 +01:00
emellor@leeni.uk.xensource.com f6d80a7f57 Reverse accidental commits for changesets 8001 and 7996-7999.
The Mercurial Queues extensions suddenly looks a lot less useful than it first
seemed.
 
Signed-off-by: Ewan Mellor <ewan@xensource.com>
2005-11-23 19:37:33 +00:00
emellor@leeni.uk.xensource.com d64896a9f0 Merged. 2005-11-23 19:31:22 +00:00
emellor@leeni.uk.xensource.com 8856d17150 imported patch my-config 2005-11-23 19:19:23 +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
emellor@leeni.uk.xensource.com 20f482d494 Remove the frontend device directories as well as the backend ones.
Closes bug #424.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
2005-11-23 19:13:13 +00:00
emellor@leeni.uk.xensource.com 9fc5d0e1cb Added document to collate information regarding distro-specific
incompatibilities in the commands that we are using in the scripts.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
2005-11-20 15:40:53 +01: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 c3381a8dac Downgrade the failure to change the iptables settings from fatal to an error.
Even though we are checking for a working iptables installation, it is still
possible that the user does not have the PHYSDEV matcher installed, so just
issue a diagnostic instead.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
2005-11-16 15:25:22 +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 946f9a1879 Added link_exists function, for neatness. Check for the existence of the pdev
before issuing the diagnostic about the missing vdev.  Having a pdev but no
vdev is a strong indicator that the network-bridge script has run once already,
and so there is nothing to worry about.  Having the vdev and no corresponding
pdev is still diagnosed.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
2005-11-15 15:54:51 +01:00
emellor@leeni.uk.xensource.com 7845e5bb11 Fix check for a working iptables installation. Checking for the iptables
binary is not sufficient, because the user may not have the appropriate
modules installed.
 
Signed-off-by: Ewan Mellor <ewan@xensource.com>
2005-11-14 12:28:47 +01:00
kaf24@firebug.cl.cam.ac.uk e7b975b0b6 If /sbin/ isn't in the path, udev rules will erroneously not get
installed.

Signed-off-by: Nivedita Singhvi <niv@us.ibm.com>
2005-11-14 11:05:34 +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 53ce8b9dd9 Don't call iptables if it is not installed. This code is only there to ensure
that packets between domU and the bridge are not firewalled, so if iptables is
not installed, then there is no worry.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
2005-11-11 17:56:02 +01:00
emellor@leeni.uk.xensource.com aea7cae133 Fix function call syntax in vif-route and vif-nat.
Function calls in shell script should not contain parenthesis.

Signed-off-by: Murillo Fernandes Bernardes <mfb@br.ibm.com>
2005-11-11 17:04:17 +01:00
kaf24@firebug.cl.cam.ac.uk ea475aded3 nloopbacks default is now 8. So vifnum of greater than 7 requires
an adjustment to nloopbacks. Warning comment updated.

Signed-off-by: Nivedita Singhvi (niv@us.ibm.com)
2005-11-11 10:46:36 +01:00
Xiaofeng Ling 05fbb602ad This patch use same expression as vif for vmx guest but has a distinguish "type=ioemu"
just like block device.
e.g. vif=['type=ioemu, mac=01:00:00:00:00:33, bridge=xenbr0']
type=ioemu to specify for vmx NIC device.
nics=4 can specify 4 vmx NIC now.
bridge is passed to device model now.
With this patch, the error
"Error: Device 0 (vif) could not be connected."
will not happen for creating vmx guest
currently, it happens on some linux distribution.

Signed-off-by: Xiaofeng Ling <xiaofeng.ling@intel.com>
2005-11-10 17:07:13 +01:00
kaf24@firebug.cl.cam.ac.uk a3dde685e8 Enable xm console for vmx guest.
When the serial port is redirect to pty, write the allocated
device to xenstore, then xm console can get it.
TODO:serial port by pty shall not block if there are no reading
on the other end

Signed-off-by: Xiaofeng Ling <xiaofeng.ling@intel.com>
2005-11-10 12:04:29 +01:00
kaf24@firebug.cl.cam.ac.uk b976b8510a Updates comments in network-bridge, removes dead code, minor typo fixes.
Signed-off-by: Nivedita Singhvi <niv@us.ibm.com>
2005-11-10 11:53:51 +01:00
kaf24@firebug.cl.cam.ac.uk e7570f0014 Support recent change moving virtual IOAPIC model into Xen for
ia64/VTI. Now ia64/vti will create links to arch/x86/dm/vmx_vioapic.c
and include/x86/vmx_vlapic.h.

Firstly, a small change to common virtual IOAPIC model to be used by
both sides. Also some compilation fix to tools is included in first
one. Secondly, there are ia64-specific changes to hook to common
IOAPIC model.

Based on this patch upon latest xen-ia64-unstable tip, we can see
multiple domains working again on XEN/IA64, including both domU and
VTI domain simultaneously in run-time.

Signed-off-by Kevin Tian <kevin.tian@intel.com>
Signed-off-by Anthony Xu <Anthony.xu@intel.com>
Signed-off-by Yunhong Jiang <yunhong.jiang@intel.com>
Signed-off-by Eddie Dong <eddie.dong@intel.com>
2005-11-09 14:53:12 +01:00
emellor@leeni.uk.xensource.com 7aa98216f5 Increase the static constant default number of loopback interfaces, nloopbacks,
to 8.  These interfaces are very cheap, so there's no problem having a few
spare.  Anyone with more than 8 NICs can still use the kernel command line or
the module parameter line to pass a larger limit to this module.

Detail the kernel command line parameter for nloopbacks in the diagnostic in
network-bridge.

Closes bug #381.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
2005-11-08 15:15:02 +01:00
kaf24@firebug.cl.cam.ac.uk 385317d870 Update tools/examples docs.
Signed-off-by: Nivedita Singhvi <niv@us.ibm.com>
2005-11-08 12:17:53 +01:00
kaf24@firebug.cl.cam.ac.uk bf4822dafb Remove the execute bit from shell snipplets (the -common files not
starting with #!) found in the example directory under tools. It
further changes the installation path of the udev rules to comply with
what debian does: It places the rules file in /etc/udev/ und creates a
symlink to it in /etc/udev/rules.d.

Signed-off-by: Tobias Hunger <tobias@aquzul.com>
2005-11-08 12:14:33 +01:00
emellor@leeni.uk.xensource.com ab6494f226 Fix misnamed call to legacy_mask_to_prefix. Thanks to Tim Moreton for finding
this.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
2005-11-07 12:36:44 +01:00
emellor@leeni.uk.xensource.com 3d511563c0 Diagnostic for hitting the nloopbacks limit. This is presumably the cause of
all the "two bridges don't work" bugs that have been reported (bug #381).

Consideration will be given to raising the default limit -- this is just a
diagnostic of the problem.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
2005-11-07 12:36:35 +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 3bbe6d0380 Removed the event server, and all it entails. This is unused, and a big pile
of crusty rubbish.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
2005-10-31 16:56:34 +01:00
emellor@leeni.uk.xensource.com ff9465e411 Merged. 2005-10-30 14:00:35 +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
kaf24@firebug.cl.cam.ac.uk 1464591d5f merge 2005-10-29 09:51:35 +01:00
emellor@leeni.uk.xensource.com 6ee89dae79 Fix the check for non-existence of the save/restore directories, by using &&
rather than -a.  The former shortcuts at the script level, whereas the latter
does not, which means that the backtick-enclosed arguments are evaluated
regardless of the success of preceding tests.

Tidy the aforementioned test into a function of its own.

Add an implementation of usleep for those systems that only have sleep (Debian,
for example).

Signed-off-by: Ewan Mellor <ewan@xensource.com>
2005-10-26 16:59:13 +01:00
emellor@leeni.uk.xensource.com a8a1d48e4c Break the write_dev function out from block into new block-common.sh, where it
can also be used by block-enbd and block-nbd.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
2005-10-26 14:58:13 +01:00
emellor@leeni.uk.xensource.com 902a84f59f Added copyright notice.
Signed-off-by: Ewan Mellor <ewan@xensource.com>
2005-10-26 14:57:16 +01:00
emellor@leeni.uk.xensource.com b043099b44 New xendomains init script, courtesy of Kurt Garloff:
It now allows the user to configure what he wants to be done on
xendomains stop: sysrq, migrate, save, or shutdown.
For this to be safe, a timeout has been introduced (optional).
On start, saved domains may be restored, and not yet started
domains from the auto start dir will be started in addition.
status reports missing domains, restart and reload work as well.

The init script is somewhat SUSE-ish, but it should work on LSB
compliant and on RH based distros as well.

I would appreciate this to be put into tools/examples/init.d/

Signed-off-by: Kurt Garloff <garloff@suse.de>
2005-10-26 14:55:32 +01:00