Revision 295ed29b

b/lib/constants.py
824 824
HV_VIF_TYPE = "vif_type"
825 825
HV_VIF_SCRIPT = "vif_script"
826 826
HV_XEN_CMD = "xen_cmd"
827
HV_XEN_CPUID = "cpuid"
827 828
HV_VNET_HDR = "vnet_hdr"
828 829
HV_VIRIDIAN = "viridian"
829 830

  
......
898 899
  HV_VIF_TYPE: VTYPE_STRING,
899 900
  HV_VIF_SCRIPT: VTYPE_STRING,
900 901
  HV_XEN_CMD: VTYPE_STRING,
902
  HV_XEN_CPUID: VTYPE_STRING,
901 903
  HV_VNET_HDR: VTYPE_BOOL,
902 904
  HV_VIRIDIAN: VTYPE_BOOL,
903 905
  }
......
1798 1800
    HV_CPU_WEIGHT: 256,
1799 1801
    HV_VIF_SCRIPT: "",
1800 1802
    HV_XEN_CMD: XEN_CMD_XM,
1803
    HV_XEN_CPUID: "",
1801 1804
    },
1802 1805
  HT_XEN_HVM: {
1803 1806
    HV_BOOT_ORDER: "cd",
......
1823 1826
    HV_VIF_SCRIPT: "",
1824 1827
    HV_VIRIDIAN: False,
1825 1828
    HV_XEN_CMD: XEN_CMD_XM,
1829
    HV_XEN_CPUID: "",
1826 1830
    },
1827 1831
  HT_KVM: {
1828 1832
    HV_KVM_PATH: KVM_PATH,
b/lib/hypervisor/hv_xen.py
305 305
  return disk_data
306 306

  
307 307

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

  
311
  Xen CPUID fields come in two shapes: LIBXL strings, which need quotes around
312
  them, and lists of XEND strings, which don't.
313

  
314
  @param data: Either type of parameter.
315
  @return: The quoted version thereof.
316

  
317
  """
318
  return "'%s'" % data if data.startswith("host") else data
319

  
320

  
308 321
class XenHypervisor(hv_base.BaseHypervisor):
309 322
  """Xen generic hypervisor interface
310 323

  
......
960 973
    constants.HV_VIF_SCRIPT: hv_base.OPT_FILE_CHECK,
961 974
    constants.HV_XEN_CMD:
962 975
      hv_base.ParamInSet(True, constants.KNOWN_XEN_COMMANDS),
976
    constants.HV_XEN_CPUID: hv_base.NO_CHECK,
963 977
    }
964 978

  
965 979
  def _GetConfig(self, instance, startup_memory, block_devices):
......
1043 1057
    config.write("on_crash = 'restart'\n")
1044 1058
    config.write("extra = '%s'\n" % hvp[constants.HV_KERNEL_ARGS])
1045 1059

  
1060
    cpuid = hvp[constants.HV_XEN_CPUID]
1061
    if cpuid:
1062
      config.write("cpuid = %s\n" % _QuoteCpuidField(cpuid))
1063

  
1046 1064
    return config.getvalue()
1047 1065

  
1048 1066

  
......
1093 1111
    constants.HV_VIRIDIAN: hv_base.NO_CHECK,
1094 1112
    constants.HV_XEN_CMD:
1095 1113
      hv_base.ParamInSet(True, constants.KNOWN_XEN_COMMANDS),
1114
    constants.HV_XEN_CPUID: hv_base.NO_CHECK,
1096 1115
    }
1097 1116

  
1098 1117
  def _GetConfig(self, instance, startup_memory, block_devices):
......
1222 1241
      config.write("on_reboot = 'destroy'\n")
1223 1242
    config.write("on_crash = 'restart'\n")
1224 1243

  
1244
    cpuid = hvp[constants.HV_XEN_CPUID]
1245
    if cpuid:
1246
      config.write("cpuid = %s\n" % _QuoteCpuidField(cpuid))
1247

  
1225 1248
    return config.getvalue()
b/man/gnt-instance.rst
728 728
    Comma separated list of emulated sounds cards, or "all" to enable
729 729
    all the available ones.
730 730

  
731
cpuid
732
    Valid for the XEN hypervisor.
733

  
734
    Modify the values returned by CPUID_ instructions run within instances.
735

  
736
    This allows you to enable migration between nodes with different CPU
737
    attributes like cores, threads, hyperthreading or SS4 support by hiding
738
    the extra features where needed.
739

  
740
    See the XEN documentation for syntax and more information.
741

  
742
.. _CPUID: http://en.wikipedia.org/wiki/CPUID
743

  
731 744
usb\_devices
732 745
    Valid for the KVM hypervisor.
733 746

  

Also available in: Unified diff