+def _PrepareQueueLock():
+ """Try to prepare the queue lock.
+
+ @return: None for success, otherwise an exception object
+
+ """
+ global queue_lock # pylint: disable-msg=W0603
+
+ if queue_lock is not None:
+ return None
+
+ # Prepare job queue
+ try:
+ queue_lock = jstore.InitAndVerifyQueue(must_lock=False)
+ return None
+ except EnvironmentError, err:
+ return err
+
+