[CA-106558] & [CA-94713]: parameterise NFS request timeout value.

Allow the user to specify the maximum time a VBD should wait before reporting
errors in the case of NFS outages. The new parameter is
SR.other-config:nfs-timeout and it is specified as an integer number of
seconds. This parameter will affect the NFS timeo mount option and the tapdisk
request timeout limit.

Signed-off-by: Andrei Lifchits <andrei.lifchits@citrix.com>
[Chandrika Srinivasan imported and modified patch for xs64bit branch]
Signed-off-by: Chandrika Srinivasan <chandrika.srinivasan@citrix.com>
Reviewed-by: Thanos Makatos <thanos.makatos@citrix.com>
Reviewed-by: Ross Lagerwall <ross.lagerwall@citrix.com>
CA-110835: check XAPI session existence before trying to get the timeout

The NFS timeout config setting was introduced by CA-106558 as a
SR.other-config field. So when mounting a NFS share, the SM backend will
call back to XAPI to get this config. Normally this won't be a problem,
because SM backend driver is usually launched up by XAPI, so there is (almost)
always a XAPI session available in hand. However, in some cases, this is
not true. E.g. when HA is enabled, the heartbeat VDI needs to be mounted even
before XAPI starts, and it's invoked by the attach-static-vdi script not XAPI.
In such case, calling XAPI to get config will fail ultimately.

The patch is a shortcut fix, it verifies whether there is a valid XAPI session
around before attempting to read the config, and will just fall back to
default if there is none. A better approach would be putting the timeout
setting as part of the SMmaster's PBD device config, so that the information
will always be accessible during a relevant SMAPI call (no need for the extra
XAPI field getting), and will be dumped/loaded automatically as part of the
static VDI attaching configuration file. This could be a future improvement,
currently registered as CP-5683.

Signed-off-by: Zheng Li <zheng.li@eu.citrix.com>
Imported-by: Chandrika Srinivasan <chandrika.srinivasan@citrix.com>
(cherry picked from commit 7ddc2498b71bf036f573a84047d70d865acdf9d9)
Ported changes for CA-106558 and CA-110835

GitHub: closes #153 on xapi-project/sm