summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRussell Bryant <rbryant@redhat.com>2013-03-21 15:08:18 -0400
committerRussell Bryant <rbryant@redhat.com>2013-03-25 10:31:03 -0400
commit8cab8ed7294c776a18e560a0c89f4e1ae18c2d46 (patch)
tree31fc6803ac936fd997a7c9b4619282ff4d864245
parent8e2a7a3b62d89a9da4c11afaffcc60f76a44ad76 (diff)
downloadnova-8cab8ed7294c776a18e560a0c89f4e1ae18c2d46.tar.gz
Initialize compute manager before loading driver.
The compute virt API uses the conductor API instance on the compute manager. Make sure the compute manager has been fully initialized before loading the driver and passing it the virtapi instance. This prevents the possibility of the driver calling back into the compute manager and using something not initialized yet, such as the conductor API in the case of this bug. This patch also moves initialization of a member variable up above super(), where the rest of the initialization is. There doesn't appear to be a reason for needing to have it at the end. Fix bug 1156490. Change-Id: I19684f24d590201d135336107425c2be2f74c83e (cherry picked from commit 9075069098e32b47bd5011e2653a23b61c18d4a3)
-rwxr-xr-xnova/compute/manager.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/nova/compute/manager.py b/nova/compute/manager.py
index 6043627830..fda7f490ad 100755
--- a/nova/compute/manager.py
+++ b/nova/compute/manager.py
@@ -329,7 +329,6 @@ class ComputeManager(manager.SchedulerDependentManager):
def __init__(self, compute_driver=None, *args, **kwargs):
"""Load configuration options and connect to the hypervisor."""
self.virtapi = ComputeVirtAPI(self)
- self.driver = driver.load_compute_driver(self.virtapi, compute_driver)
self.network_api = network.API()
self.volume_api = volume.API()
self._last_host_check = 0
@@ -343,11 +342,15 @@ class ComputeManager(manager.SchedulerDependentManager):
openstack_driver.is_quantum_security_groups())
self.consoleauth_rpcapi = consoleauth.rpcapi.ConsoleAuthAPI()
self.cells_rpcapi = cells_rpcapi.CellsAPI()
+ self._resource_tracker_dict = {}
super(ComputeManager, self).__init__(service_name="compute",
*args, **kwargs)
- self._resource_tracker_dict = {}
+ # NOTE(russellb) Load the driver last. It may call back into the
+ # compute manager via the virtapi, so we want it to be fully
+ # initialized before that happens.
+ self.driver = driver.load_compute_driver(self.virtapi, compute_driver)
def _get_resource_tracker(self, nodename):
rt = self._resource_tracker_dict.get(nodename)