David Scott [Wed, 3 Feb 2010 22:33:20 +0000 (22:33 +0000)]
CA-36554: improve the logging around the fork/exec daemon.
Switch from a buffer to a list of strings, one entry prepended on every 'debug' invocation. In the error path, walk the reversed list and dump each string separately to syslog.
Signed-off-by: David Scott <dave.scott@eu.citrix.com>
[rpc-light] when (un)marshaling variant, if it has no arguments then consider it as a string.
This bit is also necessary to discuss with the SM backend.
Basically, if you have 'type t = Foo | Bar of int with rpc' you will consider than the value Foo is actually the same thing as the string "Foo" (if you don't want to have a capital letter, use polymorphic variants as 'type t = [ `foo | `bar of int ]' which will give that the value `foo will be considered as the string "foo").
Signed-off-by: Thomas Gazagnaire <thomas.gazagnaire@citrix.com>
[rpc-light] Optimize the way (string * t) list are marshaled
This bit is necessary to discuss with the SM backend and it is also a nice optiomization. Basically, if you have: 'type t = (kk, vv) list with rpc' the library will check if value of type 'kk' are marshaled to a string; if yes, instead of having a list of stuff, it creates a dictionary which is what the python XenAPI bindings are looking for.
Signed-off-by: Thomas Gazagnaire <thomas.gazagnaire@citrix.com>
[rpc-light] Protect the XML strings as xml-light2.
xmlrpc converts '>' to '>', '<' to '<', '"' to '"' and do not erase weird characters (need to use a proper unicode validation functions at one point)
Signed-off-by: Thomas Gazagnaire <thomas.gazagnaire@citrix.com>
[rpc-light] XMLRPC fault need to be parsed correctly
Moreover, in case of complex return value v when we have an error, apply the xapi policy which is to create a structure { Status : Failure; ErrorDescription : v }. When unmarshalling the XMLRPC, if we got { Status : Success; Value: v }, then it is equivalent to v. This is sufficiently flexible to discuss with the SM backend and xapi (which have different conventions).
Signed-off-by: Thomas Gazagnaire <thomas.gazagnaire@citrix.com>
[rpc-light] Add some friendly error messages on runtime errors
This patch defines an exception 'Parse_error of (string * string * input)' when;
- the 1st string is the symbol the parser got
- the 2nd string is the symbol the parser was waiting for
Signed-off-by: Thomas Gazagnaire <thomas.gazagnaire@citrix.com>
[rpc-light] Backport the value library and clean-up the Makefile and the library building.
The value library is part of the ocaml-orm project available here: http://github.com/avsm/ocaml-orm-sqlite
This backport improves multiple points of the value library (which will be upstreamed later), like the polymorphic type variables or the type variable with module names (ie. 'type t = 'a M.tt with rpc' will work). Basically, all the types used by xapi are handles + some minor extensions as objects.
Signed-off-by: Thomas Gazagnaire <thomas.gazagnaire@citrix.com>
David Scott [Tue, 22 Dec 2009 14:47:23 +0000 (14:47 +0000)]
CA-36092: Modifying Stunnel.connect's verify_cert argument to be tri-state.
The values are:
Some true -> do verification
Some false -> don't do verification
None -> do verification if the file /var/xapi/verify_certificates exists
Signed-off-by: Magnus Therning <magnus.therning@eu.citrix.com> Acked-by: David Scott <dave.scott@eu.citrix.com>
Jon Ludlam [Mon, 21 Dec 2009 18:10:59 +0000 (18:10 +0000)]
MLVM library
This is a reimplementation of LVM in ocaml. It has had light testing, and therefore might corrupt data - use with caution! It only implements simple LVM functionality - creating/destroying/activating linear LVs (code exists for striped LVs but is untested). It also features a redo log so that LVM operation can be committed to disk in constant time.
Signed-off-by: Jon Ludlam <Jonathan.Ludlam@eu.citrix.com>
Jon Ludlam [Mon, 21 Dec 2009 18:10:58 +0000 (18:10 +0000)]
A few bits and pieces to support the vhd daemon
* Introduce a dereferencing type to camldm so that PVs can be referenced by ID rather than by device name. This is useful for passing a device-mapper table between hosts where the physical device for a particular PV is different.
* Implement device-mapper reload/suspend/resume so that a table can be changed without tearing down the device
* A few more helper functions for stdext
Signed-off-by: Jon Ludlam <Jonathan.Ludlam@eu.citrix.com>
David Scott [Mon, 21 Dec 2009 15:36:49 +0000 (15:36 +0000)]
CA-33440: Now that the direct fork code has been moved to stunnel, simplify the 'pidty' to only consider the single case of forking via the external daemon.
Signed-off-by: David Scott <dave.scott@eu.citrix.com>
David Scott [Mon, 21 Dec 2009 15:36:49 +0000 (15:36 +0000)]
CA-33440: Move the unsafe direct fork_and_exec code from forkhelpers into stunnel, since it's only stunnel (called from the CLI) which actually needs it.
Signed-off-by: David Scott <dave.scott@eu.citrix.com>
David Scott [Mon, 21 Dec 2009 14:22:52 +0000 (14:22 +0000)]
CA-36075: add back in a sane default $PATH for subprocesses that need it.
In particular the 'EXTSR' storage backend expects to find 'pvcreate' on the path. Rather than just fixing this one instance and then seeing what else fails, this patch should prevent this class of error recurring.
Note that the only place we actually pass a custom environment to a subprocess is when installing the debian etch template.
Signed-off-by: David Scott <dave.scott@eu.citrix.com>
David Scott [Fri, 18 Dec 2009 20:48:37 +0000 (20:48 +0000)]
CA-33440: when starting an stunnel process, careful to handle the case where we still do fork the binary directly i.e. that used by quicktest and the CLI.
Signed-off-by: David Scott <dave.scott@eu.citrix.com>
David Scott [Fri, 18 Dec 2009 20:48:36 +0000 (20:48 +0000)]
CA-33440: Add an 'install.sh' into which we can place commands like 'chkconfig --add fe'. Eventually we can trigger this from a proper package post-install script.
The script is named by repo currently:
/etc/xensource/scripts/install/install-xen-api-libs.hg.sh
Signed-off-by: David Scott <dave.scott@eu.citrix.com>
Jonathan Knowles [Fri, 20 Nov 2009 14:22:16 +0000 (14:22 +0000)]
Adds functions "file_lines_{fold,iter}" to the Unixext module. These functions implement the standard "fold" and "iter" functions for all the lines in a file.
Signed-off-by: Jonathan Knowles <jonathan.knowles@eu.citrix.com>
David Scott [Wed, 11 Nov 2009 17:41:48 +0000 (17:41 +0000)]
Use autoconf to detect: xen headers; XS_RESTRICT in patchqueue; ocaml packages xmlm, type-conf; libdevicemapper; and linux-specific CDROM ioctls.
Modify the xen-api-libs.hg master Makefile to conditionally compile only those libraries whose system dependencies are met. So we:
* don't compile the xen libraries (xc, xb etc) if xen/xen.h is missing
* don't compile the cdrom library if the linux ioctls are missing
* don't compile the xml-light2, rss libraries if xmlm is missing
* don't compile rpc-light if type-conv is missing
* don't compile camldm if libdevicemapper is missing
This makes it easier for these libs to be used by other tools which may not need (eg) the xen or devicemapper bindings. Note that xen-api.hg needs most of these so any missing library will lead to a xen-api.hg build failure.
Signed-off-by: David Scott <dave.scott@eu.citrix.com>
[packaging] separate the normal Makefile from the one used to build the components and create a bins target which build and install binaries (as closeandexec).
Signed-off-by: Thomas Gazagnaire <thomas.gazagnaire@citrix.com>
David Scott [Fri, 30 Oct 2009 12:50:07 +0000 (12:50 +0000)]
Switch all xapi syslog logging to 'local6' rather than 'daemon' (ie same as blktapcntrl is about to use). This allows us to (i) keep logging through syslog; but (ii) define in the syslog.conf whether the data is written synchronously or not.
Signed-off-by: David Scott <dave.scott@eu.citrix.com>
Rob Hoes [Wed, 28 Oct 2009 17:06:00 +0000 (17:06 +0000)]
[ocamldoc] Build-in Ocamldoc support
Typing 'make doc' will generate documentation for the libraries in xen-api-libs. The documentation is integrated in the xen-api documentation (the custom ocamldoc generator in xen-api.hg is used). This only works when xen-api.hg is present in myrepos and 'make doc' has been executed in it.