Skip to content

Commit

Permalink
improve injection diagnostics when nbd unavailable. Bug 755854
Browse files Browse the repository at this point in the history
It's better to fail immediately with this improved diagnostic.
Relying on qemu-nbd to detect the issue (no device), is inefficient.

Change-Id: Ib124f6b83d8f04f0b4791c98912603f3499a9d2a
  • Loading branch information
Pádraig Brady committed Feb 15, 2012
1 parent 99c2e02 commit 7ffbff4
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions nova/virt/disk/nbd.py
Expand Up @@ -54,6 +54,9 @@ class Mount(mount.Mount):
_DEVICES = ['/dev/nbd%s' % i for i in range(FLAGS.max_nbd_devices)]

def _allocate_nbd(self):
if not os.path.exists("/sys/block/nbd0"):
self.error = _('nbd unavailable: module not loaded')
return None
while True:
if not self._DEVICES:
# really want to log this info, not raise
Expand Down

0 comments on commit 7ffbff4

Please sign in to comment.