def allocate_dev(self): context = self._config.context if "block_device" in context.ami: return BlockDevice(context.ami.block_device, None) with flock(self._lock_file): return self.find_available_dev()
def __enter__(self): with flock(self._lock_file): dev = self.find_available_dev() self._dev = dev return self._dev.node