David Scott [Wed, 21 Jul 2010 22:29:38 +0000 (23:29 +0100)]
Add functions Zerocheck.get_next{zero,nonzero} which can be used to detect sparseness (relatively efficiently). Both functions primarily use aligned unsigned int-sized accesses.
Signed-off-by: David Scott <dave.scott@eu.citrix.com>
David Scott [Wed, 21 Jul 2010 22:29:15 +0000 (23:29 +0100)]
Add new modules: lazyList, extentlistSet, set_test to stdext
lazyList contains a simple lazy list implementation.
extentlistSet contains a Set implementation where elements are stored as a list of (start, length) pairs
set_test contains functions to test a set implementation
extentlistset_test contains test cases for extentlistSet using set_test.
Signed-off-by: David Scott <dave.scott@eu.citrix.com>
Rob Hoes [Fri, 18 Jun 2010 13:32:23 +0000 (14:32 +0100)]
Add biosdevname call to Netdev
biosdevname is a tool used to find out the "real" device name of a network interface, according to the BIOS. This name is not affected by manual device renaming or changes in the Linux kernel.
Rob Hoes [Fri, 18 Jun 2010 13:32:23 +0000 (14:32 +0100)]
Add biosdevname call to Netdev
biosdevname is a tool used to find out the "real" device name of a network interface, according to the BIOS. This name is not affected by manual device renaming or changes in the Linux kernel.
Ewan Mellor [Thu, 29 Apr 2010 09:22:07 +0000 (10:22 +0100)]
CA-37279: Stunnel error from WLB connect "No route to host"
Understand "No route to host" as an expected error message from stunnel, and turn that into API error WLB_UNKNOWN_HOST if we see it when contacting WLB.
This is two patches, one for xen-api-libs.hg, and one for xen-api.hg.
Signed-off-by: Ewan Mellor <ewan.mellor@eu.citrix.com>
David Scott [Tue, 30 Mar 2010 10:30:33 +0000 (11:30 +0100)]
CA-38687: be more accepting of ISO8601 dates without a timezone.
Note that xapi expects all dates to be in UTC; xapi knows nothing about timezones.
The XMLRPC spec is vague but encourages people to *omit* the timezone information from requests. We now accept such vague inputs but we still expect them to be in UTC.
The following python snippet produces no results without the fix and the full message list (as expected) with the fix:
Jon Ludlam [Wed, 24 Mar 2010 12:16:36 +0000 (12:16 +0000)]
CA-39123: Fix xapi execution in a VM. The new get_boot_cpufeatures hypercall hasn't yet been implemented in xiu. This is a temporary patch to fix the symptoms until xiu is fixed to do this properly.
Original patch by Ian Campbell.
Signed-off-by: Jon Ludlam <Jonathan.Ludlam@eu.citrix.com>
David Scott [Tue, 16 Mar 2010 20:54:36 +0000 (20:54 +0000)]
CA-38120: if we fork/exec a process and it doesn't exit with 0 (ie non-zero exit or signal of some kind) then log a message to syslog containing the pid, truncated cmdline and exit status.
Signed-off-by: David Scott <dave.scott@eu.citrix.com>
Ian Campbell [Mon, 15 Feb 2010 17:35:01 +0000 (17:35 +0000)]
Use correct upstream name for /dev/xen/evtchn.
This name has been upstream since forever and the typo here was leaving us with two device nodes.
If the device is not present then do not create it. The assumption that /dev/xen/ev{en,}tchn is minor 63 does not hold since the driver requests a dynamic minor.
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Rob Hoes [Mon, 8 Mar 2010 11:35:48 +0000 (11:35 +0000)]
CP-1652: Cpuid modules gets physical and current CPU features from Xen
Previously, the physical features were kept in a file in dom0 on first boot. This is not very robust, so now all physical and current CPU features come directly from Xen via a hypercall.
David Scott [Mon, 8 Mar 2010 11:28:56 +0000 (11:28 +0000)]
CA-38105: Fix a heap corruption in the stub_unix_recv_fd C fn.
The ocaml manual states
"caml_alloc_small(n, t) returns a fresh small block of size n <= Max_young_wosize words, with tag t. If this block is a structured block (i.e. if t < No_scan_tag), then the fields of the block (initially containing garbage) must be initialized with legal values (using direct assignment to the fields of the block) before the next allocation."
This function returns a tuple including an AF_UNIX value of type Unix.sockaddr where:
type sockaddr =
| AF_UNIX of string
| ...
Unfortunately the C fn called copy_string() to add the string to the heap block *without setting the field of the block*. This means that the field contains garbage so, in the rare event of the string allocation exhausting the minor heap and invoking a GC, the GC follows the garbage pointer and crashes. Helpfully the stack makes this obvious:
Program terminated with signal 11, Segmentation fault.
[New process 19425]
#0 0x0808135a in caml_oldify_mopup ()
(gdb) bt
#0 0x0808135a in caml_oldify_mopup ()
#1 0x08081416 in caml_empty_minor_heap ()
#2 0x080814fc in caml_minor_collection ()
#3 0x080820cc in caml_alloc_string ()
#4 0x0808216c in caml_copy_string ()
#5 0x080786d2 in stub_unix_recv_fd ()
#6 0x0805536f in camlFecomms__receive_named_fd_91 ()
The fix is to initialise the field to a legal value before calling copy_string. Note that the field is unconditionally reset to a proper string type in the following if statement.
Signed-off-by: David Scott <dave.scott@eu.citrix.com>
Jon Ludlam [Mon, 8 Mar 2010 11:28:56 +0000 (11:28 +0000)]
CA-38105: Fix segfault in fork-and-exec-daemon.
The segfault would have happened when a message was receieved on this socket without an associated fd being sent. This is bad behaviour on the part of the client, but shouldn't cause a segfault. This patch fixes the segfault, but we'll need to fix the client too!
Signed-off-by: Jon Ludlam <Jonathan.Ludlam@eu.citrix.com
Jon Ludlam [Mon, 8 Mar 2010 11:28:56 +0000 (11:28 +0000)]
CA-38105: The recent patch to the recv_fd function causes it to return an fd of -1 rather than segfault, so catch that and log what was actually received on the socket
Signed-off-by: Jon Ludlam <Jonathan.Ludlam@eu.citrix.com>
Rob Hoes [Wed, 17 Feb 2010 10:14:40 +0000 (10:14 +0000)]
CP-1635: Cpuid module to obtain CPU information
This module obtains the vendor/model/family/stepping as well as feature information from the CPU, and determines whether CPU feature masks can be applied.
Module Fun gets operators for function composition and application.
Exposes function composition (++) and function composition with two
arguments (+++) to the Fun module of our extended standard library.
Adds and exposes function application ($).
Adding extensions to some modules in the extended standard library:
- to the Map module
- to the List module
- and some functional combinators (like compose with (++)) in Fun module
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>