Query the status of a particular service instance (mon, osd, mds, rgw). For OSDs
the id is the numeric OSD ID, for MDS services it is the file system name::
- ceph orch service-instance status <type> <instance-name> [--refresh]
+ ceph orch daemon status <type> <instance-name> [--refresh]
ceph orch service {stop,start,reload} <type> <name>
- ceph orch service-instance {start,stop,reload} <type> <instance-name>
+ ceph orch daemon {start,stop,reload} <type> <daemon-id>
Current Implementation Status
mon update ✔ ✔
osd create ✔ ✔
osd rm ⚪ ✔
+ daemon status ⚪ ✔
+ daemon {stop,start,...} ⚪ ✔
device {ident,fault}-(on,off} ⚪ ✔
device ls ✔ ✔
service ls ✔ ✔
- service-instance status ⚪ ✔
- service-instance {stop,start,...} ⚪ ✔
iscsi add ⚪ ⚪
iscsi rm ⚪ ⚪
iscsi update ⚪ ⚪
if teuthology.is_type('mon', cluster_name)(r)]:
c_, _, id_ = teuthology.split_role(mon)
_shell(ctx, cluster_name, remote, [
- 'ceph', 'orch', 'service-instance', 'reconfig',
- 'mon', id_,
+ 'ceph', 'orch', 'daemon', 'reconfig',
+ 'mon.' + id_,
])
_shell(ctx, cluster_name, ctx.ceph[cluster_name].bootstrap_remote, [
- 'ceph', 'orch', 'service-instance', 'reconfig',
- 'mgr', ctx.ceph[cluster_name].first_mgr,
+ 'ceph', 'orch', 'daemon', 'reconfig',
+ 'mgr.' + ctx.ceph[cluster_name].first_mgr,
])
yield
self._orch_cmd("service", "start", "mds", "cephfs")
def test_service_instance_action(self):
- self._orch_cmd("service-instance", "restart", "mds", "a")
- self._orch_cmd("service-instance", "stop", "mds", "a")
- self._orch_cmd("service-instance", "start", "mds", "a")
+ self._orch_cmd("daemon", "restart", "mds", "a")
+ self._orch_cmd("daemon", "stop", "mds", "a")
+ self._orch_cmd("daemon", "start", "mds", "a")
def test_osd_create(self):
self._orch_cmd("osd", "create", "*:device")
'value': target_name,
'who': daemon_type + '.' + d.service_instance,
})
- return self._service_action([(
+ return self._daemon_action([(
d.service_type,
d.service_instance,
d.nodename,
refresh=refresh)
return result
- def service_action(self, action, service_type,
- service_name=None,
- service_id=None):
- self.log.debug('service_action action %s type %s name %s id %s' % (
- action, service_type, service_name, service_id))
+ def service_action(self, action, service_type, service_name):
+ self.log.debug('service_action action %s type %s name %s' % (
+ action, service_type, service_name))
def _proc_daemons(daemons):
- if service_name is None and service_id is None:
- raise ValueError('service_name or service_id required')
args = []
for d in daemons:
args.append((d.service_type, d.service_instance,
d.nodename, action))
if not args:
- if service_name:
- n = service_name + '-*'
- else:
- n = service_id
raise orchestrator.OrchestratorError(
- 'Unable to find %s.%s daemon(s)' % (
- service_type, n))
- return self._service_action(args)
+ 'Unable to find %s.%s.* daemon(s)' % (
+ service_type, service_name))
+ return self._daemon_action(args)
return self._get_services(
service_type,
- service_name=service_name,
- service_id=service_id).then(_proc_daemons)
+ service_name=service_name).then(_proc_daemons)
@async_map_completion
- def _service_action(self, service_type, service_id, host, action):
+ def _daemon_action(self, daemon_type, daemon_id, host, action):
if action == 'redeploy':
# stop, recreate the container+unit, then restart
- return self._create_daemon(service_type, service_id, host)
+ return self._create_daemon(daemon_type, daemon_id, host)
elif action == 'reconfig':
- return self._create_daemon(service_type, service_id, host,
+ return self._create_daemon(daemon_type, daemon_id, host,
reconfig=True)
actions = {
'stop': ['stop'],
'restart': ['reset-failed', 'restart'],
}
- name = '%s.%s' % (service_type, service_id)
+ name = '%s.%s' % (daemon_type, daemon_id)
for a in actions[action]:
out, err, code = self._run_cephadm(
host, name, 'unit',
['--name', name, a],
error_ok=True)
self.service_cache.invalidate(host)
- self.log.debug('_service_action code %s out %s' % (code, out))
+ self.log.debug('_daemon_action code %s out %s' % (code, out))
return "{} {} from host '{}'".format(action, name, host)
+ def daemon_action(self, action, daemon_type, daemon_id):
+ self.log.debug('daemon_action action %s type %s id %s' % (
+ action, daemon_type, daemon_id))
+
+ def _proc_daemons(daemons):
+ args = []
+ for d in daemons:
+ args.append((d.service_type, d.service_instance,
+ d.nodename, action))
+ if not args:
+ raise orchestrator.OrchestratorError(
+ 'Unable to find %s.%s daemon(s)' % (
+ daemon_type, daemon_id))
+ return self._daemon_action(args)
+
+ return self._get_services(
+ service_type=daemon_type,
+ service_id=daemon_id).then(_proc_daemons)
+
def get_inventory(self, node_filter=None, refresh=False):
"""
Return the storage inventory of nodes matching the given filter.
@mock.patch("cephadm.module.CephadmOrchestrator.send_command")
@mock.patch("cephadm.module.CephadmOrchestrator.mon_command", mon_command)
@mock.patch("cephadm.module.CephadmOrchestrator._get_connection")
- def test_service_action(self, _send_command, _get_connection, cephadm_module):
+ def test_daemon_action(self, _send_command, _get_connection, cephadm_module):
cephadm_module.service_cache_timeout = 10
with self._with_host(cephadm_module, 'test'):
c = cephadm_module.describe_service(refresh=True)
wait(cephadm_module, c)
- c = cephadm_module.service_action('redeploy', 'rgw', service_id='myrgw.foobar')
+ c = cephadm_module.daemon_action('redeploy', 'rgw', 'myrgw.foobar')
assert wait(cephadm_module, c) == ["Deployed rgw.myrgw.foobar on host 'test'"]
for what in ('start', 'stop', 'restart'):
- c = cephadm_module.service_action(what, 'rgw', service_id='myrgw.foobar')
+ c = cephadm_module.daemon_action(what, 'rgw', 'myrgw.foobar')
assert wait(cephadm_module, c) == [what + " rgw.myrgw.foobar from host 'test'"]
"""
raise NotImplementedError()
- def service_action(self, action, service_type, service_name=None, service_id=None):
- # type: (str, str, Optional[str], Optional[str]) -> Completion
+ def service_action(self, action, service_type, service_name):
+ # type: (str, str, str) -> Completion
"""
- Perform an action (start/stop/reload) on a service.
-
- Either service_name or service_id must be specified:
-
- * If using service_name, perform the action on that entire logical
- service (i.e. all daemons providing that named service).
- * If using service_id, perform the action on a single specific daemon
- instance.
+ Perform an action (start/stop/reload) on a service (i.e., all daemons
+ providing the logical service).
:param action: one of "start", "stop", "restart", "redeploy", "reconfig"
:param service_type: e.g. "mds", "rgw", ...
:param service_name: name of logical service ("cephfs", "us-east", ...)
- :param service_id: service daemon instance (usually a short hostname)
:rtype: Completion
"""
#assert action in ["start", "stop", "reload, "restart", "redeploy"]
- #assert service_name or service_id
- #assert not (service_name and service_id)
+ raise NotImplementedError()
+
+ def daemon_action(self, action, daemon_type, daemon_id):
+ # type: (str, str, str) -> Completion
+ """
+ Perform an action (start/stop/reload) on a daemon.
+
+ :param action: one of "start", "stop", "restart", "redeploy", "reconfig"
+ :param name: name of daemon
+ :rtype: Completion
+ """
+ #assert action in ["start", "stop", "reload, "restart", "redeploy"]
raise NotImplementedError()
def create_osds(self, drive_groups):
"name=svc_name,type=CephString",
'Start, stop, restart, redeploy, or reconfig an entire service (i.e. all daemons)')
def _service_action(self, action, svc_type, svc_name):
- completion = self.service_action(action, svc_type, service_name=svc_name)
+ completion = self.service_action(action, svc_type, svc_name)
self._orchestrator_wait([completion])
orchestrator.raise_if_exception(completion)
return HandleCommandResult(stdout=completion.result_str())
@orchestrator._cli_write_command(
- 'orch service-instance',
+ 'orch daemon',
"name=action,type=CephChoices,strings=start|stop|restart|redeploy|reconfig "
- "name=svc_type,type=CephString "
- "name=svc_id,type=CephString",
- 'Start, stop, restart, redeploy, or reconfig a specific service instance')
- def _service_instance_action(self, action, svc_type, svc_id):
- completion = self.service_action(action, svc_type, service_id=svc_id)
+ "name=name,type=CephString ",
+ 'Start, stop, restart, redeploy, or reconfig a specific daemon')
+ def _service_instance_action(self, action, name):
+ if '.' not in name:
+ raise orchestrator.OrchestratorError('%s is not a valid daemon name' % name)
+ (daemon_type, daemon_id) = name.split('.', 1)
+ completion = self.daemon_action(action, daemon_type, daemon_id)
self._orchestrator_wait([completion])
orchestrator.raise_if_exception(completion)
return HandleCommandResult(stdout=completion.result_str())