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.

Importing commit 7ddc249 from master and adding 'timeout' parameter.

Signed-off-by: Zheng Li <zheng.li@eu.citrix.com>
Imported-by: Siddharth Vinothkumar <siddharth.vinothkumar@citrix.com>