From 7ffbff485e40bc3f36542f2892877adc5241accf Mon Sep 17 00:00:00 2001 From: Pádraig Brady Date: Wed, 15 Feb 2012 10:05:23 +0000 Subject: improve injection diagnostics when nbd unavailable. Bug 755854 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 --- nova/virt/disk/nbd.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/nova/virt/disk/nbd.py b/nova/virt/disk/nbd.py index 029fecaf2..1839b2d90 100644 --- a/nova/virt/disk/nbd.py +++ b/nova/virt/disk/nbd.py @@ -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 -- cgit