Updated the swift-init manager for object-expir...
Updated the swift-init manager for object-expirer support since the expirer doesn't not use the object-server.conf but does start with object-. Change-Id: If6e0e9af4c6c861fdf390370f271d9139c573ba2
This commit is contained in:
parent
89ef1f40f5
commit
425705690e
@ -32,7 +32,7 @@ RUN_DIR = '/var/run/swift'
|
||||
# auth-server has been removed from ALL_SERVERS, start it explicitly
|
||||
ALL_SERVERS = ['account-auditor', 'account-server', 'container-auditor',
|
||||
'container-replicator', 'container-server', 'container-sync',
|
||||
'container-updater', 'object-auditor', 'object-server',
|
||||
'container-updater', 'object-auditor', 'object-server', 'object-expirer',
|
||||
'object-replicator', 'object-updater', 'proxy-server',
|
||||
'account-replicator', 'account-reaper']
|
||||
MAIN_SERVERS = ['proxy-server', 'account-server', 'container-server',
|
||||
@ -40,6 +40,9 @@ MAIN_SERVERS = ['proxy-server', 'account-server', 'container-server',
|
||||
REST_SERVERS = [s for s in ALL_SERVERS if s not in MAIN_SERVERS]
|
||||
GRACEFUL_SHUTDOWN_SERVERS = MAIN_SERVERS + ['auth-server']
|
||||
START_ONCE_SERVERS = REST_SERVERS
|
||||
# These are servers that match a type (account-*, container-*, object-*) but
|
||||
# don't use that type-server.conf file and instead use their own.
|
||||
STANDALONE_SERVERS = ['object-expirer']
|
||||
|
||||
KILL_WAIT = 15 # seconds to wait for servers to die
|
||||
WARNING_WAIT = 3 # seconds to wait after message that may just be a warning
|
||||
@ -356,10 +359,15 @@ class Server():
|
||||
:returns: the conf_file for this pid_file
|
||||
|
||||
"""
|
||||
return pid_file.replace(
|
||||
os.path.normpath(RUN_DIR), SWIFT_DIR, 1).replace(
|
||||
self.server, '%s-server' % self.type, 1).rsplit(
|
||||
'.pid', 1)[0] + '.conf'
|
||||
if self.server in STANDALONE_SERVERS:
|
||||
return pid_file.replace(
|
||||
os.path.normpath(RUN_DIR), SWIFT_DIR, 1).rsplit(
|
||||
'.pid', 1)[0] + '.conf'
|
||||
else:
|
||||
return pid_file.replace(
|
||||
os.path.normpath(RUN_DIR), SWIFT_DIR, 1).replace(
|
||||
self.server, '%s-server' % self.type, 1).rsplit(
|
||||
'.pid', 1)[0] + '.conf'
|
||||
|
||||
def conf_files(self, **kwargs):
|
||||
"""Get conf files for this server
|
||||
@ -368,8 +376,12 @@ class Server():
|
||||
|
||||
:returns: list of conf files
|
||||
"""
|
||||
found_conf_files = search_tree(SWIFT_DIR, '%s-server*' % self.type,
|
||||
'.conf')
|
||||
if self.server in STANDALONE_SERVERS:
|
||||
found_conf_files = search_tree(SWIFT_DIR, self.server + '*',
|
||||
'.conf')
|
||||
else:
|
||||
found_conf_files = search_tree(SWIFT_DIR, '%s-server*' % self.type,
|
||||
'.conf')
|
||||
number = kwargs.get('number')
|
||||
if number:
|
||||
try:
|
||||
|
@ -324,6 +324,11 @@ class TestServer(unittest.TestCase):
|
||||
pid_file = self.join_run_dir(
|
||||
'container-auditor/1/container-auditor.pid')
|
||||
self.assertEquals(conf_file, server.get_conf_file_name(pid_file))
|
||||
server_name = manager.STANDALONE_SERVERS[0]
|
||||
server = manager.Server(server_name)
|
||||
conf_file = self.join_swift_dir(server_name + '.conf')
|
||||
pid_file = self.join_run_dir(server_name + '.pid')
|
||||
self.assertEquals(conf_file, server.get_conf_file_name(pid_file))
|
||||
|
||||
def test_conf_files(self):
|
||||
# test get single conf file
|
||||
@ -417,6 +422,18 @@ class TestServer(unittest.TestCase):
|
||||
finally:
|
||||
sys.stdout = old_stdout
|
||||
|
||||
# test standalone conf file
|
||||
server_name = manager.STANDALONE_SERVERS[0]
|
||||
conf_files = (server_name + '.conf',)
|
||||
with temptree(conf_files) as t:
|
||||
manager.SWIFT_DIR = t
|
||||
server = manager.Server(server_name)
|
||||
conf_files = server.conf_files()
|
||||
self.assertEquals(len(conf_files), 1)
|
||||
conf_file = conf_files[0]
|
||||
conf = self.join_swift_dir(server_name + '.conf')
|
||||
self.assertEquals(conf_file, conf)
|
||||
|
||||
def test_iter_pid_files(self):
|
||||
"""
|
||||
Server.iter_pid_files is kinda boring, test the
|
||||
|
Loading…
Reference in New Issue
Block a user