]> git-server-git.apps.pok.os.sepia.ceph.com Git - teuthology.git/commitdiff
ceph: make restart take both a list of daemons and other arguments
authorSage Weil <sage@inktank.com>
Wed, 24 Jul 2013 20:14:02 +0000 (13:14 -0700)
committerSage Weil <sage@inktank.com>
Wed, 24 Jul 2013 20:27:50 +0000 (13:27 -0700)
Signed-off-by: Sage Weil <sage@inktank.com>
Reviewed-by: Tamil Muthamizhan <tamil@inktank.com>
(cherry picked from commit 1fcf8e3fbb43b6ee794117182c8d3f8e58b9da3c)

teuthology/task/ceph.py

index 81ff448d43790645f593f867f093ab1e6651231b..1150cf8e600d3ff0b30266ae73190e9e2fd5e4a8 100644 (file)
@@ -945,27 +945,35 @@ def restart(ctx, config):
       tasks:
       - ceph.restart: [osd.0, mon.1]
 
+   or::
+
+      tasks:
+      - ceph.restart:
+          daemons: [osd.0, mon.1]
+          wait-for-healthy: false
+          wait-for-osds-up: true
+
    """
    if config is None:
        config = {}
-
-   daemon = None
    if isinstance(config, list):
-       assert isinstance(config, list), \
-              "task ceph.restart only supports a list for configuration"
-       config = dict.fromkeys(config)
-       for i in config.keys():
-           type_ = i.split('.', 1)[0]
-           id_ = i.split('.', 1)[1]
-           ctx.daemons.get_daemon(type_, id_).stop()
-           ctx.daemons.get_daemon(type_, id_).restart()
-   else:
+       config = { 'daemons': config }
+   if 'daemons' not in config:
+       config['daemons'] = []
        type_daemon = ['mon', 'osd', 'mds', 'rgw']
        for d in type_daemon:
            type_ = d
            for daemon in ctx.daemons.iter_daemons_of_role(type_):
-               daemon.stop()
-               daemon.restart()
+               config['daemons'].append(type_ + '.' + daemon.id_)
+
+   assert isinstance(config['daemons'], list)
+   daemons = dict.fromkeys(config['daemons'])
+   for i in daemons.keys():
+       type_ = i.split('.', 1)[0]
+       id_ = i.split('.', 1)[1]
+       ctx.daemons.get_daemon(type_, id_).stop()
+       ctx.daemons.get_daemon(type_, id_).restart()
+
    if config.get('wait-for-healthy', True):
        healthy(ctx=ctx, config=None)
    if config.get('wait-for-osds-up', False):