Openstack Core Service -- Nova

目录:

 

Nova 架构

 

Compute service overview

  nova-api service

    Accepts and responds to end user compute API calls.

  nova-compute service

    A worker daemon that creates and terminates virtual machine instances through hypervisor APIs. For example:

    •   XenAPI for XenServer/XCP
    •   libvirt for KVM or QEMU
    •   VMwareAPI for VMware

  nova-scheduler service

    Takes a virtual machine instance request from the queue and determines on which compute server host it runs.

  nova-conductor module

    Mediates interactions between the nova-compute service and the database.

  nova-api-metadata service: Accepts metadata requests from instances. 

  nova-cert module:A server daemon that serves the Nova Cert service for X509 certificates. 

  nova-consoleauth daemon:Authorizes tokens for users that console proxies provide. 

  nova-network worker daemon: Similar to the nova-compute service, accepts networking tasks from the queue and manipulates the network.

  nova-novncproxy daemon:Provides a proxy for accessing running instances through a VNC connection. 

 

查看nova进程与服务

 

 

从虚机创建流程看 nova-* 子服务如何协同工作

  1. 客户(可以是 OpenStack 最终用户,也可以是其他程序)向 API(nova-api)发送请求:“帮我创建一个虚机”

  2. API 对请求做一些必要处理后,向 Messaging(RabbitMQ)发送了一条消息:“让 Scheduler 创建一个虚机”

  3. Scheduler(nova-scheduler)从 Messaging 获取到 API 发给它的消息,然后执行调度算法,从若干计算节点中选出节点 A

  4. Scheduler 向 Messaging 发送了一条消息:“在计算节点 A 上创建这个虚机”

  5. 计算节点 A 的 Compute(nova-compute)从 Messaging 中获取到 Scheduler 发给它的消息,然后在本节点的 Hypervisor 上启动虚机。

  6. 在虚机创建的过程中,Compute 如果需要查询或更新数据库信息,会通过 Messaging 向 Conductor(nova-conductor)发送消息,Conductor 负责数据库访问。

 

nova-scheduler 的调度机制和实现方法

  在 /etc/nova/nova.conf 中,nova 通过以下三个参数来配置 nova-scheduler。

  scheduler_driver
  scheduler_available_filters
  scheduler_default_filters

Filter scheduler

  Filter scheduler 是 nova-scheduler 默认的调度器,调度过程分为两步:

  1. 通过过滤器(filter)选择满足条件的计算节点(运行 nova-compute)

  2. 通过权重计算(weighting)选择在最优(权重值最大)的计算节点上创建 Instance。

scheduler_driver=nova.scheduler.filter_scheduler.FilterScheduler

  Nova 允许使用第三方 scheduler,配置 scheduler_driver 即可。 这又一次体现了OpenStack的开放性。

  Scheduler 可以使用多个 filter 依次进行过滤,过滤之后的节点再通过计算权重选出最适合的节点。

  下图是调度过程的一个示例

Filter

  当 Filter scheduler 需要执行调度操作时,会让 filter 对计算节点进行判断,filter 返回 True 或 False。

  Nova.conf 中的 scheduler_available_filters 选项用于配置 scheduler 可用的 filter,默认是所有 nova 自带的 filter 都可以用于滤操作。

scheduler_available_filters = nova.scheduler.filters.all_filters

  另外还有一个选项 scheduler_default_filters,用于指定 scheduler 真正使用的 filter,默认值如下

scheduler_default_filters = RetryFilter, AvailabilityZoneFilter, RamFilter, DiskFilter, ComputeFilter, ComputeCapabilitiesFilter, ImagePropertiesFilter, ServerGroupAntiAffinityFilter, ServerGroupAffinityFilter

  Filter scheduler 将按照列表中的顺序依次过滤。

Weight

  经过前面一堆 filter 的过滤,nova-scheduler 选出了能够部署 instance 的计算节点。 如果有多个计算节点通过了过滤,那么最终选择哪个节点呢?

  Scheduler 会对每个计算节点打分,得分最高的获胜。 打分的过程就是 weight,翻译过来就是计算权重值,那么 scheduler 是根据什么来计算权重值呢?

  目前 nova-scheduler 的默认实现是根据计算节点空闲的内存量计算权重值: 空闲内存越多,权重越大,instance 将被部署到当前空闲内存最多的计算节点上。

 

Instance 生命周期的管理

OpenStack 对 instance 最主要的操作都是通过 nova-compute 实现的,包括 instance 的 launch、shutdown、reboot、suspend、resume、terminate、resize、migration、snapshot 等。

 

 

Instance故障处理

Instance Migrate失败

  导致虚拟机不能正常工作,图形化界面无法做任何恢复操作,在此情况下可以通过命令行使用以下方式进行恢复:

  1、rebuild:  nova rebuild <instance-name or id> <image-name>

  2、rescue:  nova rescue [--image <image-name>] <instance-name or id>

 

Nova Compute故障

  nova compute故障导致其虚拟机无法正常工作,图形化界面无法做任何恢复操作,在此情况下可以通过命令行使用以下方式进行恢复:

  1、evacuate: nova evacuate [--force] <instance-name or id> [<host>]

  

本文部分内容转载自:http://www.cnblogs.com/CloudMan6/

posted @ 2017-02-09 21:46  Vincen_shen  阅读(268)  评论(0)    收藏  举报