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-122205: Continuation to the previous commits

Tests have uncovered additional failures, expanding error handler
to catch ENOENT againt OSError and EIO against CommandException

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

GitHub: closes #94 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.

Signed-off-by: Thanos Makatos <thanos.makatos@citrix.com>
Reviewed-by: Germano Percossi <germano.percossi@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 as we were previously ignoring the result of it and detected the
actual error much later on.

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

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

GitHub: closes #93 on xapi-project/sm