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):
"""
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'):
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__)
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:
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)
"""
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:
# 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...')