Commit 7cb42171 authored by Nikita Staroverov's avatar Nikita Staroverov Committed by Iustin Pop
Browse files

Add support for -cpu option in KVM



This adds supports for the (non-validated) cpu parameter to KVM.
Signed-off-by: default avatarIustin Pop <iustin@google.com>
Reviewed-by: default avatarIustin Pop <iustin@google.com>
parent 24ccfd74
......@@ -773,6 +773,7 @@ HV_MEM_PATH = "mem_path"
HV_PASSTHROUGH = "pci_pass"
HV_BLOCKDEV_PREFIX = "blockdev_prefix"
HV_REBOOT_BEHAVIOR = "reboot_behavior"
HV_CPU_TYPE = "cpu_type"
HVS_PARAMETER_TYPES = {
HV_BOOT_ORDER: VTYPE_STRING,
......@@ -828,6 +829,7 @@ HVS_PARAMETER_TYPES = {
HV_PASSTHROUGH: VTYPE_STRING,
HV_BLOCKDEV_PREFIX: VTYPE_STRING,
HV_REBOOT_BEHAVIOR: VTYPE_STRING,
HV_CPU_TYPE: VTYPE_STRING,
}
HVS_PARAMETERS = frozenset(HVS_PARAMETER_TYPES.keys())
......@@ -1812,6 +1814,7 @@ HVC_DEFAULTS = {
HV_MEM_PATH: "",
HV_REBOOT_BEHAVIOR: INSTANCE_REBOOT_ALLOWED,
HV_CPU_MASK: CPU_PINNING_ALL,
HV_CPU_TYPE: "",
},
HT_FAKE: {
},
......
......@@ -493,6 +493,7 @@ class KVMHypervisor(hv_base.BaseHypervisor):
constants.HV_REBOOT_BEHAVIOR:
hv_base.ParamInSet(True, constants.REBOOT_BEHAVIORS),
constants.HV_CPU_MASK: hv_base.OPT_MULTI_CPU_MASK_CHECK,
constants.HV_CPU_TYPE: hv_base.NO_CHECK
}
_MIGRATION_STATUS_RE = re.compile("Migration\s+status:\s+(\w+)",
......@@ -1243,6 +1244,10 @@ class KVMHypervisor(hv_base.BaseHypervisor):
if hvp[constants.HV_KVM_USE_CHROOT]:
kvm_cmd.extend(["-chroot", self._InstanceChrootDir(instance.name)])
# Add qemu-KVM -cpu param
if hvp[constants.HV_CPU_TYPE]:
kvm_cmd.extend(["-cpu", hvp[constants.HV_CPU_TYPE]])
# Save the current instance nics, but defer their expansion as parameters,
# as we'll need to generate executable temp files for them.
kvm_nics = instance.nics
......
......@@ -1773,6 +1773,7 @@ def _GetInstanceParameterFields():
constants.HV_PAE: "PAE",
constants.HV_VNC_BIND_ADDRESS: "VNC_bind_address",
constants.HV_PASSTHROUGH: "pci_pass",
constants.HV_CPU_TYPE: "cpu_type",
}
fields = [
......
......@@ -385,6 +385,19 @@ spice\_use\_vdagent
Enables or disables passing mouse events via SPICE vdagent.
cpu\_type
Valid for the KVM hypervisor.
This parameter determines the emulated cpu for the instance. If this
parameter is empty (which is the default configuration), it will not
be passed to KVM.
Be aware of setting this parameter to ``"host"`` if you have nodes
with different CPUs from each other. Live migration may stop working
in this situation.
For more information please refer to the KVM manual.
acpi
Valid for the Xen HVM and KVM hypervisors.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment