55 lines
1.7 KiB

# Copyright 2017 Huawei Technologies Co.,LTD.
# All Rights Reserved.
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
import eventlet
import oslo_messaging as messaging
from oslo_utils import importutils
from mogan.common import exception
from mogan.conf import CONF
class SchedulerManager(object):
"""Mogan Scheduler manager main class."""
target = messaging.Target(version=RPC_API_VERSION)
def __init__(self, topic, host=None):
super(SchedulerManager, self).__init__() = host or
self.topic = topic
scheduler_driver = CONF.scheduler.scheduler_driver
self.driver = importutils.import_object(scheduler_driver)
self._startup_delay = True
def init_host(self):
self._startup_delay = False
def _wait_for_scheduler(self):
while self._startup_delay and not self.driver.is_ready():
def select_destinations(self, ctxt, request_spec, filter_properties):
dests = self.driver.schedule(
ctxt, request_spec, filter_properties)
return dests
def del_host(self):