Commit Graph
72 Commits
Author SHA1 Message Date
Sander Eikelenboom adee1dd918 tools/hotplug/Linux: supply --physdev-is-bridged in iptables runes
With newer (pvops) kernels logs get flooded with this iptables
warning: physdev match: using --physdev-out in the OUTPUT, FORWARD and
POSTROUTING chains for non-bridged traffic is not supported anymore

Using the --physdev-is-bridged option prevents this.
See also: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=571634#10

Signed-off-by: Sander Eikelenboom <linux@eikelenboom.it>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
2010-11-10 14:37:19 +00:00
Jan Beulich 95e155c6ec tools/hotplug: Linux udev rules adjustment
While earlier this year some work was done to eliminate libxc's
creation of nodes under /dev (as in some cases it actually got
things wrong), I just found that tapdisk2 does exactly the same.
While I'm not currently aiming at removing this code, I want to
at least suggest some adjustments to the provided rules file.

First of all, the present rule

KERNEL=="blktap[0-9]*", NAME="xen/%k"

matches both blktap1's devices and blktap2's ring devices,
resulting in whoever comes last replacing what was there
before (e.g. a tap2:aio: attach will replace bltap1's
/dev/blktap0 [i.e. the main control device] with the ring device
of the new virtual disk). Therefore we should add a subsystem
qualifier there.

Second, at some udev versions default to using 0660 as the
permissions on nodes it creates. The kernel (with devtmpfs)
defaults to 0600, and hence I'd suggest to also make this
explicit in the rules.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
Cc: Boris Derzhavets <bderzhavets@yahoo.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
2010-09-21 15:59:01 +01:00
744d6961f9 tools, build system: Make changing distro-specific layout aspects easier
Introduce CONFIG_LEAF_DIR, SUBSYS_DIR, INITD_DIR variables to cope
better with variation between distributions.

See docs/misc/distro_mapping.txt for details.

Signed-off-by: Bruce Edge <bruce.edge@gmail.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
2010-09-20 17:54:25 +01:00
Brendan Cully 33577c40bf tools/hotplug: 21549:8bcaec29574e breaks vif-script with arguments.
For example, (vif-script 'vif-bridge bridge=eth1') in xend-config.sxp will
cause vif-setup to attempt to execute 'vif-bridge bridge=eth1' due to a
quoting mismatch. The fix appears to be to remove the extra quotes around
"$script" in vif-setup.

Signed-off-by: Brendan Cully <brendan@cs.ubc.ca>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
2010-08-18 14:50:51 +01:00
Anthony Perard 025e84f126 tools/hotplug, Use udev rules instead of qemu script to setup the bridge.
From: Anthony PERARD <anthony.perard@citrix.com>

This patch adds a second argument to vif-bridge script. It can be "vif"
or "tap". "vif" give the default behavior and "tap" just add the
interface to the found bridge when the action is "add".

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
---
 tools/hotplug/Linux/vif-bridge        |   20 ++++++---
 tools/hotplug/Linux/vif-common.sh     |   70 ++++++++++++++++++++++++---------
 tools/hotplug/Linux/xen-backend.rules |    5 +-
 tools/libxl/libxl.c                   |    6 +-
 4 files changed, 70 insertions(+), 31 deletions(-)
2010-08-09 16:46:02 +01:00
Olaf Hering 42b7a80b01 # HG changeset patch
# User Olaf Hering <olaf@aepfle.de>
# Date 1280140115 -3600
# Node ID 8c3e1e8ddd599371d882b17996be88b545119ccb
# Parent  2092c06f9467747da608c448ddd01e2f1f82290a
tools/hotplug: init.d should test for /proc/xen/capabilities being a file

Correct test for /proc/xen/capabilities
It is a file, not a directory.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
2010-07-26 11:29:11 +01:00
Ian Jackson fd452d0f64 tools/hotplug etc.: remove Default-Enabled from LSB header
"Default-Enabled:" is not a LSB keyword.
Remove it from the LSB section.

This avoids an openSuSE buildcheck warning and we are not aware of any
reason why it should be kept.

From: Olaf Hering <olaf@aepfle.de>
Signed-off-by: Olaf Hering <olaf@aepfle.de>
Modified-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
2010-07-26 11:15:40 +01:00
Olaf Hering 7e4a3b097f tools/hotplug: add LSB header to xen-watchdog runlevel script
Signed-off-by: Olaf Hering <olaf@aepfle.de>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
2010-07-26 11:11:25 +01:00
Olaf Hering 8fc69686f5 tools/hotplug: Install udev rules into rules.d
Install rules straight into /etc/udev/rules.d
udev version 029 since mid 2004 uses this directory already.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
2010-07-23 19:23:49 +01:00
Olaf Hering f4c4de9caf tools/hotplug: correct xend initscript dependency in LSB part
Add missing dependencies to runlevel script
xend requires at least xenstored

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
2010-07-23 17:55:14 +01:00
Olaf Hering cddbcd7143 tools and Makefiles: introduce and use new SYSCONFIG_DIR variable
On SuSE the configuration files in /etc/sysconfig/ will be updated in
a smart way from templates found in /var/adm/fillup-templates/
Introduce new variable SYSCONFIG_DIR for Linux installations.  Now
only one place needs patching, or it can be specified as option to
make(1).

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
2010-07-23 17:50:05 +01:00
Ian Jackson ec9afc69fe tools/hotplug: xencommons: xenconsoled tracing
cut and paste error lead to using the xenstored command line syntax
for xenconsoled.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
2010-07-09 18:46:07 +01:00
Ian Jackson 0c85cce09c tools/hotplug: locking.sh script: fix lock directory remains on error bug
_release_lock should be used instead of release_lock.
sigerr is introduced so that it can be redefined by
xen-hotplug-common.sh to a version which writes error status to xenstore.

Signed-off-by: Kouya Shimura <kouya@jp.fujitsu.com>
2010-07-06 13:10:14 +01:00
Ian Jackson f706d9e9af tools: init.d/xencommons: Wait for xenstored to start before setting dom0 name
On one of my boxes, the xenstore-write setting dom0's name starts
before xenstored is actually ready to handle the connection properly,
resulting in the name set failing.  Wait for xenstored to be up and
responding to reads before continuing, timing out after 30 seconds.

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
2010-06-29 15:07:17 +01:00
Ian Jackson 8209429099 tools: init.d/xencommons: Make init script more verbose
Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
2010-06-29 15:06:27 +01:00
Ian Jackson e724c3fa88 prompt user to start xencommons first if it is not running.
Signed-off-by: Yu Zhiguo <yuzg@cn.fujitsu.com>
2010-06-23 17:01:35 +01:00
Ian Jackson 7b76ecc628 init.d: Fix xencommons init script chkconfig configuration
Fix the xencommons init script chkconfig configuration since the
priority was missing here and chkconfig was complaining about invalid
chkconfig script so I added both start and stop priorities to the
chkconfig line and it was working fine, the script was successfully
added to chkconfig when using `chkconfig --add xencommons` and
management using the chkconfig utility was now possible.

Tested on RHEL-5 Server with Xen-4.1-unstable installed, running on
PVops kernel 2.6.32.15 and it was working fine.

Signed-off-by: Michal Novotny <minovotn@redhat.com>
2010-06-22 16:22:30 +01:00
Stefano Stabellini 14d8a83b62 this patch adds support for xl in xendomains: if xm list fails all the
following commands are issued using xl instead.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
2010-06-22 16:05:30 +01:00
Ian Jackson 6f4e9be827 If xenfs is compiled as a module, now cannot complete
'service xencommons start', mount xenfs directly can fix it,
it can trigger modprobe xenfs.

Signed-off-by: Yu Zhiguo <yuzg@cn.fujitsu.com>
2010-06-22 15:39:42 +01:00
Keir Fraser c814a49b06 Revert 21641:2e5844e17d6f "xencommons: modprobe xenfs if it not be loaded"
Nacked by Jeremy Fitzhardinge and Ian Jackson.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2010-06-21 18:37:34 +01:00
Keir Fraser 0ca1bba0a6 xencommons: modprobe xenfs if it not be loaded
If xenfs is compiled as a module, now cannot complete
'service xencommons start', modprobe xenfs can fix it.

Signed-off-by: Yu Zhiguo <yuzg@cn.fujitsu.com>
2010-06-21 09:57:10 +01:00
Keir Fraser edf9a6a284 xend: Do not mess with bridge if admin has set one up already
Previously, the default "network-script",
/etc/xen/scripts/network-bridge, would attempt to do its horrid work
even if you had already set everything up in /etc/network/interfaces.

Setting up your bridge in /etc/network/interfaces is:
 * easy
 * required for libxl since libxl never does it for you
 * not a fragile piece of lunacy
 * properly documented
 * the way everyone would expect it to work

In this small patch we make it so that the default config for xend
doesn't mess about on startup if you already have a bridge, and
doesn't mess about on shutdown unless your first-named bridge (eth0 or
xenbr0, normally) doesn't also have a physical interface named
p<whatever> (peth0 or pxenbr0) enslaved to it.  The latter test is not
ideal but will hopefully do from now until the time xend finally dies.

We also fix the "documentation" - ie, the comments in the default
xend-config.sxp - to correspond to reality.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
2010-06-15 11:36:27 +01:00
Keir Fraser bce846e928 xen-watchdog: Move init script to OS-dep dir and implement for netbsd
Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2010-06-09 13:29:22 +01:00
Keir Fraser 24454c884a tools: Add missing files under tools/hotplug/Linux/init.d
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2010-06-07 17:14:37 +01:00
Keir Fraser 702890192a xl: init scripts (v2)
Now the init script is called xencommons and, as the name suggests, it
is a common script between xl and xend because it is used to start
xenconsoled, xenstored and xenbackendd and the initialization of these
three daemons has been removed from xend.  The global
xen_toolstack=xl/xend variable has been removed.  Regarding the
network setup, I made the vif scripts follow the same pattern as the
other scripts in xen-backend: a new script called vif-setup is
executed unconditionally. vif-setup is going to do the right thing
depending on the value of the environmental variable "script" (same
technique used before), defaulting to vif-bridge.  In the common
scenario the toolstack doesn't need to set the variable "script"
because vif-bridge is going to be called anyway.  There is no global
network script to setup the network bridges with xl, so if you are
using xl without xend, you need to manually configure the bridges
using your distro network setup, or, if you are lazy, you can just add
something like:

/etc/xen/scripts/network-bridge start

to your rc.local.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
2010-06-07 15:49:46 +01:00
Keir Fraser 0cc54b151a Add xl init scripts
this patch adds an init script for xl, so that it can be used without
xend installed on the system.  In cases in which both toolstacks are
present, only one init script will be run, dependening on the value of
xen_toolstack in /etc/sysconfig/xen_toolstack.  Please note that a
correct value of xen_toolstack (either xl or xend), is required now.
The network script and the vif script to be used with xl can be
specified in /etc/sysconfig/xenlightdaemons.  Xl sets the vif script
to xl-vif-script by default, that reads /etc/sysconfig/xenlightdaemons
and calls the vif script set there.  A port to a debian system should
be straightforward, just replacing /etc/sysconfig with /etc/default
everywhere.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
2010-06-07 07:05:54 +01:00
Keir Fraser cf928043f9 Allow space in vbd path name
c/s 20393 breaks existing domain configuration that contains
spaces in the vbd path name.  Fixed by this trivial patch which
provides missing quotes.

Signed-off-by: Jim Fehlig <jfehlig@novell.com>
2010-05-26 08:14:51 +01:00
Keir Fraser c8272ff4cb xend: suppress errors during capabilities check
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2010-05-17 10:56:36 +01:00
Keir Fraser f770264fe1 Calling awk and not gawk in the Xen scripts
I noticed that 2 scripts in Xen 4.0.0 are calling "gawk". Normally, in
most distributions, gawk is considered a specific version of awk.
Calling "gawk" and not "awk" generally means that you need
specificities of the "g" version of awk, as opposed to "mawk" which is
another implementation of the same tool.

So, unless I misread the scripts, Xen doesn't need to use gawk but
just any implementation of awk, and the attached patch can safely be
applied.

If I am wrong (which I don't think I am at the first look) and that
there's a reason why gawk is used and not awk, then IMHO, the toplevel
README should mention it in the prerequisites.

From: Thomas Goirand <thomas@goirand.fr>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2010-04-19 09:00:30 +01:00
Keir Fraser fc9e443321 tools/hotplug/Linux/blktap: remove optional tapdisk: prefix
Perhaps this should even be further generalized (e.g. to remove any
"[!/]*:" pattern prefixes) to be more forward compatible?

Signed-off-by: Jan Beulich <jbeulich@novell.com>
2010-04-19 08:58:43 +01:00
Keir Fraser a124755be6 blktap2: a little fix to xen-hotplug-cleanup
Signed-off-by: James (Song Wei) <jsong@novell.com>
2010-04-12 07:23:21 +01:00
Keir Fraser f1ad4b4ad7 hotplug: Avoid race condition when creating or destroying network bridges
I saw the following message when I created or destroyed two bridges by
using network-bridge script at same time.  Of course names of the
bridges are different.  But, a temporal name "tmpbridge" is used by
the script to create or destroy the bridges.  I think that the message
was shown by "tmpbridge".

  SIOCSIFNAME: File exists

This patch avoids race condition when creating or destroying the
bridges.

Signed-off-by: Masaki Kanno <kanno.masaki@jp.fujitsu.com>
2010-03-15 13:16:35 +00:00
Keir Fraser a64e08899b Fix blktap2 test in xen-hotplug-cleanup
The blktap2 test in xen-hotplug-cleanup was not quite right, causing
orphaned /vm/<uuid>/device node in xenstore.  Attempt to reattach the
device failed:

xen53: # xm block-attach 0 file:/tmp/d0 /dev/xvdp r
xen53: # xm block-detach 0 /dev/xvdp
xen53: # xenstore-ls /vm/00000000-0000-0000-0000-000000000000/device
vbd =3D ""
 51952 =3D ""
  frontend =3D "/local/domain/0/device/vbd/51952"
  frontend-id =3D "0"
  backend-id =3D "0"
  backend =3D "/local/domain/0/backend/vbd/0/51952"
xen53: # xm block-attach 0 file:/tmp/d0 /dev/xvdp r
Error: Device /dev/xvdp (51952, vbd) is already connected.
Usage: xm block-attach <Domain> <BackDev> <FrontDev> <Mode>
[BackDomain]

From: Jim Fehlig <jfehlig@novell.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2010-02-22 10:07:27 +00:00
Keir Fraser 79f5cb24ab hotplug: ignore xenstore-read error
The failure to read "backend/tap/<domid>/*" in the xenstore is a usual
case since the domain is gone after xenstore-ls command is executed.
The error should be ignored.

Signed-off-by: Kouya Shimura <kouya@jp.fujitsu.com>
2010-02-16 09:28:39 +00:00
Keir Fraser f3bbcc7995 tools: Do not append trailing slash to XEN_ROOT in Makefiles
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2010-02-04 09:03:42 +00:00
Keir Fraser 56b0c617c9 Linux: Use losetup -f where available.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2010-01-14 10:12:58 +00:00
Keir Fraser bbe624405f Fix losetup -f not working on SLES10
Signed-off-by: Gary Grebus <gary.grebus@oracle.com>
2009-12-14 07:56:21 +00:00
Keir Fraser fc63162a09 PVUSB: xm/xend support
You can see the following slides to understand the usage.
http://www.xen.org/files/xensummit_intel09/PVUSBStatusUpdate.pdf
Limitations:
"xm usb-hc-create" accepts up to 16 ports, but, current usbfront
can work with up to 15 ports. This may be bug and I'm preparing
to fix it.

This xm/xend support requires linux-2.6.18-xen.hg c/s 939 or above.
I recommend latest tip.

Signed-off-by: Noboru Iwamatsu <n_iwamatsu@jp.fujitsu.com>
2009-12-11 08:52:17 +00:00
Keir Fraser 0ce73f80ea Linux vbd hotplug: Speed up finding a loopback device
- Use the device and inode information provided by losetup to find
   if the vbd backing file is in use on another vbd.

 - Use losetup to find a free loopback device.

Signed-off-by: Gary Grebus <gary.grebus@oracle.com>
2009-11-03 08:39:21 +00:00
Keir Fraser 92e6cb5673 Linux vbd hotplug: Avoid "leaked" loopback devices
Avoid races between hotplug "add" and "remove" leading to "leaked"
loopback devices.

- Don't setup loopback device if xend is no longer waiting for the
  vbd.
- Use the lock file to avoid add/remove races.

Signed-off-by: Gary Grebus <gary.grebus@oracle.com>
2009-11-03 08:38:55 +00:00
Keir Fraser 636eaa12d9 Tools-side support for creating and destroying netchannel2 interfaces.
Signed-off-by: Steven Smith <steven.smith@citrix.com>
2009-10-07 07:47:50 +01:00
Keir Fraser 7c211e2350 mount /proc/xen in init.d/xen
pvops dom0 kernels have a separate xenfs which has to be mounted on
/proc/xen.  Systems with older configurations don't have xenfs listed
in fstab, and it can sometimes make sense to keep it that way (for
example, if the dom0 wants to boot a native-only kernel too).

The attached patch to the script which ends up in /etc/init.t/xend
mounts /proc/xen if it appears to be necessary.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
2009-09-09 15:32:30 +01:00
Keir Fraser ad46d7a628 xend: Enable to set config variables in /etc/sysconfig/xend
The attached patch enables to set the environment variables for xend
in /etc/sysconfig/xend.

There are four variables.

XENCONSOLED_TRACE=3D[none|guest|hv|all]
XENSTORED_ROOTDIR=3D/var/lib/xenstored
XENSTORED_TRACE=3D[yes|on|1]
XENBACKENDD_DEBUG=3D[yes|on|1]

The XENCONSOLED_TRACE and XENSTORED_ROOTDIR take strings for each
command's options. And if thease variables have non-zero strings, then
export them.
If the XENSTORED_TRACE and XENBACKENDD_DEBUG take either "yes", "on"
or "1" then export them.

From: Kazuhiro SUZUKI <kaz@jp.fujitsu.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2009-09-07 09:00:21 +01:00
Keir Fraser b6cd10140c hotplug scripts: better same_vm checks
currently the function same_vm in block-common.sh is the one
responsible for detecting if two block devices can be used at the same
time by two VMs. This can be allowed in few specific cases: when the
two VMs are actually the same VM and when the two VMs are the guest
and its stubdomain. We need to expand these exceptions to handle
properly save restore issues: this patch adds to the exceptions the
case when two VMs are the same VM because of save\restore races, and
when two VMs are the guest and the stubdomain of the previous guest,
again during save\restore.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
2009-08-19 13:11:33 +01:00
Keir Fraser 37541c4165 tools: Fix iptables failure test in vif-common.sh
In changset 19540 a bug was introduced in the fib_iptable function in
vif-common.sh that incorrectly checks the exit status of iptables --
it always believes iptables has failed even when it hasn't.

The attached patch fixes that.  It's also bug 1490.

Signed-off-by: John Haxby <john.haxby@oracle.com>
2009-08-07 17:31:27 +01:00
Keir Fraser a9c036a84d Revert part of c/s 19349: fixes qcow for HVM guests 2009-07-21 12:06:52 +01:00
Keir Fraser 773e0fb2ff buikd: Fix the detection of udev with udevadm version < 128
Signed-off-by: Marc-A. Dahlhaus <mad@wol.de>
2009-07-02 11:31:00 +01:00
Keir Fraser 286423408d blktap2: add blktap2 device class and device controller
blktap2 devices must be handled differently than blktap2
devices. blktap2 devices require a sysfs write to close the underlying
device, as well as extra sysfs writes when the domU is
paused/unpaused. The differences between blktap1 and blktap2 are great
enough to warrant the creation of a new device class, 'tap2', and
device controller for blktap2 devices.

  * add a new device controller (Blktap2Controller) and device class
    (tap2) for blktap2 devices
  * move blktap2 specific code from DevController to Blktap2Controller
  * if possible, check xenstore to determine block device class
  * use vmpath (/vm/<uuid>/) when releasing devices
  * modify linux hotplug cleanup script to handle blktap2 device
    removal

Signed-off-by: Ryan O'Connor <rjo@cs.ubc.ca>
2009-07-01 10:53:15 +01:00
Keir Fraser 369b997d51 xend: create /var/lock/subsys at startup
Ubuntu puts /var/lock on tmpfs, so we should create /var/lock at
startup, rather than at installation time.

Signed-off-by: Jun Koi <junkoi2004@gmail.com>
2009-06-25 13:14:03 +01:00
Keir Fraser 6cba5a2ed1 Fix buildsystem to detect udev > version 124
udev removed the udevinfo symlink from versions higher than 123 and
xen's build-system could not detect if udev is in place and has the
required version.

Signed-off-by: Marc-A. Dahlhaus <mad@wol.de>
2009-06-25 13:02:37 +01:00