Inconceivably late single character interdiff:

$ git show 90b03f39496946fd5736840ed87f31278cd6f2fd
commit 90b03f39496946fd5736840ed87f31278cd6f2fd
Author: Raffa Santi <[email protected]>
Date:   Sun Sep 29 12:45:03 2013 +0200

    fixup! Add cpuid support to XEN hypervisors

diff --git a/lib/hypervisor/hv_xen.py b/lib/hypervisor/hv_xen.py
index dd64998..2960aa5 100644
--- a/lib/hypervisor/hv_xen.py
+++ b/lib/hypervisor/hv_xen.py
@@ -304,6 +304,7 @@ def _GetConfigFileDiskData(block_devices, blockdev_prefix,

   return disk_data

+
 def _QuoteCpuidField(data):
   """Add quotes around the CPUID field only if necessary.

--RS

On Thu, Aug 29, 2013 at 2:45 PM, Santi Raffa <[email protected]> wrote:
> Noooooope. I swear I ran commit-check multiple times and yet I must've
> missed this every time.
>
> ganeti/hypervisor/hv_xen.py:307:1: E302 expected 2 blank lines, found 1
> make: *** [pep8] Error 1
>
> (I'm sorry, I really am trying to minimize the amount of volume my
> attempts are generating, but I'm not being particularly successful.)
>
> --RS
>
> On Thu, Aug 29, 2013 at 2:20 PM, Raffa Santi <[email protected]> wrote:
>> From: Santi Raffa <[email protected]>
>>
>> This allows clusters or groups to migrate instances between
>> heterogeneous nodes by hiding CPU capabilities as needed.
>>
>> Signed-off-by: Raffa Santi <[email protected]>
>> ---
>>  lib/constants.py         |  4 ++++
>>  lib/hypervisor/hv_xen.py | 22 ++++++++++++++++++++++
>>  man/gnt-instance.rst     | 14 ++++++++++++++
>>  3 files changed, 40 insertions(+)
>>
>> diff --git a/lib/constants.py b/lib/constants.py
>> index b41d870..5263f87 100644
>> --- a/lib/constants.py
>> +++ b/lib/constants.py
>> @@ -942,6 +942,7 @@ HV_KVM_PATH = "kvm_path"
>>  HV_VIF_TYPE = "vif_type"
>>  HV_VIF_SCRIPT = "vif_script"
>>  HV_XEN_CMD = "xen_cmd"
>> +HV_XEN_CPUID = "cpuid"
>>  HV_VNET_HDR = "vnet_hdr"
>>  HV_VIRIDIAN = "viridian"
>>
>> @@ -1016,6 +1017,7 @@ HVS_PARAMETER_TYPES = {
>>    HV_VIF_TYPE: VTYPE_STRING,
>>    HV_VIF_SCRIPT: VTYPE_STRING,
>>    HV_XEN_CMD: VTYPE_STRING,
>> +  HV_XEN_CPUID: VTYPE_STRING,
>>    HV_VNET_HDR: VTYPE_BOOL,
>>    HV_VIRIDIAN: VTYPE_BOOL,
>>    }
>> @@ -2065,6 +2067,7 @@ HVC_DEFAULTS = {
>>      HV_CPU_WEIGHT: 256,
>>      HV_VIF_SCRIPT: "",
>>      HV_XEN_CMD: XEN_CMD_XM,
>> +    HV_XEN_CPUID: "",
>>      },
>>    HT_XEN_HVM: {
>>      HV_BOOT_ORDER: "cd",
>> @@ -2090,6 +2093,7 @@ HVC_DEFAULTS = {
>>      HV_VIF_SCRIPT: "",
>>      HV_VIRIDIAN: False,
>>      HV_XEN_CMD: XEN_CMD_XM,
>> +    HV_XEN_CPUID: "",
>>      },
>>    HT_KVM: {
>>      HV_KVM_PATH: KVM_PATH,
>> diff --git a/lib/hypervisor/hv_xen.py b/lib/hypervisor/hv_xen.py
>> index 8aa940f..aaa68ec 100644
>> --- a/lib/hypervisor/hv_xen.py
>> +++ b/lib/hypervisor/hv_xen.py
>> @@ -304,6 +304,18 @@ def _GetConfigFileDiskData(block_devices, 
>> blockdev_prefix,
>>
>>    return disk_data
>>
>> +def _QuoteCpuidField(data):
>> +  """Add quotes around the CPUID field only if necessary.
>> +
>> +  Xen CPUID fields come in two shapes: LIBXL strings, which need quotes 
>> around
>> +  them, and lists of XEND strings, which don't.
>> +
>> +  @param data: Either type of parameter.
>> +  @return: The quoted version thereof.
>> +  """
>> +
>> +  return data if "[" in data else "'%s'" % data
>> +
>>
>>  class XenHypervisor(hv_base.BaseHypervisor):
>>    """Xen generic hypervisor interface
>> @@ -960,6 +972,7 @@ class XenPvmHypervisor(XenHypervisor):
>>      constants.HV_VIF_SCRIPT: hv_base.OPT_FILE_CHECK,
>>      constants.HV_XEN_CMD:
>>        hv_base.ParamInSet(True, constants.KNOWN_XEN_COMMANDS),
>> +    constants.HV_XEN_CPUID: hv_base.NO_CHECK,
>>      }
>>
>>    def _GetConfig(self, instance, startup_memory, block_devices):
>> @@ -1039,6 +1052,10 @@ class XenPvmHypervisor(XenHypervisor):
>>      config.write("on_crash = 'restart'\n")
>>      config.write("extra = '%s'\n" % hvp[constants.HV_KERNEL_ARGS])
>>
>> +    cpuid = hvp[constants.HV_XEN_CPUID]
>> +    if cpuid:
>> +      config.write("cpuid = %s\n" % _QuoteCpuidField(cpuid))
>> +
>>      return config.getvalue()
>>
>>
>> @@ -1089,6 +1106,7 @@ class XenHvmHypervisor(XenHypervisor):
>>      constants.HV_VIRIDIAN: hv_base.NO_CHECK,
>>      constants.HV_XEN_CMD:
>>        hv_base.ParamInSet(True, constants.KNOWN_XEN_COMMANDS),
>> +    constants.HV_XEN_CPUID: hv_base.NO_CHECK,
>>      }
>>
>>    def _GetConfig(self, instance, startup_memory, block_devices):
>> @@ -1218,4 +1236,8 @@ class XenHvmHypervisor(XenHypervisor):
>>        config.write("on_reboot = 'destroy'\n")
>>      config.write("on_crash = 'restart'\n")
>>
>> +    cpuid = hvp[constants.HV_XEN_CPUID]
>> +    if cpuid:
>> +      config.write("cpuid = %s\n" % _QuoteCpuidField(cpuid))
>> +
>>      return config.getvalue()
>> diff --git a/man/gnt-instance.rst b/man/gnt-instance.rst
>> index 9189748..ea3bad3 100644
>> --- a/man/gnt-instance.rst
>> +++ b/man/gnt-instance.rst
>> @@ -723,6 +723,20 @@ soundhw
>>      Comma separated list of emulated sounds cards, or "all" to enable
>>      all the available ones.
>>
>> +cpuid
>> +    Valid for the XEN hypervisor.
>> +
>> +    Modify the values returned by CPUID instructions run within instances.
>> +
>> +    This allows you to enable migration between nodes with different CPU
>> +    attributes like cores, threads, hyperthreading or SS4 support by hiding
>> +    the extra features where needed.
>> +
>> +    See the XEN documentation for syntax and more information. Wikipedia
>> +    also has a helpful article on the topic:
>> +
>> +    http://en.wikipedia.org/wiki/CPUID
>> +
>>  usb\_devices
>>      Valid for the KVM hypervisor.
>>
>> --
>> 1.8.4
>>
>
>
>
> --
> Google Germany GmbH
> Dienerstr. 12
> 80331 München
>
>
> Registergericht und -nummer: Hamburg, HRB 86891
> Sitz der Gesellschaft: Hamburg
> Geschäftsführer: Graham Law, Christine Elizabeth Flores



-- 
Raffa Santi
Google Germany GmbH
Dienerstr. 12
80331 München


Registergericht und -nummer: Hamburg, HRB 86891
Sitz der Gesellschaft: Hamburg
Geschäftsführer: Graham Law, Christine Elizabeth Flores

Reply via email to