Clean up RunWithLocks
Clean up RunWithLocks

This patch cleans RunWithLocks up a little bit by reducing the number
of delay function terminations, and using the QAThread class to ensure
exceptions are thrown at the right time and in the right place.

Signed-off-by: Hrvoje Ribicic <riba@google.com>
Reviewed-by: Petr Pudlak <pudlak@google.com>
Signed-off-by: Thomas Thrainer <thomasth@google.com>
Reviewed-by: Helga Velroyen <helgav@google.com>

(cherry picked from commit 9558c2a4fc9eee309d56a6a84cc2a5935054dd1e)

ganeti/ganeti,ganeti/ganeti,mbakke/ganeti,grnet/snf-ganeti,ganeti-github-testing/ganeti-test-1,yiannist/ganeti,andir/ganeti,mbakke/ganeti,apyrgio/ganeti,onponomarev/ganeti,ganeti-github-testing/ganeti-test-1,leshchevds/ganeti,dimara/ganeti,yiannist/ganeti,mbakke/ganeti,andir/ganeti,grnet/snf-ganeti,bitemyapp/ganeti,ganeti/ganeti,leshchevds/ganeti,dimara/ganeti,apyrgio/snf-ganeti,andir/ganeti,apyrgio/ganeti,apyrgio/snf-ganeti,yiannist/ganeti,leshchevds/ganeti,bitemyapp/ganeti,onponomarev/ganeti