Merge "Refactored datastores to use common chown function"
This commit is contained in:
commit
8bbcc3949c
|
@ -64,7 +64,9 @@ class CouchbaseApp(object):
|
|||
mount_point = CONF.couchbase.mount_point
|
||||
try:
|
||||
LOG.info(_('Couchbase Server change data dir path'))
|
||||
utils.execute_with_timeout(system.cmd_own_data_dir, shell=True)
|
||||
operating_system.update_owner('couchbase',
|
||||
'couchbase',
|
||||
mount_point)
|
||||
pwd = CouchbaseRootAccess.get_password()
|
||||
utils.execute_with_timeout(
|
||||
(system.cmd_node_init
|
||||
|
|
|
@ -33,8 +33,6 @@ cmd_cluster_init = ('sudo /opt/couchbase/bin/couchbase-cli cluster-init '
|
|||
'--cluster-init-password=%(PWD)s '
|
||||
'--cluster-init-port=8091')
|
||||
cmd_kill = 'sudo pkill -u couchbase'
|
||||
cmd_own_data_dir = ('sudo chown couchbase:couchbase %s' %
|
||||
CONF.couchbase.mount_point)
|
||||
cmd_rm_old_data_dir = 'sudo rm -rf /opt/couchbase/var/lib/couchbase/data'
|
||||
""" For optimal couchbase operations, swappiness of vm should be set to 0.
|
||||
Reference link: http://docs.couchbase.com/couchbase-manual-2
|
||||
|
|
|
@ -17,6 +17,7 @@ import os
|
|||
|
||||
from trove.common import cfg
|
||||
from trove.common import exception
|
||||
from trove.guestagent.common import operating_system
|
||||
from trove.guestagent import dbaas
|
||||
from trove.guestagent import volume
|
||||
from trove.guestagent.datastore.mongodb import service as mongo_service
|
||||
|
@ -62,7 +63,7 @@ class Manager(periodic_task.PeriodicTasks):
|
|||
if os.path.exists(system.MONGODB_MOUNT_POINT):
|
||||
device.migrate_data(mount_point)
|
||||
device.mount(mount_point)
|
||||
self.app.update_owner(mount_point)
|
||||
operating_system.update_owner('mongodb', 'mongodb', mount_point)
|
||||
|
||||
LOG.debug("Mounted the volume %(path)s as %(mount)s" %
|
||||
{'path': device_path, "mount": mount_point})
|
||||
|
|
|
@ -194,14 +194,6 @@ class MongoDBApp(object):
|
|||
def _add_config_parameter(self, config_contents, parameter, value):
|
||||
return (config_contents or '') + "\n%s = %s" % (parameter, value)
|
||||
|
||||
def update_owner(self, path):
|
||||
LOG.info(_("Set owner to 'mongodb' for %s ") % system.CONFIG)
|
||||
utils.execute_with_timeout("chown", "-R", "mongodb", path,
|
||||
run_as_root=True, root_helper="sudo")
|
||||
LOG.info(_("Set group to 'mongodb' for %s ") % system.CONFIG)
|
||||
utils.execute_with_timeout("chgrp", "-R", "mongodb", path,
|
||||
run_as_root=True, root_helper="sudo")
|
||||
|
||||
def clear_storage(self):
|
||||
mount_point = "/var/lib/mongodb/*"
|
||||
try:
|
||||
|
|
Loading…
Reference in New Issue