Commit Graph
126 Commits
Author SHA1 Message Date
emellor@leeni.uk.xensource.com 8fc503a014 Disable use of mmap. This allows Xenstored to run with an NFS-mounted
/var/lib/xenstored.  Closes bug #400.  This fix no doubt has a performance hit,
so I have opened bug #401 to discuss a better fix.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
2005-11-12 17:51:14 +01:00
kaf24@firebug.cl.cam.ac.uk f8e8438eef Remove unnecessary NULL checks before freeing memory blocks.
The following functions check for NULL internally:
 free, kfree, xfree, free_xenheap_page[s]

Signed-off-by: Keir Fraser <keir@xensource.com>
2005-11-11 12:55:47 +01:00
emellor@leeni.uk.xensource.com a22a20e2bb Fix the log reopening by moving the code with all the races out of the signal
handler and into the main loop.  The "self-pipe trick" is used to awaken the
select() call on SIGHUP.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
2005-11-10 16:20:27 +01:00
kaf24@firebug.cl.cam.ac.uk 5e034a1be8 Fix the clean target of the tools/xenstore Makefile to
remove all files created. Currently leaves some of its
files behind.

Signed-off-by: Tobias Hunger <tobias@aquzul.com>
2005-11-08 12:06:18 +01:00
emellor@leeni.uk.xensource.com 0fad7c8152 Make xenstored reopen its trace file on SIGHUP. This allows one to rotate the
logs beneath the daemon.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
2005-11-07 12:28:53 +01:00
kaf24@firebug.cl.cam.ac.uk 0a2a26aa78 Make it clear that the result of xs_get_domain_path() must be free()'d. 2005-11-02 11:25:08 +01:00
kaf24@firebug.cl.cam.ac.uk 41ae27972e Remove all binaries on make clean. 2005-10-27 17:20:33 +01:00
emellor@leeni.uk.xensource.com e4ba1fec3e Fix format spec for tracing.
Signed-off-by: Ewan Mellor <ewan@xensource.com>
2005-10-25 16:00:49 +01:00
emellor@leeni.uk.xensource.com 8b6e8053b8 Added a timestamp to the logging output by trace_io.
Signed-off-by: Ewan Mellor <ewan@xensource.com>
2005-10-24 14:12:42 +01:00
emellor@leeni.uk.xensource.com fea7782321 Change the semantics of GetDomainPath so that it always succeeds, regardless of
whether a domain has been introduced to the store.  Added a separate message
XS_IS_DOMAIN_INTRODUCED and API for that (xs_is_domain_introduced) to determine
whether the domain has really been introduced.  This change means that the
tools can determine the correct domain path earlier in the domain creation
process, which is particularly a factor with live migration, as it allows us
to create the devices earlier in the process, and unpause the new domain before
performing the introduce.  Until recently we already had these features, but
the simplification of the interface between xend and xenstored caused breakage.

No longer clear out the domain path when a domain is introduced -- this was a
hack to work around the recent problematic semantics of GetDomainPath.

Do not write the contents of the info block to the store.  All the configuration
info is written to the /vm path, and anything else in the info block is either
dealt with explicitly or is ephemeral and has no place in the store.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
2005-10-23 22:45:15 +01:00
emellor@leeni.uk.xensource.com a04a1a1dc7 Break proc paths out into separate include file, rather than inlining them.
Signed-off-by: Ewan Mellor <ewan@xensource.com>
2005-10-21 13:30:31 +01:00
emellor@leeni.uk.xensource.com 2b99d6e3a9 Take advantage of the new UUID (handle) stored for us in Xen to improve the
recreation semantics.

Remove the unpause at the end of xc_linux_restore, and move it to
XendDomainInfo.  This is necessary because xenstored now allocates the domain
path when the domain is introduced, which means that the new domain cannot
start running until that introduce is performed and the new devices
configured.

Give restore a separate completion phase in which domain details are stored.
This is required because the domain path is no longer available until after
the introduceDomain call.

TODO: Split the domain introduction into two so that the domain path is
available earlier.  At the moment, the domain <-> store channel details are
passed in to xenstored when the domain is introduced, but in the case of
restore it is necessary to wait until the restore is completed before the
channel MFN is available.

Change the interface between XendDomainInfo and XendCheckpoint/image to not
have hideous callbacks through setConsoleRef and setStoreRef.  Instead,
image.createImage explicitly returns those values, and XendCheckpoint passes
them through to completeRestore.

Move the purging of the domain path corresponding to a new domain from Xend
to xenstored, since xenstored is now in charge of this path.  With the domain
path creation moved to xenstored, Xend cannot remove the path, because watches
may have fired on it already.

Fix the printf statement in xenstored in verbose mode that details the
messages being written.  This statement was printing the buffer using %s, but
this buffer has an explicit length field, so we were seeing garbage after the
correct details.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
2005-10-19 11:47:51 +01:00
cl349@firebug.cl.cam.ac.uk 006b46b2d0 Fix transaction EAGAIN handling in xenstore client programs.
Redirect all output to a buffer and only print the buffer once the
transaction succeeds, discarding output from previous attempts.
In particular, fixes failures when the (block) backend driver would
not configure because reads from the hotplug script did get double
output when a transaction had to be redone.
Signed-off-by: Christian Limpach <Christian.Limpach@cl.cam.ac.uk>
2005-10-18 02:08:26 +01:00
emellor@leeni.uk.xensource.com 706fcdf4de Have xenstored initialise its connections, meaning that xend can be out of
that loop completely -- the xc_init_store, initDomainStore calls can all go.

Have xenstored understand where the local domain information goes.  Xend no
longer has to generate a path and pass it to xenstored through
xs_introduce_domain -- we just allow xenstored to generate the path, and then
call GetDomainPath later.  There is still some work required to tidy this up.

Change the uuid module to generate uuids as lists of bytes, not in the
stringified form.  Added a unit test for that module.

Change the semantics of Xend restart, relying on these changes to the
xenstored semantics and earlier changes to add an opaque handle to the
hypervisor's domain-specific data block.  The semantics are now clearer, as
Xend can validate whether the details in the store match the current live
domain.

Added a usage statement to xenstored.

Some of this code is by Steven Hand.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
2005-10-17 16:22:05 +01:00
emellor@leeni.uk.xensource.com 9f7fae040f Added --tidy flag to xenstore-rm that recursively removes any empty directories
left by the primary removal.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
2005-10-15 12:52:38 +01:00
kaf24@firebug.cl.cam.ac.uk b5d8fa2d87 Fix client dependency on libxenstore in Makefile.
Signed-off-by: Keir Fraser <keir@xensource.com>
2005-10-13 11:12:11 +01:00
kaf24@firebug.cl.cam.ac.uk 3b83e00b15 Change xenstore-domain messaging protocol to match what we use
for other inter-domain comms (power-of-two-sized rings, and
free-running indexes). The interface is defined in the spirit of
the console protocol, so maybe some chance of merging them
together later?

Signed-off-by: Keir Fraser <keir@xensource.com>
2005-10-12 18:25:40 +01:00
kaf24@firebug.cl.cam.ac.uk a54918631e Fix xsls build dependency.
Signed-off-by: Keir Fraser <keir@xensource.com>
2005-10-12 18:18:43 +01:00
emellor@ewan 1d47535f5f Fix the handling of EAGAIN from the transaction_end; we were failing to do any
work if the transaction caused a retry, because optind had been obliterated.
Achieve this by splitting the main body of the loop off to a separate function,
meaning that we get rid of the goto out at the same time.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
2005-10-12 12:03:03 +01:00
kaf24@firebug.cl.cam.ac.uk d8263e8dba Fix Xen public interfaces and the tools to consistently
use stdint-format bitsize types (uint32_t and friends).

Signed-off-by: Keir Fraser <keir@xensource.com>
2005-10-12 11:07:37 +01:00
kaf24@firebug.cl.cam.ac.uk e8d5405d57 Fix compilation problems with xenstore.
Signed-off-by: Jerone Young <jyoung5@us.ibm.com>
2005-10-12 09:34:27 +01:00
jrb44@freefall.cl.cam.ac.uk 26f6adc1c8 Added xsls to xenstore Makefile install dependencies to fix "make dist".
Signed-off-by: James Bulpin <james@xensource.com>
2005-10-11 14:26:23 +01:00
kaf24@firebug.cl.cam.ac.uk 490bab7b96 Xenstore client library spawns a reader thread the first
time a watch is registered. Before this it is fine for
caller threads to read the comms channel directly as no
async messages will be received.

This avoids various user tools needlessly creating three
threads where one will do the job.

Signed-off-by: Keir Fraser <keir@xensource.com>
2005-10-11 13:02:59 +01:00
kaf24@firebug.cl.cam.ac.uk 11dde699b0 Echo request and transaction identifiers in xenstored
replies (and set to zero for async watch events).

Signed-off-by: Keir Fraser <keir@xensource.com>
2005-10-11 12:39:03 +01:00
emellor@ewan e248dc43ae Added xsls utility, which recursively lists the contents of the store.
Signed-off-by: Ewan Mellor <ewan@xensource.com>
2005-10-11 10:29:29 +01:00
emellor@ewan bcdb352075 When a domain is introduced to xenstored, check whether this has already
happened, and only return EINVAL if the event channel details have changed.
This allows Xend to introduce domains when it starts without having to be
concerned about whether xenstored has restarted at the same time.  This
behaviour used to be subsumed by the bind_interdomain semantics for existing
channels, but in the simplification of that interface, the check must now move
to userspace.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
2005-10-10 19:04:03 +01:00
emellor@ewan 99bc4ba13a Mention -s option in usage.
Signed-off-by: Ewan Mellor <ewan@xensource.com>
2005-10-10 18:59:57 +01:00
kaf24@firebug.cl.cam.ac.uk bddd41366d xenstored now supports multiple concurrent transactions per
connection, plus interleaving of transactional and
non-transactional accesses. A transaction identifier is added
to the xsd_sockmsg header structure (0 means 'not in context
of a transaction'). The user and kernel xs interfaces accept
a pointer to a transaction handle where appropriate --
currently this is directly cast to an integer identifier in
the client library / kernel driver, but will allow for keeping
extra dynamic client-side state in future if we need to.

The transaction mutex has now gone. It's replaced with a
read-write mutex, but this is only acquired for exclusive
access during suspend/resume, to ensure there are no in-progress
transactions.

Signed-off-by: Keir Fraser <keir@xensource.com>
2005-10-10 15:38:01 +01:00
kaf24@firebug.cl.cam.ac.uk 4d423f9a65 No need to gate xenstored reading requests from a
connection on whether there are pending replies/watches.
Signed-off-by: Keir Fraser <keir@xensource.com>
2005-10-10 11:37:10 +01:00
kaf24@firebug.cl.cam.ac.uk 5fec4cf766 Simplify reply logic in xenstored. Maintain a linked list
of pending replies that are sent out in order.

Currently we only read new requests when the reply list is
empty. In fact there is no good reason for this restriction.
Another interesting point is that (on my test machine)
hotplug blk setup fails if xenstored_client connects to
xenstored via the unix domain socket rather than through the
kernel --- this points to some user/kernel races that are
'fixed' by the extra serialisation of the in-kernel mutexes.
It definitely needs looking into.

Signed-off-by: Keir Fraser <keir@xensource.com>
2005-10-09 23:53:03 +01:00
kaf24@firebug.cl.cam.ac.uk 25517fd2f2 Extend xenbus/xenstore client interface to include a transaction
handle on appropriate operations. Next step is to plug this
through to the store daemon and get rid of the nasty serialisation
mutex for transactions.

Signed-off-by: Keir Fraser <keir@xensource.com>
2005-10-09 21:29:10 +01:00
kaf24@firebug.cl.cam.ac.uk 4657d174ab Refactor xenbus to break up the xenbus_lock and permit watches
to fire concurrently with request/reply pairs. Remove
watch_ack message: no longer needed.

Signed-off-by: Keir Fraser <keir@xensource.com>
2005-10-09 18:52:54 +01:00
kaf24@firebug.cl.cam.ac.uk 7429d6e032 Make libxenstore thread-safe. It also spawns an internal
thread to read messages from the comms channel.

Signed-off-by: Keir Fraser <keir@xensource.com>
2005-10-08 19:19:27 +01:00
kaf24@firebug.cl.cam.ac.uk 5b013ee256 Rationalise xenstore header files a little. xenstored.h,
which defines aspects of the 'wire' protocol between
xs daemon and clients in user and kernel land, is now
xs_wire.h and moved to xen's public/io directory. From there
it is more easily accessible by kernels.

Signed-off-by: Keir Fraser <keir@xensource.com>
2005-10-07 16:49:29 +01:00
kaf24@firebug.cl.cam.ac.uk 76bd51c23d Change xs_read_watch interface to return a sized array (in userspace and in
kernel).

Add index macros (XS_WATCH_*) for accessing the array to allow for future
expansion.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2005-10-07 15:51:53 +01:00
kaf24@firebug.cl.cam.ac.uk 07a233ac7c User tools send evtchn notifications via /dev/xen/evtchn
rather than using hypercall directly.

Signed-off-by: Keir Fraser <keir@xensource.com>
2005-10-06 17:02:38 +01:00
kaf24@firebug.cl.cam.ac.uk c804adf4b6 Change how event channels are allocated and used by the control
tools. /dev/xen/evtchn is now used by daemons to connect to
remote domains: the advantage is that the local ports are garbage
collected automatically if the daemon dies. xen no longer
constructs end-to-end event-channel port pairs -- it allocates an
unbound port in new domU and writes that port to xenstore. It is
then picked up by teh appropriate daemon which does interdomain bind
via /dev/xen/evtchn.

Signed-off-by: Keir Fraser <keir@xensource.com>
2005-10-06 16:07:52 +01:00
kaf24@firebug.cl.cam.ac.uk 1cd0f4f23f Fix tools to pull public header files from standard
location in libxc directory. Not direct from xen and
xenlinux build trees! Also fix a type name in 
x86_emulator test harness.

Signed-off-by: Keir Fraser <keir@xensource.com>
2005-10-04 15:02:18 +01:00
kaf24@firebug.cl.cam.ac.uk 45dc6ad80a xenstore fires @releaseDomain both when a domain shuts
down and when it eventually dies. xenconsoled now only
relinquishes its handle on a domain when it dies. This
allows us to 'xm console' connect to a crashed domain,
which is very useful!

Signed-off-by: Keir Fraser <keir@xensource.com>
2005-09-26 18:49:21 +01:00
emellor@ewan bdd477ad34 Add check for speed (takes 33 minutes on my laptop, OUCH!)
Make xenstored use tdb, transactions can soft-fail (EAGAIN)
Transactions no longer take root dir, no longer lock & block: commit can fail spuriously with EAGAIN, not ETIMEDOUT.
Speeds up transactions by over 1000 times, should be NFS safe.
New program: xs_tdb_dump to dump raw TDB contents.
Don't do failure testing: we are no longer robust against all ENOMEM 8(
Introduce "struct node" which contains perms, children and data.
Make struct xs_permissions unpadded, so we can write to tdb w/o valgrind complaints.
Gently modify TDB to use talloc, not do alloc on tdb_delete.

Fix up transaction users for new semantics.
Don't need a transaction around a single read in xen/i386/kernel/smpboot.c.
Python: transaction_start() returns True/False rather than raising exception on EAGAIN.
Fix usage comment on xs_transaction_end().
Include stdarg to xs_tdb_dump so it compiles.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2005-09-23 14:28:16 +01:00
Rusty Russell f11f68cd11 Make xenstored use tdb, transactions can soft-fail (EAGAIN)
Transactions no longer take root dir, no longer lock & block: commit can fail spuriously with EAGAIN, not ETIMEDOUT.
Speeds up transactions by over 1000 times, should be NFS safe.
New program: xs_tdb_dump to dump raw TDB contents.
Don't do failure testing: we are no longer robust against all ENOMEM 8(
Introduce "struct node" which contains perms, children and data.
Make struct xs_permissions unpadded, so we can write to tdb w/o valgrind complaints.
Gently modify TDB to use talloc, not do alloc on tdb_delete.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2005-09-23 14:25:01 +01:00
Rusty Russell 7c7896249b Add check for speed (takes 33 minutes on my laptop, OUCH!)
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2005-09-23 14:24:58 +01:00
kaf24@firebug.cl.cam.ac.uk c50a971459 This fixes the "make check" feature of xenstore to properly compile with
x86-64. When compiling you would get the following error since on x86-64
it was passing a long , when you are expecting an int.

Signed-off-by: Jerone Young <jyoung5@us.ibm.com>
2005-09-22 11:04:30 +01:00
cl349@firebug.cl.cam.ac.uk e83a8e7c2b Fire watches once immediately upon registration.
It matches the model of programming used to avoid races with watches,
and also makes re-establishing watches on daemon restart easier.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Christian Limpach <Christian.Limpach@cl.cam.ac.uk>
2005-09-19 14:47:56 +00:00
cl349@firebug.cl.cam.ac.uk e7dcd2ce65 Fix one more usage of xs_write.
Signed-off-by: Christian Limpach <Christian.Limpach@cl.cam.ac.uk>
2005-09-19 14:36:15 +00:00
cl349@firebug.cl.cam.ac.uk 7fd9bccce2 Remove iflag argument to xs_write
xs_write with O_CREAT|O_EXCL causes problems over daemon restarts, since
it's not idempotent.
It turns out noone really needs the flags word at all, so get rid of it.
It's now as if everyone specified "O_CREAT".
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Christian Limpach <Christian.Limpach@cl.cam.ac.uk>
2005-09-19 14:34:30 +00:00
cl349@firebug.cl.cam.ac.uk 265d719ce5 Make xs_mkdir an xs_rm idempotent.
When modifying libxenstore to transparently restart when the daemon dies,
it became apparent that life is simpler when all commands can simply be
restarted.  So this patch makes a slight semantic change to xs_rm and xs_mkdir: 
xs_rm now succeeds if the file doesn't exist (as long as the parent exists),
and xs_mkdir succeeds if the directory already exists.
Noone should notice.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Christian Limpach <Christian.Limpach@cl.cam.ac.uk>
2005-09-19 14:25:29 +00:00
kaf24@firebug.cl.cam.ac.uk 3886819443 Remove unsued domain_controller.h file.
Signed-off-by: Keir Fraser <keir@xensource.com>
2005-09-14 10:58:00 +00:00
cl349@firebug.cl.cam.ac.uk 2c0ba8d075 Fix xenstored watch crash.
When a connection blocked waiting on a transaction, don't queue watch events.
Sure, they'd be ignored and re-transmitted, but it hits an assert that we don't
send data out blocked connections, and it's wasteful.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (authored)
Signed-off-by: Christian Limpach <Christian.Limpach@cl.cam.ac.uk>
2005-09-14 08:41:49 +00:00
cl349@firebug.cl.cam.ac.uk 27cdd701cf merge? 2005-09-13 15:05:49 +00:00