mgr/cephadm: apply nfs service spec

orch apply nfs <svc_id> [<placement>]

Signed-off-by: Michael Fritch <mfritch@suse.com>
This commit is contained in:
Michael Fritch 2020-03-09 12:44:06 -06:00
parent 81823176af
commit 76f27894ca
No known key found for this signature in database
GPG Key ID: 75F3EB2E80A03B7F
2 changed files with 14 additions and 2 deletions

View File

@ -2364,6 +2364,7 @@ class CephadmOrchestrator(orchestrator.Orchestrator, MgrModule):
'mds': self._create_mds,
'rgw': self._create_rgw,
'rbd-mirror': self._create_rbd_mirror,
'nfs': self._create_nfs,
'grafana': self._create_grafana,
'alertmanager': self._create_alertmanager,
'prometheus': self._create_prometheus,
@ -2433,6 +2434,8 @@ class CephadmOrchestrator(orchestrator.Orchestrator, MgrModule):
daemon_type, daemon_id, host))
if daemon_type == 'mon':
create_func(daemon_id, host, network) # type: ignore
elif daemon_type == 'nfs':
create_func(daemon_id, host, spec) # type: ignore
else:
create_func(daemon_id, host) # type: ignore
@ -2668,6 +2671,7 @@ class CephadmOrchestrator(orchestrator.Orchestrator, MgrModule):
'mds': PlacementSpec(count=2),
'rgw': PlacementSpec(count=2),
'rbd-mirror': PlacementSpec(count=2),
'nfs': PlacementSpec(count=1),
'grafana': PlacementSpec(count=1),
'alertmanager': PlacementSpec(count=1),
'prometheus': PlacementSpec(count=1),
@ -2800,6 +2804,10 @@ class CephadmOrchestrator(orchestrator.Orchestrator, MgrModule):
keyring=keyring,
cephadm_config=cephadm_config)
@trivial_completion
def apply_nfs(self, spec):
return self._apply(spec)
def _generate_prometheus_config(self):
# type: () -> Tuple[Dict[str, Any], List[str]]
deps = [] # type: List[str]

View File

@ -785,13 +785,17 @@ Usage:
@_cli_write_command(
'orch apply nfs',
"name=svc_id,type=CephString "
'name=svc_id,type=CephString '
'name=pool,type=CephString '
'name=namespace,type=CephString,req=false '
'name=placement,type=CephString,req=false '
'name=unmanaged,type=CephBool,req=false',
'Scale an NFS service')
def _apply_nfs(self, svc_id, placement=None, unmanaged=False):
def _apply_nfs(self, svc_id, pool, namespace=None, placement=None, unmanaged=False):
spec = NFSServiceSpec(
svc_id,
pool=pool,
namespace=namespace,
placement=PlacementSpec.from_string(placement),
unmanaged=unmanaged,
)