def start(self):
subtasks = [self.driver.pre_upgrade()]
hosts = dbapi.get_hosts_by_cluster(self._upgrade['cluster_id'])
# We may have plenty controllers each with various set of services.
# In order to orchestrate upgrades properly, we need to iterate
# by them in right order. For example, first goes controllers with
# keystone, then with nova, and so on. See iteration details in
# get_controllers() docstring.
for host in iterhosts(hosts):
for service in iterservices(host):
subtasks.append(self.driver.start(service, [host]))
# Execute gathered tasks one-by-one preserving order. Please note,
# that it doesn't mean there can't be parallel execution since driver
# may return a Celery group of tasks instead, and in that case the
# group will be executed instead. The idea is to run one-by-one what
# was returned by driver regardless whether it's a task, a group or
# a chain.
supertask = celery.chain(*subtasks)
supertask.apply_async()
评论列表
文章目录