CP-8679: fake makedirs and file, add errorcodes

Enhance the testing library by faking out os.makedirs and file. This
will enable to test further components, which try to use these
functions.

Also create a setup_error_codes method that will pretend that the error
codes file required by XenError are there.

Also increase the existing testlib's coverage to 100%.

Signed-off-by: Mate Lakat <mate.lakat@citrix.com>
(cherry picked from commit 0c91e384e5de298508daeef29e3e2fc9a8bbbf83)
Fix XenError

If the XML error description does not exist in the filesystem, XenError
tried to call Exception.__init__(self, ''), which is invalid, as self is
not inheriting from Exception.

Github: fixes xapi-project/sm#158

Signed-off-by: Mate Lakat <mate.lakat@citrix.com>
(cherry picked from commit cb1e0df497c24e6e31929b69353cada6bf0e0538)
CP-8629: Do not build snapwatchd for unit testing

It is no longer required to compile snapwatchd and put the bindings on
the pythonpath, so removing it.

Signed-off-by: Mate Lakat <mate.lakat@citrix.com>
(cherry picked from commit 310776c5bb196f46abeb4f03b15997b3be4c348a)
Testlib enhancements

GitHub: closes #172 on xapi-project/sm
CP-8203: Add multipath.conf entry for EQLOGIC

Signed-off-by: Robert Breker <robert.breker@citrix.com>
Acked-by: Germano Percossi <germano.percossi@citrix.com>
CA-125717: Reinstate default dev_loss_tmo in /etc/multipath.conf

Since implementing CA-108915 we need to specify dev_loss_tmo in
/etc/multipath.conf to properly handle lost devices.
It seems that the setting accidentaly got lost when porting the configuration
file from guest-packages.hg to dm-multipath.git. This commit reinstates the
dev_loss_tmo setting that we had before.

Why we need dev_loss_tmo:
   The way in which explicit path mapping is currently implemented requires
   dev_loss_tmo to be a finite value as close to 0 as possible.

   This is because multipathd will only monitor devices that are:
     a) accessible (scsi_id works) when a new map is initially added
     b) devices that appear after new map is added.
   In case of  dev_loss_tmo infinity, it is far more likely that devices
   linger around, are not accessible when a map is initially added (violate a),
   and multipathd does not receive an event for when they become accessible
   (like when they newly appear in case b). This leads to cases in which a
   SRs are backed by less paths then available.

   The use of dev_loss_tmo 30 generally minimises this problem.

Signed-off-by: Robert Breker <robert.breker@citrix.com>
Acked-by: Germano Percossi <germano.percossi@citrix.com>
CA-125717: Make NETAPP LUN.* default to dev_loss_tmo 30 as a workaround

As the inbox device specific entry specifies dev_loss_tmo infinity, we need to
customise it in multipath.conf until we overcome the limitations when combining
explicit path mapping with larger values for dev_loss_tmo as outlined in
CA-135899.

Signed-off-by: Robert Breker <robert.breker@citrix.com>
Acked-by: Germano Percossi <germano.percossi@citrix.com>
Order device specific entries in multipath.conf alphabetically

No functional change.

Signed-off-by: Robert Breker <robert.breker@citrix.com>
Acked-by: Germano Percossi <germano.percossi@citrix.com>
Improve the comments in multipath.conf to better guide users

No functional change.

Signed-off-by: Robert Breker <robert.breker@citrix.com>
Acked-by: Germano Percossi <germano.percossi@citrix.com>
Merge multiple improvements to multipath.conf

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

GitHub: closes #146 on xapi-project/sm
CA-134864: Fix plugin call for SXM.

Signed-off-by: Siddharth Vinothkumar <siddharth.vinothkumar@citrix.com>
Reviewed-by: Chandrika Srinivasan <chandrika.srinivasan@citrix.com>

GitHub: closes #175 on xapi-project/sm
CA-130987: Forward any exceptions thrown inside _snapshot

Signed-off-by: Vineeth Raveendran <vineeth.thampi@citrix.com>
Reviewed-by: Chandrika Srinivasan <chandrika.srinivasan@citrix.com>
Imported-by: Siddharth Vinothkumar <siddharth.vinothkumar@citrix.com>
Reviewed-by: Mate Lakat <mate.lakat@citrix.com>

(cherry picked from commit 6d7cf76dc400fbc4c8ccafddf72131c65724da67)

GitHub: closes #195 on xapi-project/sm