<s> """<STR_LIT>""" <EOL> from oslo_log import log as logging <EOL> import oslo_messaging as messaging <EOL> from oslo_serialization import jsonutils <EOL> from oslo_service import periodic_task <EOL> from oslo_utils import importutils <EOL> from stevedore import driver <EOL> import nova . conf <EOL> from nova import exception <EOL> from nova . i18n import _ , _LW <EOL> from nova import manager <EOL> from nova import objects <EOL> from nova import quota <EOL> LOG = logging . getLogger ( __name__ ) <EOL> CONF = nova . conf . CONF <EOL> QUOTAS = quota . QUOTAS <EOL> class SchedulerManager ( manager . Manager ) : <EOL> """<STR_LIT>""" <EOL> target = messaging . Target ( version = '<STR_LIT>' ) <EOL> _sentinel = object ( ) <EOL> def __init__ ( self , scheduler_driver = None , * args , ** kwargs ) : <EOL> if not scheduler_driver : <EOL> scheduler_driver = CONF . scheduler_driver <EOL> try : <EOL> self . driver = driver . DriverManager ( <EOL> "<STR_LIT>" , <EOL> scheduler_driver , <EOL> invoke_on_load = True ) . driver <EOL> except RuntimeError : <EOL> try : <EOL> self . driver = importutils . import_object ( scheduler_driver ) <EOL> LOG . warning ( _LW ( "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" ) , <EOL> { '<STR_LIT:path>' : scheduler_driver } ) <EOL> except ( ImportError , ValueError ) : <EOL> raise RuntimeError ( <EOL> _ ( "<STR_LIT>" <EOL> "<STR_LIT>" ) , <EOL> { '<STR_LIT>' : scheduler_driver } ) <EOL> super ( SchedulerManager , self ) . __init__ ( service_name = '<STR_LIT>' , <EOL> * args , ** kwargs ) <EOL> @ periodic_task . periodic_task <EOL> def _expire_reservations ( self , context ) : <EOL> QUOTAS . expire ( context ) <EOL> @ periodic_task . periodic_task ( spacing = CONF . scheduler_driver_task_period , <EOL> run_immediately = True ) <EOL> def _run_periodic_tasks ( self , context ) : <EOL> self . driver . run_periodic_tasks ( context ) <EOL> @ messaging . expected_exceptions ( exception . NoValidHost ) <EOL> def select_destinations ( self , ctxt , <EOL> request_spec = None , filter_properties = None , <EOL> spec_obj = _sentinel ) : <EOL> """<STR_LIT>""" <EOL> if spec_obj is self . _sentinel : <EOL> spec_obj = objects . RequestSpec . from_primitives ( ctxt , <EOL> request_spec , <EOL> filter_properties ) <EOL> dests = self . driver . select_destinations ( ctxt , spec_obj ) <EOL> return jsonutils . to_primitive ( dests ) <EOL> def update_aggregates ( self , ctxt , aggregates ) : <EOL> """<STR_LIT>""" <EOL> self . driver . host_manager . update_aggregates ( aggregates ) <EOL> def delete_aggregate ( self , ctxt , aggregate ) : <EOL> """<STR_LIT>""" <EOL> self . driver . host_manager . delete_aggregate ( aggregate ) <EOL> def update_instance_info ( self , context , host_name , instance_info ) : <EOL> """<STR_LIT>""" <EOL> self . driver . host_manager . update_instance_info ( context , host_name , <EOL> instance_info ) <EOL> def delete_instance_info ( self , context , host_name , instance_uuid ) : <EOL> """<STR_LIT>""" <EOL> self . driver . host_manager . delete_instance_info ( context , host_name , <EOL> instance_uuid ) <EOL> def sync_instance_info ( self , context , host_name , instance_uuids ) : <EOL> """<STR_LIT>""" <EOL> self . driver . host_manager . sync_instance_info ( context , host_name , <EOL> instance_uuids ) </s>
