CA-120162: don't fail if the GC can't be kicked

When a VDI.delete needs to abort the GC and restart it, a deadlock might
occur which leads to reporting that VDI.delete failed while it has
partially succeeded, as the actual deletion of the VDI will happen
sooner or later. Fixing the deadlock is not straightforward, so the best
effort solution is to simply ignore such failures.

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

GitHub: closes #83 on xapi-project/sm
CA-116748: Fix VSS Snapshot for 64 bit.

- Removed swig dependency by adding a new xslib.py which defines
  wrappers for the api's defined by xen.lowlevel.xs library to communicate with xenstore.
- Removed xslib.c, xslib.h, xslib.i
- Fix drivers/vss_control.
- Removed xslib dependency from srmetadata.py.
- Fix journaler.py dependencies.
- Fix Makefile.

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

GitHub: closes #85 on xapi-project/sm
CP-7830: Move all references to iscsiadm inside iscsilib

Signed-off-by: Chandrika Srinivasan <chandrika.srinivasan@citrix.com>
Acked-by: Germano Percossi <germano.percossi@citrix.com>

GitHub: closes #86 on xapi-project/sm
CA-128373: move lvm.conf patch from dom0.hg to sm

Patch in dom0.hg/patches.dom0/patch-etc_lvm_lvm.conf takes care of
CA-16427 and CA-57153. Because of CP-5830, we end up with inconsistent
lvm.conf files. We drop the patch from dom0.hg and now configure
lvm.conf during SM RPM installation time, the same way we do for CP-5830.

NB the way we configure lvm.conf is very fragile, we should use
Germano's Python script for Borehamwood (it lives in
tampa-lcm/sm.hg/mk/sm.spec.in).

Signed-off-by: Thanos Makatos <thanos.makatos@citrix.com>
Reviewed-by: Chandrika Srinivasan <chandrika.srinivasan@citrix.com>

GitHub: closes #87 on xapi-project/sm
CA-122205: Resolve race between VDI.activate and GC.

The issue here is journaler._getAllEntries() that activates, opens and
deactivates journaler tagged LV files from the LVHDSR.attach
call. A parallel running GC could remove the journaler LV during this
time, resulting in _getAllEntries to throw an exception EIO. Ignoring
such errors in such cases, since it reduces the false positives.

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

GitHub: closes #81 on xapi-project/sm
CA-122205: Addressing build errors, also backing out blktap2 changes

The blktap2.py changes in commit 68286d16 are not relevant to this issue,
it could be worked on later.

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

GitHub: closes #89 on xapi-project/sm
[CA-128364] & [CP-7396]: Fix tapdisk rrd plugin deregister call.

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

GitHub: closes #88 on xapi-project/sm
[CA-129187] & [CA-116748]: remove xs path to ignore error if path does not exist

Also modified the way exception is raised, use Exception class
instead of string

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

GitHub: closes #90 on xapi-project/sm
CA-114341: check return value of LVHD plugins

Initially the return value of the call to the plugin was checked (when
the plugin was called via the xe command), and when xe was replaced the
check was removed. It is unclear why this happened (no justification in
the commit messages), so it might be an omission.

Signed-off-by: Thanos Makatos <thanos.makatos@citrix.com>
Reviewed-by: Germano Percossi <germano.percossi@citrix.com>
CA-114341: GC: acquire VDI lock non-blocking

The GC needs to acquire the SR and VDI locks in the reverse order
VDI.activate/deactivate do, which leads to temporary deadlock that is
resolved when the VDI.activate/deactivate give up. This patch makes the
GC to simply try to acquire the VDI lock, if it fails to do so it skips
the VDI, and that leads to the GC releasing the SR lock.

Signed-off-by: Thanos Makatos <thanos.makatos@citrix.com>
Reviewed-by: Germano Percossi <germano.percossi@citrix.com>
Merge CA-114341

Signed-off-by: Germano Percossi <germano.percossi@citrix.com>

GitHub: closes #84 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>
CA-117628: don't ignore result of VHD footer zeroing errors

Although this commit is not required for fixing the issue, it is still
important we were previously ignoring the result of it detected the
actual error much later on.

Signed-off-by: Thanos Makatos <thanos.makatos@citrix.com>