also adds missing RGWSpec.validate()
Fixes: https://tracker.ceph.com/issues/46268
Signed-off-by: Michael Fritch <mfritch@suse.com>
return [HostSpec(h) for h in hosts]
return hosts
+ service_id = None
+ if service_type == 'rgw':
+ service_id = 'realm.zone'
+
+ spec = ServiceSpec(service_type=service_type,
+ service_id=service_id,
+ placement=placement)
hosts = HostAssignment(
- spec=ServiceSpec(service_type, placement=placement),
+ spec=spec,
get_hosts_func=get_hosts_func,
get_daemons_func=lambda _: daemons).place()
assert sorted([h.hostname for h in hosts]) == sorted(expected)
if service_id:
a = service_id.split('.', 2)
rgw_realm = a[0]
- rgw_zone = a[1]
+ if len(a) > 1:
+ rgw_zone = a[1]
if len(a) > 2:
subcluster = a[2]
else:
ports.append(f"port={self.get_port()}")
return f'beast {" ".join(ports)}'
+ def validate(self):
+ super(RGWSpec, self).validate()
+
+ if not self.rgw_realm:
+ raise ServiceSpecValidationError(
+ 'Cannot add RGW: No realm specified')
+ if not self.rgw_zone:
+ raise ServiceSpecValidationError(
+ 'Cannot add RGW: No zone specified')
+
yaml.add_representer(RGWSpec, ServiceSpec.yaml_representer)