2019独角兽企业重金招聘Python工程师标准>>>

感谢朋友支持本博客,欢迎共同探讨交流,由于能力和时间有限,错误之处在所难免,欢迎指正!

如有转载,请保留源作者博客信息。

Better Me的博客:blog.csdn.net/tantexian

如需交流,欢迎大家博客留言。

1、horizon模块:

里面的tables.py的lanch通过url映射到forms.py里面LaunchForm、然后页面传参数进去。然后调用api模块里面nova.py的server_create、
2、python-novaclient
再调用python-novaclient模块V1.1/servers.py的ServerManager类里面的create()、在调用base.py里面的_boot()封装url请求。
3、nova模块:
wsgi对于的发布模块在nova/api/openstack/compute/__init__.py文件里面。发布之后就url地址对应应关系如下:
self._list()对应底层的index()函数     
self._create()对应底层的create()函数
self._delete()对应底层的delete()函数
self._get()对应底层的show()函数

create的url对应nova/api/openstack/compute/servers.py里面的create()
在此函数里面获取image、network、flavor等参数、然后调用self.compute_api.create然后调用self._schedule_run_instance、消息队列发送rpc_method的run_instance方法、根据FLAGS.scheduler_topic配置调用scheduler模块中manager.py的run_instance。配置文件scheduler_driver = FLAGS.scheduler_driver,此处生产环境中用的是--scheduler_driver=nova.scheduler.simple.SimpleScheduler,所以:simple.py里面的schedule_run_instance方法。
driver.cast_to_compute_host将消息发到消息队列中。
compute/manage.py的run_instance方法、_run_instance、_spawn然后配置文件compute_driver = FLAGS.compute_driver的default='nova.virt.connection.get_connection',
get_connection里面 t == 'libvirt':  conn = libvirt_conn.get_connection(read_only) 接着from nova.virt.libvirt import connection as libvirt_conn
因此调用libvirt里面的spawn函数、然后生成xml文件。

1、horizon模块调用流程

2、novaclient模块调用流程
注:        resp, body = self.api.client.post(url, body=body)这句话就是发送post请求,到nova,nova里面的wsgi能够根据这个url自动匹配执行相应函数
3、nova模块调用流程
注:nova的wsgi的发布都在/nova/api/openstack/compute文件夹下面。
上面没有传递available_zone参数????
下面语句则表示调用scheduler
此处生产环境中用的是--scheduler_driver=nova.scheduler.simple.SimpleScheduler,所以:
一下为simple调度算法:
def _schedule_instance(self, context, instance_opts, *_args, **_kwargs):
"""Picks a host that is up and has the fewest running instances."""
elevated = context.elevated()
availability_zone = instance_opts.get('availability_zone')
zone, host = FLAGS.default_schedule_zone, None
if availability_zone:
zone, _x, host = availability_zone.partition(':')
if host and context.is_admin:
service = db.service_get_by_args(elevated, host, 'nova-compute')
if not utils.service_is_up(service):
raise exception.WillNotSchedule(host=host)
return host
results = db.service_get_all_compute_sorted(elevated)//获取最少的资源利用率的host
in_isolation = instance_opts['image_ref'] in FLAGS.isolated_images
check_cores = not in_isolation or not FLAGS.skip_isolated_core_check
if zone:
results = [(service, cores) for (service, cores) in results
if service['availability_zone'] == zone] //此处的availability_zone为页面传递过来
requested_networks =  _kwargs['requested_networks']
if requested_networks:
results = [(service, cores) for (service, cores) in results
if service['network_ref'] in [network_uuid for (network_uuid, fixed_ip) in requested_networks]] //此处的 requested_networks 为页面传递过来
for result in results:
(service, instance_cores) = result
if in_isolation and service['host'] not in FLAGS.isolated_hosts:
# isloated images run on isolated hosts
continue
if service['host'] in FLAGS.isolated_hosts and not in_isolation:
# images that aren't isolated only run on general hosts
continue
if (check_cores and
instance_cores + instance_opts['vcpus'] > FLAGS.max_cores):
msg = _("Not enough allocatable CPU cores remaining")
raise exception.NoValidHost(reason=msg)
if not self._isenough_subnet(elevated, service):
continue            
if utils.service_is_up(service) and not service['disabled']:
return service['host']
msg = _("Is the appropriate service running?")
raise exception.NoValidHost(reason=msg)

转载于:https://my.oschina.net/tantexian/blog/626575

openstack e版创建instance整个流程相关推荐

  1. openstack创建云主机流程

    创建云主机流程 当访问Dashboard的时候,会显示一个登录页面,Dashboard会告诉你,想使用Openstack创建云主机?那你得先把你的账号密码交给我,我去Keystone上验证你的身份之后 ...

  2. OpenStack---T版-nova组件部署流程

    OpenStack---T版-nova组件部署流程 nova组件部署位置 计算节点Nova服务配置 nova组件部署位置 [控制节点ct] nova-api(nova主服务) nova-schedul ...

  3. OpenStack T版—Neutron组件部署详解

    目录 一.OpenStack网络 1.1.OpenStack网络概述 1.2.Linux虚拟网络 1.3.OpenStack网络基础服务 1.4.Neutron主要插件.代理与服务 1.5.小结 二. ...

  4. OpenStack Queens版搭建详解

    目录 OpenStack Queens版搭建详解 1.基础环境配置 1.2 节点网络规划 1.3 关闭防火墙 1.4 配置yum源 1.5 配置节点IP 1.6 配置主机名 1.7 配置主机名解析(h ...

  5. OpenStack Stein版搭建详解

    目录 .基础环境配置 1.1 节点硬件规划 1.2 节点网络规划 1.3 关闭防火墙 1.4 配置yum源 1.5 配置节点IP 1.6 配置主机名 1.7 配置主机名解析 1.8 配置NTP服务 2 ...

  6. openstack“T版“Glance组件部署

    文章目录 Glance镜像服务 Glance镜像服务 Glance架构详解 Glance工作流程 OpenStack-Glance组件部署 Glance镜像服务 概述 它在OpenStack中的项目名 ...

  7. OpenStack Nova核心组件和RabbitMQ通信流程分析

    前言 云计算从资源提供类型可以分为 IaaS(基础设施即服务) PaaS(平台即服务)和 SaaS(软件即服务)三层. IaaS和PaaS相辅相成,目前云计算商业领域的各大公有云厂商一般都会提供Iaa ...

  8. Visual Paradigm创建UML的流程和一点实用技巧

    常用工具系列 相关文章: Windows平台 常用开发工具下载 putty,Android Studio,Visual Studio Code,git,Visual Paradigm社区版 Ubunt ...

  9. Openstack Train版搭建

    一.环境准备 1.1.服务器准备 主机名 系统 网卡 ct(控制节点) centos7 虚拟:172.16.100.254 nat:192.168.100.254 c2 (计算节点1) centos7 ...

最新文章

  1. django之BBS需求分析和orm设计-71
  2. 怎么设置java的精度值_Java:如何为double值设置Precision?
  3. 问题 F: 序列操作Ⅱ(前缀最大公约数,后缀最大公约数)
  4. postconstruct_@PostConstruct注解,你该好好看看
  5. HDU5248:序列变换(二分)
  6. Docker CEO Ben Golub:Docker借助开源、天时走向成功
  7. 作者:​郑树泉(1965-),男,上海计算机软件技术开发中心高级工程师,上海产业技术研究院工程大数据服务创新中心主任。...
  8. 《高性能MySQL》第2章~第4章
  9. 6大维度重磅升级,容器云平台BeyondContainer发布1.8版本
  10. 【数据结构】KMP算法分析与理解(图文分析)
  11. OpenCV学习笔记——图像平滑处理
  12. 性能(八)Postman汉化踩坑
  13. 你想在网易云音乐中播放 QQ 音乐中下载的歌曲吗?用上它后助你秒实现!
  14. hustoj 忘记admin密码的解决方案
  15. VT100 终端控制码
  16. 三星三防s8计算机功能在哪里,三星s8三防版怎么样 三防版三星s8配置参数介绍...
  17. github官网连接超时解决方案(图解版,亲测成功)
  18. php计算两个坐标(经度,纬度)之间的方位角
  19. python爬虫工资高吗_月薪2万的爬虫工程师,Python需要学到什么程度?
  20. 异常-----JAVASE

热门文章

  1. LeetCode 1 两数之和
  2. (0049)iOS开发之数据精度处理四舍五入问题
  3. uniapp中vuex状态管理
  4. HTML5元素周期表
  5. 前端代码规范-CSS
  6. 流式套接字:基于TCP协议的Socket网络编程(案例2)
  7. OFDM同步算法之Minn算法
  8. 20165235实验四 Android程序设计
  9. React Native知识2-Text组件
  10. phpcmsv9多表联合查询分页功能实现