CP-7343: Enable conversion for whitespaces

Enable CentOS 6.5 flag to fix problem with devices with padded IDs.
Use same name mangling as udev rules.

Signed-off-by: Frediano Ziglio <frediano.ziglio@citrix.com>
Reviewed-by: Chandrika Srinivasan <chandrika.srinivasan@citrix.com>

Github: closes #67 on xapi-project/sm
CP-5913: Move users of "xs.h" to "xenstore.h"

Signed-off-by: Zoltan Kiss <zoltan.kiss@citrix.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Thanos Makatos <thanos.makatos@citrix.com>

GitHub: closes #74 on xapi-project/sm
CA-125486: Don't use commas in /etc/multipath.conf

The syntax of some of the custom entries in /etc/multipath.conf is wrong. It is
not valid to separate parameter declarations using commas.

The DM multipath parser misreads and does not apply the erroneous custom
configuration entries.

Signed-off-by: Robert Breker <robert.breker@citrix.com>
Acked-by: Germano Percossi <germano.percossi@citrix.com>

GitHub: closes #72 on xapi-project/sm
CA-127209: Disk may not have enough space to do a parent inflate

In case when the clone operation failed for Out of Storage, disk may not
have enough space to do a inflate parent keeping the full sized child.
The order of operation should be to delete the children, and then go for
a parent inflate

Signed-off-by: Vineeth Thampi Raveendran <vineeth.thampi@citrix.com>
Reviewed-by: Thanos Makatos <thanos.makatos@citrix.com>

GitHub: closes #77 on xapi-project/sm
CP-7396: Ensure tapdisk reports metrics to rrdd.

- Register tapdisk with rrdd as a plugin when we open a new tapdisk.
- Deregister tapdisk with rrdd before we detach the tapdisk.

Signed-off-by: Siddharth Vinothkumar <siddharth.vinothkumar@citrix.com>
Reviewed-by: Vineeth Thampi Raveendran <vineeth.thampi@citrix.com>

GitHub: closes #75 on xapi-project/sm
CA-125230: Fix compilation for 64 bit

Support pack use fixed build architecture.
Change to detect architecture to fix building on 64 bit architecture and
stay compatible with 32 bit one.

Signed-off-by: Frediano Ziglio <frediano.ziglio@citrix.com>
Acked-by: Germano Percossi <germano.percossi@citrix.com>

GitHub: closes #68 on xapi-project/sm
CA-117628: allow LVM metadata updates when running through plug-in

This patch uses the LVM configuration file that allows metadata updates when
running LVM commands on the master through the plug-in. In addition,
this patch introduces checks on the return value of a few functions.

Signed-off-by: Thanos Makatos <thanos.makatos@citrix.com>
Acked-by: Germano Percossi <germano.percossi@citrix.com>

GitHub: closes #70 on xapi-project/sm
XOP-591: Dump sm_config as part of NFSVDI.generate_config

This information is used by HA to attach heartbeat VDI when XAPI is
not around. It is necessary to preserve the sm_config information
because it now contains the nosubdir flag which is crucial for
deciding which path to mount.

Previously, we deliberately didn't change this to minimize code
churn, because we knew that Cloudstack didn't use XenServer's HA,
and even if they do, they should use the normal NFSSR with subdirectory.

However, the situation changed. Firstly, CloudStack will use XenServer's
HA; Secondly, a user could set heartbeat SR to CloudStack's primary NFSSR
storage by mistake (which has the nosubdir=true) and he/she will then
stuck in a situation can't easily recover. Therefore, we must fix this
problem properly.

Signed-off-by: Zheng Li <zheng.li@citrix.com>
Reviewed-by: Vineeth Thampi Raveendran <vineeth.thampi@citrix.com>

Github: closes #78 on xapi-project/sm
Revert "CA-117628: allow LVM metadata updates when running through plug-in"

This reverts commit e4a239c3dcc901d63ffb71644e532c8d050b84aa. The commit
is reverted because it has apparently exposed an existing bug. Will
reapply the commit once this is confirmed and the bug fixed.

Signed-off-by: Thanos Makatos <thanos.makatos@citrix.com>
Acked-by: Germano Percossi <germano.percossi@citrix.com>

Github: closes #80 on xapi-project/sm
CA-127463: After a snapshot failure, VHDs are left in PAUSED state

In the event of a snapshot failure, both tapdisk and VHDs are left in
paused state. During the recovery cycle using journaler mechanism, the
VHDs are brought back to a stable state, but further vdi deactivate will
fail with VHDs in paused state. Currently there is no mechanism to
unpause the VHDs and the tapdisk.

Signed-off-by: Vineeth Thampi Raveendran <vineeth.thampi@citrix.com>
Reviewed-by: Thanos Makatos <thanos.makatos@citrix.com>

GitHub: closes #79 on xapi-project/sm
CA-128175: vhd-util check on ~TB sized disk taking long.

vhd-util check by default does a quadratic check on the BAT that takes a long time
(In the order of 10 mins) to finish. This inadvertently could block leaf
coalesce. Skipping of quadratic BAT check was introduced via CA-90801
for non-leaf coalesce case.

Signed-off-by: Vineeth Thampi Raveendran <vineeth.thampi@citrix.com>
Reviewed-by: Thanos Makatos <thanos.makatos@citrix.com>

GitHub: closes #82 on xapi-project/sm