"""
def __init__(self,
rgw_zone, # type: str
+ placement=None,
hosts=None, # type: Optional[List[str]]
rgw_multisite=None, # type: Optional[bool]
rgw_zonemaster=None, # type: Optional[bool]
# default values that makes sense for Ansible. Rook has default values implemented
# in Rook itself. Thus we don't set any defaults here in this class.
- super(RGWSpec, self).__init__(name=rgw_zone, count=count)
+ super(RGWSpec, self).__init__(name=rgw_zone, count=count,
+ placement=placement)
#: List of hosts where RGWs should run. Not for Rook.
- self.hosts = hosts
+ if hosts:
+ self.placement.hosts = hosts
#: is multisite
self.rgw_multisite = rgw_multisite
return HandleCommandResult(stdout=completion.result_str())
@_write_cli('orchestrator rgw add',
- 'name=zone_name,type=CephString,req=false',
+ 'name=zone_name,type=CephString,req=false '
+ 'name=num,type=CephInt,req=false '
+ "name=hosts,type=CephString,n=N,req=false",
'Create an RGW service. A complete <rgw_spec> can be provided'\
' using <-i> to customize completelly the RGW service')
- def _rgw_add(self, zone_name=None, inbuf=None):
+ def _rgw_add(self, zone_name, num, hosts, inbuf=None):
usage = """
Usage:
ceph orchestrator rgw add -i <json_file>
msg = 'Failed to read JSON input: {}'.format(str(e)) + usage
return HandleCommandResult(-errno.EINVAL, stderr=msg)
elif zone_name:
- rgw_spec = orchestrator.RGWSpec(rgw_zone=zone_name)
+ rgw_spec = orchestrator.RGWSpec(
+ rgw_zone=zone_name,
+ placement=orchestrator.PlacementSpec(nodes=hosts),
+ count=num or 1)
else:
return HandleCommandResult(-errno.EINVAL, stderr=usage)