Esempio n. 1
0
 def __init__(self):
     super(VmsSelectionRPCAPI, self).__init__()
     target = messaging.Target(topic=CONF.vms_selection_topic)
     """
     objects_base.XdrsObjectSerializer需要进行进一步实现,还未完成;
     """
     serializer = objects_base.XdrsObjectSerializer()
     self.client = self.get_client(target, serializer)
Esempio n. 2
0
 def __init__(self):
     super(ControllerRPCAPI, self).__init__()
     target = messaging.Target(topic=CONF.controller_topic)
     """
     objects_base.XdrsObjectSerializer需要进行进一步实现,还未完成;
     """
     serializer = objects_base.XdrsObjectSerializer()
     self.client = self.get_client(target, serializer)
Esempio n. 3
0
 def __init__(self):
     super(ConductorAPI, self).__init__()
     target = messaging.Target(topic=CONF.xdrs_conductor_topic)
     version_cap = 1.0
     serializer = objects_base.XdrsObjectSerializer()
     self.client = rpc.get_client(target,
                                  version_cap=version_cap,
                                  serializer=serializer)
Esempio n. 4
0
 def __init__(self):
     super(HostToGlobalRPCAPI, self).__init__()
     target = messaging.Target(topic=CONF.xdrs_global_topic)
     """
     objects_base.XdrsObjectSerializer需要进行进一步实现,还未完成;
     """
     serializer = objects_base.XdrsObjectSerializer()
     self.client = self.get_client(target, serializer)
Esempio n. 5
0
    def start(self):
        verstr = version.version_string_with_package()
        LOG.audit(_('Starting %(topic)s node (version %(version)s)'), {
            'topic': self.topic,
            'version': verstr
        })

        self.basic_config_check()
        """
        服务中的初始化操作;
        @@@@这里很重要;
        需要实现hosts/vms/scheduler中的init_host方法;
        """
        self.manager.init_host()
        """
        ======================================================================================
        self.manager = <nova.cert.manager.CertManager object at 0x3ed4550>
        self.manager.init_host = <bound method CertManager.init_host of <nova.cert.manager.CertManager object at 0x3ed4550>>
        ======================================================================================
        ======================================================================================
        self.manager = <nova.conductor.manager.ConductorManager object at 0x248f490>
        self.manager.init_host = <bound method ConductorManager.init_host of <nova.conductor.manager.ConductorManager object at 0x248f490>>
        ======================================================================================
        ======================================================================================
        self.manager = <nova.scheduler.manager.SchedulerManager object at 0x369d490>
        self.manager.init_host = <bound method SchedulerManager.init_host of <nova.scheduler.manager.SchedulerManager object at 0x369d490>>
        ======================================================================================
        ======================================================================================
        self.manager = <nova.compute.manager.ComputeManager object at 0x2beba90>
        self.manager.init_host = <bound method ComputeManager.init_host of <nova.compute.manager.ComputeManager object at 0x2beba90>>
        ======================================================================================
        ======================================================================================
        self.manager = <nova.console.manager.ConsoleProxyManager object at 0x2898490>
        self.manager.init_host = <bound method ConsoleProxyManager.init_host of <nova.console.manager.ConsoleProxyManager object at 0x2898490>>
        ======================================================================================
        """

        self.model_disconnected = False
        ctxt = context.get_admin_context()

        try:
            self.service_ref = self.conductor_api.service_get_by_args(
                ctxt, self.host, self.binary)
            self.service_id = self.service_ref['id']
            """
            ======================================================================================
            ctxt = <nova.context.RequestContext object at 0x1f996d0>
            self.host = node01.shinian.com
            self.binary = nova-scheduler
            self.service_ref = {'binary': u'nova-scheduler', 'deleted': 0L, 'created_at': '2015-01-08T02:46:44.000000', 'updated_at': '2015-01-30T09:29:40.000000', 'report_count': 192315L, 'topic': u'scheduler', 'host': u'node01.shinian.com', 'disabled': False, 'deleted_at': None, 'disabled_reason': None, 'id': 2L}
            self.service_id = 2
            ======================================================================================
            """

        except exception.NotFound:
            try:
                self.service_ref = self._create_service_ref(ctxt)
            except (exception.ServiceTopicExists,
                    exception.ServiceBinaryExists):
                # NOTE(danms): If we race to create a record with a sibling
                # worker, don't fail here.
                self.service_ref = self.conductor_api.service_get_by_args(
                    ctxt, self.host, self.binary)
        """
        在计算服务初始化之后,且在计算服务完全应用之前,务必要确认更新
        可用的资源信息;
        @@@@这里很重要;
        需要在hosts和vms中实现这个方法,同上面的init_host方法,还未解决;
        """
        self.manager.pre_start_hook()
        """
        RPC机制的应用;
        @@@@这里很重要;
        """
        if self.backdoor_port is not None:
            self.manager.backdoor_port = self.backdoor_port
        LOG.debug(_("Creating RPC server for service %s") % self.topic)
        target = messaging.Target(topic=self.topic, server=self.host)
        """
        self.topic = scheduler
        self.host = node01.shinian.com
        target = <Target topic=scheduler, server=node01.shinian.com>
        """
        endpoints = [
            self.manager,
            baserpc.BaseRPCAPI(self.manager.service_name, self.backdoor_port)
        ]
        """
        ======================================================================================
        self.manager = <nova.scheduler.manager.SchedulerManager object at 0x2b71210>
        self.manager.service_name = scheduler
        self.backdoor_port = None
        endpoints = [<nova.scheduler.manager.SchedulerManager object at 0x2b71210>, <nova.baserpc.BaseRPCAPI object at 0x4e3ee10>]
        ======================================================================================
        """
        endpoints.extend(self.manager.additional_endpoints)
        """
        ======================================================================================
        endpoints = [<nova.scheduler.manager.SchedulerManager object at 0x2e341d0>, 
                    <nova.baserpc.BaseRPCAPI object at 0x50aafd0>, 
                    <nova.scheduler.manager._SchedulerManagerV3Proxy object at 0x2e9df90>]
        ======================================================================================
        """
        """
        objects_base.XdrsObjectSerializer需要进行进一步实现,还未完成;
        """
        serializer = objects_base.XdrsObjectSerializer()
        self.rpcserver = rpc.get_server(target, endpoints, serializer)
        self.rpcserver.start()

        if self.periodic_enable:
            if self.periodic_fuzzy_delay:
                initial_delay = random.randint(0, self.periodic_fuzzy_delay)
            else:
                initial_delay = None
            """
            启动线程,周期性任务的实现;
            @@@@这里很重要;
            """
            self.tg.add_dynamic_timer(
                self.periodic_tasks,
                initial_delay=initial_delay,
                periodic_interval_max=self.periodic_interval_max)