]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
Rename CephState to DaemonGroup and move to orchestra
authorZack Cerza <zack@cerza.org>
Thu, 24 Jul 2014 01:58:55 +0000 (19:58 -0600)
committerZack Cerza <zack@cerza.org>
Thu, 24 Jul 2014 01:59:16 +0000 (19:59 -0600)
Signed-off-by: Zack Cerza <zack.cerza@inktank.com>
teuthology/task/ceph.py
teuthology/task/rest_api.py
teuthology/task/samba.py

index 582f27cd135646b09e77c0aba1ce5b68f05490c2..458f86f4848208fd6a9ccb70aee45a24ccb095b7 100644 (file)
@@ -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'):
index d34d31af6b335c68aaae8fa60d3e0443531aeb46..de09df46460d9a78e9d74d269e5ae8482ff10fa5 100644 (file)
@@ -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:
index a0375c5208efea58cd59667589e4d36ae5c11f36..fa13f047265127a55cd470ea8fe904742efad7d3 100644 (file)
@@ -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...')