CP-5443: Make sm compile with different Python versions.

Use proper include directory.

Signed-off-by: Frediano Ziglio <frediano.ziglio@citrix.com>
CA-99235: Keep trying to remove the tag forever

In the error handling path of VDI.activate, if the connection with the
master is lost, the slave cannot remove the tag from sm-config. When the
connection is restored, the VDI is left in undefined state. To avoid
this we keep trying to remove the tag until we succeed (the connection
with the host has been restored).
Merge pull request #7 from tmakatos/CA-99235

CA-99235: Keep trying to remove the tag forever
Merge pull request #6 from freddy77/python_version

CP-5443: Make sm compile with different Python versions.
CA-110509: Impossible to create LVHD over iSCSI SRs with more then one iSCSI target IP

When passing multiples IPs on the target list, when printing entries for the
wildcard option we compose a string this way
IP1,IP2,..,IPn:PORT
The IPs can be in IPv4 or IPv6 format but the last colon is always
a delimiter for the port.
The parse_IP_port function is not suitable in this case (it needs to be modified, anyway),
so we simply split the PORT from the rest of the string: the latter is kept as it is.
CA-108915: Deprecate mpathHBA so dev_loss_tmo can be configured by DMP

SM calls the script /opt/xensource/sm/mpathHBA if a host has at least one
multipathed HBA SR. The script mpathHBA goes through all fc-ports and specifies
dev_loss_tmo (and the deprecated variant lpfc_nodev_tmo) as MPATH_TIMEOUT=30s.
This is not good because some users need to modify this timeout value in order
to accommodate controller failover events.

In recent versions of DM Multipath dev_loss_tmo can be configured as a
configuration option in /etc/multipath.conf. This commit removes
/opt/xensource/sm/mpathHBA so DMP can set the dev_loss_tmo value which users
configure in multipath.conf.

Signed-off-by: Robert Breker <robert.breker@citrix.com>
CP-5736: ISCSISR - force_tapdisk

This is a workaround to make it possible to use a domU provided iSCSI
target as a raw iSCSI SR. By using the force_tapdisk parameter during SR
creation, disks will be accessed through tapdisk aio which copies
blocks, preventing page sharing issues between guests. This is a
workaround for the bug CA-110453.
CP-5736: Unit tests

Unit tests and scripts to setup the environment. See tests/README for
details.
CA-111816: Remove duplicate diskdatatest-folder from the sm repository

The sm-repository currently contains the folder diskdatatest although the same
folder is as well contained in the xencert-repository.

As XenCert is the only component that uses diskdatatest, it seems the better
place to maintain it. This commit removes the duplicate copy from SM.

Signed-off-by: Robert Breker <robert.breker@citrix.com>
PR-1291: Initial Commit for OCFS2 SR Offering
Update README.md

Fix typo
CP-4526: Fix SR.scan.
CP-4523:  Storage Thin Provisioning: Handle OCFS2 failure

Added new OCFS specific errors and covered all error paths in OCFS operations.
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>

GitHub: closes #10 on xapi-project/sm
CA-113313: Limiting the OCFS SR offering to OCFSoHBA and OCFSoISCSI.
CA-113314: Fixed OCFSoHBA scan error, added 3rd unused arg to vdi(),
ref. FileSR
CP-5737: Fix typo in comment

Signed-off-by: Frediano Ziglio <frediano.ziglio@citrix.com>
CP-5737: Properly format output string.

Add missing operator to format a string.

Signed-off-by: Frediano Ziglio <frediano.ziglio@citrix.com>
CP-5737: Avoid to mix different types during checks.

'f' was either integer or fileobject, this could cause type errors, use None
to have always an object.

Signed-off-by: Frediano Ziglio <frediano.ziglio@citrix.com>
CP-5737: Find proper lvm tools directory

Directory is /usr/bin or /sbin base on distro (CentOS 6.4 uses /sbin).

Signed-off-by: Frediano Ziglio <frediano.ziglio@citrix.com>