host capability
目前通过ComputeCapabilitiesFilter 是可以做到cpu 指令集的filter,ComputeCapabilitiesFilter 是通过flavor的extra_spe来传递的。
传递的形式为:capabilities:cpu_info:features=ssse3
实现方式:
1.compute_capabilities_filter.py中首先解析flavor-extra_spec , 得到capabilities:cpu_info:features
if scope[0] != "capabilities":
continue
2.得到host_state中的cpu_info:features
(Pdb) pp host_state.cpu_info
u'{"vendor": "Intel", "model": "SandyBridge", "arch": "x86_64", "features":
["pge", "avx", "clflush", "sep", "syscall", "vme", "dtes64", "msr", "fsgsbase", "xsave", "vmx",
"erms", "xtpr", "cmov", "smep", "ssse3", "est", "pat", "monitor", "smx", "pbe",
"lm", "tsc", "nx", "fxsr", "tm", "sse4.1", "pae", "sse4.2", "pclmuldq", "acpi",
"tsc-deadline", "mmx", "osxsave", "cx8", "mce", "de", "tm2", "ht", "pse", "lahf_lm",
"popcnt", "mca", "apic", "sse", "f16c", "ds", "pni", "rdtscp", "aes", "sse2", "ss", "ds_cpl",
"pcid", "fpu", "cx16", "pse36", "mtrr", "pdcm", "rdrand", "x2apic"],
"topology": {"cores": 2, "cells": 1, "threads": 2, "sockets": 1}}' pp instance_type
Flavor(created_at=None,deleted=False,deleted_at=None,disabled=False,ephemeral_gb=0,
extra_specs={capabilities:cpu_info:arch='x86_64',capabilities:cpu_info:features='<or> acpi,adx,avx,avx2'},
flavorid='',id=2,is_public=True,memory_mb=512,name='m1.tiny',projects=<?>,root_gb=1,rxtx_factor=1.0,swap=0,updated_at=None,vcpu_weight=0,vcpus=1) (Pdb) pp scope
[u'cpu_info', u'features'] (Pdb) pp req
u'<or> acpi,adx,avx,avx2'
3. 最后比较req中cpu的需要是否host_state中的cpu_info:features能满足。
那么,host_state中的cpu_info:features怎么获得?
1.resource_tracker.py: self.compute_node.update_from_virt_driver(resources)
def update_from_virt_driver(self, resources):
# NOTE(pmurray): the virt driver provides a dict of values that
# can be copied into the compute node. The names and representation
# do not exactly match.
# TODO(pmurray): the resources dict should be formalized.
keys = ["vcpus", "memory_mb", "local_gb", "cpu_info",
"vcpus_used", "memory_mb_used", "local_gb_used",
"numa_topology", "hypervisor_type",
"hypervisor_version", "hypervisor_hostname",
"disk_available_least", "host_ip"]
for key in keys:
if key in resources:
self[key] = resources[key]
2.compute_node 把信息report给 scheduler,filter就得到了 scheduler的host_state
Nova中还有一个object VirtCPUModel, 它是 instance object 的一部分,用来描述guest cpu模型,其详细说明在:
https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Virtualization_Administration_Guide/sect-libvirt-dom-xml-cpu-model-top.html
@base.NovaObjectRegistry.register
class VirtCPUModel(base.NovaObject):
# Version 1.0: Initial version
VERSION = '1.0' fields = {
'arch': fields.ArchitectureField(nullable=True),
'vendor': fields.StringField(nullable=True),
'topology': fields.ObjectField('VirtCPUTopology',
nullable=True),
'features': fields.ListOfObjectsField("VirtCPUFeature",
default=[]),
'mode': fields.CPUModeField(nullable=True),
'model': fields.StringField(nullable=True),
'match': fields.CPUMatchField(nullable=True),
}
object的填充方式:
guest.cpu = self._get_guest_cpu_config(
flavor, image_meta, guest_numa_config.numaconfig,
instance.numa_topology) # Notes(yjiang5): we always sync the instance's vcpu model with
# the corresponding config file.
instance.vcpu_model = self._cpu_config_to_vcpu_model(
guest.cpu, instance.vcpu_model)
mode/model通过nova.conf来配置
def _get_guest_cpu_model_config(self):
mode = CONF.libvirt.cpu_mode
model = CONF.libvirt.cpu_model
topology 通过flave-extra_spec/ image meta
virt.hardware.py
def _get_cpu_topology_constraints(flavor, image_meta):
"""Get the topology constraints declared in flavor or image :param flavor: Flavor object to read extra specs from
:param image_meta: nova.objects.ImageMeta object instance Gets the topology constraints from the configuration defined
in the flavor extra specs or the image metadata. In the flavor
this will look for hw:cpu_sockets - preferred socket count
hw:cpu_cores - preferred core count
hw:cpu_threads - preferred thread count
hw:cpu_max_sockets - maximum socket count
hw:cpu_max_cores - maximum core count
hw:cpu_max_threads - maximum thread count In the image metadata this will look at hw_cpu_sockets - preferred socket count
hw_cpu_cores - preferred core count
hw_cpu_threads - preferred thread count
hw_cpu_max_sockets - maximum socket count
hw_cpu_max_cores - maximum core count
hw_cpu_max_threads - maximum thread count
feature 也是通过flave-extra_spec/ image meta:
class VirtCPUFeature(base.NovaObject):
VERSION = '1.0' fields = {
'policy': fields.CPUFeaturePolicyField(nullable=True),
'name': fields.StringField(nullable=False),
}
features = [objects.VirtCPUFeature(
name=f.name,
policy=f.policy) for f in cpu_config.features]
vcpu_model.features = features
virt.hardware.py
def _add_cpu_pinning_constraint(flavor, image_meta, numa_topology):
flavor_pinning = flavor.get('extra_specs', {}).get("hw:cpu_policy")
image_pinning = image_meta.properties.get("hw_cpu_policy")
实现了cpu instruction 规则force/require/optional/disable/forbid。
通过image来限定有2种:
ImagePropertiesFilter
根据instance's image上定义的属性来过滤,熟悉包括
architecture, hypervisor type, hypervisor version (for Xen hypervisor type only), and virtual machine mode。
其中,他们的值可以为:
arch:
ALL = [
ALPHA,
ARMV6,
ARMV7,
ARMV7B,
AARCH64,
CRIS,
I686,
IA64,
LM32,
M68K,
MICROBLAZE,
MICROBLAZEEL,
MIPS,
MIPSEL,
MIPS64,
MIPS64EL,
OPENRISC,
PARISC,
PARISC64,
PPC,
PPCLE,
PPC64,
PPC64LE,
PPCEMB,
S390,
S390X,
SH4,
SH4EB,
SPARC,
SPARC64,
UNICORE32,
X86_64,
XTENSA,
XTENSAEB,
]
HVType:
ALL = (
BAREMETAL,
BHYVE,
DOCKER,
FAKE,
HYPERV,
IRONIC,
KQEMU,
KVM,
LXC,
LXD,
OPENVZ,
PARALLELS,
PHYP,
QEMU,
TEST,
UML,
VBOX,
VIRTUOZZO,
VMWARE,
XEN,
ZVM,
)
VMMode:
ALL = [HVM, XEN, UML, EXE]
如果image->properties中没有这些属性,则通过过滤;如果有这些属性,而host->capabilities->supportedinstances没有,返回False。
比如,
$ glance image-update img-uuid --property architecture=arm --property hypervisor_type=qemu
2 AggregateImagePropertiesIsolation:
匹配属性定义在 image的元数据中,用于对这些 aggregate 组进行匹配
比如下面这个 aggregate 分组 myWinAgg 将 windows 系统作为元数据 os=windows
$ nova aggregate-details MyWinAgg
+----+----------+-------------------+------------+---------------+
| Id | Name | Availability Zone | Hosts | Metadata |
+----+----------+-------------------+------------+---------------+
| 1 | MyWinAgg | None | 'sf-devel' | 'os=windows' |
+----+----------+-------------------+------------+---------------+
在这个理子中,因为下面 win-2012的镜像中有 windows 的属性, 通过他启动的虚拟机实例会再 sf-devel 分组上启动.
$ glance image-show Win-2012
+------------------+--------------------------------------+
| Property | Value |
+------------------+--------------------------------------+
| Property 'os' | windows |
| checksum | f8a2eeee2dc65b3d9b6e63678955bd83 |
| container_format | ami |
| created_at | 2013-11-14T13:24:25 |
目前社区关于这块的工作:
https://review.openstack.org/#/c/286520/3/specs/newton/approved/expose-host-capabilities.rst
打算扩展和统一host capability,主要在现有的host capability之上扩展以下3个方面:
- 版本capability
- 用在image filter的architecture, hypervisor type, VM mode
- 不易被发现的e.g.: SSD, SR-IOV, fibre channel, etc。
https://review.openstack.org/#/c/309762/2/specs/newton/approved/standardize-capabilities.rst
试图采用枚举的方式(nova.objects.fields.Enum-based)来同一capability的描述模型。
它首先定义了capabilities:
A capability is a *singular* piece of information describing some **functionality** or **feature** of an entity that can be provided to a custom。
比如:
* `hw:x86_cpu_instruction_set_ext:sse`
* `hw:x86_cpu_instruction_set_ext:mmx`
用来表述CPU的指令集
* `virt:libvirt:set_admin_pass`
* `virt:libvirt:huge_pages`
* `virt:libvirt:uefi_boot`
用来表述libvirt的capability.
host capability的更多相关文章
- MapReduce原理讲解
简介 本文主要介绍MapReduce V2的基本原理, 也是笔者在学习MR的学习笔记整理. 本文首先大概介绍下MRV2的客户端跟服务器交互的两个协议, 然后着重介绍MRV2的核心模块MRAppMast ...
- libvirt cpu mode
libvirt中 cpu mode可以有以下3种: custom : 该模式下cpu element用来描述guest可见的CPU,该模式也是mode的default模式,它会使得persistent ...
- (转) Linux的capability深入分析(2)
一)capability的工具介绍 在我们的试验环境是RHEL6,libcap-2.16软件包中包含了相关的capability设置及查看工作,如下: rpm -ql libcap-2.16- ...
- Selenium 、WebDriver :Capability
Selenium | WebDriver Capability 内容摘要: 1.WebDriver 通用配置 2.RemoteWebDriver特有配置 3.Grid特有配置 4.在使用特定浏览器时的 ...
- Linux的capability深入分析(2)【转】
转自:https://blog.csdn.net/wangpengqi/article/details/9821231 rpm -ql libcap-2.16-5.2.el6.i686 /lib/l ...
- iSCSI Network Designs: Part 5 – iSCSI Multipathing, Host Bus Adapters, High Availability and Redundancy
iSCSI Network Designs: Part 5 – iSCSI Multipathing, Host Bus Adapters, High Availability and Redunda ...
- centos linux系统日常管理3 服务管理ntsysv,chkconfig,系统日志rsyslog,last ,lastb ,exec,xargs,dmesg,screen,nohup,curl,ping ,telnet,traceroute ,dig ,nc,nmap,host,nethogs 第十六节课
centos linux系统日常管理3 服务管理ntsysv,chkconfig,系统日志rsyslog,last ,lastb ,exec,xargs,dmesg,screen,nohup,cur ...
- GNU Radio: Synchronization and MIMO Capability with USRP Devices
Application Note Synchronization and MIMO Capability with USRP Devices Ettus Research Introduction S ...
- PatentTips - Method for booting a host device from an MMC/SD device
FIELD OF THE INVENTION The present invention relates to a memory device and especially to the interf ...
随机推荐
- 导出网页中的table到excel
导出网页中的table到excel的两种简便方法: 1. 纯 JavaScript 方法,缺点只支持IE浏览器 var elTable = document.getElementById(" ...
- php5.4新特性实践
本机安装的是wampserver2.2e-php5.4.3-httpd2.2.22-mysql5.5.24-32b.exe集成包 自带了php5.4 1. 数组写法 定义一个数组 过去: $arr = ...
- MySQL中数据中设计中的范式与反范式
设计关系数据库时,遵从不同的规范要求,设计出合理的关系型数据库,这些不同的规范要求被称为不同的范式,各种范式呈递次规范,越高的范式数据库冗余越小.但是有些时候一昧的追求范式减少冗余,反而会降低数据读写 ...
- Android系统移植与调试之------->如何修改Android设备存储盘符名称与Android设备的型号
一.修改Android设备存储盘符名称 (注:TBDG1073为我的项目名称) 1.修改device/other/TBDG1073/system.prop 文件 2.修改ro.media.patiti ...
- Linux中权限管理之文件特殊权限
SetUID 1.只有在可执行的二进制程序上设定SUID权限才是有意义的 2.命令执行者要对该程序拥有执行权限 3.命令执行者在执行该程序时获得该程序文件属主的身份 4.SetUID权限只在该程序执行 ...
- 并发 错误 java.lang.IllegalMonitorStateException: current thread not owner 分析
public class ThreadTest implements Callable<String> { public String call() throws Exception { ...
- 1.1 使用电脑测试MC20模块的基础使用和测试
需要准备的硬件 MC20开发板 1个 https://item.taobao.com/item.htm?id=562661881042 GSM/GPRS天线 1根 https://item.taoba ...
- 剑指offer 面试49题
面试49题: 题:丑数 题目:把只包含因子2.3和5的数称作丑数(Ugly Number).例如6.8都是丑数,但14不是,因为它包含因子7. 习惯上我们把1当做是第一个丑数.求按从小到大的顺序的第N ...
- MySql安装成功后命令行进行必要的配置
1.1 首次用命令行登录 用zip方式安装成功mysql,并通过net start mysql 命令正常启动mysql服务后,打开dos命令行窗口,输入“mysql -uroot -p”或“mysql ...
- Apache NiFi 开发 安装说明
系统环境: vmware安装的centos6.7虚拟机 jdk1.8版本 maven库3.3.9版本(在使用源码编译启动的时候需要修改配置文件与当前使用的maven版本匹配,最低使用版本好像是3.1. ...