Removed screen runner (forking seems better in the end).
Some other small cleanups.
This commit is contained in:
@@ -24,7 +24,6 @@ from devstack import trace as tr
|
||||
from devstack import utils
|
||||
|
||||
from devstack.runners import fork
|
||||
from devstack.runners import screen
|
||||
|
||||
|
||||
LOG = logging.getLogger("devstack.component")
|
||||
@@ -298,11 +297,9 @@ class ProgramRuntime(ComponentBase):
|
||||
#what classes handle different running/stopping types
|
||||
STARTER_CLS_MAPPING = {
|
||||
fork.RUN_TYPE: fork.ForkRunner,
|
||||
screen.RUN_TYPE: screen.ScreenRunner,
|
||||
}
|
||||
STOPPER_CLS_MAPPING = {
|
||||
fork.RUN_TYPE: fork.ForkRunner,
|
||||
screen.RUN_TYPE: screen.ScreenRunner,
|
||||
}
|
||||
|
||||
def __init__(self, component_name, *args, **kargs):
|
||||
|
||||
@@ -327,9 +327,6 @@ def _run_components(action_name, component_order, components, distro, root_dir,
|
||||
results.append(str(start_result))
|
||||
elif action_name == settings.UNINSTALL:
|
||||
_uninstall(component, instance, program_args.get('force', False))
|
||||
else:
|
||||
#TODO throw?
|
||||
pass
|
||||
#display any configs touched...
|
||||
_print_cfgs(config, action_name)
|
||||
#any post run actions go now
|
||||
@@ -349,14 +346,14 @@ def _get_def_components():
|
||||
def_components[settings.KEYSTONE] = []
|
||||
#TODO add in xvnc?
|
||||
def_components[settings.NOVA] = [
|
||||
nova.NCPU,
|
||||
nova.NVOL,
|
||||
nova.NAPI,
|
||||
nova.NOBJ,
|
||||
nova.NNET,
|
||||
nova.NCERT,
|
||||
nova.NSCHED,
|
||||
nova.NCAUTH,
|
||||
nova.NCERT,
|
||||
nova.NCPU,
|
||||
nova.NNET,
|
||||
nova.NOBJ,
|
||||
nova.NSCHED,
|
||||
nova.NVOL,
|
||||
]
|
||||
def_components[settings.NOVNC] = []
|
||||
def_components[settings.HORIZON] = []
|
||||
@@ -388,12 +385,12 @@ def _run_action(args):
|
||||
(rep, maxlen) = utils.welcome(_WELCOME_MAP.get(action))
|
||||
header = utils.center_text("Action Runner", rep, maxlen)
|
||||
print(header)
|
||||
#need to figure out dependencies for components (if any)
|
||||
ignore_deps = args.pop('ignore_deps', False)
|
||||
if not defaulted_components:
|
||||
LOG.info("Activating components [%s]" % (", ".join(sorted(components.keys()))))
|
||||
else:
|
||||
LOG.info("Activating default components [%s]" % (", ".join(sorted(components.keys()))))
|
||||
#need to figure out dependencies for components (if any)
|
||||
ignore_deps = args.pop('ignore_deps', False)
|
||||
if not ignore_deps:
|
||||
new_components = settings.resolve_dependencies(components.keys())
|
||||
component_diff = new_components.difference(components.keys())
|
||||
@@ -401,6 +398,8 @@ def _run_action(args):
|
||||
LOG.info("Having to activate dependent components: [%s]" % (", ".join(sorted(component_diff))))
|
||||
for new_component in component_diff:
|
||||
components[new_component] = list()
|
||||
#see if we have previously already done the components
|
||||
#TODO the check is really pretty basic so should not be depended on...
|
||||
component_skips = _check_roots(action, rootdir, components.keys())
|
||||
for c in component_skips:
|
||||
components.pop(c)
|
||||
|
||||
@@ -1,70 +0,0 @@
|
||||
# vim: tabstop=4 shiftwidth=4 softtabstop=4
|
||||
|
||||
# Copyright (C) 2012 Yahoo! Inc. All Rights Reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import time
|
||||
import re
|
||||
|
||||
from devstack import log as logging
|
||||
from devstack import shell as sh
|
||||
from devstack import utils
|
||||
|
||||
LOG = logging.getLogger("install.screen")
|
||||
|
||||
SCREEN_MAKE = ['screen', '-d', '-m', '-S', '%NAME%', '-t', '%NAME%']
|
||||
LIST_CMD = ['screen', '-list']
|
||||
KILL_CMD = ['screen', '-r', "%ENTRY%", '-X', 'kill']
|
||||
QUIT_CMD = ['screen', '-r', "%ENTRY%", '-X', 'kill']
|
||||
NAME_POSTFIX = ".devstack"
|
||||
RUN_TYPE = "SCREEN"
|
||||
TYPE = "TYPE"
|
||||
|
||||
|
||||
class ScreenRunner(object):
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
def stop(self, name, *args, **kargs):
|
||||
real_name = name + NAME_POSTFIX
|
||||
(sysout, _) = sh.execute(*LIST_CMD)
|
||||
lines = sysout.splitlines()
|
||||
entries = list()
|
||||
lookfor = r"^(\d+\." + re.escape(real_name) + r")\s+(.*)$"
|
||||
for line in lines:
|
||||
cleaned_line = line.strip()
|
||||
if not cleaned_line:
|
||||
continue
|
||||
mtch = re.match(lookfor, cleaned_line)
|
||||
if not mtch:
|
||||
continue
|
||||
kill_entry = mtch.group(1)
|
||||
entries.append(kill_entry)
|
||||
for entry in entries:
|
||||
params = dict()
|
||||
params['ENTRY'] = entry
|
||||
kill_cmd = [{'cmd':KILL_CMD}]
|
||||
utils.execute_template(*kill_cmd, params=params, **kargs)
|
||||
time.sleep(2)
|
||||
quit_cmd = [{'cmd':QUIT_CMD}]
|
||||
utils.execute_template(*kill_cmd, params=params, **kargs)
|
||||
|
||||
def start(self, name, program, *args, **kargs):
|
||||
app_dir = kargs.get('app_dir')
|
||||
params = dict()
|
||||
params['NAME'] = name + NAME_POSTFIX
|
||||
runcmd = SCREEN_MAKE + [program] + list(args)
|
||||
cmds = [{'cmd':runcmd}]
|
||||
utils.execute_template(*cmds, params=params, cwd=app_dir, **kargs)
|
||||
return None
|
||||
Reference in New Issue
Block a user