Removed static time sleep number and moved to config, except for libvirt...
This commit is contained in:
parent
1aa74de841
commit
898980f8c8
@ -37,6 +37,11 @@ syslog = 0
|
||||
# Which run type to use [fork (the default), upstart, screen]
|
||||
run_type = fork
|
||||
|
||||
# How many seconds to wait until a service comes online before using it.
|
||||
# For example, before uploading to glance we need keystone and glance to be online.
|
||||
# Sometimes this takes 5 to 10 seconds to start these up....
|
||||
service_wait_seconds = 5
|
||||
|
||||
[upstart]
|
||||
|
||||
# These flags are used for starting components under upstart (if default/run_type is upstart)
|
||||
|
@ -17,7 +17,6 @@
|
||||
from devstack import component as comp
|
||||
from devstack import exceptions as excp
|
||||
from devstack import log as logging
|
||||
from devstack import settings
|
||||
from devstack import shell as sh
|
||||
from devstack import utils
|
||||
|
||||
@ -25,9 +24,6 @@ import abc
|
||||
|
||||
LOG = logging.getLogger("devstack.components.db")
|
||||
|
||||
# How long we wait before using the database after a restart
|
||||
START_WAIT_TIME = settings.WAIT_ALIVE_SECS
|
||||
|
||||
# Need to reset pw to blank since this distributions don't seem to
|
||||
# always reset it when u uninstall the db
|
||||
RESET_BASE_PW = ''
|
||||
@ -158,6 +154,7 @@ class DBInstaller(comp.PkgInstallComponent):
|
||||
class DBRuntime(comp.EmptyRuntime):
|
||||
def __init__(self, *args, **kargs):
|
||||
comp.EmptyRuntime.__init__(self, *args, **kargs)
|
||||
self.wait_time = max(self.cfg.getint('default', 'service_wait_seconds'), 1)
|
||||
|
||||
def _get_run_actions(self, act, exception_cls):
|
||||
dbtype = self.cfg.get("db", "type")
|
||||
@ -173,8 +170,8 @@ class DBRuntime(comp.EmptyRuntime):
|
||||
sh.execute(*startcmd,
|
||||
run_as_root=True,
|
||||
check_exit_code=True)
|
||||
LOG.info("Please wait %s seconds while it starts up." % START_WAIT_TIME)
|
||||
sh.sleep(START_WAIT_TIME)
|
||||
LOG.info("Please wait %s seconds while it starts up." % self.wait_time)
|
||||
sh.sleep(self.wait_time)
|
||||
return 1
|
||||
else:
|
||||
return 0
|
||||
@ -195,8 +192,8 @@ class DBRuntime(comp.EmptyRuntime):
|
||||
sh.execute(*restartcmd,
|
||||
run_as_root=True,
|
||||
check_exit_code=True)
|
||||
LOG.info("Please wait %s seconds while it restarts." % START_WAIT_TIME)
|
||||
sh.sleep(START_WAIT_TIME)
|
||||
LOG.info("Please wait %s seconds while it restarts." % self.wait_time)
|
||||
sh.sleep(self.wait_time)
|
||||
return 1
|
||||
|
||||
def status(self):
|
||||
|
@ -19,7 +19,6 @@ import io
|
||||
from devstack import cfg
|
||||
from devstack import component as comp
|
||||
from devstack import log as logging
|
||||
from devstack import settings
|
||||
from devstack import shell as sh
|
||||
|
||||
from devstack.components import db
|
||||
@ -53,9 +52,6 @@ GSCR = 'scrub'
|
||||
# This db will be dropped and created
|
||||
DB_NAME = "glance"
|
||||
|
||||
# How long to wait before attempting image upload
|
||||
WAIT_ONLINE_TO = settings.WAIT_ALIVE_SECS
|
||||
|
||||
# What applications to start
|
||||
APP_OPTIONS = {
|
||||
'glance-api': ['--config-file', sh.joinpths('%ROOT%', "etc", API_CONF)],
|
||||
@ -187,6 +183,7 @@ class GlanceRuntime(comp.PythonRuntime):
|
||||
comp.PythonRuntime.__init__(self, *args, **kargs)
|
||||
self.cfg_dir = sh.joinpths(self.app_dir, CONFIG_DIR)
|
||||
self.bin_dir = sh.joinpths(self.app_dir, BIN_DIR)
|
||||
self.wait_time = max(self.cfg.getint('default', 'service_wait_seconds'), 1)
|
||||
|
||||
def known_subsystems(self):
|
||||
return SUB_TO_APP.keys()
|
||||
@ -213,6 +210,6 @@ class GlanceRuntime(comp.PythonRuntime):
|
||||
else:
|
||||
# Install any images that need activating...
|
||||
# TODO: make this less cheesy - need to wait till glance goes online
|
||||
LOG.info("Waiting %s seconds so that glance can start up before image install." % (WAIT_ONLINE_TO))
|
||||
sh.sleep(WAIT_ONLINE_TO)
|
||||
LOG.info("Waiting %s seconds so that glance can start up before image install." % (self.wait_time))
|
||||
sh.sleep(self.wait_time)
|
||||
uploader.Service(self.cfg, self.pw_gen).install()
|
||||
|
@ -21,7 +21,6 @@ from urlparse import urlunparse
|
||||
from devstack import cfg
|
||||
from devstack import component as comp
|
||||
from devstack import log as logging
|
||||
from devstack import settings
|
||||
from devstack import shell as sh
|
||||
from devstack import utils
|
||||
|
||||
@ -63,9 +62,6 @@ APP_OPTIONS = {
|
||||
}
|
||||
|
||||
|
||||
# Used to wait until started before we can run the data setup script
|
||||
WAIT_ONLINE_TO = settings.WAIT_ALIVE_SECS
|
||||
|
||||
# Swift template additions
|
||||
# TODO: get rid of these
|
||||
SWIFT_TEMPL_ADDS = ['catalog.RegionOne.object_store.publicURL = http://%SERVICE_HOST%:8080/v1/AUTH_$(tenant_id)s',
|
||||
@ -206,6 +202,7 @@ class KeystoneRuntime(comp.PythonRuntime):
|
||||
comp.PythonRuntime.__init__(self, *args, **kargs)
|
||||
self.cfg_dir = sh.joinpths(self.app_dir, CONFIG_DIR)
|
||||
self.bin_dir = sh.joinpths(self.app_dir, BIN_DIR)
|
||||
self.wait_time = max(self.cfg.getint('default', 'service_wait_seconds'), 1)
|
||||
|
||||
def post_start(self):
|
||||
tgt_fn = sh.joinpths(self.bin_dir, MANAGE_DATA_CONF)
|
||||
@ -213,8 +210,8 @@ class KeystoneRuntime(comp.PythonRuntime):
|
||||
# If its still there, run it
|
||||
# these environment additions are important
|
||||
# in that they eventually affect how this script runs
|
||||
LOG.info("Waiting %s seconds so that keystone can start up before running first time init." % (WAIT_ONLINE_TO))
|
||||
sh.sleep(WAIT_ONLINE_TO)
|
||||
LOG.info("Waiting %s seconds so that keystone can start up before running first time init." % (self.wait_time))
|
||||
sh.sleep(self.wait_time)
|
||||
env = dict()
|
||||
env['ENABLED_SERVICES'] = ",".join(self.instances.keys())
|
||||
env['BIN_DIR'] = self.bin_dir
|
||||
|
@ -19,7 +19,6 @@ import io
|
||||
from devstack import cfg
|
||||
from devstack import component as comp
|
||||
from devstack import log as logging
|
||||
from devstack import settings
|
||||
from devstack import shell as sh
|
||||
from devstack import utils
|
||||
|
||||
@ -57,9 +56,6 @@ APP_OPTIONS = {
|
||||
'melange-server': ['--config-file', '%CFG_FILE%'],
|
||||
}
|
||||
|
||||
# Wait time before we try to init melanges cidr (waiting for the server to start...)
|
||||
WAIT_ONLINE_TO = settings.WAIT_ALIVE_SECS
|
||||
|
||||
|
||||
class MelangeUninstaller(comp.PythonUninstallComponent):
|
||||
def __init__(self, *args, **kargs):
|
||||
@ -137,6 +133,7 @@ class MelangeRuntime(comp.PythonRuntime):
|
||||
comp.PythonRuntime.__init__(self, *args, **kargs)
|
||||
self.bin_dir = sh.joinpths(self.app_dir, BIN_DIR)
|
||||
self.cfg_dir = sh.joinpths(self.app_dir, *CFG_LOC)
|
||||
self.wait_time = max(self.cfg.getint('default', 'service_wait_seconds'), 1)
|
||||
|
||||
def _get_apps_to_start(self):
|
||||
apps = list()
|
||||
@ -161,8 +158,8 @@ class MelangeRuntime(comp.PythonRuntime):
|
||||
def post_start(self):
|
||||
comp.PythonRuntime.post_start(self)
|
||||
if "create-cidr" in self.options:
|
||||
LOG.info("Waiting %s seconds so that the melange server can start up before cidr range creation." % (WAIT_ONLINE_TO))
|
||||
sh.sleep(WAIT_ONLINE_TO)
|
||||
LOG.info("Waiting %s seconds so that the melange server can start up before cidr range creation." % (self.wait_time))
|
||||
sh.sleep(self.wait_time)
|
||||
mp = dict()
|
||||
mp['CIDR_RANGE'] = self.cfg.getdefaulted('melange', 'm_mac_range', DEF_CIDR_RANGE)
|
||||
utils.execute_template(*CIDR_CREATE_CMD, params=mp)
|
||||
|
@ -21,7 +21,6 @@ from devstack import date
|
||||
from devstack import exceptions
|
||||
from devstack import libvirt as virsh
|
||||
from devstack import log as logging
|
||||
from devstack import settings
|
||||
from devstack import shell as sh
|
||||
from devstack import utils
|
||||
|
||||
@ -199,9 +198,6 @@ STD_COMPUTE_EXTS = 'nova.api.openstack.compute.contrib.standard_extensions'
|
||||
# Config keys we warm up so u won't be prompted later
|
||||
WARMUP_PWS = [('rabbit', rabbit.PW_USER_PROMPT)]
|
||||
|
||||
# Used to wait until started before we can run the data setup script
|
||||
WAIT_ONLINE_TO = settings.WAIT_ALIVE_SECS
|
||||
|
||||
# Nova conf default section
|
||||
NV_CONF_DEF_SECTION = "[DEFAULT]"
|
||||
|
||||
@ -403,6 +399,7 @@ class NovaRuntime(comp.PythonRuntime):
|
||||
comp.PythonRuntime.__init__(self, *args, **kargs)
|
||||
self.cfg_dir = sh.joinpths(self.app_dir, CONFIG_DIR)
|
||||
self.bin_dir = sh.joinpths(self.app_dir, BIN_DIR)
|
||||
self.wait_time = max(self.cfg.getint('default', 'service_wait_seconds'), 1)
|
||||
|
||||
def _setup_network_init(self):
|
||||
tgt_fn = sh.joinpths(self.bin_dir, NET_INIT_CONF)
|
||||
@ -412,8 +409,8 @@ class NovaRuntime(comp.PythonRuntime):
|
||||
# these environment additions are important
|
||||
# in that they eventually affect how this script runs
|
||||
if 'quantum' in self.options:
|
||||
LOG.info("Waiting %s seconds so that quantum can start up before running first time init." % (WAIT_ONLINE_TO))
|
||||
sh.sleep(WAIT_ONLINE_TO)
|
||||
LOG.info("Waiting %s seconds so that quantum can start up before running first time init." % (self.wait_time))
|
||||
sh.sleep(self.wait_time)
|
||||
env = dict()
|
||||
env['ENABLED_SERVICES'] = ",".join(self.instances.keys())
|
||||
setup_cmd = NET_INIT_CMD_ROOT + [tgt_fn]
|
||||
|
@ -18,7 +18,6 @@ from tempfile import TemporaryFile
|
||||
|
||||
from devstack import component as comp
|
||||
from devstack import log as logging
|
||||
from devstack import settings
|
||||
from devstack import shell as sh
|
||||
|
||||
LOG = logging.getLogger("devstack.components.rabbit")
|
||||
@ -33,9 +32,6 @@ PWD_CMD = ['rabbitmqctl', 'change_password', 'guest']
|
||||
# Default password (guest)
|
||||
RESET_BASE_PW = ''
|
||||
|
||||
# How long we wait for rabbitmq to start up before doing commands on it
|
||||
WAIT_ON_TIME = settings.WAIT_ALIVE_SECS
|
||||
|
||||
# Config keys we warm up so u won't be prompted later
|
||||
WARMUP_PWS = ['rabbit']
|
||||
|
||||
@ -85,6 +81,7 @@ class RabbitInstaller(comp.PkgInstallComponent):
|
||||
class RabbitRuntime(comp.EmptyRuntime):
|
||||
def __init__(self, *args, **kargs):
|
||||
comp.EmptyRuntime.__init__(self, *args, **kargs)
|
||||
self.wait_time = max(self.cfg.getint('default', 'service_wait_seconds'), 1)
|
||||
|
||||
def start(self):
|
||||
if self.status() != comp.STATUS_STARTED:
|
||||
@ -132,8 +129,8 @@ class RabbitRuntime(comp.EmptyRuntime):
|
||||
def restart(self):
|
||||
LOG.info("Restarting rabbit-mq.")
|
||||
self._run_cmd(RESTART_CMD)
|
||||
LOG.info("Please wait %s seconds while it starts up." % (WAIT_ON_TIME))
|
||||
sh.sleep(WAIT_ON_TIME)
|
||||
LOG.info("Please wait %s seconds while it starts up." % (self.wait_time))
|
||||
sh.sleep(self.wait_time)
|
||||
return 1
|
||||
|
||||
def stop(self):
|
||||
|
@ -215,7 +215,7 @@ class Image(object):
|
||||
continue
|
||||
LOG.debug("Checking if you already have an image named %r" % (name))
|
||||
if self._registry.has_image(name):
|
||||
LOG.warn("You already 'seem' to have image named %r, skipping that install..." % (name))
|
||||
LOG.warn("You already 'seem' to have image named %r, skipping its install..." % (name))
|
||||
found_name = True
|
||||
break
|
||||
if not found_name:
|
||||
@ -226,8 +226,11 @@ class Image(object):
|
||||
locations = Unpacker().unpack(url_fn, fetch_fn, tdir)
|
||||
tgt_image_name = self._generate_img_name(url_fn)
|
||||
self._register(tgt_image_name, locations)
|
||||
return tgt_image_name
|
||||
finally:
|
||||
sh.deldir(tdir)
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
class Registry:
|
||||
@ -345,8 +348,10 @@ class Service:
|
||||
token = self._get_token()
|
||||
for url in urls:
|
||||
try:
|
||||
Image(url, token).install()
|
||||
am_installed += 1
|
||||
name = Image(url, token).install()
|
||||
if name:
|
||||
LOG.info("Installed image named %r" % (name))
|
||||
am_installed += 1
|
||||
except (IOError, tarfile.TarError) as e:
|
||||
LOG.exception('Installing %r failed due to: %s', url, e)
|
||||
return am_installed
|
||||
|
@ -16,7 +16,6 @@
|
||||
|
||||
from devstack import exceptions as excp
|
||||
from devstack import log as logging
|
||||
from devstack import settings
|
||||
from devstack import shell as sh
|
||||
from devstack import utils
|
||||
|
||||
@ -55,7 +54,8 @@ _DEAD = 'DEAD'
|
||||
_ALIVE = 'ALIVE'
|
||||
|
||||
# Alive wait time, just a sleep we put into so that the service can start up
|
||||
WAIT_ALIVE_TIME = settings.WAIT_ALIVE_SECS
|
||||
# FIXME: take from config...
|
||||
WAIT_ALIVE_TIME = 5
|
||||
|
||||
|
||||
def _get_virt_lib():
|
||||
|
@ -17,7 +17,6 @@
|
||||
import json
|
||||
import re
|
||||
import tempfile
|
||||
import time
|
||||
|
||||
from devstack import date
|
||||
from devstack import exceptions as excp
|
||||
@ -62,9 +61,6 @@ SCREEN_KILLER = ['screen', '-X', '-S', '%SCREEN_ID%', 'quit']
|
||||
SCREEN_SOCKET_DIR_NAME = "devstack-screen-sockets"
|
||||
SCREEN_SOCKET_PERM = 0700
|
||||
|
||||
# Used to wait until started before we can run the actual start cmd
|
||||
WAIT_ONLINE_TO = settings.WAIT_ALIVE_SECS
|
||||
|
||||
# Run screen as root?
|
||||
ROOT_GO = True
|
||||
|
||||
@ -76,6 +72,7 @@ class ScreenRunner(base.RunnerBase):
|
||||
def __init__(self, cfg, component_name, trace_dir):
|
||||
base.RunnerBase.__init__(self, cfg, component_name, trace_dir)
|
||||
self.socket_dir = sh.joinpths(tempfile.gettempdir(), SCREEN_SOCKET_DIR_NAME)
|
||||
self.wait_time = max(self.cfg.getint('default', 'service_wait_seconds'), 1)
|
||||
|
||||
def stop(self, app_name):
|
||||
trace_fn = tr.trace_fn(self.trace_dir, SCREEN_TEMPL % (app_name))
|
||||
@ -161,8 +158,8 @@ class ScreenRunner(base.RunnerBase):
|
||||
shell=True,
|
||||
run_as_root=ROOT_GO,
|
||||
env_overrides=self._get_env())
|
||||
LOG.debug("Waiting %s seconds before we attempt to set the title bar for that session." % (WAIT_ONLINE_TO))
|
||||
time.sleep(WAIT_ONLINE_TO)
|
||||
LOG.debug("Waiting %s seconds before we attempt to set the title bar for that session." % (self.wait_time))
|
||||
sh.sleep(self.wait_time)
|
||||
bar_init_cmd = self._gen_cmd(BAR_INIT)
|
||||
sh.execute(*bar_init_cmd,
|
||||
shell=True,
|
||||
@ -182,8 +179,8 @@ class ScreenRunner(base.RunnerBase):
|
||||
shell=True,
|
||||
run_as_root=ROOT_GO,
|
||||
env_overrides=self._get_env())
|
||||
LOG.debug("Waiting %s seconds before we attempt to run command [%s] in that window." % (WAIT_ONLINE_TO, run_cmd))
|
||||
time.sleep(WAIT_ONLINE_TO)
|
||||
LOG.debug("Waiting %s seconds before we attempt to run command [%s] in that window." % (self.wait_time, run_cmd))
|
||||
sh.sleep(self.wait_time)
|
||||
start_cmd = self._gen_cmd(CMD_START, mp)
|
||||
sh.execute(*start_cmd,
|
||||
shell=True,
|
||||
|
@ -24,9 +24,6 @@ PROG_NICE_NAME = "DEVSTACKpy"
|
||||
IPV4 = 'IPv4'
|
||||
IPV6 = 'IPv6'
|
||||
|
||||
# How long to wait for a service to startup
|
||||
WAIT_ALIVE_SECS = 5
|
||||
|
||||
# Different run types supported
|
||||
RUN_TYPE_FORK = "FORK"
|
||||
RUN_TYPE_UPSTART = "UPSTART"
|
||||
|
Loading…
Reference in New Issue
Block a user