if spec.placement.is_empty():
# fill in default placement
defaults = {
- 'mon': orchestrator.PlacementSpec(count=5),
- 'mgr': orchestrator.PlacementSpec(count=2),
- 'mds': orchestrator.PlacementSpec(count=2),
- 'rgw': orchestrator.PlacementSpec(count=2),
- 'rbd-mirror': orchestrator.PlacementSpec(count=2),
- 'grafana': orchestrator.PlacementSpec(count=1),
- 'alertmanager': orchestrator.PlacementSpec(count=1),
- 'prometheus': orchestrator.PlacementSpec(count=1),
- 'node-exporter': orchestrator.PlacementSpec(all_hosts=True),
- 'crash': orchestrator.PlacementSpec(all_hosts=True),
+ 'mon': PlacementSpec(count=5),
+ 'mgr': PlacementSpec(count=2),
+ 'mds': PlacementSpec(count=2),
+ 'rgw': PlacementSpec(count=2),
+ 'rbd-mirror': PlacementSpec(count=2),
+ 'grafana': PlacementSpec(count=1),
+ 'alertmanager': PlacementSpec(count=1),
+ 'prometheus': PlacementSpec(count=1),
+ 'node-exporter': PlacementSpec(all_hosts=True),
+ 'crash': PlacementSpec(all_hosts=True),
}
spec.placement = defaults[spec.service_type]
+ elif spec.service_type in ['mon', 'mgr'] and \
+ spec.placement.count is not None and \
+ spec.placement.count < 1:
+ raise OrchestratorError('cannot scale %s service below 1' % (
+ spec.service_type))
self.log.info('Saving service %s spec with placement %s' % (
spec.service_name(), spec.placement.pretty_str()))
self.spec_store.save(spec)