[CA-137573]: Fix "Unrecognised bus type" VDIs.

Use "device/subsystem" to obtain SCSI details of the host CDROM drive.

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

(cherry picked from commit 6ad534df70013f8f24dbf3f7d646694f606702a6)
CP-8744:  SR trim limited to compatible SRs

Limited SR trim capability to LVHD based SRs. Also error handling
was modified to return a XML string response on failure containing
errcode and errmsg as a key value pair. Trim functionality was
separated from the trim plugin entry point.

Signed-off-by: Vineeth Raveendran <vineeth.thampi@citrix.com>
Reviewed-by: Mate Lakat <mate.lakat@citrix.com>

GitHub: closes #182 xapi-project/sm
CP-8744: [UnitTest] Add unittest for trim plugin

Signed-off-by: Mate Lakat <mate.lakat@citrix.com>
Reviewed-by: Vineeth Raveendran <vineeth.thampi@citrix.com>
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 #173 xapi-project/sm
CP-8657: Remove iSL references from storage manager.

- Removed all code references
- Removed all CSLG error codes
- Replaced CSLGXMLParse to XMLParse

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

GitHub: closes #183 xapi-project/sm
CP-8657: Fix XE_SR_ERRORCODES.xml

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

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