Revision 7c8ae421 qa/qa_group.py

b/qa/qa_group.py
87 87
  @rtype: tuple
88 88
  @return: (policy, specs), where:
89 89
      - policy is a dictionary of the policy values, instance specs excluded
90
      - specs is dict of dict, specs[key][par] is a spec value, where key is
91
        "min" or "max"
90
      - specs is a dictionary containing only the specs, using the internal
91
        format (see L{constants.IPOLICY_DEFAULTS} for an example), but without
92
        the standard values
92 93

  
93 94
  """
94 95
  info = qa_utils.GetObjectInfo(["gnt-group", "info", groupname])
......
98 99
  (ret_policy, ret_specs) = qa_utils.ParseIPolicy(policy)
99 100

  
100 101
  # Sanity checks
101
  assert "min" in ret_specs and "max" in ret_specs
102
  assert "minmax" in ret_specs
103
  assert len(ret_specs["minmax"]) > 0
102 104
  assert len(ret_policy) > 0
103 105
  return (ret_policy, ret_specs)
104 106

  
......
115 117
  @param new_specs: new complete specs, in the same format returned by
116 118
      L{_GetGroupIPolicy}
117 119
  @type diff_specs: dict
118
  @param diff_specs: diff_specs[key][par], where key is "min", "max". It
119
      can be an incomplete specifications or an empty dictionary.
120
  @param diff_specs: partial specs, it can be an incomplete specifications, but
121
      if min/max specs are specified, their number must match the number of the
122
      existing specs
120 123
  @type fail: bool
121 124
  @param fail: if the change is expected to fail
122 125
  @type old_values: tuple
......
138 141
  # the node group under test
139 142
  old_values = _GetGroupIPolicy(groupname)
140 143
  samevals = dict((p, 4) for p in constants.ISPECS_PARAMETERS)
141
  base_specs = {"min": samevals, "max": samevals}
144
  base_specs = {
145
    constants.ISPECS_MINMAX: [{
146
      constants.ISPECS_MIN: samevals,
147
      constants.ISPECS_MAX: samevals,
148
      }],
149
    }
142 150
  mod_values = _TestGroupSetISpecs(groupname, new_specs=base_specs,
143 151
                                   old_values=old_values)
144 152
  for par in constants.ISPECS_PARAMETERS:
145 153
    # First make sure that the test works with good values
146
    good_specs = {"min": {par: 8}, "max": {par: 8}}
154
    good_specs = {
155
      constants.ISPECS_MINMAX: [{
156
        constants.ISPECS_MIN: {par: 8},
157
        constants.ISPECS_MAX: {par: 8},
158
        }],
159
      }
147 160
    mod_values = _TestGroupSetISpecs(groupname, diff_specs=good_specs,
148 161
                                     old_values=mod_values)
149
    bad_specs = {"min": {par: 8}, "max": {par: 4}}
162
    bad_specs = {
163
      constants.ISPECS_MINMAX: [{
164
        constants.ISPECS_MIN: {par: 8},
165
        constants.ISPECS_MAX: {par: 4},
166
        }],
167
      }
150 168
    _TestGroupSetISpecs(groupname, diff_specs=bad_specs, fail=True,
151 169
                        old_values=mod_values)
152 170
  AssertCommand(["gnt-group", "modify", "--ipolicy-bounds-specs", "default",

Also available in: Unified diff