Use correct context synching status

Use the trust context when synching cluster status
with orchestration status.

Change-Id: I8ae0d1b92c3adce83032bb6c5f269d8d23c20c5e
Partial-Blueprint: bp-driver-consolodation
Closes-Bug: #1651243
changes/24/410824/4
Randall Burt 6 years ago
parent d4cceee48d
commit c40413518a
  1. 9
      magnum/drivers/heat/driver.py
  2. 3
      magnum/tests/unit/conductor/handlers/test_mesos_cluster_conductor.py
  3. 3
      magnum/tests/unit/conductor/handlers/test_swarm_cluster_conductor.py
  4. 3
      magnum/tests/unit/drivers/test_heat_driver.py

@ -22,6 +22,7 @@ from heatclient.common import template_utils
from heatclient import exc as heatexc
from magnum.common import clients
from magnum.common import context as mag_ctx
from magnum.common import exception
from magnum.common import short_id
from magnum.conductor.handlers.common import cert_manager
@ -73,7 +74,9 @@ class HeatDriver(driver.Driver):
raise NotImplementedError("Must implement 'get_template_definition'")
def update_cluster_status(self, context, cluster):
poller = HeatPoller(clients.OpenStackClients(context), cluster, self)
stack_ctx = mag_ctx.make_cluster_context(cluster)
poller = HeatPoller(clients.OpenStackClients(stack_ctx), context,
cluster, self)
poller.poll_and_check()
def create_cluster(self, context, cluster, cluster_create_timeout):
@ -151,9 +154,9 @@ class HeatDriver(driver.Driver):
class HeatPoller(object):
def __init__(self, openstack_client, cluster, cluster_driver):
def __init__(self, openstack_client, context, cluster, cluster_driver):
self.openstack_client = openstack_client
self.context = self.openstack_client.context
self.context = context
self.cluster = cluster
self.cluster_template = conductor_utils.retrieve_cluster_template(
self.context, cluster)

@ -308,7 +308,8 @@ class TestClusterConductorWithMesos(base.TestCase):
cluster_template = objects.ClusterTemplate(
self.context, **self.cluster_template_dict)
mock_retrieve_cluster_template.return_value = cluster_template
poller = heat_driver.HeatPoller(mock_openstack_client, cluster,
poller = heat_driver.HeatPoller(mock_openstack_client,
mock.MagicMock(), cluster,
mesos_dr.Driver())
poller.get_version_info = mock.MagicMock()
return (mock_heat_stack, cluster, poller)

@ -435,7 +435,8 @@ class TestClusterConductorWithSwarm(base.TestCase):
mock_retrieve_cluster_template.return_value = \
cluster_template
mock_driver.return_value = swarm_dr.Driver()
poller = heat_driver.HeatPoller(mock_openstack_client, cluster,
poller = heat_driver.HeatPoller(mock_openstack_client,
mock.MagicMock(), cluster,
swarm_dr.Driver())
poller.get_version_info = mock.MagicMock()
return (mock_heat_stack, cluster, poller)

@ -45,7 +45,8 @@ class TestHeatPoller(base.TestCase):
**cluster_template_dict)
mock_retrieve_cluster_template.return_value = cluster_template
mock_driver.return_value = k8s_atomic_dr.Driver()
poller = heat_driver.HeatPoller(mock_openstack_client, cluster,
poller = heat_driver.HeatPoller(mock_openstack_client,
mock.MagicMock(), cluster,
k8s_atomic_dr.Driver())
poller.get_version_info = mock.MagicMock()
return (mock_heat_stack, cluster, poller)

Loading…
Cancel
Save