misc: Fix possible deadlock when entering sampling method

If a thread entered a sampling method and got the lock, it must exit and
release the lock. This code try to ensure this using try finally block.
However, before the try, we log a message about entering the sampling
method. If this log call raises, the lock will never be released,
causing all other threads entering this methods to wait forever.

The possibility of logging failure is very low, but we have seen this in
the field with older Python versions. It is likely that most of the code
is not safe considering such errors, but this particular case it is
trivial to write the code safely.

Change-Id: Ie4b5ce467ed07a3ba787687c7caa9db4c765ef08
Signed-off-by: Nir Soffer <nsoffer@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/28612
Reviewed-by: Federico Simoncelli <fsimonce@redhat.com>
Reviewed-by: Yaniv Bronhaim <ybronhei@redhat.com>
Reviewed-by: Saggi Mizrahi <smizrahi@redhat.com>