From fead6dcd53e77240767063fc6e885f9c138c2776 Mon Sep 17 00:00:00 2001 From: Vishvananda Ishaya Date: Thu, 11 Oct 2012 11:59:47 -0700 Subject: Stops compute api import at import time There is an automatic import of compute.api at import time whenever anything under compute is imported. This leads to all sorts of weird dependency problems such as the one here: https://review.openstack.org/#/c/14170/ This modifies the import to happen when compute.API() is called, which is how we handle it for network and volume. A few imports were also modified to make it consistent with this new style. Change-Id: Ic748376510aa4cc48dfefc6ec36621d0ae498bfc --- nova/compute/__init__.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'nova/compute') diff --git a/nova/compute/__init__.py b/nova/compute/__init__.py index 2916ff048..b770778aa 100644 --- a/nova/compute/__init__.py +++ b/nova/compute/__init__.py @@ -21,5 +21,8 @@ import nova.flags import nova.openstack.common.importutils -API = nova.openstack.common.importutils.import_class( - nova.flags.FLAGS.compute_api_class) + +def API(*args, **kwargs): + importutils = nova.openstack.common.importutils + cls = importutils.import_class(nova.flags.FLAGS.compute_api_class) + return cls(*args, **kwargs) -- cgit