[libvirt] [PATCH v4 08/11] CPU selection infrastructure
Daniel Veillard
veillard at redhat.com
Fri Dec 18 15:15:39 UTC 2009
On Thu, Dec 17, 2009 at 09:21:42PM +0100, Jiri Denemark wrote:
> Each driver supporting CPU selection must fill in host CPU capabilities.
> When filling them, drivers for hypervisors running on the same node as
> libvirtd can use cpuNodeData() to obtain raw CPU data. Other drivers,
> such as VMware, need to implement their own way of getting such data.
> Raw data can be decoded into virCPUDefPtr using cpuDecode() function.
>
> When implementing virConnectCompareCPU(), a hypervisor driver can just
> call cpuCompareXML() function with host CPU capabilities.
>
> For each guest for which a driver supports selecting CPU models, it must
> set the appropriate feature in guest's capabilities:
>
> virCapabilitiesAddGuestFeature(guest, "cpuselection", 1, 0)
>
> Actions needed when a domain is being created depend on whether the
> hypervisor understands raw CPU data (currently CPUID for i686, x86_64
> architectures) or symbolic names has to be used.
>
> Typical use by hypervisors which prefer CPUID (such as VMware and Xen):
>
> - convert guest CPU configuration from domain's XML into a set of raw
> data structures each representing one of the feature policies:
>
> cpuEncode(conn, architecture, guest_cpu_config,
> &forced_data, &required_data, &optional_data,
> &disabled_data, &forbidden_data)
>
> - create a mask or whatever the hypervisor expects to see and pass it
> to the hypervisor
>
> Typical use by hypervisors with symbolic model names (such as QEMU):
>
> - get raw CPU data for a computed guest CPU:
>
> cpuGuestData(conn, host_cpu, guest_cpu_config, &data)
>
> - decode raw data into virCPUDefPtr with a possible restriction on
> allowed model names:
>
> cpuDecode(conn, guest, data, n_allowed_models, allowed_models)
>
> - pass guest->model and guest->features to the hypervisor
>
> Signed-off-by: Jiri Denemark <jdenemar at redhat.com>
> ---
> configure.in | 20 +
> src/Makefile.am | 12 +
> src/cpu/cpu.c | 242 ++++++++++
> src/cpu/cpu.h | 129 +++++
> src/cpu/cpu_generic.c | 123 +++++
> src/cpu/cpu_generic.h | 32 ++
> src/cpu/cpu_map.c | 130 ++++++
> src/cpu/cpu_map.h | 41 ++
> src/cpu/cpu_x86.c | 1162 ++++++++++++++++++++++++++++++++++++++++++++++
> src/cpu/cpu_x86.h | 31 ++
> src/cpu/cpu_x86_data.h | 45 ++
> src/libvirt_private.syms | 10 +
> 12 files changed, 1977 insertions(+), 0 deletions(-)
> create mode 100644 src/cpu/cpu.c
> create mode 100644 src/cpu/cpu.h
> create mode 100644 src/cpu/cpu_generic.c
> create mode 100644 src/cpu/cpu_generic.h
> create mode 100644 src/cpu/cpu_map.c
> create mode 100644 src/cpu/cpu_map.h
> create mode 100644 src/cpu/cpu_x86.c
> create mode 100644 src/cpu/cpu_x86.h
> create mode 100644 src/cpu/cpu_x86_data.h
Okay, I just add to remove empty lines at end of C files and extend
po/POTFILES.in with the new files with translatable comments,
Daniel
--
Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/
daniel at veillard.com | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library http://libvirt.org/
More information about the libvir-list
mailing list