CA-136790: Move utility function refreshDev from B_util to scsiutil

So it can be used throughout SM.

Signed-off-by: Robert Breker <robert.breker@citrix.com>
Reviewed-by: Keith Petley <keith.petley@citrix.com>
CA-136790: Add utility function for calling python functions with a timeout

Signed-off-by: Robert Breker <robert.breker@citrix.com>
Reviewed-by: Keith Petley <keith.petley@citrix.com>
CA-136790: Add utility functions for refreshing LUN sizes to scsiutil, on_slave

This commit implements means to effectively refresh LUN sizes for a provided
SCSIid. It provides functionality to refresh the current host, with and w/o
multipath, as well as all slaves in a pool.

Signed-off-by: Robert Breker <robert.breker@citrix.com>
Reviewed-by: Keith Petley <keith.petley@citrix.com>
CA-136790: Enable online expansion of LVHDxSRs

Attempt to expand the size of LVHDxSRs by growing into additional available
space, if extra space exists on the backing device during sr-attach of the
master or sr-scan.

If the master detects that the LUN has been resized, it will synchronize
with the slaves. If all nodes succeed to refresh the size of the LUN, the
master will go ahead and resize the PV.

This commit supersedes the limited undocumented functionality to expand
LVHDxSRs that we had before. The master used to do the resize after a reboot
during sr-attach. Pool members needed to be rebooted after the master as there
was no synchronization between pool nodes.

Signed-off-by: Robert Breker <robert.breker@citrix.com>
Reviewed-by: Keith Petley <keith.petley@citrix.com>
Merge branch 'CA-136790'

GitHub: closes #143 on xapi-project/sm
CP-8629: Adding travis requirements.

Signed-off-by: Siddharth Vinothkumar <siddharth.vinothkumar@citrix.com>
Reviewed-by: Mate Lakat <mate.lakat@citrix.com>
CP-8629: Don't use travis for xs64bit yet

Disable travis CI on the xs64bit branch. An internal Jenkins instance is
used to check that branch.

Signed-off-by: Mate Lakat <mate.lakat@citrix.com>
Reviewed-by: Mate Lakat <mate.lakat@citrix.com>
Signed-off-by: Siddharth Vinothkumar <siddharth.vinothkumar@citrix.com>
CP-8629: Add travis and coveralls badges

The badges will display the build status of the master branch.

Signed-off-by: Siddharth Vinothkumar <siddharth.vinothkumar@citrix.com>
Reviewed-by: Mate Lakat <mate.lakat@citrix.com>
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