CP-8629: Direct PPA install

A build system behind a firewall cannot use apt-add-repository directly.
To workaround the problem, including the public key and adding the
repository directly as part of
install_prerequisites_for_python_unittests.sh script.

Signed-off-by: Mate Lakat <mate.lakat@citrix.com>
Acked-by: Chandrika Srinivasan <chandrika.srinivasan@citrix.com>

GitHub: closes #141 on xapi-project/sm
Move to Python 2.6
CP-8629: Install to temporary directory

While making snapwatchd, the binaries are also installed. If DESTDIR is
not set, it means that the binaries will be installed to the /
directory. Create a temporary directory, and set that as DESTDIR to
avoid polluting the root directory.

Signed-off-by: Mate Lakat <mate.lakat@citrix.com>
Acked-by: Chandrika Srinivasan <chandrika.srinivasan@citrix.com>

GitHub: closes #141 on xapi-project/sm
CP-8629: Install coverage

Install coverage package, so unit test coverage could be measured.

Signed-off-by: Mate Lakat <mate.lakat@citrix.com>
Acked-by: Chandrika Srinivasan <chandrika.srinivasan@citrix.com>
CP-8629: Run unittests with coverage

Run unittests with coverage and report both unit test results and
coverage in computer consumable format.

Signed-off-by: Mate Lakat <mate.lakat@citrix.com>
Acked-by: Chandrika Srinivasan <chandrika.srinivasan@citrix.com>

GitHub: closes #141 on xapi-project/sm
CP-8629: Run all tests

Do not specify the testfile explicitly, just the directory - nose will
pick up all the test files.

Signed-off-by: Mate Lakat <mate.lakat@citrix.com>
Acked-by: Chandrika Srinivasan <chandrika.srinivasan@citrix.com>
CP-8629: Unit tests for devscan

Add unit tests for devscan.py Also added a test library with useful
helper commands.

Signed-off-by: Mate Lakat <mate.lakat@citrix.com>
Acked-by: Chandrika Srinivasan <chandrika.srinivasan@citrix.com>
CA-135649: Add additional HBA information to sr-probe and sr-create

There currently is no easy way to gather the basic information about HBAs, that
are required for provisioning external storage.

This commit adds some basic information about the FC and iSCSI HBAs to the
HBA-specific output of "xe sr-probe type=LVMoHBA" and "xe sr-create
type=LVMoHBA" to address this gap.

Signed-off-by: Robert Breker <robert.breker@citrix.com>
Reviewed-by: Chandrika Srinivasan <chandrika.srinivasan@citrix.com>
CA-135649: Unit tests

Adding unit tests - devscan.scan will report the parameters if they are
provided by the device driver. Also added some additional logging to
show files not found and files being opened.

Signed-off-by: Mate Lakat <mate.lakat@citrix.com>
Acked-by: Chandrika Srinivasan <chandrika.srinivasan@citrix.com>
Merge branch 'CA-135649'

GitHub: closes #151 on xapi-project/sm
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)