diff --git a/lib/constants.py b/lib/constants.py index 13449519529cfb218e739ebeebd0109ef670f49b..e4dcd5781da03ed13f3ffcab37d8e354de18ac64 100644 --- a/lib/constants.py +++ b/lib/constants.py @@ -832,6 +832,7 @@ HV_CPU_THREADS = "cpu_threads" HV_CPU_SOCKETS = "cpu_sockets" HV_SOUNDHW = "soundhw" HV_USB_DEVICES = "usb_devices" +HV_KVM_EXTRA = "kvm_extra" HVS_PARAMETER_TYPES = { @@ -897,6 +898,7 @@ HVS_PARAMETER_TYPES = { HV_CPU_SOCKETS: VTYPE_INT, HV_SOUNDHW: VTYPE_STRING, HV_USB_DEVICES: VTYPE_STRING, + HV_KVM_EXTRA: VTYPE_STRING, } HVS_PARAMETERS = frozenset(HVS_PARAMETER_TYPES.keys()) @@ -1966,6 +1968,7 @@ HVC_DEFAULTS = { HV_CPU_SOCKETS: 0, HV_SOUNDHW: "", HV_USB_DEVICES: "", + HV_KVM_EXTRA: "", }, HT_FAKE: {}, HT_CHROOT: { diff --git a/lib/hypervisor/hv_kvm.py b/lib/hypervisor/hv_kvm.py index 47b033058539b1eaa682314d9ca7f308e9a2447b..54191b7cdc8cd678c1250c6263fff7a87cafc77f 100644 --- a/lib/hypervisor/hv_kvm.py +++ b/lib/hypervisor/hv_kvm.py @@ -537,6 +537,7 @@ class KVMHypervisor(hv_base.BaseHypervisor): constants.HV_CPU_SOCKETS: hv_base.OPT_NONNEGATIVE_INT_CHECK, constants.HV_SOUNDHW: hv_base.NO_CHECK, constants.HV_USB_DEVICES: hv_base.NO_CHECK, + constants.HV_KVM_EXTRA: hv_base.NO_CHECK, } _MIGRATION_STATUS_RE = re.compile("Migration\s+status:\s+(\w+)", @@ -1345,6 +1346,9 @@ class KVMHypervisor(hv_base.BaseHypervisor): for dev in hvp[constants.HV_USB_DEVICES].split(","): kvm_cmd.extend(["-usbdevice", dev]) + if hvp[constants.HV_KVM_EXTRA]: + kvm_cmd.extend([hvp[constants.HV_KVM_EXTRA]]) + # 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 diff --git a/man/gnt-instance.rst b/man/gnt-instance.rst index 276c824a665584cb7fbfc3de5e4fd963ccb7e3c1..cdbba36710f2f1c8f455d1a4299946bfc2a79f6e 100644 --- a/man/gnt-instance.rst +++ b/man/gnt-instance.rst @@ -663,6 +663,12 @@ usb\_devices ``-usbdevice`` option. See the **qemu**\(1) manpage for the syntax of the possible components. +kvm\_extra + Valid for the KVM hypervisor. + + Any other option to the KVM hypervisor, useful tweaking anything + that Ganeti doesn't support. + The ``-O (--os-parameters)`` option allows customisation of the OS parameters. The actual parameter names and values depends on the OS