Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mgr/orch: fix orch apply iscsi #34814

Merged
merged 3 commits into from May 5, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions doc/mgr/orchestrator.rst
Expand Up @@ -568,7 +568,7 @@ This is an overview of the current implementation status of the orchestrators.
=================================== ====== =========
Command Rook Cephadm
=================================== ====== =========
apply iscsi ⚪
apply iscsi ⚪
apply mds ✔ ✔
apply mgr ⚪ ✔
apply mon ✔ ✔
Expand All @@ -583,7 +583,7 @@ This is an overview of the current implementation status of the orchestrators.
daemon {stop,start,...} ⚪ ✔
device {ident,fault}-(on,off} ⚪ ✔
device ls ✔ ✔
iscsi add ⚪
iscsi add ⚪
mds add ✔ ✔
nfs add ✔ ✔
rbd-mirror add ⚪ ✔
Expand Down
12 changes: 5 additions & 7 deletions src/pybind/mgr/cephadm/module.py
Expand Up @@ -2068,7 +2068,7 @@ def find_destroyed_osds(self) -> Dict[str, List[str]]:
try:
tree = json.loads(out)
except json.decoder.JSONDecodeError:
self.log.error(f"Could not decode json -> {out}")
self.log.exception(f"Could not decode json -> {out}")
return osd_host_map

nodes = tree.get('nodes', {})
Expand Down Expand Up @@ -2479,10 +2479,10 @@ def matches_network(host):
daemon_type, daemon_id, host))
if daemon_type == 'mon':
create_func(daemon_id, host, network) # type: ignore
elif daemon_type == 'nfs':
elif daemon_type in ['nfs', 'iscsi']:
create_func(daemon_id, host, spec) # type: ignore
else:
create_func(daemon_id, host) # type: ignore
create_func(daemon_id, host) # type: ignore

# add to daemon list so next name(s) will also be unique
sd = orchestrator.DaemonDescription(
Expand Down Expand Up @@ -2514,7 +2514,7 @@ def _apply_all_services(self):
if self._apply_service(spec):
r = True
except Exception as e:
self.log.warning('Failed to apply %s spec %s: %s' % (
self.log.exception('Failed to apply %s spec %s: %s' % (
spec.service_name(), spec, e))
return r

Expand Down Expand Up @@ -2625,9 +2625,7 @@ def _create_daemons(self, daemon_type, spec, daemons,
daemon_type, daemon_id, host))
if daemon_type == 'mon':
args.append((daemon_id, host, network)) # type: ignore
elif daemon_type == 'nfs':
args.append((daemon_id, host, spec)) # type: ignore
elif daemon_type == 'iscsi':
elif daemon_type in ['nfs', 'iscsi']:
args.append((daemon_id, host, spec)) # type: ignore
else:
args.append((daemon_id, host)) # type: ignore
Expand Down
20 changes: 20 additions & 0 deletions src/pybind/mgr/orchestrator/module.py
Expand Up @@ -926,6 +926,26 @@ def _apply_nfs(self, svc_id, pool, namespace=None, placement=None, unmanaged=Fal
self._orchestrator_wait([completion])
return HandleCommandResult(stdout=completion.result_str())

@_cli_write_command(
'orch apply iscsi',
'name=pool,type=CephString '
'name=trusted_ip_list,type=CephString,req=false '
'name=placement,type=CephString,req=false '
'name=unmanaged,type=CephBool,req=false',
'Scale an iSCSI service')
def _apply_iscsi(self, pool, trusted_ip_list=None, placement=None, unmanaged=False, inbuf=None):
spec = IscsiServiceSpec(
service_id='iscsi',
pool=pool,
trusted_ip_list=trusted_ip_list,
placement=PlacementSpec.from_string(placement),
unmanaged=unmanaged,
)
completion = self.apply_iscsi(spec)
self._orchestrator_wait([completion])
raise_if_exception(completion)
return HandleCommandResult(stdout=completion.result_str())

@_cli_write_command(
'orch set backend',
"name=module_name,type=CephString,req=true",
Expand Down