From: Zack Cerza Date: Thu, 24 Jul 2014 01:58:55 +0000 (-0600) Subject: Rename CephState to DaemonGroup and move to orchestra X-Git-Tag: 1.1.0~1309 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=479a1fe67698b86020ba0b735e0d1ee02b517a15;p=teuthology.git Rename CephState to DaemonGroup and move to orchestra Signed-off-by: Zack Cerza --- diff --git a/teuthology/task/ceph.py b/teuthology/task/ceph.py index 582f27cd13..458f86f484 100644 --- a/teuthology/task/ceph.py +++ b/teuthology/task/ceph.py @@ -17,64 +17,13 @@ from teuthology import contextutil from ..orchestra import run import ceph_client as cclient from teuthology.orchestra.run import CommandFailedError -from teuthology.orchestra.daemon import DaemonState +from teuthology.orchestra.daemon import DaemonGroup DEFAULT_CONF_PATH = '/etc/ceph/ceph.conf' log = logging.getLogger(__name__) -class CephState(object): - """ - Collection of daemon state instances - """ - def __init__(self): - """ - self.daemons is a dictionary indexed by role. Each entry is a dictionary of - DaemonState values indexcd by an id parameter. - """ - self.daemons = {} - - def add_daemon(self, remote, role, id_, *args, **kwargs): - """ - Add a daemon. If there already is a daemon for this id_ and role, stop that - daemon and. Restart the damon once the new value is set. - - :param remote: Remote site - :param role: Role (osd, mds, mon, rgw, for example) - :param id_: Id (index into role dictionary) - :param args: Daemonstate positional parameters - :param kwargs: Daemonstate keyword parameters - """ - if role not in self.daemons: - self.daemons[role] = {} - if id_ in self.daemons[role]: - self.daemons[role][id_].stop() - self.daemons[role][id_] = None - self.daemons[role][id_] = DaemonState(remote, role, id_, *args, **kwargs) - self.daemons[role][id_].restart() - - def get_daemon(self, role, id_): - """ - get the daemon associated with this id_ for this role. - - :param role: Role (osd, mds, mon, rgw, for example) - :param id_: Id (index into role dictionary) - """ - if role not in self.daemons: - return None - return self.daemons[role].get(str(id_), None) - - def iter_daemons_of_role(self, role): - """ - Iterate through all daemon instances for this role. Return dictionary of - daemon values. - - :param role: Role (osd, mds, mon, rgw, for example) - """ - return self.daemons.get(role, {}).values() - - @contextlib.contextmanager def ceph_log(ctx, config): """ @@ -1285,7 +1234,7 @@ def task(ctx, config): overrides = ctx.config.get('overrides', {}) teuthology.deep_merge(config, overrides.get('ceph', {})) - ctx.daemons = CephState() + ctx.daemons = DaemonGroup() testdir = teuthology.get_testdir(ctx) if config.get('coverage'): diff --git a/teuthology/task/rest_api.py b/teuthology/task/rest_api.py index d34d31af6b..de09df4646 100644 --- a/teuthology/task/rest_api.py +++ b/teuthology/task/rest_api.py @@ -8,7 +8,7 @@ import time from teuthology import misc as teuthology from teuthology import contextutil from ..orchestra import run -from teuthology.task.ceph import CephState +from ..orchestra.daemon import DaemonGroup log = logging.getLogger(__name__) @@ -19,7 +19,7 @@ def run_rest_api_daemon(ctx, api_clients): Wrapper starts the rest api daemons """ if not hasattr(ctx, 'daemons'): - ctx.daemons = CephState() + ctx.daemons = DaemonGroup() remotes = ctx.cluster.only(teuthology.is_type('client')).remotes for rems, roles in remotes.iteritems(): for whole_id_ in roles: diff --git a/teuthology/task/samba.py b/teuthology/task/samba.py index a0375c5208..fa13f04726 100644 --- a/teuthology/task/samba.py +++ b/teuthology/task/samba.py @@ -7,14 +7,15 @@ import sys from teuthology import misc as teuthology from ..orchestra import run +from ..orchestra.daemon import DaemonGroup log = logging.getLogger(__name__) def get_sambas(ctx, roles): """ Scan for roles that are samba. Yield the id of the the samba role - (samba.0, samba.1...) and the associated remote site - + (samba.0, samba.1...) and the associated remote site + :param ctx: Context :param roles: roles for this test (extracted from yaml files) """ @@ -92,9 +93,9 @@ def task(ctx, config): testdir = teuthology.get_testdir(ctx) - from teuthology.task.ceph import CephState + from teuthology.task.ceph import DaemonGroup if not hasattr(ctx, 'daemons'): - ctx.daemons = CephState() + ctx.daemons = DaemonGroup() for id_, remote in samba_servers: @@ -175,7 +176,7 @@ def task(ctx, config): # let smbd initialize, probably a better way... import time - seconds_to_sleep = 100 + seconds_to_sleep = 100 log.info('Sleeping for %s seconds...' % seconds_to_sleep) time.sleep(seconds_to_sleep) log.info('Sleeping stopped...')