nova创建instance流程
###################################################################
具体请看官方的介绍:http://docs.openstack.org/developer/nova/conductor.html
Conductor as a place for orchestrating tasks
1. nova-conductor作用:
###################################################################
http://www.aboutyun.com/thread-17436-1-1.html
综述
- API server:处理客户端的请求,并且转发到cloud control
- Cloud control:处理compute节点,网络控制节点,API server和scheduler中间连接
- Scheduler:选择一个host去执行命令
- compute worker:启动和停止实例,附加和删除卷 等操作
- network controller:管理网络资源,分配固定IP,配置vlans
1.API server将消息发送到Cloud Controller
API
- 查看这种类型的instance是否达到最大值
- 如果不存在安全组,就创建个
- 生成MAC地址和hostnames
- 给scheduler发送一个消息去运行这个实例
CAST
- def _schedule_run_instance(self,
- ...
- return rpc_method(context,
- FLAGS.scheduler_topic,
- {"method": "run_instance",
- "args": {"topic": FLAGS.compute_topic,
- "request_spec": request_spec,
- "admin_password": admin_password,
- "injected_files": injected_files,
- "requested_networks": requested_networks,
- "is_first_time": True,
- "filter_properties": filter_properties}})
Scheduler
- def cast_to_compute_host(context, host, method, update_db=True, **kwargs):
- """Cast request to a compute host queue"""
- if update_db:
- # fall back on the id if the uuid is not present
- instance_id = kwargs.get('instance_id', None)
- instance_uuid = kwargs.get('instance_uuid', instance_id)
- if instance_uuid is not None:
- now = utils.utcnow()
- db.instance_update(context, instance_uuid,
- {'host': host, 'scheduled_at': now})
- rpc.cast(context,
- db.queue_get_for(context, 'compute', host),
- {"method": method, "args": kwargs})
- LOG.debug(_("Casted '%(method)s' to compute '%(host)s'") % locals())
Compute
- def _run_instance(self, context, instance_uuid,
- requested_networks=None,
- injected_files=[],
- admin_password=None,
- is_first_time=False,
- **kwargs):
- """Launch a new instance with specified options."""
- context = context.elevated()
- try:
- instance = self.db.instance_get_by_uuid(context, instance_uuid)
- self._check_instance_not_already_created(context, instance)
- image_meta = self._check_image_size(context, instance)
- self._start_building(context, instance)
- self._notify_about_instance_usage(instance, "create.start")
- network_info = self._allocate_network(context, instance,
- requested_networks)
- try:
- block_device_info = self._prep_block_device(context, instance)
- instance = self._spawn(context, instance, image_meta,
- network_info, block_device_info,
- injected_files, admin_password)
- ...
- 检查instance是否已经在运行
- 分配一个固定的ip地址
- 如果没有设置vlan和网桥,设置一下
- 最后通过虚拟化的driver spawn一个instance
network controller
- def allocate_for_instance(self, context, instance, **kwargs):
- """Allocates all network structures for an instance.
- :returns: network info as from get_instance_nw_info() below
- """
- args = kwargs
- args['instance_id'] = instance['id']
- args['instance_uuid'] = instance['uuid']
- args['project_id'] = instance['project_id']
- args['host'] = instance['host']
- args['rxtx_factor'] = instance['instance_type']['rxtx_factor']
- nw_info = rpc.call(context, FLAGS.network_topic,
- {'method': 'allocate_for_instance',
- 'args': args})
RPC.call 与RPC.cast最大的不同 就是call方法需要一个response
Spawn instance
- def spawn(self, context, instance, image_meta, network_info,
- block_device_info=None):
- xml = self.to_xml(instance, network_info, image_meta, False,
- block_device_info=block_device_info)
- self.firewall_driver.setup_basic_filtering(instance, network_info)
- self.firewall_driver.prepare_instance_filter(instance, network_info)
- self._create_image(context, instance, xml, network_info=network_info,
- block_device_info=block_device_info)
- self._create_new_domain(xml)
- LOG.debug(_("Instance is running"), instance=instance)
- self._enable_hairpin(instance)
- self.firewall_driver.apply_instance_filter(instance, network_info)
- def _wait_for_boot():
- """Called at an interval until the VM is running."""
- try:
- state = self.get_info(instance)['state']
- except exception.NotFound:
- LOG.error(_("During reboot, instance disappeared."),
- instance=instance)
- raise utils.LoopingCallDone
- if state == power_state.RUNNING:
- LOG.info(_("Instance spawned successfully."),
- instance=instance)
- raise utils.LoopingCallDone
- timer = utils.LoopingCall(_wait_for_boot)
- return timer.start(interval=0.5, now=True)
- 通过libvirt xml文件,然后根据xml文件生成instance
- 准备network filter,默认的fierwall driver是iptables
- image的创建(详细情况以后再介绍)
def _create_image(self, context, instance, libvirt_xml, suffix='',
- 最后虚拟化driver的spawn()方法中调用driver 的creatXML()
转载于:https://www.cnblogs.com/double12gzh/p/10166182.html
nova创建instance流程相关推荐
- nova 创建虚拟机流程
1 Nova创建虚机流程 Openstack创建虚拟机的整个流程如图1所示.前端horizon发送创建虚机的请求之后,novaapi接收请求,并作处理,详见1.1节.注:Nova schedule ...
- Nova创建虚拟机流程解读
一 介绍 创建一个虚拟机至少需要指定的参数有3个:虚拟机名字,镜像,Flavor.执行"nova image-list"命令可以看到目前可用的虚拟机镜像. 命令执行结果如下: [r ...
- openstack e版创建instance整个流程
2019独角兽企业重金招聘Python工程师标准>>> 感谢朋友支持本博客,欢迎共同探讨交流,由于能力和时间有限,错误之处在所难免,欢迎指正! 如有转载,请保留源作者博客信息. Be ...
- Nova 启动虚拟机流程解析
目录 文章目录 目录 前言 从请求说起 nova-api service 阶段 前言 Nova 启动虚拟机的东西太多,持续更新- 从请求说起 无论是通过 Dashboard 还是 CLI 启动一个虚拟 ...
- 【JVM】Java对象创建的流程步骤
· 本文摘要 · 罗列Java创建对象的各种方式: · 讲解Java对象创建的流程步骤: 一.Java创建对象的各种方式 · 1. 用关键字new,老少皆知的方法:StringBuffer sb = ...
- nova创建虚拟机源码分析系列之六 api入口create方法
openstack 版本:Newton 注:博文图片采用了很多大牛博客图片,仅作为总结学习,非商用. 该图全面的说明了nova创建虚机的过程,从逻辑的角度清晰的描述了前端请求创建虚拟机之后发生的一系列 ...
- OpenStack---T版-nova组件部署流程
OpenStack---T版-nova组件部署流程 nova组件部署位置 计算节点Nova服务配置 nova组件部署位置 [控制节点ct] nova-api(nova主服务) nova-schedul ...
- Perforce使用之创建DEPOT流程
Perforce 创建Depot流程 1. 创建Depot存储目录 #mkdir newdepot <?xml:namespace prefix = v ns = "urn:sche ...
- 2018-04-07进程创建学习流程
进程创建的流程学习博客 http://gityuan.com/2016/03/26/app-process-create/ 转载于:https://www.cnblogs.com/buder-cp/p ...
最新文章
- 5、Linux系统的目录结构
- ImportError: Could not find ‘cudart64_100.dll报错
- 欢迎来到“现实”世界,bilibili!
- A. And Then There Were K
- 冷热rx-java可观察
- WINCE 下配置 QT 的方法
- I/O Permission Bit Map in Task State Segment(TSS)
- python dataframe排序_python – Pandas DataFrame排序忽略了这种情况
- excel怎么批量插行_批量制作anki卡片最易上手方法
- mac新手入门:在Mac上怎么使用夜览
- c语言设计函数型号发生器,基于51单片机函数信号发生器
- OTO电子商务商业模式探析
- 大华监控相机RTSP视频流
- excel如何去重统计户数_如何用好excel统计函数
- 信息安全实验:实现一个fake-wifi
- 初识 PS CS6(十三)___用快速选择工具择图
- 微信小程序制作全流程(1)
- 程序的优化 文字的减法
- TIOBE 8 月编程语言排行榜:数据挖掘和人工智能语言强势崛起!
- [ZCMU OJ]1633: 酷酷的单词(遍历)
热门文章
- mybatis 遍历数组_Mybatis中别名、插件与数据源配置
- 最简单快捷搭建私链步骤笔记
- 学习Java必须避开的十大致命雷区,新手入门千万不要踩!
- Ghost 2.18.3 发布,基于 Markdown 的在线写作平台
- mysql Table 'performance_schema.session_variables' doesn't exist
- 你的袜子还是干的吗?
- 移动端的推拉效果导航菜单-支持响应式及其多层菜单
- PAT1057. 数零壹
- C++学习笔记(10)运算符重载,友元函数,友元类
- 工作之后如何高效的学习?