kvm: Add kvm_extra parameter
authorGuido Trotter <ultrotter@google.com>
Fri, 11 Jan 2013 18:03:40 +0000 (19:03 +0100)
committerGuido Trotter <ultrotter@google.com>
Mon, 14 Jan 2013 14:36:30 +0000 (15:36 +0100)
As requested in Issue 261 and many other times.

Signed-off-by: Guido Trotter <ultrotter@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>

lib/constants.py
lib/hypervisor/hv_kvm.py
man/gnt-instance.rst

index 1344951..e4dcd57 100644 (file)
@@ -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: {
index 47b0330..54191b7 100644 (file)
@@ -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
index 276c824..cdbba36 100644 (file)
@@ -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