]> git-server-git.apps.pok.os.sepia.ceph.com Git - teuthology.git/commitdiff
stop and restart daemons as restart only starts.
authortamil <tamil.muthamizhan@inktank.com>
Thu, 21 Mar 2013 00:40:46 +0000 (17:40 -0700)
committertamil <tamil.muthamizhan@inktank.com>
Thu, 21 Mar 2013 00:40:46 +0000 (17:40 -0700)
Signed-off-by: tamil <tamil.muthamizhan@inktank.com>
teuthology/task/ceph.py
teuthology/task/install.py

index a59f8a67b45c8aacbb9362fbec611533adf59198..db0f929595f4f761f39650afd6b6176ad93f3055 100644 (file)
@@ -969,13 +969,7 @@ def restart(ctx, config):
    if config is None:
        config = {}
 
-   ctx.daemons = CephState()
-
-   testdir = teuthology.get_testdir(ctx)
-   coverage_dir = '{tdir}/archive/coverage'.format(tdir=testdir)
-
-   daemon_signal = 'kill'
-
+   daemon = None
    if isinstance(config, list):
        assert isinstance(config, list), \
               "task ceph.restart only supports a list for configuration"
@@ -983,35 +977,18 @@ def restart(ctx, config):
        for i in config.keys():
            type_ = i.split('.')[0]
            id_ = i.split('.')[1]
-           daemons = ctx.cluster.only(teuthology.is_type(type_))
-           for remote, roles_for_host in daemons.remotes.iteritems():
-              run_cmd = [
-                  '{tdir}/enable-coredump'.format(tdir=testdir),
-                  'ceph-coverage',
-                  coverage_dir,
-                  'sudo',
-                  '{tdir}/daemon-helper'.format(tdir=testdir),
-                  daemon_signal,
-                  ]
-              run_cmd_tail = [
-                  'ceph-%s' % (type_),
-                  '-f',
-                  '-i', id_]
-              run_cmd.extend(run_cmd_tail)
-              ctx.daemons.add_daemon(remote, type_, id_,
-                                    args=run_cmd,
-                                    logger=log.getChild(i),
-                                    stdin=run.PIPE,
-                                    wait=False,
-                                    )
-       yield
+           ctx.daemons.get_daemon(type_, id_).stop()
+           ctx.daemons.get_daemon(type_, id_).restart()
    else:
-       with contextutil.nested(
-           lambda: run_daemon(ctx=ctx, config=config, type_='mon'),
-           lambda: run_daemon(ctx=ctx, config=config, type_='osd'),
-           lambda: run_daemon(ctx=ctx, config=config, type_='mds'),
-           ):
-           yield
+       type_daemon = ['mon', 'osd', 'mds']
+       for d in type_daemon:
+           type_ = d
+           for daemon in ctx.daemons.iter_daemons_of_role(type_):
+               daemon.stop()
+               daemon.restart()
+   if config.get('wait-for-healthy', True):
+       healthy(ctx=ctx, config=None)
+   yield
 
 @contextlib.contextmanager
 def task(ctx, config):
index 6d6cec75cc333f040f5d7f2f1c613faa8c490d93..fc58b89593134e65ee98b4ea6f4718c0f2c8639c 100644 (file)
@@ -458,7 +458,7 @@ def upgrade(ctx, config):
     or
         tasks:
         - install.upgrade:
-             client.0:
+             mon.a:
                 branch: end
              osd.0:
                 branch: other
@@ -505,13 +505,18 @@ def upgrade(ctx, config):
         for remote in ctx.cluster.remotes.iterkeys():
             _upgrade_ceph_packages(ctx, remote, debs, ceph_branch)
     else:
-        for node in config.keys():
-            kkeys = config.get(node)
-            (remote,) = ctx.cluster.only(node).remotes.iterkeys()
-            for var, branch_val in kkeys.iteritems():
-                if var == 'branch' or var == 'tag' or var == 'sha1':
-                    ceph_branch = branch_val
-                    _upgrade_ceph_packages(ctx, remote, debs, ceph_branch)
+        list_roles = []
+        for role in config.keys():
+            (remote,) = ctx.cluster.only(role).remotes.iterkeys()
+            kkeys = config.get(role)
+            if remote in list_roles:
+                continue
+            else:
+                for var, branch_val in kkeys.iteritems():
+                    if var == 'branch' or var == 'tag' or var == 'sha1':
+                        ceph_branch = branch_val
+                        _upgrade_ceph_packages(ctx, remote, debs, ceph_branch)
+                        list_roles.append(remote)
     yield
 
 @contextlib.contextmanager