path = self.get_ceph_option('cephadm_path')
try:
with open(path, 'r') as f:
- self._ceph_daemon = f.read()
+ self._cephadm = f.read()
except (IOError, TypeError) as e:
raise RuntimeError("unable to read cephadm at '%s': %s" % (
path, str(e)))
'name=host,type=CephString',
'Check whether we can access and manage a remote host')
def _check_host(self, host):
- out, err, code = self._run_ceph_daemon(host, '', 'check-host', [],
- error_ok=True, no_fsid=True)
+ out, err, code = self._run_cephadm(host, '', 'check-host', [],
+ error_ok=True, no_fsid=True)
if code:
return 1, '', err
return 0, 'host ok', err
'name=host,type=CephString',
'Try to prepare a host for remote management')
def _prepare_host(self, host):
- out, err, code = self._run_ceph_daemon(host, '', 'prepare-host', [],
- error_ok=True, no_fsid=True)
+ out, err, code = self._run_cephadm(host, '', 'prepare-host', [],
+ error_ok=True, no_fsid=True)
if code:
return 1, '', err
return 0, 'host ok', err
executable_path))
return executable_path
- def _run_ceph_daemon(self, host, entity, command, args,
- stdin=None,
- no_fsid=False,
- error_ok=False,
- image=None):
+ def _run_cephadm(self, host, entity, command, args,
+ stdin=None,
+ no_fsid=False,
+ error_ok=False,
+ image=None):
"""
- Run ceph-daemon on the remote host with the given command + args
+ Run cephadm on the remote host with the given command + args
"""
conn = self._get_connection(host)
script = 'injected_argv = ' + json.dumps(final_args) + '\n'
if stdin:
script += 'injected_stdin = ' + json.dumps(stdin) + '\n'
- script += self._ceph_daemon
+ script += self._cephadm
out, err, code = remoto.process.check(
conn,
['/usr/bin/python', '-u'],
@async_map_completion
def _refresh_host_services(self, host):
- out, err, code = self._run_ceph_daemon(
+ out, err, code = self._run_cephadm(
host, 'mon', 'ls', [], no_fsid=True)
data = json.loads(''.join(out))
self.log.error('refreshed host %s services: %s' % (host, data))
result = []
for host, ls in services.items():
for d in ls:
- if not d['style'].startswith('ceph-daemon'):
- self.log.debug('ignoring non-ceph-daemon on %s: %s' % (host, d))
+ if not d['style'].startswith('cephadm'):
+ self.log.debug('ignoring non-cephadm on %s: %s' % (host, d))
continue
if d['fsid'] != self._cluster_fsid:
self.log.debug('ignoring foreign daemon on %s: %s' % (host, d))
}
name = '%s.%s' % (service_type, service_id)
for a in actions[action]:
- out, err, code = self._run_ceph_daemon(
+ out, err, code = self._run_cephadm(
host, name, 'unit',
['--name', name, a],
error_ok=True)
if host_info.outdated(self.inventory_cache_timeout) or refresh:
self.log.info("refresh stale inventory for '{}'".format(host))
- out, err, code = self._run_ceph_daemon(
+ out, err, code = self._run_cephadm(
host, 'osd',
'ceph-volume',
['--', 'inventory', '--format=json'])
'on' if on else 'off'),
'--path', '/dev/' + dev,
]
- out, err, code = self._run_ceph_daemon(
+ out, err, code = self._run_cephadm(
host, 'osd', 'shell', ['--'] + cmd,
error_ok=True)
if code:
devices = drive_group.data_devices.paths
for device in devices:
- out, err, code = self._run_ceph_daemon(
+ out, err, code = self._run_cephadm(
host, 'osd', 'ceph-volume',
[
'--config-and-keyring', '-',
self.log.debug('ceph-volume prepare: %s' % out)
# check result
- out, err, code = self._run_ceph_daemon(
+ out, err, code = self._run_cephadm(
host, 'osd', 'ceph-volume',
[
'--',
'crash_keyring': crash_keyring,
})
- out, err, code = self._run_ceph_daemon(
+ out, err, code = self._run_cephadm(
host, name, 'deploy',
[
'--name', name,
"""
Remove a daemon
"""
- out, err, code = self._run_ceph_daemon(
+ out, err, code = self._run_cephadm(
host, name, 'rm-daemon',
['--name', name])
self.log.debug('_remove_daemon code %s out %s' % (code, out))
if not host:
raise OrchestratorError('no hosts defined')
self.log.debug('using host %s' % host)
- out, code = self._run_ceph_daemon(
+ out, code = self._run_cephadm(
host, None, 'pull', [],
image=image_name,
no_fsid=True)
-def _run_ceph_daemon(ret):
+def _run_cephadm(ret):
def foo(*args, **kwargs):
return ret, '', 0
return foo
c = ssh_module.get_hosts()
assert self._wait(ssh_module, c) == []
- @mock.patch("ssh.module.SSHOrchestrator._run_ceph_daemon", _run_ceph_daemon('[]'))
+ @mock.patch("ssh.module.SSHOrchestrator._run_cephadm", _run_cephadm('[]'))
def test_service_ls(self, ssh_module):
with self._with_host(ssh_module, 'test'):
c = ssh_module.describe_service()
assert self._wait(ssh_module, c) == []
- @mock.patch("ssh.module.SSHOrchestrator._run_ceph_daemon", _run_ceph_daemon('[]'))
+ @mock.patch("ssh.module.SSHOrchestrator._run_cephadm", _run_cephadm('[]'))
def test_device_ls(self, ssh_module):
with self._with_host(ssh_module, 'test'):
c = ssh_module.get_inventory()
assert self._wait(ssh_module, c) == [InventoryNode('test')]
- @mock.patch("ssh.module.SSHOrchestrator._run_ceph_daemon", _run_ceph_daemon('[]'))
+ @mock.patch("ssh.module.SSHOrchestrator._run_cephadm", _run_cephadm('[]'))
@mock.patch("ssh.module.SSHOrchestrator.send_command")
@mock.patch("ssh.module.SSHOrchestrator.mon_command", mon_command)
@mock.patch("ssh.module.SSHOrchestrator._get_connection")
c = ssh_module.update_mons(1, [parse_host_specs('test:0.0.0.0=a')])
assert self._wait(ssh_module, c) == ["(Re)deployed mon.a on host 'test'"]
- @mock.patch("ssh.module.SSHOrchestrator._run_ceph_daemon", _run_ceph_daemon('[]'))
+ @mock.patch("ssh.module.SSHOrchestrator._run_cephadm", _run_cephadm('[]'))
@mock.patch("ssh.module.SSHOrchestrator.send_command")
@mock.patch("ssh.module.SSHOrchestrator.mon_command", mon_command)
@mock.patch("ssh.module.SSHOrchestrator._get_connection")
assert "(Re)deployed mgr." in out
assert " on host 'test'" in out
- @mock.patch("ssh.module.SSHOrchestrator._run_ceph_daemon", _run_ceph_daemon('{}'))
+ @mock.patch("ssh.module.SSHOrchestrator._run_cephadm", _run_cephadm('{}'))
@mock.patch("ssh.module.SSHOrchestrator.send_command")
@mock.patch("ssh.module.SSHOrchestrator.mon_command", mon_command)
@mock.patch("ssh.module.SSHOrchestrator._get_connection")
c = ssh_module.create_osds(dg)
assert self._wait(ssh_module, c) == "Created osd(s) on host 'test'"
- @mock.patch("ssh.module.SSHOrchestrator._run_ceph_daemon", _run_ceph_daemon('{}'))
+ @mock.patch("ssh.module.SSHOrchestrator._run_cephadm", _run_cephadm('{}'))
@mock.patch("ssh.module.SSHOrchestrator.send_command")
@mock.patch("ssh.module.SSHOrchestrator.mon_command", mon_command)
@mock.patch("ssh.module.SSHOrchestrator._get_connection")
assert "(Re)deployed mds.name." in out
assert " on host 'test'" in out
- @mock.patch("ssh.module.SSHOrchestrator._run_ceph_daemon", _run_ceph_daemon('{}'))
+ @mock.patch("ssh.module.SSHOrchestrator._run_cephadm", _run_cephadm('{}'))
@mock.patch("ssh.module.SSHOrchestrator.send_command")
@mock.patch("ssh.module.SSHOrchestrator.mon_command", mon_command)
@mock.patch("ssh.module.SSHOrchestrator._get_connection")
assert "(Re)deployed rgw.realm.zone." in out
assert " on host 'test'" in out
- @mock.patch("ssh.module.SSHOrchestrator._run_ceph_daemon", _run_ceph_daemon(
+ @mock.patch("ssh.module.SSHOrchestrator._run_cephadm", _run_cephadm(
json.dumps([
dict(
name='rgw.myrgw.foobar',
- style='ceph-daemon',
+ style='cephadm',
fsid='fsid',
container_id='container_id',
version='version',
out = self._wait(ssh_module, c)
assert out == ["Removed rgw.myrgw.foobar from host 'test'"]
- @mock.patch("ssh.module.SSHOrchestrator._run_ceph_daemon", _run_ceph_daemon('{}'))
+ @mock.patch("ssh.module.SSHOrchestrator._run_cephadm", _run_cephadm('{}'))
@mock.patch("ssh.module.SSHOrchestrator.send_command")
@mock.patch("ssh.module.SSHOrchestrator.mon_command", mon_command)
@mock.patch("ssh.module.SSHOrchestrator._get_connection")
assert "(Re)deployed rbd-mirror." in out
assert " on host 'test'" in out
- @mock.patch("ssh.module.SSHOrchestrator._run_ceph_daemon", _run_ceph_daemon('{}'))
+ @mock.patch("ssh.module.SSHOrchestrator._run_cephadm", _run_cephadm('{}'))
@mock.patch("ssh.module.SSHOrchestrator.send_command")
@mock.patch("ssh.module.SSHOrchestrator.mon_command", mon_command)
@mock.patch("ssh.module.SSHOrchestrator._get_connection")