kvm: Add -vga option
authorGuido Trotter <ultrotter@google.com>
Fri, 11 Jan 2013 18:11:13 +0000 (19:11 +0100)
committerGuido Trotter <ultrotter@google.com>
Mon, 14 Jan 2013 14:36:30 +0000 (15:36 +0100)
As requested in Issue 69.

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 e4dcd57..508d608 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_VGA = "vga"
 HV_KVM_EXTRA = "kvm_extra"
 
 
@@ -898,6 +899,7 @@ HVS_PARAMETER_TYPES = {
   HV_CPU_SOCKETS: VTYPE_INT,
   HV_SOUNDHW: VTYPE_STRING,
   HV_USB_DEVICES: VTYPE_STRING,
+  HV_VGA: VTYPE_STRING,
   HV_KVM_EXTRA: VTYPE_STRING,
   }
 
@@ -1968,6 +1970,7 @@ HVC_DEFAULTS = {
     HV_CPU_SOCKETS: 0,
     HV_SOUNDHW: "",
     HV_USB_DEVICES: "",
+    HV_VGA: "",
     HV_KVM_EXTRA: "",
     },
   HT_FAKE: {},
index 54191b7..16f105a 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_VGA: hv_base.NO_CHECK,
     constants.HV_KVM_EXTRA: hv_base.NO_CHECK,
     }
 
@@ -1321,9 +1322,6 @@ class KVMHypervisor(hv_base.BaseHypervisor):
       logging.info("KVM: SPICE will listen on port %s", instance.network_port)
       kvm_cmd.extend(["-spice", spice_arg])
 
-      # Tell kvm to use the paravirtualized graphic card, optimized for SPICE
-      kvm_cmd.extend(["-vga", "qxl"])
-
     else:
       kvm_cmd.extend(["-nographic"])
 
@@ -1341,6 +1339,13 @@ class KVMHypervisor(hv_base.BaseHypervisor):
     if hvp[constants.HV_SOUNDHW]:
       kvm_cmd.extend(["-soundhw", hvp[constants.HV_SOUNDHW]])
 
+    # Pass a -vga option if requested, or if spice is used, for backwards
+    # compatibility.
+    if hvp[constants.HV_VGA]:
+      kvm_cmd.extend(["-vga", hvp[constants.HV_VGA]])
+    elif spice_bind:
+      kvm_cmd.extend(["-vga", "qxl"])
+
     # Various types of usb devices, comma separated
     if hvp[constants.HV_USB_DEVICES]:
       for dev in hvp[constants.HV_USB_DEVICES].split(","):
index cdbba36..0d6b931 100644 (file)
@@ -663,6 +663,11 @@ usb\_devices
     ``-usbdevice`` option. See the **qemu**\(1) manpage for the syntax
     of the possible components.
 
+vga
+    Valid for the KVM hypervisor.
+
+    Emulated vga mode, passed the the kvm -vga option.
+
 kvm\_extra
     Valid for the KVM hypervisor.