libvirt cpu mode
libvirt中 cpu mode可以有以下3种:
custom :
该模式下cpu element用来描述guest可见的CPU,该模式也是mode的default模式,它会使得persistent guest不论host CPU是怎样,guest可见的CPU是一样的。有利于migration。
host-model
:
该模式下,domain初始化时会copy当前host cpu的capabilities到guest 的domain。match
attribute 和任何feature elements不适用该模式。
host-passthrough:
该模式下,guest可见的CPU与当前运行之上的host的CPU完全相同,model和任何feature elements不适用该模式。
https://libvirt.org/formatdomain.html#elementsCPU
libvirt cpu mode 在nova中通过一下nova.conf来配置:
# Set to "host-model" to clone the host CPU feature flags; to "host- # passthrough" to use the host CPU model exactly; to "custom" to use a named # CPU model; to "none" to not set any CPU model. If virt_type="kvm|qemu", it # will default to "host-model", otherwise it will default to "none" (string # value) # Allowed values: host-model, host-passthrough, custom, none #cpu_mode = <None>
https://wiki.openstack.org/wiki/LibvirtXMLCPUModel
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.