CA-119888: Fix logical volume deletion error.

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

GitHub: closes #191 on xapi-project/sm
CA-140596: [UnitTest] log to stdout

By printing the log messages to stdout, they will be captured by nose,
thus not disturbing the user. Should a test fail, the messages will
still be displayed.

Signed-off-by: Mate Lakat <mate.lakat@citrix.com>
CA-140596: [UnitTest] Enable custom context

Should the user want to use a custom context implementation, he can use
the with_custom_context decorator to do that. It enables users to
inherit from TestContext, extend its functionality, and use the extended
version in a test.

Signed-off-by: Mate Lakat <mate.lakat@citrix.com>
CA-140596: [UnitTest] Test to reproduce gc error

This test will reproduce the issue that was seen in the referenced
issue. Whenever a new Lock instance is created, and the file() call
fails, the instance's lockfile attribute remained uninitialised. As the
instance has a custom destructor, that will be called by the garbage
collector. That function assumes that the instance has a lockfile
attribute, and thus raises a message.

Signed-off-by: Mate Lakat <mate.lakat@citrix.com>
CA-140596: Make Lock garbage collectable

Initialise a None lockfile attribute in Lock's constructor, as the field
is assumed to be existing in the destructor (_close)

Signed-off-by: Mate Lakat <mate.lakat@citrix.com>
CA-140596: Fix lock concurrency issue

If the namespace directory was cleaned up before Lock tried to open the
lockfile, it would result the IOError to bubble up. To avoid this
situation, the lockfile creation will be re-tried after an additional
namespace creation, 10 times, if it raised an ENOENT.

Signed-off-by: Mate Lakat <mate.lakat@citrix.com>