Merge pull request #23702 from Rubab-Syed/rgw-orchestrator-rook

mgr/orchestrator: Add RGW service support

Reviewed-by: John Spray <john.spray@redhat.com>
This commit is contained in:
John Spray 2018-09-11 19:36:26 +01:00 committed by GitHub
commit 86f3bcffa6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 61 additions and 0 deletions

View File

@ -174,6 +174,20 @@ class OrchestratorCli(MgrModule):
)
self._wait([completion])
return 0, "", "Success."
elif svc_type == "rgw":
store_name = cmd['svc_arg']
spec = orchestrator.StatelessServiceSpec()
spec.name = store_name
completion = self._oremote(
"add_stateless_service",
svc_type,
spec
)
self._wait([completion])
return 0, "", "Success."
else:
raise NotImplementedError(svc_type)

View File

@ -359,6 +359,10 @@ class RookOrchestrator(MgrModule, orchestrator.Orchestrator):
return RookWriteCompletion(
lambda: self.rook_cluster.add_filesystem(spec), None,
"Creating Filesystem services for {0}".format(spec.name))
elif service_type == "rgw" :
return RookWriteCompletion(
lambda: self.rook_cluster.add_objectstore(spec), None,
"Creating RGW services for {0}".format(spec.name))
else:
# TODO: RGW, NFS
raise NotImplementedError(service_type)

View File

@ -218,6 +218,49 @@ class RookCluster(object):
else:
raise
def add_objectstore(self, spec):
rook_os = {
"apiVersion": ROOK_API_NAME,
"kind": "ObjectStore",
"metadata": {
"name": spec.name,
"namespace": self.rook_namespace
},
"spec": {
"metaDataPool": {
"failureDomain": "host",
"replicated": {
"size": 1
}
},
"dataPool": {
"failureDomain": "osd",
"replicated": {
"size": 1
}
},
"gateway": {
"type": "s3",
"port": 80,
"instances": 1,
"allNodes": False
}
}
}
try:
self.rook_api_post(
"objectstores/",
body=rook_os
)
except ApiException as e:
if e.status == 409:
log.info("ObjectStore '{0}' already exists".format(spec.name))
# Idempotent, succeed.
else:
raise
def can_create_osd(self):
current_cluster = self.rook_api_get(
"clusters/{0}".format(self.cluster_name))