Commit 4ab75599 authored by Dimitris Aragiorgis's avatar Dimitris Aragiorgis Committed by Guido Trotter
Browse files

Add KVM machine version as hv param



This is needed in case an instance must be booted with an exact type of
machine version (due to e.g. outdated drivers). If this hv param
explicitly defined (during instance creation/modification) then the kvm
process will be started having this version for the -M option. Otherwise
the default (derived from _GetDefaultMachineVersion() will be used.
Signed-off-by: default avatarDimitris Aragiorgis <dimara@grnet.gr>
Reviewed-by: default avatarGuido Trotter <ultrotter@google.com>
parent 8e55e20f
...@@ -834,6 +834,7 @@ HV_SOUNDHW = "soundhw" ...@@ -834,6 +834,7 @@ HV_SOUNDHW = "soundhw"
HV_USB_DEVICES = "usb_devices" HV_USB_DEVICES = "usb_devices"
HV_VGA = "vga" HV_VGA = "vga"
HV_KVM_EXTRA = "kvm_extra" HV_KVM_EXTRA = "kvm_extra"
HV_KVM_MACHINE_VERSION = "machine_version"
HVS_PARAMETER_TYPES = { HVS_PARAMETER_TYPES = {
...@@ -901,6 +902,7 @@ HVS_PARAMETER_TYPES = { ...@@ -901,6 +902,7 @@ HVS_PARAMETER_TYPES = {
HV_USB_DEVICES: VTYPE_STRING, HV_USB_DEVICES: VTYPE_STRING,
HV_VGA: VTYPE_STRING, HV_VGA: VTYPE_STRING,
HV_KVM_EXTRA: VTYPE_STRING, HV_KVM_EXTRA: VTYPE_STRING,
HV_KVM_MACHINE_VERSION: VTYPE_STRING,
} }
HVS_PARAMETERS = frozenset(HVS_PARAMETER_TYPES.keys()) HVS_PARAMETERS = frozenset(HVS_PARAMETER_TYPES.keys())
...@@ -1972,6 +1974,7 @@ HVC_DEFAULTS = { ...@@ -1972,6 +1974,7 @@ HVC_DEFAULTS = {
HV_USB_DEVICES: "", HV_USB_DEVICES: "",
HV_VGA: "", HV_VGA: "",
HV_KVM_EXTRA: "", HV_KVM_EXTRA: "",
HV_KVM_MACHINE_VERSION: "",
}, },
HT_FAKE: {}, HT_FAKE: {},
HT_CHROOT: { HT_CHROOT: {
......
...@@ -539,6 +539,7 @@ class KVMHypervisor(hv_base.BaseHypervisor): ...@@ -539,6 +539,7 @@ class KVMHypervisor(hv_base.BaseHypervisor):
constants.HV_USB_DEVICES: hv_base.NO_CHECK, constants.HV_USB_DEVICES: hv_base.NO_CHECK,
constants.HV_VGA: hv_base.NO_CHECK, constants.HV_VGA: hv_base.NO_CHECK,
constants.HV_KVM_EXTRA: hv_base.NO_CHECK, constants.HV_KVM_EXTRA: hv_base.NO_CHECK,
constants.HV_KVM_MACHINE_VERSION: hv_base.NO_CHECK,
} }
_MIGRATION_STATUS_RE = re.compile("Migration\s+status:\s+(\w+)", _MIGRATION_STATUS_RE = re.compile("Migration\s+status:\s+(\w+)",
...@@ -1025,7 +1026,6 @@ class KVMHypervisor(hv_base.BaseHypervisor): ...@@ -1025,7 +1026,6 @@ class KVMHypervisor(hv_base.BaseHypervisor):
pidfile = self._InstancePidFile(instance.name) pidfile = self._InstancePidFile(instance.name)
kvm = constants.KVM_PATH kvm = constants.KVM_PATH
kvm_cmd = [kvm] kvm_cmd = [kvm]
kvm_cmd.extend(["-M", self._GetDefaultMachineVersion()])
# used just by the vnc server, if enabled # used just by the vnc server, if enabled
kvm_cmd.extend(["-name", instance.name]) kvm_cmd.extend(["-name", instance.name])
kvm_cmd.extend(["-m", instance.beparams[constants.BE_MAXMEM]]) kvm_cmd.extend(["-m", instance.beparams[constants.BE_MAXMEM]])
...@@ -1049,6 +1049,11 @@ class KVMHypervisor(hv_base.BaseHypervisor): ...@@ -1049,6 +1049,11 @@ class KVMHypervisor(hv_base.BaseHypervisor):
constants.INSTANCE_REBOOT_EXIT: constants.INSTANCE_REBOOT_EXIT:
kvm_cmd.extend(["-no-reboot"]) kvm_cmd.extend(["-no-reboot"])
mversion = hvp[constants.HV_KVM_MACHINE_VERSION]
if not mversion:
mversion = self._GetDefaultMachineVersion()
kvm_cmd.extend(["-M", mversion])
kernel_path = hvp[constants.HV_KERNEL_PATH] kernel_path = hvp[constants.HV_KERNEL_PATH]
if kernel_path: if kernel_path:
boot_disk = boot_cdrom = boot_floppy = boot_network = False boot_disk = boot_cdrom = boot_floppy = boot_network = False
......
...@@ -674,6 +674,12 @@ kvm\_extra ...@@ -674,6 +674,12 @@ kvm\_extra
Any other option to the KVM hypervisor, useful tweaking anything Any other option to the KVM hypervisor, useful tweaking anything
that Ganeti doesn't support. that Ganeti doesn't support.
machine\_version
Valid for the KVM hypervisor.
Use in case an instance must be booted with an exact type of
machine version (due to e.g. outdated drivers). In case it's not set
the default version supported by your version of kvm is used.
The ``-O (--os-parameters)`` option allows customisation of the OS The ``-O (--os-parameters)`` option allows customisation of the OS
parameters. The actual parameter names and values depends on the OS parameters. The actual parameter names and values depends on the OS
......
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