From 448cda91e3ea2a9234b150ad6bfd5228472212ed Mon Sep 17 00:00:00 2001 From: Monty Taylor Date: Sun, 21 Oct 2018 10:27:38 -0500 Subject: [PATCH] Don't start task managers passed in to Connection If someone (such as our friend nodepool) creates and passes in a TaskManager, it should be assumed that the calling context controls the lifecycle of that TaskManager. In that case, don't run start() on it. Depends-On: https://review.openstack.org/612168 Change-Id: I0ac5dc428250158471cb64d5b1601cabbb4deb86 --- openstack/connection.py | 11 ++++++++--- .../notes/no-start-task-manager-56773f3ea5eb3a59.yaml | 6 ++++++ 2 files changed, 14 insertions(+), 3 deletions(-) create mode 100644 releasenotes/notes/no-start-task-manager-56773f3ea5eb3a59.yaml diff --git a/openstack/connection.py b/openstack/connection.py index b67cc5905..945283598 100644 --- a/openstack/connection.py +++ b/openstack/connection.py @@ -288,9 +288,14 @@ class Connection(six.with_metaclass(_meta.ConnectionMeta, load_envvars=cloud is not None, **kwargs) - self.task_manager = task_manager or _task_manager.TaskManager( - self.config.full_name) - self.task_manager.start() + if task_manager: + # If a TaskManager was passed in, don't start it, assume it's + # under the control of the calling context. + self.task_manager = task_manager + else: + self.task_manager = _task_manager.TaskManager( + self.config.full_name) + self.task_manager.start() self._session = None self._proxies = {} diff --git a/releasenotes/notes/no-start-task-manager-56773f3ea5eb3a59.yaml b/releasenotes/notes/no-start-task-manager-56773f3ea5eb3a59.yaml new file mode 100644 index 000000000..e40507d12 --- /dev/null +++ b/releasenotes/notes/no-start-task-manager-56773f3ea5eb3a59.yaml @@ -0,0 +1,6 @@ +--- +fixes: + - | + Fixed a regression in the new `TaskManager` code which caused programs that + were passing in a `TaskManager` that they had been running `start` on to + fail due to a double call.