CA-94406: VDI reset only on epoch begin

This resolves a bug where VDIs were reset after migration, because the act of
plugging a VBD will reset the VDI. A corresponding change in the storage
managers moves the reset_leaf call (which resets VDIs) to the SR command
"vdi_epoch_begin", which was recently added to Xapi's SMAPIv2.

This commit just adds the plumbing necessary to call epoch_begin and epoch_end
on VDIs in the storage layer. The corresponding commit in sm.hg adds those
commands to the storage layer, and also moves the reset_leaf call into
vdi_epoch_begin.

Signed-off-by: Mike McClurg <mike.mcclurg@citrix.com>
Remove erroneous extra call to VDI.epoch_end

Signed-off-by: Mike McClurg <mike.mcclurg@citrix.com>
CA-95645: fix Python 2.6 type error comparing DateTime

We compare the result of an rpc call with a constant called
_RECONNECT_AND_RETRY (which was just set to an anonymous function) to decide if
we need to retry the rpc call. When the result is a DateTime object, and we're
using python 2.6+, this comparison (using ==) throws an exception.

The fix is to use the 'is' operator instead of '==', so that we're testing
object equality, and not structural equality. We also set the
_RECONNECT_AND_RETRY constant to object(), which is more sensible than (lambda
_ : ()).

Signed-off-by: Mike McClurg <mike.mcclurg@citrix.com>
Import patch api-remove-TypeToXml
Import api-autogen-use-rpc-light
Import api-task-use-rpc-light
Import patch api-server-use-rpc-light
Import patch api-autogen-refactor-to-match-the-rpc-arg-names
Whitespace
Import some of patch api-events-use-rpc-light
Merge pull request #948 from mcclurmc/ca95645-python-2.6-datetime

CA-95645: fix Python 2.6 type error comparing DateTime
CA-94616: Check SR Capabilities before suspending VM for checkpoint
Whitespace: Xapi_pv_drivers_version.of_drivers_version.

$ camlp4o -printer o -no_comments ocaml/xapi/xapi_pv_driver_version.ml | md5sum
5605b59b4dae1e43796c0b158ae99dcd  -
$ git checkout HEAD^
$ camlp4o -printer o -no_comments ocaml/xapi/xapi_pv_driver_version.ml | md5sum
5605b59b4dae1e43796c0b158ae99dcd  -

Signed-off-by: John Else <john.else@citrix.com>
CA-89023: Fix PV tools OS type detection.

Using the /drivers/xenvbd xenstore key to flag that a guest is Windows
is problematic, since:

1. This key goes away after suspend/resume or migrate, so cannot be
   relied upon to mark PV tools as out of date after a rolling pool upgrade.
2. This key isn't written at all by the Tampa PV drivers.

Instead, we now check that /data/os_distro equals "windows" - this value is
hardcoded in the windows guest agent.

Signed-off-by: John Else <john.else@citrix.com>
Fix typo.

Signed-off-by: John Else <john.else@citrix.com>
Fix various things such that it now compiles
Use custom marshallers to make sure rpc-light generated xml is
identical to xml-light2

Signed-off-by: Jon Ludlam <jonathan.ludlam@eu.citrix.com>
Fix some more marshalling issues.

Add marshallers for Set Enum types whenever they're not already
in the set of all types.

Signed-off-by: Jon Ludlam <jonathan.ludlam@eu.citrix.com>
Use rpc-light for events

Signed-off-by: Jon Ludlam <jonathan.ludlam@eu.citrix.com>
Fix the marshalling of XenAPI methods that have unit response type

This is now done my marshalling an empty string, in the same way
that the old XMLRPC layer used to. This commit also fixes the
old-style XMLRPC embedded Json, and also the return of
system.listMethods

Signed-off-by: Jon Ludlam <jonathan.ludlam@eu.citrix.com>