diff options
| author | Pádraig Brady <pbrady@redhat.com> | 2012-02-15 10:05:23 +0000 |
|---|---|---|
| committer | Pádraig Brady <pbrady@redhat.com> | 2012-02-15 10:09:45 +0000 |
| commit | 7ffbff485e40bc3f36542f2892877adc5241accf (patch) | |
| tree | 63670c29695b5506d54850e1bda3d5bff02c83a8 | |
| parent | 99c2e02b44a1012c8e26fc7658dc40ec4620a1ee (diff) | |
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
| -rw-r--r-- | nova/virt/disk/nbd.py | 3 |
1 files changed, 3 insertions, 0 deletions
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 |
