CP-8514: [UnitTest] Add fake LVM subsystem

This test helper makes it possible to fake the lvm layer. This first
patch emulates the lvcreate command.

Signed-off-by: Mate Lakat <mate.lakat@citrix.com>
Reviewed-by: Vineeth Thampi Raveendran <vineeth.thampi@citrix.com>
CP-8514: [UnitTest] Add tests for lvutil.create

These changes test the lvutil.create method just before the TRIM
functionality was added.

Signed-off-by: Mate Lakat <mate.lakat@citrix.com>
Reviewed-by: Vineeth Thampi Raveendran <vineeth.thampi@citrix.com>
CP-8514: [UnitTest] Mock out os.stat

As the LVM operations use os.stat to detect the existence of a given
path, it needs to be mocked out. This change adds a simple
implementation, which does not return the expected stat information,
just raises an OSError if the file does not exists.

Signed-off-by: Mate Lakat <mate.lakat@citrix.com>
Reviewed-by: Vineeth Thampi Raveendran <vineeth.thampi@citrix.com>
CP-8514: [UnitTest] Mock out lvremove and dmsetup

To test lvutil.remove, the /usr/bin/lvremove and /sbin/dmsetup system
utilities mocked out with a primitive implementation. dmsetup will just
return 0 with empty stdout and stderr, which seems to be enough for now.

Signed-off-by: Mate Lakat <mate.lakat@citrix.com>
Reviewed-by: Vineeth Thampi Raveendran <vineeth.thampi@citrix.com>
CP-8514: [UnitTest] Cover lvutil.remove

Testing the behavior of lvutil.remove.

Signed-off-by: Mate Lakat <mate.lakat@citrix.com>
Reviewed-by: Vineeth Thampi Raveendran <vineeth.thampi@citrix.com>
CP-8514: [UnitTest] lvutil.lvcreate and lvremove

Test functionality for lvcreate size_in_percentage, additional
config_param arg for lvremove

Signed-off-by: Vineeth Raveendran <vineeth.thampi@citrix.com>
Reviewed-by: Mate Lakat <mate.lakat@citrix.com>
Merge branch 'TRIM-UNITTESTS' into xs64bit

GitHub: closes #178 on xapi-project/sm