Skip to content

Commit

Permalink
Avoid TypeError when loading libvirt.LibvirtDriver
Browse files Browse the repository at this point in the history
Fixes bug 1078304

The libvirt.LibvirtDriver.__init__() signature has changed since:

  openstack/nova@081b652c

to take a new virtapi parameter. This is not required by any
ceilometer usage of the driver, however the absence of a
corresponding argument causes importutils.import_object_ns()
to fail with TypeError.

For testing the nova fake.FakeVirtAPI still uses the old
signature, hence we try both.

Change-Id: I05a9728ceb435a72f5fa8a648cd70b079126396e
  • Loading branch information
Eoghan Glynn committed Nov 13, 2012
1 parent 1226dbf commit 0909643
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions ceilometer/compute/libvirt.py
Expand Up @@ -44,8 +44,13 @@ def get_libvirt_connection():
# The direct-import implementation only works with Folsom because
# the configuration setting changed.
try:
return importutils.import_object_ns('nova.virt',
FLAGS.compute_driver)
try:
return importutils.import_object_ns('nova.virt',
FLAGS.compute_driver,
None)
except TypeError:
return importutils.import_object_ns('nova.virt',
FLAGS.compute_driver)
except ImportError:
# Fall back to the way it was done in Essex.
import nova.virt.connection
Expand Down

0 comments on commit 0909643

Please sign in to comment.