Make nbd reservation thread-safe

Avoid the situation where two local threads choose the same nbd number
for injecting files into the instance. If this happened quickly enough
nova was left with one qemu-nbd hanging and blocking the device forever.

Fixes bug 1207422

Change-Id: I18864b19ebd30669534e45ca7a50e12f61207302
(cherry picked from commit e4ed9e3726b87e4f37138867f752b0588f3626a0)
Merge "Make nbd reservation thread-safe" into stable/grizzly