From 62bfcb09a88e4e0ad9f11d55d5f39fe4d6a9898b Mon Sep 17 00:00:00 2001 From: Peng Liang Date: Sat, 29 Aug 2020 17:23:12 +0800 Subject: [PATCH] add documents about custom CPU mode Signed-off-by: Peng Liang --- .../docs/Virtualization/vm-configuration.md | 35 ++++++++++++++++++- .../zh/docs/Virtualization/虚拟机配置.md | 35 ++++++++++++++++++- 2 files changed, 68 insertions(+), 2 deletions(-) diff --git a/content/en/docs/Virtualization/vm-configuration.md b/content/en/docs/Virtualization/vm-configuration.md index a290a4a05d92..a93c44f1b33f 100644 --- a/content/en/docs/Virtualization/vm-configuration.md +++ b/content/en/docs/Virtualization/vm-configuration.md @@ -97,12 +97,30 @@ This section describes how to configure the vCPU and virtual memory. - **cpu**: The mode of the virtual processor. - **mode**: The mode of the vCPU. The **host-passthrough** indicates that the architecture and features of the virtual CPU are the same as those of the host. + **mode**: The mode of the vCPU. + + - **host-passthrough**: indicates that the architecture and features of the virtual CPU are the same as those of the host. + + - **custom**: indicates that the architecture and features of the virtual CPU are configured by the **cpu** element. Sub-element **topology**: A sub-element of the element cpu, used to describe the topology structure of a vCPU mode. - The attributes **socket**, **cores**, and **threads** of the sub-element topology describe the number of CPU sockets of a VM, the number of processor cores included in each CPU socket, and the number of hyperthreads included in each processor core, respectively. The attribute value is a positive integer, and a product of the three values is equal to the number of of vCPUs. + Sub-element **model**: A sub-element of the element cpu, used to describe the CPU model when **mode** is custom. + + Sub-element **feature**: A sub-element of the element cpu, used to enable/disable a CPU feature when **mode** is custom. The attribute **name** describes the name of the CPU feature. And whether enable the CPU feature is controlled by the attribute **policy**: + + - **force**: force enable the CPU feature regardless of it being supported by host CPU. + + - **require**: enable the CPU feature. + + - **optional**: the CPU feature will be enabled if and only if it is supported by host CPU. + + - **disable**: disable the CPU feature. + + - **forbid**: disable the CPU feature and guest creation will fail if the feature is supported by host CPU. + ### Configuration Example @@ -120,6 +138,21 @@ For example, if the number of vCPUs is 4, the processing mode is host-passthroug ``` +If the virtual memory is 8 GiB, the number of vCPUs is 4, the processing mode is custom, the CPU model is Kunpeng-920, and pmull is disabled, the configuration is as follows: + +``` + + ... + 4 + 8 + + Kunpeng-920 + + + ... + +``` + ## Virtual Device Configuration The VM XML configuration file uses the **devices** elements to configure virtual devices, including storage devices, network devices, buses, and mouse devices. This section describes how to configure common virtual devices. diff --git a/content/zh/docs/Virtualization/虚拟机配置.md b/content/zh/docs/Virtualization/虚拟机配置.md index 9988f532a1c9..799ab9c3cea2 100644 --- a/content/zh/docs/Virtualization/虚拟机配置.md +++ b/content/zh/docs/Virtualization/虚拟机配置.md @@ -102,12 +102,30 @@ XML配置文件的基本格式如下,其中label代表具体标签名,attrib - cpu:虚拟处理器模式。 - 属性mode:表示虚拟CPU的模式,属性值host-passthrough表示虚拟CPU的架构和特性与主机保持一致。 + 属性mode:表示虚拟CPU的模式。 + + - host-passthrough:表示虚拟CPU的架构和特性与主机保持一致。 + + - custom:表示虚拟CPU的架构和特性由此cpu元素控制。 子元素topology:元素cpu的子元素,用于描述虚拟CPU模式的拓扑结构。 - 子元素topology的属性socket、cores、threads分别描述了虚拟机具有多少个cpu socket,每个cpu socket中包含多少个处理核心(core),每个处理器核心具有多少个超线程(thread),属性值为正整数且三者的乘积等于虚拟CPU的个数。 + 子元素model:元素cpu的子元素,当mode为custom时用于描述CPU的模型。 + + 子元素feature:元素cpu的子元素,当mode为custom时用于描述某一特性的使能情况。其中,属性name表示特性的名称,属性policy表示这一特性的使能控制策略: + + - force:表示强制使能该特性,无论主机CPU是否支持该特性。 + + - require:表示使能该特性,并且当主机CPU不支持该特性并且hypervisor不支持模拟该特性时,创建虚拟机失败。 + + - optional:表示该特性的使能情况与主机上该特性的使能情况保持一致。 + + - disable:禁用该特性。 + + - forbid:禁用该特性,并且当主机支持该特性时创建虚拟机失败。 + #### 配置示例 @@ -125,6 +143,21 @@ XML配置文件的基本格式如下,其中label代表具体标签名,attrib ``` +虚拟内存为8GiB,虚拟CPU个数为4,处理模式为custom,model为Kunpeng-920,且禁用pmull特性的配置如下: + +``` + + ... + 4 + 8 + + Kunpeng-920 + + + ... + +``` + ## 配置虚拟设备 虚拟机XML配置文件使用devices元素配置虚拟设备,包括存储设备、网络设备、总线、鼠标等,本节介绍常用的虚拟设备如何配置。 -- 2.18.4