Commit Graph
38 Commits
Author SHA1 Message Date
Keir Fraser 630ec346ad blktap: Revert parts of c/s 19349.
Caused blktapctrl pipes to be created with uninitialised variable in name.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2009-06-01 14:02:26 +01:00
Keir Fraser cde518aa71 blktap: Move error signaling to blktapctrl
Until now the udev script for blktap devices needs to decide if to
signal success or failure to xend. As this script runs completely
independent of blktapctrl and tapdisk/ioemu which do the real work,
the udev script can't even theoretically know if tapdisk is happy.

This patch removes the udev script and replaces its checks by new
ones in libblktap.

Signed-off-by: Kevin Wolf <kwolf@suse.de>
2009-03-12 18:48:09 +00:00
Keir Fraser 3dc413c7bd blktapctrl: Fix too early close of pipes
Connections to ioemu have single_handler set, so they are closed as
soon as all images of a certain type are closed. This is wrong with
ioemu: All images that belong to the same domain are handled by the
same backend process (usually qemu-dm, but also tapdisk-ioemu for
domains without device model), regardless of the image type.

This patch checks for the same-domain condition for ioemu connections.

Signed-off-by: Kevin Wolf <kwolf@suse.de>
2009-03-12 18:46:26 +00:00
Keir Fraser 8b173f5236 blktapctrl: Select backend by prefix
This patch adds support for specifying the backend (tapdisk or ioemu)
to blktapctrl. Images can be specified e.g. as tap:tapdisk:aio,
tap:ioemu:qcow2 or tap:vmdk. When omitting the backend, a default is
chosen based on the image type (currently always tapdisk because ioemu
as a backend is broken until a follow-up patch series against qemu-xen
is applied)

Signed-off-by: Kevin Wolf <kwolf@suse.de>
2009-03-12 18:42:31 +00:00
Keir Fraser 121068a2ce blktap: portability cleanup
Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
2008-07-14 10:03:09 +01:00
Keir Fraser 962649c369 blktap: cleanup
Make functions w/o a prototype static and remove redundant
declaration of xs_fire_next_watch().

Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
2008-07-11 15:36:40 +01:00
Keir Fraser 5109f87cee Blktapctrl compatibility layer
I originally had just changed the NEWINTF ioctl to send over 48-bits
of information, which works on 64-bit but not on 32-bit (since the arg
is an unsigned long).  Additionally, the previous changes would break
an older userland against a new kernel.  For that reason, introduce a
new ioctl (NEWINTF_EXT) that fixes both of these problems.  This is
the dom0 userland side.

Signed-off-by: Chris Lalancette <clalance@redhat.com>
2008-07-09 10:41:49 +01:00
Keir Fraser 4fe815abd1 blktap: Extend userland busid to 32 bits
Signed-off-by: Chris Lalancette <clalance@redhat.com>
2008-06-27 16:08:56 +01:00
Keir Fraser defe5e9a30 blktap: Automatically start tapdisk-ioemu on demand
When a domain wants to use a tap:ioemu disk but has no device model,
start a tapdisk-ioemu instance as provider. Also, move the creation
and removal of communication pipes to xend so that qemu-dm doesn't
need the unwanted SIGHUP handler anymore.

Signed-off-by: Kevin Wolf <kwolf@suse.de>
2008-04-23 16:57:23 +01:00
Keir Fraser 8318d7d63d Revert 17499:451ae3b8e5c8
Breaks HVM guest creation (bugzilla #1221).

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2008-04-23 13:30:24 +01:00
Keir Fraser 3b64ad17ca blktap: Automatically start tapdisk-ioemu on demand
When a domain wants to use a tap:ioemu disk but has no device model,
start a tapdisk-ioemu instance as provider. Also, move the creation
and removal of communication pipes to xend so that qemu-dm doesn't
need the unwanted SIGHUP handler anymore.

Signed-off-by: Kevin Wolf <kwolf@suse.de>
2008-04-22 14:39:33 +01:00
Keir Fraser 45b676a245 Use ioemu block drivers through blktap.
Add support for a tap:ioemu pseudo driver. Devices using this driver
won't use tapdisk (containing the code duplication) any more, but will
connect to the qemu-dm of the domain. In this way no working
configuration should be broken right now as you can still choose to
use the tapdisk drivers.

Signed-off-by: Kevin Wolf <kwolf@suse.de>
2008-03-18 10:58:47 +00:00
Keir Fraser a226d0f1bb blktapctrl: Fix a potential device minor number leak.
Signed-off-by: Kouya Shimura <kouya@jp.fujitsu.com>
2008-03-03 11:08:10 +00:00
Keir Fraser 219c37ca95 blktap: qcow2 image format support
This patch adds support for the qcow2 image format to blktap. It
consists mostly of qemu code, adapted to the blktap interfaces.
Snapshots and compressed images are supported.

The qcow2 driver may be used by either specifying tap:qcow2 or by
using tap:qcow which will detect that you have a version 2 image and
will call the qcow2 driver.

Signed-off-by: Kevin Wolf <kwolf@suse.de>
2008-02-21 10:30:57 +00:00
Keir Fraser 363a648846 blktap: cleanups for *BSD.
Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
2007-12-05 09:59:23 +00:00
Keir Fraser 8ddc7e13ab blktap: remove unused headers.
Attached patch removes unused linux specific headers
and makes bswap.h ready for BSD support.

This is first step for BSD support in blktap. More to come.
No functional change.

Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
2007-12-04 10:48:28 +00:00
kfraser@localhost.localdomain 4eb73854d7 Fix file descriptor leak in blktapctrl
The blktapctrl process is responsible for spawning individual tapdisk
processes. It does this using the 'system' method, but unfortunately
none of its file descriptors have the close-on-exec flag set. The
parent blktapctl process opens a couple of unix domain sockets
per-tapdisk it spawns. So the first tapdisk get 2 FDs leaked to it,
the second gets 4 FDs leaked to it, the 3rd gets 6 and so on. The use
of 'system' also unneccessarily invokes the shell.

Replace system with fork/execvp, and explicitly close all file handles
up to _SC_OPEN_MAX.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2007-08-01 09:04:20 +01:00
kfraser@localhost.localdomain ff2fc71eda tools: warn_unused_result build fixes.
Note that some of the existing error checking for asprintf was wrong
for Linux.  asprintf in glibc returns -1 on error, but leaves the
pointer uninitialized.  Only the BSDs zero out the pointer on error.

Also, while fixing these warnings I saw several error paths that were
incorrect.  This patch minimally fixes the warn_unused_result; more
complete error path cleanup will be a later patch.

Signed-off-by:  Charles Coffing <ccoffing@novell.com>
2007-06-12 11:38:31 +01:00
kfraser@localhost.localdomain ecc82ca3e6 blktap: Fix compile errors
When compiling the various blktap drivers with warnings cranked up, I
get errors that return values are not checked.

Signed-off-by: Charles Coffing <ccoffing@novell.com>
2007-05-24 14:07:40 +01:00
kfraser@localhost.localdomain 541b4e900d blktap: Add one more error reason statement to blktapctrl
blktapctrl already prints out exits reasons for all goto's to
open_failed except of not finding a device number for blktap0
This patch adds just that message so the user will get more info than
just "Unable to start blktapctrl"
Common source of this issue is that blktap is missing/failed to
load/...

Signed-off-by: Christian Ehrhardt <ehrhardt@linux.vnet.ibm.com>
2007-05-24 10:50:07 +01:00
Brendan Cully 5d93b6f183 Put blktap character device back into /dev/xen.
Changeset 14895:800aa9f5cec9 accidentally moved it into /var/run/tap
along with the control FIFOs.
Signed-off-by: Brendan Cully <brendan@cs.ubc.ca>
2007-05-02 09:42:43 -07:00
Jake Wires 34cb794701 [TAPDISK] Move tapdisk control files from /dev/xen to /var/run/tap
Signed-off-by: Jake Wires <jwires@xensource.com>
2007-04-23 17:15:38 -07:00
Jake Wires c4f51da19f [TAPDISK] Use incremental cookies and fix blktapctrl::test_path parameter typo.
Signed-off-by: Jake Wires <jwires@xensource.com>
2007-04-23 15:37:53 -07:00
Jake Wires a3d17a18e5 [TAPDISK] honor read-only attributes when creating tap-based VBDs
Signed-off-by: Jake Wires <jwires@xensource.com>
2007-02-23 17:26:07 -08:00
Ewan Mellor 62184014df Set FD_CLOEXEC on the pidfile fd, so that tapdisk does not get it.
Signed-off-by: Ewan Mellor <ewan@xensource.com>
2006-12-14 10:31:31 +00:00
Ewan Mellor 0a85a374e0 Steal the write_pidfile function from xenstored_core, and use it to ensure
that blktapctrl only starts once.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
2006-12-13 11:23:01 +00:00
kfraser@localhost.localdomain bc79267989 [BLKTAP] Use lartge enough types to express parameters of large block devices.
While the kernel side of blktap drivers is using 64-bit sector numbers
correctly when reporting disk sizing, the userspace parts where this
dat is actually generated is truncating at 32-bit. There are 3 variables
related to disk sizing which are used in the kernel/userspace code
'size', 'sector size' & 'info'. In kernel space these are treated as being
unsigned long long, unsigned long, and unsigned int, respectively. In
the blktap userspace code this were all varyingly long, unsigned long.
This mismatch caused 32-bit wraparound on large disks. The attached
patch updates the blktap userspace to use the same data types as
kernel space for all these params, thus both fixing the 32-bit bug &
giving the code consistency.

This patch has been tested both by comparing /proc/partitions in the
guest, with the image size seen in the host, and by using Stephen
Tweedie's 'verify-data' tool on a variety of multi-TB sized disks.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2006-11-28 13:50:32 +00:00
Andrew Warfield 3cfbe70d32 [BLKTAP] Little error handling fix to blktapctrl.c.
Signed-off-by: Andrew Warfield <andy@xensource.com>
2006-11-15 12:50:17 -08:00
kfraser@localhost.localdomain 720860012a [BLKTAP] Various cleanups necessary for ia64 support.
- remove magic number 8 and 64.
  page size / sector size is 8 on x86, however on ia64 page size is
  16kb.
  blkring size is 64 on x86. however it's 128 on ia64.
- replace 0xFFFF with INVALID_GRANT_HANDLE
- don't map io ring into user space with uncachable.
  kernel access the page with cacable and tapdisk uses memory barrier
  so that it isn't necessary.
- remove printk warning and inserted new line.
- remove unused variable, page.
- add one BUG()

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
2006-11-07 11:01:35 +00:00
kfraser@localhost.localdomain 9f29e9da09 [BLKTAP] Simplify linked-list insertion/deletion.
This should also avoid (bogus) compiler warnings, as reported
on IA64.
Signed-off-by: Keir Fraser <keir@xensource.com>
2006-10-25 10:56:50 +01:00
kaf24@firebug.cl.cam.ac.uk 1febf1acf7 [BLKTAP] Remove bogus extra public definition of sig_handler().
Also do not build the daemon -fPIC.
Signed-off-by: Keir Fraser <keir@xensource.com>
2006-10-08 18:05:57 +01:00
kfraser@localhost.localdomain dc2917720c [BLKTAP] Formatting and style cleanups to blktapctrl.
Signed-off-by: Keir Fraser <keir@xensource.com>
2006-10-06 15:04:42 +01:00
jchesterfield@dhcp92.uk.xensource.com 9bc9168a08 [BLKTAP] Blktapctrl: Add asynchronous watch on dom0 name entry for blktapctrl on startup. This patch cleans up the synchronisation issues between blktapctrl and xend at initialisation if the Dom0 entries have not yet been populated.
Signed-off-by: Julian Chesterfield <julian@xensource.com>
2006-10-05 10:55:13 +01:00
kfraser@localhost.localdomain bb52a4e20a [BLKTAP] Find major number by searching sysfs
instead of reading /proc/devices.

Signed-off-by: Steven Rostedt <srostedt@redhat.com>
2006-09-29 14:55:57 +01:00
Andrew Warfield 9dd368070b [BLKTAP] have blktap use a dynamic major
blktap currently uses a hardcoded major of 254 for the device.  This is
not robust in anyway and needs to be dynamic.

Note: it is better not to have the daemon create the node, and have udev
create it instead. But since the daemon currently creates the node
anyway, it is still the way this is done.  That change needs to be made
at another time.

Signed-off-by: Steven Rostedt <srostedt@redhat.com>
2006-09-28 12:47:45 -07:00
jchesterfield@dhcp92.uk.xensource.com 7005c6cd93 Switch blktapctrl.c over to using standard system daemon(3) call. Current patch was not closing all FDs and redirecting output to /dev/null, preventing tapdisk from launching correctly. 2006-08-01 17:59:27 +01:00
kfraser@localhost.localdomain 31c8886dc2 [BLKTAP] Properly daemonise the blktap control daemon. Fixes bug #709.
Signed-off-by: Harry Butterworth <butterwo@uk.ibm.com>
2006-07-31 18:07:25 +01:00
jchesterfield@dhcp92.uk.xensource.com 0da81aa1d4 Added blktap support. Includes kernel driver (enabled as CONFIG_XEN_BLKDEV_TAP=y) and userspace tools. The userspace deamon (blktapctrl) is enabled by default when xend is activated. For further information on using and configuring blktap see tools/blktap/README. 2006-07-13 10:13:26 +01:00