Move role revision updates to a separate method
Use proper locking for node allocation

save is refactored to accept a code block that needs to be
protected with the role lock. Make use of that in allocate
and convert usages of previous allocate functions accordingly.
Merge pull request #1056 from dirkmueller/master_use_locking_for_allocate

Use Proper Locking for allocate