Revision 17463d22 lib/objects.py

b/lib/objects.py
858 858
    "file_storage_dir",
859 859
    "enabled_hypervisors",
860 860
    "hvparams",
861
    "os_hvp",
861 862
    "beparams",
862 863
    "nicparams",
863 864
    "candidate_pool_size",
......
878 879
        self.hvparams[hypervisor] = FillDict(
879 880
            constants.HVC_DEFAULTS[hypervisor], self.hvparams[hypervisor])
880 881

  
882
    # TODO: Figure out if it's better to put this into OS than Cluster
883
    if self.os_hvp is None:
884
      self.os_hvp = {}
885

  
881 886
    self.beparams = UpgradeGroupedParams(self.beparams,
882 887
                                         constants.BEC_DEFAULTS)
883 888
    migrate_default_bridge = not self.nicparams
......
940 945
      skip_keys = constants.HVC_GLOBALS
941 946
    else:
942 947
      skip_keys = []
943
    return FillDict(self.hvparams.get(instance.hypervisor, {}),
944
                    instance.hvparams, skip_keys=skip_keys)
948

  
949
    # We fill the list from least to most important override
950
    fill_stack = [
951
      self.hvparams.get(instance.hypervisor, {}),
952
      self.os_hvp.get(instance.os, {}).get(instance.hypervisor, {}),
953
      instance.hvparams,
954
      ]
955

  
956
    ret_dict = {}
957
    for o_dict in fill_stack:
958
      ret_dict = FillDict(ret_dict, o_dict, skip_keys=skip_keys)
959

  
960
    return ret_dict
945 961

  
946 962
  def FillBE(self, instance):
947 963
    """Fill an instance's beparams dict.

Also available in: Unified diff