compute和schedule通过scheduler_client进行rpc通讯
来源:互联网 发布:金相自动分析软件 编辑:程序博客网 时间:2024/06/05 08:31
compute和schedule 节点之前都是通过rpc来通讯的,例如在E:\nova\nova\compute\manager.py 中一般通过self.scheduler_client来和schedule 通讯,例如下面的例子 def _update_scheduler_instance_info(self, context, instance): """Sends an InstanceList with created or updated Instance objects to the Scheduler client. In the case of init_host, the value passed will already be an InstanceList. Other calls will send individual Instance objects that have been created or resized. In this case, we create an InstanceList object containing that Instance. """ if not self.send_instance_updates: return if isinstance(instance, obj_instance.Instance): instance = objects.InstanceList(objects=[instance]) context = context.elevated() self.scheduler_client.update_instance_info(context, self.host, instance)这里的scheduler_client在ComputeManager的__init__ 中赋值class ComputeManager(manager.Manager): """Manages the running instances from creation to destruction.""" target = messaging.Target(version='4.18') # How long to wait in seconds before re-issuing a shutdown # signal to an instance during power off. The overall # time to wait is set by CONF.shutdown_timeout. SHUTDOWN_RETRY_INTERVAL = 10 def __init__(self, compute_driver=None, *args, **kwargs): """Load configuration options and connect to the hypervisor.""" self.scheduler_client = scheduler_client.SchedulerClient()而这里的scheduler_client原来是从nova.scheduler.clientfrom nova.scheduler import client as scheduler_client到nova.scheduler.client 这个路径下看看E:\nova\nova\scheduler\client\__init__.pyclass SchedulerClient(object): """Client library for placing calls to the scheduler.""" def __init__(self): self.queryclient = LazyLoader(importutils.import_class( 'nova.scheduler.client.query.SchedulerQueryClient')) self.reportclient = LazyLoader(importutils.import_class( 'nova.scheduler.client.report.SchedulerReportClient')) @utils.retry_select_destinations def select_destinations(self, context, spec_obj, instance_uuids): return self.queryclient.select_destinations(context, spec_obj, instance_uuids)原来schedule 就提供了queryclient和reportclient 两个对外的rpc接口,这里的LazyLoader 并没有在SchedulerClient的_init__函数中加载nova.scheduler.client.query.SchedulerQueryClient和nova.scheduler.client.report.SchedulerReportClient。而是在实际使用的时候才需要,因此才叫LazyLoader这里以nova.scheduler.client.query.SchedulerQueryClient为例路径为:E:\nova\nova\scheduler\client\query.pyclass SchedulerQueryClient(object): """Client class for querying to the scheduler.""" def __init__(self): self.scheduler_rpcapi = scheduler_rpcapi.SchedulerAPI() def select_destinations(self, context, spec_obj, instance_uuids): """Returns destinations(s) best suited for this request_spec and filter_properties. The result should be a list of dicts with 'host', 'nodename' and 'limits' as keys. """ return self.scheduler_rpcapi.select_destinations(context, spec_obj, instance_uuids)原来最终还是通过scheduler_rpcapi来访问schedule的接口.可见这里的SchedulerClient真的是一个client
阅读全文
0 0
- compute和schedule通过scheduler_client进行rpc通讯
- 使用COMPUTE和COMPUTE BY对数据进行汇总
- p2p通过middlebox进行通讯
- COMPUTE 和 COMPUTE BY
- Compute 和Compute By
- compute和compute by
- nodemcu通过MQTT协议进行通讯
- 如何通过xcode编程使MAC机器和HID的USB单片机设备进行通讯
- 滴滴打车 司机端和客户端接收订单是通过什么机制进行及时通讯的
- SYD8801从机和TIcc2540主机进行通讯(通过修改主机端代码实现)
- SYD8801从机和TIcc2540主机进行通讯(通过修改从机端代码实现)
- IOS和配件进行通讯
- ios和配件进行通讯
- wamp安装——RPC & pub/sub (c++/java/python 跨语言RPC和通讯)
- Python、PHP通过xml-rpc进行通信,xml-rpc中文的解决
- Python、PHP通过xml-rpc进行通信,xml-rpc中文的解决
- Python、PHP通过xml-rpc进行通信,xml-rpc中文的解决
- compute和compute by的用法
- 输入不同对象的姓名、性别、年龄、体重和住址等信息,并输出显示
- Log4net日志记录示例
- Ext 自定义排序
- 爬取百度贴吧某帖子的所有照片
- IEEE754 转换
- compute和schedule通过scheduler_client进行rpc通讯
- springMVC入门--5.文件上传下载
- VMware CentOS7联网
- 使用freemarker导出EXCEL WPS可以打开EXCEL2016打不开问题解决
- vue-cli,vue-axios登录注册实例 (后台flask实现,数据库sqlite3)并在iphone模拟器中运行
- iOS混合开发之一
- 编写一个学生类Students,该类成员变量包括学号no、姓名name、性别sex和年龄age,该类的成员方法有genNo()getName ). * getSex().getAge().和setA
- Flex 布局教程:实例篇
- Android最简单实现日夜间模式切换