Merge "Miscellaneous Cluster Fixes"

This commit is contained in:
Jenkins 2014-10-20 17:28:29 +00:00 committed by Gerrit Code Review
commit b5fcceeafb
7 changed files with 8 additions and 15 deletions

View File

@ -161,5 +161,5 @@ class ClusterController(wsgi.Controller):
cluster = models.Cluster.create(context, name, datastore,
datastore_version, instances)
view = views.load_view(cluster, req=req)
view = views.load_view(cluster, req=req, load_servers=False)
return wsgi.Result(view.data(), 200)

View File

@ -480,7 +480,7 @@ class ClusterNotFound(NotFound):
class ClusterFlavorsNotEqual(TroveError):
message = _("The flavor for each instance in a cluster must be equal.")
message = _("The flavor for each instance in a cluster must be the same.")
class ClusterVolumeSizeRequired(TroveError):
@ -489,7 +489,7 @@ class ClusterVolumeSizeRequired(TroveError):
class ClusterVolumeSizesNotEqual(TroveError):
message = _("The volume size for each instance in a cluster must be "
"equal.")
"the same.")
class ClusterNumInstancesNotSupported(TroveError):

View File

@ -121,14 +121,13 @@ class MongoDbClusterTasks(task_models.ClusterTasks):
failed_instance_ids.append(instance_id)
return failed_instance_ids
usage_timeout = CONF.usage_timeout
LOG.debug("Polling until service status is ready for "
"instance ids: %s" % instance_ids)
try:
utils.poll_until(lambda: instance_ids,
lambda ids: _all_status_ready(ids),
sleep_time=USAGE_SLEEP_TIME,
time_out=usage_timeout)
time_out=CONF.usage_timeout)
except PollTimeOut:
LOG.exception(_("Timeout for all instance service statuses "
"to become ready."))

View File

@ -104,13 +104,10 @@ class Manager(periodic_task.PeriodicTasks):
config_changes = {}
if cluster_config is not None:
config_changes['bind_ip'] = operating_system.get_ip_address()
# TODO(ramashri) remove smallfiles config at end of dev testing
if cluster_config["instance_type"] == "config_server":
config_changes["configsvr"] = "true"
config_changes["smallfiles"] = "true"
elif cluster_config["instance_type"] == "member":
config_changes["replSet"] = cluster_config["replica_set_name"]
config_changes["smallfiles"] = "true"
if (mount_point is not None and
(cluster_config is None or
cluster_config['instance_type'] != "query_router")):

View File

@ -183,7 +183,6 @@ class ConfigurationMixin(object):
return ret
# TODO(amcreynolds): add NotifyMixin + ConfigurationMixin-like functionality
class ClusterTasks(Cluster):
def delete_cluster(self, context, cluster_id):
@ -265,8 +264,6 @@ class FreshInstanceTasks(FreshInstance, NotifyMixin, ConfigurationMixin):
availability_zone,
nics)
# TODO(amcreynolds): need to find a way to merge cluster_config
# TODO(amcreynolds): into config_contents
config = self._render_config(flavor)
config_overrides = self._render_override_config(flavor,
overrides=overrides)
@ -729,7 +726,7 @@ class FreshInstanceTasks(FreshInstance, NotifyMixin, ConfigurationMixin):
packages, databases, users, backup_info=None,
config_contents=None, root_password=None,
overrides=None, cluster_config=None):
LOG.info(_("Entering guest_prepare"))
LOG.debug("Entering guest_prepare")
# Now wait for the response from the create to do additional work
self.guest.prepare(flavor_ram, packages, databases, users,
device_path=volume_info['device_path'],

View File

@ -179,6 +179,7 @@ class TestClusterController(TestCase):
mock_cluster = Mock()
mock_cluster.instances = []
mock_cluster.instances_without_server = []
mock_cluster.datastore_version.manager = 'mongodb'
mock_cluster_create.return_value = mock_cluster
@ -199,6 +200,7 @@ class TestClusterController(TestCase):
mock_cluster = Mock()
mock_cluster.instances = []
mock_cluster.instances_without_server = []
mock_cluster.datastore_version.manager = 'mongodb'
mock_cluster_load.return_value = mock_cluster

View File

@ -116,7 +116,6 @@ class GuestAgentMongoDBClusterManagerTest(testtools.TestCase):
mock_start, mock_poll, mock_set_status):
self._prepare_method("test-id-2", "config_server")
mock_update.assert_called_with(None, {'configsvr': 'true',
'smallfiles': 'true',
'bind_ip': '10.0.0.3',
'dbpath': '/var/lib/mongodb'})
self.assertTrue(self.manager.app.status.is_config_server)
@ -132,8 +131,7 @@ class GuestAgentMongoDBClusterManagerTest(testtools.TestCase):
mock_poll, mock_set_status):
self._prepare_method("test-id-3", "member")
mock_update.assert_called_with(None,
{'smallfiles': 'true',
'bind_ip': '10.0.0.4',
{'bind_ip': '10.0.0.4',
'dbpath': '/var/lib/mongodb',
'replSet': 'rs1'})
mock_set_status.assert_called_with(