Merge "Move MongoDB mongos upstart script to elements"
This commit is contained in:
commit
3d75a974b5
|
@ -175,16 +175,6 @@ class MongoDBApp(object):
|
|||
LOG.info(_("Configuring instance as a cluster query router."))
|
||||
self.is_query_router = True
|
||||
|
||||
# Write the 'mongos' upstart script.
|
||||
# FIXME(pmalik): The control script should really be written in the
|
||||
# elements.
|
||||
# The guestagent will choose the right daemon ('mongod' or 'mongos')
|
||||
# based on the 'cluster_config' values.
|
||||
upstart_contents = (system.MONGOS_UPSTART_CONTENTS.
|
||||
format(config_file_placeholder=CONFIG_FILE))
|
||||
operating_system.write_file(system.MONGOS_UPSTART, upstart_contents,
|
||||
as_root=True)
|
||||
|
||||
# FIXME(pmalik): We should really have a separate configuration
|
||||
# template for the 'mongos' process.
|
||||
# Remove all storage configurations from the template.
|
||||
|
|
|
@ -25,7 +25,6 @@ MONGO_PID_FILE = '/var/run/mongodb/mongodb.pid'
|
|||
MONGO_LOG_FILE = '/var/log/mongodb/mongod.log'
|
||||
|
||||
CONFIG_CANDIDATES = ["/etc/mongodb.conf", "/etc/mongod.conf"]
|
||||
MONGOS_UPSTART = "/etc/init/mongos.conf"
|
||||
MONGO_ADMIN_NAME = 'os_admin'
|
||||
MONGO_ADMIN_ROLES = [{'db': 'admin', 'role': 'userAdminAnyDatabase'},
|
||||
{'db': 'admin', 'role': 'dbAdminAnyDatabase'},
|
||||
|
@ -44,27 +43,4 @@ MONGO_USER = {operating_system.REDHAT: "mongod",
|
|||
operating_system.DEBIAN: "mongodb",
|
||||
operating_system.SUSE: "mongod"}[OS_NAME]
|
||||
|
||||
INIT_EXEC_MONGOS = ("start-stop-daemon --start --quiet --chuid %s "
|
||||
"--exec /usr/bin/mongos -- "
|
||||
"--config {config_file_placeholder}" % MONGO_USER)
|
||||
|
||||
MONGOS_UPSTART_CONTENTS = """limit fsize unlimited unlimited # (file size)
|
||||
limit cpu unlimited unlimited # (cpu time)
|
||||
limit as unlimited unlimited # (virtual memory size)
|
||||
limit nofile 64000 64000 # (open files)
|
||||
limit nproc 64000 64000 # (processes/threads)
|
||||
|
||||
pre-start script
|
||||
mkdir -p /var/log/mongodb/
|
||||
end script
|
||||
|
||||
start on runlevel [2345]
|
||||
stop on runlevel [06]
|
||||
|
||||
script
|
||||
ENABLE_MONGOS="yes"
|
||||
if [ -f /etc/default/mongos ]; then . /etc/default/mongos; fi
|
||||
if [ "x$ENABLE_MONGOS" = "xyes" ]; then exec %s; fi
|
||||
end script """ % INIT_EXEC_MONGOS
|
||||
|
||||
PACKAGER = pkg.Package()
|
||||
|
|
|
@ -21,10 +21,8 @@ import trove.common.context as context
|
|||
import trove.common.instance as ds_instance
|
||||
import trove.common.utils as utils
|
||||
from trove.guestagent.common.configuration import ImportOverrideStrategy
|
||||
from trove.guestagent.common import operating_system
|
||||
import trove.guestagent.datastore.experimental.mongodb.manager as manager
|
||||
import trove.guestagent.datastore.experimental.mongodb.service as service
|
||||
import trove.guestagent.datastore.experimental.mongodb.system as system
|
||||
import trove.guestagent.volume as volume
|
||||
import trove.tests.unittests.trove_testtools as trove_testtools
|
||||
|
||||
|
@ -142,15 +140,12 @@ class GuestAgentMongoDBClusterManagerTest(trove_testtools.TestCase):
|
|||
self.manager.app.status.set_status.assert_called_with(
|
||||
ds_instance.ServiceStatuses.INSTANCE_READY, force=True)
|
||||
|
||||
@mock.patch.object(operating_system, 'write_file')
|
||||
@mock.patch.object(service.MongoDBApp, '_configure_network')
|
||||
def test_configure_as_query_router(self, net_conf, os_write_file):
|
||||
def test_configure_as_query_router(self, net_conf):
|
||||
self.conf_mgr.parse_configuration = mock.Mock(
|
||||
return_value={'storage.mmapv1.smallFiles': False,
|
||||
'storage.journal.enabled': True})
|
||||
self.manager.app._configure_as_query_router()
|
||||
os_write_file.assert_called_once_with(system.MONGOS_UPSTART, mock.ANY,
|
||||
as_root=True)
|
||||
self.conf_mgr.save_configuration.assert_called_once_with({})
|
||||
net_conf.assert_called_once_with(service.MONGODB_PORT)
|
||||
self.conf_mgr.apply_system_override.assert_called_once_with(
|
||||
|
|
Loading…
Reference in New Issue