Don't accept tasks for stopped managers
In case a provider manager is being replaced due to a configuration change, raise exceptions for any tasks submitted after it is stopped. This will probably cause many errors, but they should already be handled and servers will eventually be deleted. We can minimize the disruption by making the provider managers more adaptable to changes, but this stopgap measure should at least fix the current problem we are observing with threads that get stuck and never complete. Change-Id: I3d190881ede30480d7c4ae970a0cb2dd07c3e160
This commit is contained in:
parent
18567ba04f
commit
e829bcb6b1
@ -276,10 +276,6 @@ class ProviderManager(TaskManager):
|
||||
return True
|
||||
return False
|
||||
|
||||
def submitTask(self, task):
|
||||
self.queue.put(task)
|
||||
return task.wait()
|
||||
|
||||
def findFlavor(self, min_ram, name_filter=None):
|
||||
# Note: this will throw an error if the provider is offline
|
||||
# but all the callers are in threads (they call in via CreateServer) so
|
||||
|
@ -86,5 +86,7 @@ class TaskManager(threading.Thread):
|
||||
self.queue.task_done()
|
||||
|
||||
def submitTask(self, task):
|
||||
if not self._running:
|
||||
raise Exception("Manager %s is no longer running" % self.name)
|
||||
self.queue.put(task)
|
||||
return task.wait()
|
||||
|
Loading…
Reference in New Issue
Block a user