CA-145685: Create a tap disk to pass the host DVD drive to a PV guest

More robust version. Supersedes commit 050d45de

Signed-off-by: Flavien Quesnel <flavien.quesnel@citrix.com>
Reviewed-by: Germano Percossi <germano.percossi@citrix.com>
CA-145685: [UnitTest] Add unit tests

Supersedes commit 801f9e9c

Signed-off-by: Flavien Quesnel <flavien.quesnel@citrix.com>
Reviewed-by: Germano Percossi <germano.percossi@citrix.com>
Merge CA-145685 into xs64bit (new version)

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

GitHub: closes #226 on xapi-project/sm
CA-147816: Create a tap disk for every kind of udev device

Commit a121c306 was about creating a tap disk when passing a physical
cd device to a guest.
For that purpose, we checked that the value of sr.sm_config['type'] was
equal to 'cd'.

With CA-147816, we also want a tap disk in case of a USB device.
However, sr.sm_config['type'] is equal to 'block' in this case, which
may be too general; for instance, we do not want to create a tap disk
for a storage array.
Moreover, there is no easy way to know that we are dealing with a USB
device.

According to the XenServer 6.2 administration guide, a udev SR only
handles cd and usb devices.
This fix relies on this assumption, since a tap disk is now created if
the SR handles udev devices.

Signed-off-by: Flavien Quesnel <flavien.quesnel@citrix.com>
Reviewed-by: Thanos Makatos <thanos.makatos@citrix.com>
CA-147816: [UnitTest] Update and refactor unit tests

Update and refactor unit tests introduced by 3060073a to reflect the
changes from a121c306 to c0f26bf4.

Signed-off-by: Flavien Quesnel <flavien.quesnel@citrix.com>
Merge branch 'CA-147816' into xs64bit

Signed-off-by: Chandrika Srinivasan <chandrika.srinivasan@citrix.com>

GitHub: closes #228 on xapi-project/sm
CA-129230: Output of SM is truncated in logs

Fix: When any exception is raised in the standalone SRCommand.run() method,
where the problem was found, it is logged into SMlog using the format:
"Exception: <module.exception_name> raised. msg: "<exception_message>""

If the exception is an instance of SR.SRException, the error message is
converted to xml and printed, which was the default behaviour. All other
types of exceptions are re-raised.

Signed-off-by: Kostas Ladopoulos <Konstantinos.Ladopoulos@citrix.com>
CA-129230: [UnitTest] Three Unit Tests regarding the fix

Signed-off-by: Kostas Ladopoulos <Konstantinos.Ladopoulos@citrix.com>