Revision 8bd977e9

b/lib/constants.py
704 704
HV_BLOCKDEV_PREFIX = "blockdev_prefix"
705 705
HV_REBOOT_BEHAVIOR = "reboot_behavior"
706 706
HV_CPU_TYPE = "cpu_type"
707
HV_CPU_CAP = "cpu_cap"
708
HV_CPU_WEIGHT = "cpu_weight"
709

  
707 710

  
708 711
HVS_PARAMETER_TYPES = {
709 712
  HV_BOOT_ORDER: VTYPE_STRING,
......
760 763
  HV_BLOCKDEV_PREFIX: VTYPE_STRING,
761 764
  HV_REBOOT_BEHAVIOR: VTYPE_STRING,
762 765
  HV_CPU_TYPE: VTYPE_STRING,
766
  HV_CPU_CAP: VTYPE_INT,
767
  HV_CPU_WEIGHT: VTYPE_INT,
763 768
  }
764 769

  
765 770
HVS_PARAMETERS = frozenset(HVS_PARAMETER_TYPES.keys())
......
1701 1706
    HV_BLOCKDEV_PREFIX: "sd",
1702 1707
    HV_REBOOT_BEHAVIOR: INSTANCE_REBOOT_ALLOWED,
1703 1708
    HV_CPU_MASK: CPU_PINNING_ALL,
1709
    HV_CPU_CAP: 0,
1710
    HV_CPU_WEIGHT: 256,
1704 1711
    },
1705 1712
  HT_XEN_HVM: {
1706 1713
    HV_BOOT_ORDER: "cd",
......
1720 1727
    HV_PASSTHROUGH: "",
1721 1728
    HV_REBOOT_BEHAVIOR: INSTANCE_REBOOT_ALLOWED,
1722 1729
    HV_CPU_MASK: CPU_PINNING_ALL,
1730
    HV_CPU_CAP: 0,
1731
    HV_CPU_WEIGHT: 256,
1723 1732
    },
1724 1733
  HT_KVM: {
1725 1734
    HV_KERNEL_PATH: KVM_KERNEL,
b/lib/hypervisor/hv_xen.py
630 630
    constants.HV_REBOOT_BEHAVIOR:
631 631
      hv_base.ParamInSet(True, constants.REBOOT_BEHAVIORS),
632 632
    constants.HV_CPU_MASK: hv_base.OPT_MULTI_CPU_MASK_CHECK,
633
    constants.HV_CPU_CAP: hv_base.NO_CHECK,
634
    constants.HV_CPU_WEIGHT:
635
      (False, lambda x: 0 < x < 65536, "invalid weight", None, None),
633 636
    }
634 637

  
635 638
  @classmethod
......
672 675
    cpu_pinning = cls._CreateConfigCpus(hvp[constants.HV_CPU_MASK])
673 676
    if cpu_pinning:
674 677
      config.write("%s\n" % cpu_pinning)
678
    cpu_cap = hvp[constants.HV_CPU_CAP]
679
    if cpu_cap:
680
      config.write("cpu_cap=%d\n" % cpu_cap)
681
    cpu_weight = hvp[constants.HV_CPU_WEIGHT]
682
    if cpu_weight:
683
      config.write("cpu_weight=%d\n" % cpu_weight)
675 684

  
676 685
    config.write("name = '%s'\n" % instance.name)
677 686

  
......
743 752
    constants.HV_REBOOT_BEHAVIOR:
744 753
      hv_base.ParamInSet(True, constants.REBOOT_BEHAVIORS),
745 754
    constants.HV_CPU_MASK: hv_base.OPT_MULTI_CPU_MASK_CHECK,
755
    constants.HV_CPU_CAP: hv_base.NO_CHECK,
756
    constants.HV_CPU_WEIGHT:
757
      (False, lambda x: 0 < x < 65535, "invalid weight", None, None),
746 758
    }
747 759

  
748 760
  @classmethod
......
766 778
    cpu_pinning = cls._CreateConfigCpus(hvp[constants.HV_CPU_MASK])
767 779
    if cpu_pinning:
768 780
      config.write("%s\n" % cpu_pinning)
781
    cpu_cap = hvp[constants.HV_CPU_CAP]
782
    if cpu_cap:
783
      config.write("cpu_cap=%d\n" % cpu_cap)
784
    cpu_weight = hvp[constants.HV_CPU_WEIGHT]
785
    if cpu_weight:
786
      config.write("cpu_weight=%d\n" % cpu_weight)
769 787

  
770 788
    config.write("name = '%s'\n" % instance.name)
771 789
    if hvp[constants.HV_PAE]:
b/man/gnt-instance.rst
587 587
      # Turn off CPU pinning (default setting)
588 588
      gnt-instance modify -H cpu_mask=all my-inst
589 589

  
590
cpu\_cap
591
    Valid for the Xen hypervisor.
592

  
593
    Set the maximum amount of cpu usage by the VM. The value is a percentage
594
    between 0 and (100 * number of VCPUs). Default cap is 0: unlimited.
595

  
596
cpu\_weight
597
    Valid for the Xen hypervisor.
598

  
599
    Set the cpu time ratio to be allocated to the VM. Valid values are
600
    between 1 and 65535. Default weight is 256.
601

  
590 602
usb\_mouse
591 603
    Valid for the KVM hypervisor.
592 604

  

Also available in: Unified diff