extra_args=extra_args)
def update_mons(self, spec):
- # type: (List[orchestrator.HostSpec]) -> orchestrator.Completion
+ # type: (orchestrator.StatefulServiceSpec) -> orchestrator.Completion
"""
Adjust the number of cluster managers.
"""
# type: (orchestrator.PlacementSpec) -> None
self.placement_spec = placement_spec
- def place(self):
+ def place(self, host_pool, count=None):
+ # type: (List, Optional[int]) -> List[HostSpec]
raise NotImplementedError
super(SimpleScheduler, self).__init__(placement_spec)
def place(self, host_pool, count=None):
- # type: (List, Optional(int)) -> List
+ # type: (List, Optional[int]) -> List[HostSpec]
if not host_pool:
raise Exception('List of host candidates is empty')
host_pool = [HostSpec(x, '', '') for x in host_pool]
"""
def __init__(self,
- spec=None, # type: orchestrator.PlacementSpec
- scheduler=None, # type: BaseScheduler
- get_hosts_func=None, # type: Callable
- service_type=None, # type: str
+ spec=None, # type: Optional[orchestrator.StatefulServiceSpec]
+ scheduler=None, # type: Optional[BaseScheduler]
+ get_hosts_func=None, # type: Optional[Callable]
+ service_type=None, # type: Optional[str]
):
assert spec and get_hosts_func and service_type
self.spec = spec
self.service_type = service_type
def load(self):
- # type: () -> orchestrator.PlacementSpec
+ # type: () -> orchestrator.StatefulServiceSpec
"""
Load nodes into the spec.placement.nodes container.
"""
# If no imperative or declarative host assignments, use the scheduler to pick from the
# host pool (assuming `count` is set)
if not self.spec.placement.label and not self.spec.placement.nodes and self.spec.placement.count:
- logger.info("Found num spec. Looking for labeled nodes.".format(self.scheduler))
+ logger.info("Found num spec. Looking for labeled nodes.")
# TODO: actually query for labels (self.service_type)
candidates = self.scheduler.place([x[0] for x in self.get_hosts_func()],
count=self.spec.placement.count)
class NFSServiceSpec(StatelessServiceSpec):
- def __init__(self, name, pool=None, namespace=None, count=1, placement=None):
- super(NFSServiceSpec, self).__init__(name, placement, count)
+ def __init__(self, name, pool=None, namespace=None, placement=None):
+ super(NFSServiceSpec, self).__init__(name, placement)
#: RADOS pool where NFS client recovery data is stored.
self.pool = pool