CA-140252: Hack for legacy PV tools evtchn alignment

Since the new ioreq server in Xen, one of its event channels is now allocated
on-demand rather than eagerly at start-of-day. Therefore, when the toolstack
comes to allocate event channels for Xenstore and the console, they are
shuffled down by one.

This is fine for HVM guests with modern PV tools since they re-read this
information upon each resume. However, legacy PV tools do not and rely on these
to be the same across suspend/resume.

This patch adds an explicit workaround to realign the event channels as they
were on previous versions by having Xenopsd allocating another channel before
the two it needs. As this is done with evtchn_allocate_unbound and the guest
will not bind it, it should not affect event channel scalability in dom0.

The workaround has been made explicit and a configuration option in Xenopsd so
that we can only carry it until such a time that we no longer support HVM
guests using these legacy PV tools, at which point it can be removed.

Signed-off-by: Si Beaumont <simon.beaumont@citrix.com>
Fix build on ocaml-4.00.1

Signed-off-by: Jon Ludlam <jonathan.ludlam@citrix.com>
Merge pull request #91 from simonjbeaumont/ca-140252

CA-140252: Hack for legacy PV tools evtchn alignment
CP-9206: Replace hard-coded paths with a search path

Signed-off-by: Jon Ludlam <jonathan.ludlam@citrix.com>
CA-141366: Don't continue domain build if not enough memory

As part of the domain build, a function is called to wait_xen_free_mem which
will wait for the scrubber to free up memory and return a boolean when it is
finished or if it would never succeed. This changeset takes this value into
account when deciding whether to proceed with the domain build and fails if the
call to wait_xen_free_mem returns false like in then set_shadow_multiplier in
both the Xenops_server_xen and Xenops_server_xenlight modules.

Signed-off-by: Si Beaumont <simon.beaumont@citrix.com>
Don't log all Domain build errors as Bootloader errors

Signed-off-by: Si Beaumont <simon.beaumont@citrix.com>
CA-141366: Use a proper XenopsAPI error for Not_enough_memory

Rather than it just being becoming a generic "Internal error" later, we should
raise exceptions in the Xenops_interface where possible so clients can match
against them.

Signed-off-by: Si Beaumont <simon.beaumont@citrix.com>
Merge pull request #94 from jonludlam/CP-9206

CP-9206
CP-8989: Suspend_image_viewer debug utility

An executable that takes a path to a suspend image and parses and displays the
structure of it according to the new suspend image framing format.
Merge pull request #88 from simonjbeaumont/migv2-utility

CP-8989: Suspend_image_viewer debug utility
Merge pull request #95 from simonjbeaumont/ca-141366

CA-141366: Don't continue domain build if not enough memory
CA-141520: Only use evtchn alignment hack for HVM guests

Signed-off-by: Si Beaumont <simon.beaumont@citrix.com>
Merge pull request #96 from simonjbeaumont/ca-141520

CA-141520: Only use evtchn alignment hack for HVM guests
Remove unused variable

Signed-off-by: Si Beaumont <simon.beaumont@citrix.com>
Allow type system to enforce assumptions about poll

Signed-off-by: Si Beaumont <simon.beaumont@citrix.com>
Declare Libxl call before use in bindings

Signed-off-by: Si Beaumont <simon.beaumont@citrix.com>
Remove commented out Libxl bindings

These are now in the Xen source tree.

Signed-off-by: Si Beaumont <simon.beaumont@citrix.com>
Enable errors for all warnings

Signed-off-by: Si Beaumont <simon.beaumont@citrix.com>
Merge pull request #97 from simonjbeaumont/fix-warnings

Fix compiler warnings and enable errors for future warnings