diff options
| author | Johannes Erdfelt <johannes.erdfelt@rackspace.com> | 2011-04-08 11:21:36 -0700 |
|---|---|---|
| committer | Johannes Erdfelt <johannes.erdfelt@rackspace.com> | 2011-04-08 11:21:36 -0700 |
| commit | 5deb4796bc26d98eeea94065c5098f7ce30ac2af (patch) | |
| tree | 9410cea79ab22f5f7ecb7d3f14f08423d39202cc | |
| parent | dde00815914c88f6f0254e222373e1ee5f3381b6 (diff) | |
| download | nova-5deb4796bc26d98eeea94065c5098f7ce30ac2af.tar.gz nova-5deb4796bc26d98eeea94065c5098f7ce30ac2af.tar.xz nova-5deb4796bc26d98eeea94065c5098f7ce30ac2af.zip | |
Short circuit non-existant device during unit tests. It won't ever be created
because of the stubs used during the unit tests
| -rw-r--r-- | nova/virt/xenapi/vm_utils.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/nova/virt/xenapi/vm_utils.py b/nova/virt/xenapi/vm_utils.py index 73a1e2a3a..d2045a557 100644 --- a/nova/virt/xenapi/vm_utils.py +++ b/nova/virt/xenapi/vm_utils.py @@ -936,7 +936,11 @@ def with_vdi_attached_here(session, vdi_ref, read_only, f): if dev != orig_dev: LOG.debug(_('VBD %(vbd_ref)s plugged into wrong dev, ' 'remapping to %(dev)s') % locals()) - _wait_for_device(dev) + if dev != 'autodetect': + # NOTE(johannes): Unit tests will end up with a device called + # 'autodetect' which obviously won't exist. It's not ideal, + # but the alternatives were much messier + _wait_for_device(dev) return f(dev) finally: LOG.debug(_('Destroying VBD for VDI %s ... '), vdi_ref) |
