Support 'viridian' parameter in Xen HVM
authorThomas Thrainer <thomasth@google.com>
Tue, 6 Aug 2013 08:04:58 +0000 (10:04 +0200)
committerThomas Thrainer <thomasth@google.com>
Tue, 6 Aug 2013 08:36:40 +0000 (10:36 +0200)
This parameter is required to prevent bluescreens in Windows instances.

This fixes issue 233.

Signed-off-by: Heiko Baumann <heibau@googlemail.com>
Signed-off-by: Thomas Thrainer <thomasth@google.com>
Reviewed-by: Helga Velroyen <helgav@google.com>

lib/constants.py
lib/hypervisor/hv_xen.py

index 339ead8..eefc250 100644 (file)
@@ -950,6 +950,7 @@ HV_KVM_MACHINE_VERSION = "machine_version"
 HV_KVM_PATH = "kvm_path"
 HV_VIF_TYPE = "vif_type"
 HV_VNET_HDR = "vnet_hdr"
+HV_VIRIDIAN = "viridian"
 
 
 HVS_PARAMETER_TYPES = {
@@ -1021,6 +1022,7 @@ HVS_PARAMETER_TYPES = {
   HV_KVM_MACHINE_VERSION: VTYPE_STRING,
   HV_VIF_TYPE: VTYPE_STRING,
   HV_VNET_HDR: VTYPE_BOOL,
+  HV_VIRIDIAN: VTYPE_BOOL,
   }
 
 HVS_PARAMETERS = frozenset(HVS_PARAMETER_TYPES.keys())
@@ -2047,6 +2049,7 @@ HVC_DEFAULTS = {
     HV_CPU_CAP: 0,
     HV_CPU_WEIGHT: 256,
     HV_VIF_TYPE: HT_HVM_VIF_IOEMU,
+    HV_VIRIDIAN: False,
     },
   HT_KVM: {
     HV_KVM_PATH: KVM_PATH,
index daf0b3f..909ef5f 100644 (file)
@@ -926,6 +926,7 @@ class XenHvmHypervisor(XenHypervisor):
       (False, lambda x: 0 < x < 65535, "invalid weight", None, None),
     constants.HV_VIF_TYPE:
       hv_base.ParamInSet(False, constants.HT_HVM_VALID_VIF_TYPES),
+    constants.HV_VIRIDIAN: hv_base.NO_CHECK,
     }
 
   def _GetConfig(self, instance, startup_memory, block_devices):
@@ -963,6 +964,11 @@ class XenHvmHypervisor(XenHypervisor):
       config.write("acpi = 1\n")
     else:
       config.write("acpi = 0\n")
+    if hvp[constants.HV_VIRIDIAN]:
+      config.write("viridian = 1\n")
+    else:
+      config.write("viridian = 0\n")
+
     config.write("apic = 1\n")
     config.write("device_model = '%s'\n" % hvp[constants.HV_DEVICE_MODEL])
     config.write("boot = '%s'\n" % hvp[constants.HV_BOOT_ORDER])